LLVMFuzzerTestOneInput:
  130|  6.97k|{
  131|  6.97k|  struct jpeg_decompress_struct cinfo;
  132|  6.97k|  struct fuzzer_error_mgr jerr;
  133|  6.97k|  JSAMPARRAY buffer = NULL;
  134|  6.97k|  int row_stride;
  135|  6.97k|  int numTests = 1;
  136|  6.97k|  struct test tests[NUMTESTS] = {
  137|       |    /*
  138|       |      Output       Quantize 2-Pass Dither
  139|       |      Colorspace   Colors   Quant  Mode
  140|       |    */
  141|  6.97k|    { JCS_RGB565,  FALSE,   FALSE, JDITHER_NONE    },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
                  { JCS_RGB565,  FALSE,   FALSE, JDITHER_NONE    },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
  142|  6.97k|    { JCS_RGB565,  FALSE,   FALSE, JDITHER_ORDERED },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
                  { JCS_RGB565,  FALSE,   FALSE, JDITHER_ORDERED },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
  143|  6.97k|    { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_NONE    },
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
                  { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_NONE    },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
  144|  6.97k|    { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_ORDERED },
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
                  { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_ORDERED },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
  145|  6.97k|    { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_FS      },
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
                  { JCS_UNKNOWN, TRUE,    FALSE, JDITHER_FS      },
  ------------------
  |  |  207|  6.97k|#define FALSE   0               /* values of boolean */
  ------------------
  146|  6.97k|    { JCS_UNKNOWN, TRUE,    TRUE,  JDITHER_NONE    },
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
                  { JCS_UNKNOWN, TRUE,    TRUE,  JDITHER_NONE    },
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
  147|  6.97k|    { JCS_UNKNOWN, TRUE,    TRUE,  JDITHER_FS      }
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
                  { JCS_UNKNOWN, TRUE,    TRUE,  JDITHER_FS      }
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
  148|  6.97k|  };
  149|       |
  150|       |  /* Reject too-small input. */
  151|  6.97k|  if (size < 2)
  ------------------
  |  Branch (151:7): [True: 1, False: 6.97k]
  ------------------
  152|      1|    return 0;
  153|       |
  154|  6.97k|  cinfo.err = jpeg_std_error(&jerr.pub);
  155|  6.97k|  jerr.pub.error_exit = fuzzer_error_exit;
  156|  6.97k|  jerr.pub.emit_message = fuzzer_emit_message;
  157|       |
  158|  6.97k|  jpeg_create_decompress(&cinfo);
  ------------------
  |  |  972|  6.97k|  jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
  |  |  ------------------
  |  |  |  |    4|  6.97k|#define JPEG_LIB_VERSION  62
  |  |  ------------------
  |  |  973|  6.97k|                        (size_t)sizeof(struct jpeg_decompress_struct))
  ------------------
  159|       |
  160|  26.8k|  for (int ti = 0; ti < numTests; ti++) {
  ------------------
  |  Branch (160:20): [True: 19.9k, False: 6.89k]
  ------------------
  161|  19.9k|    int64_t sum = 0;
  162|       |
  163|  19.9k|    marker_sum = 0;
  164|       |
  165|  19.9k|    if (setjmp(jerr.setjmp_buffer)) {
  ------------------
  |  Branch (165:9): [True: 3.95k, False: 15.9k]
  ------------------
  166|  3.95k|      jpeg_abort_decompress(&cinfo);
  167|  3.95k|      continue;
  168|  3.95k|    }
  169|       |
  170|  15.9k|    jpeg_mem_src(&cinfo, data, (unsigned long)size);
  171|       |
  172|   334k|    for (int m = JPEG_APP0; m <= JPEG_APP0 + 15; m++) {
  ------------------
  |  | 1168|  15.9k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
                  for (int m = JPEG_APP0; m <= JPEG_APP0 + 15; m++) {
  ------------------
  |  | 1168|   334k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  |  Branch (172:29): [True: 318k, False: 15.9k]
  ------------------
  173|   318k|      if (m != JPEG_APP0 + 3)
  ------------------
  |  | 1168|   318k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  |  Branch (173:11): [True: 298k, False: 19.9k]
  ------------------
  174|   298k|        jpeg_save_markers(&cinfo, m, 256);
  175|   318k|    }
  176|  15.9k|    jpeg_set_marker_processor(&cinfo, JPEG_APP0 + 3, custom_marker_processor);
  ------------------
  |  | 1168|  15.9k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  177|       |
  178|  15.9k|    jpeg_read_header(&cinfo, TRUE);
  ------------------
  |  |  210|  15.9k|#define TRUE    1
  ------------------
  179|       |
  180|       |    /* Sanity check dimensions to avoid memory exhaustion.  Casting width to
  181|       |       (uint64_t) prevents integer overflow if width * height > INT_MAX. */
  182|  18.1k|    if (cinfo.image_width < 1 || cinfo.image_height < 1 ||
  ------------------
  |  Branch (182:9): [True: 18.4E, False: 18.1k]
  |  Branch (182:34): [True: 0, False: 18.1k]
  ------------------
  183|  18.1k|        (uint64_t)cinfo.image_width * cinfo.image_height > 1048576)
  ------------------
  |  Branch (183:9): [True: 46, False: 18.1k]
  ------------------
  184|     54|      goto bailout;
  185|       |
  186|  15.9k|    cinfo.dct_method = JDCT_FLOAT;
  187|  15.9k|    cinfo.buffered_image = jpeg_has_multiple_scans(&cinfo);
  188|  15.9k|    if (((cinfo.jpeg_color_space == JCS_YCbCr ||
  ------------------
  |  Branch (188:11): [True: 5.56k, False: 10.3k]
  ------------------
  189|  10.3k|          cinfo.jpeg_color_space == JCS_RGB) && cinfo.num_components == 3) ||
  ------------------
  |  Branch (189:11): [True: 2.14k, False: 8.20k]
  |  Branch (189:49): [True: 9.93k, False: 0]
  ------------------
  190|  8.20k|        (cinfo.jpeg_color_space == JCS_GRAYSCALE &&
  ------------------
  |  Branch (190:10): [True: 6.65k, False: 1.55k]
  ------------------
  191|  16.5k|         cinfo.num_components == 1)) {
  ------------------
  |  Branch (191:10): [True: 6.65k, False: 0]
  ------------------
  192|  16.5k|      cinfo.out_color_space = tests[ti].out_color_space;
  193|  16.5k|      if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (193:11): [True: 6.65k, False: 9.93k]
  ------------------
  194|  6.65k|        numTests = 5;
  195|  6.65k|        if (cinfo.out_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (195:13): [True: 3.43k, False: 3.22k]
  ------------------
  196|  3.43k|          cinfo.out_color_space = JCS_GRAYSCALE;
  197|  9.93k|      } else {
  198|  9.93k|        numTests = 7;
  199|  9.93k|        if (cinfo.out_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (199:13): [True: 6.72k, False: 3.21k]
  ------------------
  200|  6.72k|          cinfo.out_color_space = ti % 2 ? JCS_RGB : JCS_EXT_BGR;
  ------------------
  |  Branch (200:35): [True: 2.68k, False: 4.04k]
  ------------------
  201|  9.93k|      }
  202|  16.5k|      cinfo.quantize_colors = tests[ti].quantize_colors;
  203|  16.5k|      cinfo.two_pass_quantize = tests[ti].two_pass_quantize;
  204|  16.5k|      cinfo.dither_mode = tests[ti].dither_mode;
  205|  16.5k|    }
  206|       |
  207|  15.9k|    if (!jpeg_start_decompress(&cinfo)) {
  ------------------
  |  Branch (207:9): [True: 0, False: 15.9k]
  ------------------
  208|      0|      jpeg_abort_decompress(&cinfo);
  209|      0|      continue;
  210|      0|    }
  211|       |
  212|  15.9k|    row_stride = cinfo.output_width * cinfo.output_components;
  213|  15.9k|    buffer = (*cinfo.mem->alloc_sarray)
  214|  15.9k|      ((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1);
  ------------------
  |  |  889|  15.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  215|       |
  216|  15.9k|    if (cinfo.buffered_image) {
  ------------------
  |  Branch (216:9): [True: 12.3k, False: 3.61k]
  ------------------
  217|       |      /* Process all scans. */
  218|  37.7k|      while (!jpeg_input_complete(&cinfo) &&
  ------------------
  |  Branch (218:14): [True: 32.5k, False: 5.23k]
  ------------------
  219|  32.5k|             cinfo.input_scan_number != cinfo.output_scan_number) {
  ------------------
  |  Branch (219:14): [True: 32.4k, False: 115]
  ------------------
  220|  32.4k|        int retval;
  221|       |
  222|  32.4k|        if (cinfo.input_scan_number > 100) {
  ------------------
  |  Branch (222:13): [True: 5, False: 32.4k]
  ------------------
  223|      5|          jpeg_abort_decompress(&cinfo);
  224|      5|          goto bailout;
  225|      5|        }
  226|       |
  227|       |        /* Consume input data until we have a complete scan or reach the end
  228|       |           of input. */
  229|  17.7M|        do {
  230|  17.7M|          retval = jpeg_consume_input(&cinfo);
  231|  17.7M|        } while (retval != JPEG_SUSPENDED && retval != JPEG_REACHED_SOS &&
  ------------------
  |  | 1065|  35.4M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
                      } while (retval != JPEG_SUSPENDED && retval != JPEG_REACHED_SOS &&
  ------------------
  |  | 1111|  35.4M|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (231:18): [True: 17.7M, False: 5.39k]
  |  Branch (231:46): [True: 17.7M, False: 20.3k]
  ------------------
  232|  17.7M|                 retval != JPEG_REACHED_EOI);
  ------------------
  |  | 1112|  17.7M|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (232:18): [True: 17.7M, False: 6.74k]
  ------------------
  233|       |
  234|  32.4k|        if (retval == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|  32.4k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (234:13): [True: 6.74k, False: 25.6k]
  ------------------
  235|  6.74k|          break;
  236|       |
  237|       |        /* Start outputting the current scan. */
  238|  25.6k|        if (!jpeg_start_output(&cinfo, cinfo.input_scan_number))
  ------------------
  |  Branch (238:13): [True: 23, False: 25.6k]
  ------------------
  239|     23|          break;
  240|       |
  241|   100M|        while (cinfo.output_scanline < cinfo.output_height) {
  ------------------
  |  Branch (241:16): [True: 100M, False: 24.9k]
  ------------------
  242|   100M|          if (!cinfo.two_pass_quantize &&
  ------------------
  |  Branch (242:15): [True: 73.2M, False: 27.6M]
  ------------------
  243|  73.2M|              (cinfo.output_scanline == 0 || cinfo.output_scanline == 16)) {
  ------------------
  |  Branch (243:16): [True: 19.8k, False: 73.2M]
  |  Branch (243:46): [True: 14.9k, False: 73.1M]
  ------------------
  244|  34.7k|            JDIMENSION output_scanline = cinfo.output_scanline;
  245|       |
  246|  34.7k|            jpeg_skip_scanlines(&cinfo, 8);
  247|  34.7k|            if (cinfo.output_scanline == output_scanline)
  ------------------
  |  Branch (247:17): [True: 230, False: 34.5k]
  ------------------
  248|    230|              break;
  249|   100M|          } else {
  250|   100M|            if (jpeg_read_scanlines(&cinfo, buffer, 1) != 1)
  ------------------
  |  Branch (250:17): [True: 528, False: 100M]
  ------------------
  251|    528|              break;
  252|       |            /* Touch all of the output pixels in order to catch uninitialized
  253|       |               reads when using MemorySanitizer. */
  254|  4.43G|            for (int i = 0; i < row_stride; i++)
  ------------------
  |  Branch (254:29): [True: 4.33G, False: 100M]
  ------------------
  255|  4.33G|              sum += buffer[0][i];
  256|   100M|          }
  257|   100M|        }
  258|       |
  259|       |        /* Finish this output pass. */
  260|  25.6k|        if (!jpeg_finish_output(&cinfo))
  ------------------
  |  Branch (260:13): [True: 182, False: 25.4k]
  ------------------
  261|    182|          break;
  262|  25.6k|      }
  263|       |
  264|  12.3k|    } else {
  265|       |
  266|  11.1M|      while (cinfo.output_scanline < cinfo.output_height) {
  ------------------
  |  Branch (266:14): [True: 11.1M, False: 3.61k]
  ------------------
  267|  11.1M|        if (!cinfo.two_pass_quantize &&
  ------------------
  |  Branch (267:13): [True: 9.50M, False: 1.60M]
  ------------------
  268|  9.50M|            (cinfo.output_scanline == 0 || cinfo.output_scanline == 16))
  ------------------
  |  Branch (268:14): [True: 4.46k, False: 9.50M]
  |  Branch (268:44): [True: 2.37k, False: 9.49M]
  ------------------
  269|  6.83k|          jpeg_skip_scanlines(&cinfo, 8);
  270|  11.1M|        else {
  271|  11.1M|          jpeg_read_scanlines(&cinfo, buffer, 1);
  272|  1.17G|          for (int i = 0; i < row_stride; i++)
  ------------------
  |  Branch (272:27): [True: 1.15G, False: 11.1M]
  ------------------
  273|  1.15G|            sum += buffer[0][i];
  274|  11.1M|        }
  275|  11.1M|      }
  276|       |
  277|  3.61k|    }
  278|       |
  279|  15.9k|    jpeg_finish_decompress(&cinfo);
  280|       |
  281|       |    /* Prevent the sums above from being optimized out.  This test should never
  282|       |       be true, but the compiler doesn't know that. */
  283|  15.9k|    if (sum > (int64_t)255 * 1048576 * 4 ||
  ------------------
  |  Branch (283:9): [True: 17, False: 15.8k]
  ------------------
  284|  15.8k|        marker_sum > (int64_t)255 * 1048576)
  ------------------
  |  Branch (284:9): [True: 0, False: 15.8k]
  ------------------
  285|     17|      goto bailout;
  286|  15.9k|  }
  287|       |
  288|  6.97k|bailout:
  289|  6.97k|  jpeg_destroy_decompress(&cinfo);
  290|  6.97k|  return 0;
  291|  6.97k|}
decompress_libjpeg.cc:_ZL17fuzzer_error_exitP18jpeg_common_struct:
   63|  3.95k|{
   64|  3.95k|  struct fuzzer_error_mgr *fuzz_err = (struct fuzzer_error_mgr *)cinfo->err;
   65|       |
   66|  3.95k|  longjmp(fuzz_err->setjmp_buffer, 1);
   67|  3.95k|}
decompress_libjpeg.cc:_ZL19fuzzer_emit_messageP18jpeg_common_structi:
   71|  43.9M|{
   72|  43.9M|}
decompress_libjpeg.cc:_ZL23custom_marker_processorP22jpeg_decompress_struct:
   78|  15.0k|{
   79|  15.0k|  struct jpeg_source_mgr *src = cinfo->src;
   80|  15.0k|  INT32 length;
   81|       |
   82|       |  /* Read and consume the 2-byte length field. */
   83|  15.0k|  if (src->bytes_in_buffer < 2)
  ------------------
  |  Branch (83:7): [True: 694, False: 14.3k]
  ------------------
   84|    694|    return FALSE;
  ------------------
  |  |  207|    694|#define FALSE   0               /* values of boolean */
  ------------------
   85|       |
   86|  14.3k|  length = ((INT32)src->next_input_byte[0] << 8) +
   87|  14.3k|            (INT32)src->next_input_byte[1];
   88|  14.3k|  src->next_input_byte += 2;
   89|  14.3k|  src->bytes_in_buffer -= 2;
   90|  14.3k|  length -= 2;
   91|       |
   92|  14.3k|  if (length < 0)
  ------------------
  |  Branch (92:7): [True: 8.05k, False: 6.31k]
  ------------------
   93|  8.05k|    return FALSE;
  ------------------
  |  |  207|  8.05k|#define FALSE   0               /* values of boolean */
  ------------------
   94|       |
   95|       |  /* Consume and touch all marker data in order to catch uninitialized reads
   96|       |     when using MemorySanitizer. */
   97|  3.74M|  while (length > 0) {
  ------------------
  |  Branch (97:10): [True: 3.74M, False: 6.31k]
  ------------------
   98|  3.74M|    if (src->bytes_in_buffer == 0) {
  ------------------
  |  Branch (98:9): [True: 3.73M, False: 5.51k]
  ------------------
   99|  3.73M|      if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (99:11): [True: 0, False: 3.73M]
  ------------------
  100|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  101|  3.73M|    }
  102|       |
  103|  3.74M|    size_t available = (size_t)length < src->bytes_in_buffer ?
  ------------------
  |  Branch (103:24): [True: 5.45k, False: 3.73M]
  ------------------
  104|  3.73M|                       (size_t)length : src->bytes_in_buffer;
  105|       |
  106|  13.2M|    for (size_t i = 0; i < available; i++)
  ------------------
  |  Branch (106:24): [True: 9.47M, False: 3.74M]
  ------------------
  107|  9.47M|      marker_sum += src->next_input_byte[i];
  108|       |
  109|  3.74M|    src->next_input_byte += available;
  110|  3.74M|    src->bytes_in_buffer -= available;
  111|  3.74M|    length -= (INT32)available;
  112|  3.74M|  }
  113|       |
  114|  6.31k|  return TRUE;
  ------------------
  |  |  210|  6.31k|#define TRUE    1
  ------------------
  115|  6.31k|}

jsimd_can_ycc_rgb:
  111|  4.98k|{
  112|  4.98k|  init_simd();
  113|       |
  114|       |  /* The code is optimised for these values only */
  115|  4.98k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  4.98k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (115:7): [Folded, False: 4.98k]
  ------------------
  116|      0|    return 0;
  117|  4.98k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (117:7): [Folded, False: 4.98k]
  ------------------
  118|      0|    return 0;
  119|  4.98k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|  4.98k|#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 (119:7): [Folded, False: 4.98k]
  |  Branch (119:31): [True: 0, Folded]
  ------------------
  120|      0|    return 0;
  121|       |
  122|  4.98k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   26|  4.98k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (122:7): [True: 4.98k, False: 0]
  ------------------
  123|  4.98k|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2))
  ------------------
  |  |   30|  4.98k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   27|  4.98k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (30:30): [True: 4.98k, False: 0]
  |  |  ------------------
  ------------------
  124|  4.98k|    return 1;
  125|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (125:7): [True: 0, False: 0]
  ------------------
  126|      0|      IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
  ------------------
  |  |   29|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   27|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (29:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  127|      0|    return 1;
  128|       |
  129|      0|  return 0;
  130|      0|}
jsimd_can_ycc_rgb565:
  134|  1.36k|{
  135|  1.36k|  return 0;
  136|  1.36k|}
jsimd_ycc_rgb_convert:
  246|  48.5M|{
  247|  48.5M|  void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
  248|  48.5M|  void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
  249|       |
  250|  48.5M|  if (simd_support == ~0U)
  ------------------
  |  Branch (250:7): [True: 0, False: 48.5M]
  ------------------
  251|      0|    init_simd();
  252|       |
  253|  48.5M|  switch (cinfo->out_color_space) {
  254|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (254:3): [True: 0, False: 48.5M]
  ------------------
  255|      0|    avx2fct = jsimd_ycc_extrgb_convert_avx2;
  256|      0|    sse2fct = jsimd_ycc_extrgb_convert_sse2;
  257|      0|    break;
  258|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (258:3): [True: 0, False: 48.5M]
  ------------------
  259|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (259:3): [True: 0, False: 48.5M]
  ------------------
  260|      0|    avx2fct = jsimd_ycc_extrgbx_convert_avx2;
  261|      0|    sse2fct = jsimd_ycc_extrgbx_convert_sse2;
  262|      0|    break;
  263|  29.6M|  case JCS_EXT_BGR:
  ------------------
  |  Branch (263:3): [True: 29.6M, False: 18.8M]
  ------------------
  264|  29.6M|    avx2fct = jsimd_ycc_extbgr_convert_avx2;
  265|  29.6M|    sse2fct = jsimd_ycc_extbgr_convert_sse2;
  266|  29.6M|    break;
  267|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (267:3): [True: 0, False: 48.5M]
  ------------------
  268|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (268:3): [True: 0, False: 48.5M]
  ------------------
  269|      0|    avx2fct = jsimd_ycc_extbgrx_convert_avx2;
  270|      0|    sse2fct = jsimd_ycc_extbgrx_convert_sse2;
  271|      0|    break;
  272|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (272:3): [True: 0, False: 48.5M]
  ------------------
  273|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (273:3): [True: 0, False: 48.5M]
  ------------------
  274|      0|    avx2fct = jsimd_ycc_extxbgr_convert_avx2;
  275|      0|    sse2fct = jsimd_ycc_extxbgr_convert_sse2;
  276|      0|    break;
  277|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (277:3): [True: 0, False: 48.5M]
  ------------------
  278|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (278:3): [True: 0, False: 48.5M]
  ------------------
  279|      0|    avx2fct = jsimd_ycc_extxrgb_convert_avx2;
  280|      0|    sse2fct = jsimd_ycc_extxrgb_convert_sse2;
  281|      0|    break;
  282|  18.8M|  default:
  ------------------
  |  Branch (282:3): [True: 18.8M, False: 29.6M]
  ------------------
  283|  18.8M|    avx2fct = jsimd_ycc_rgb_convert_avx2;
  284|  18.8M|    sse2fct = jsimd_ycc_rgb_convert_sse2;
  285|  18.8M|    break;
  286|  48.5M|  }
  287|       |
  288|  48.5M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  48.5M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (288:7): [True: 48.5M, False: 0]
  ------------------
  289|  48.5M|    avx2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
  290|      0|  else
  291|      0|    sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
  292|  48.5M|}
jsimd_can_h2v2_upsample:
  379|    377|{
  380|    377|  init_simd();
  381|       |
  382|       |  /* The code is optimised for these values only */
  383|    377|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    377|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (383:7): [Folded, False: 377]
  ------------------
  384|      0|    return 0;
  385|    377|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (385:7): [Folded, False: 377]
  ------------------
  386|      0|    return 0;
  387|       |
  388|    377|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|    377|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (388:7): [True: 377, False: 0]
  ------------------
  389|    377|    return 1;
  390|      0|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (390:7): [True: 0, False: 0]
  ------------------
  391|      0|    return 1;
  392|       |
  393|      0|  return 0;
  394|      0|}
jsimd_can_h2v1_upsample:
  398|  1.07k|{
  399|  1.07k|  init_simd();
  400|       |
  401|       |  /* The code is optimised for these values only */
  402|  1.07k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.07k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (402:7): [Folded, False: 1.07k]
  ------------------
  403|      0|    return 0;
  404|  1.07k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (404:7): [Folded, False: 1.07k]
  ------------------
  405|      0|    return 0;
  406|       |
  407|  1.07k|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  1.07k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (407:7): [True: 1.07k, False: 0]
  ------------------
  408|  1.07k|    return 1;
  409|      0|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (409:7): [True: 0, False: 0]
  ------------------
  410|      0|    return 1;
  411|       |
  412|      0|  return 0;
  413|      0|}
jsimd_h2v2_upsample:
  418|  1.08M|{
  419|  1.08M|  if (simd_support == ~0U)
  ------------------
  |  Branch (419:7): [True: 0, False: 1.08M]
  ------------------
  420|      0|    init_simd();
  421|       |
  422|  1.08M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  1.08M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (422:7): [True: 1.08M, False: 0]
  ------------------
  423|  1.08M|    jsimd_h2v2_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
  424|  1.08M|                             input_data, output_data_ptr);
  425|      0|  else
  426|      0|    jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
  427|      0|                             input_data, output_data_ptr);
  428|  1.08M|}
jsimd_h2v1_upsample:
  433|  5.99M|{
  434|  5.99M|  if (simd_support == ~0U)
  ------------------
  |  Branch (434:7): [True: 0, False: 5.99M]
  ------------------
  435|      0|    init_simd();
  436|       |
  437|  5.99M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  5.99M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (437:7): [True: 5.99M, False: 0]
  ------------------
  438|  5.99M|    jsimd_h2v1_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
  439|  5.99M|                             input_data, output_data_ptr);
  440|      0|  else
  441|      0|    jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
  442|      0|                             input_data, output_data_ptr);
  443|  5.99M|}
jsimd_can_h2v2_fancy_upsample:
  447|  2.42k|{
  448|  2.42k|  init_simd();
  449|       |
  450|       |  /* The code is optimised for these values only */
  451|  2.42k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  2.42k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (451:7): [Folded, False: 2.42k]
  ------------------
  452|      0|    return 0;
  453|  2.42k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (453:7): [Folded, False: 2.42k]
  ------------------
  454|      0|    return 0;
  455|       |
  456|  2.42k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   26|  2.42k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (456:7): [True: 2.42k, False: 0]
  ------------------
  457|  2.42k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2))
  ------------------
  |  |   30|  2.42k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   27|  2.42k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (30:30): [True: 2.42k, False: 0]
  |  |  ------------------
  ------------------
  458|  2.42k|    return 1;
  459|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (459:7): [True: 0, False: 0]
  ------------------
  460|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
  ------------------
  |  |   29|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   27|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (29:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  461|      0|    return 1;
  462|       |
  463|      0|  return 0;
  464|      0|}
jsimd_can_h2v1_fancy_upsample:
  468|  4.41k|{
  469|  4.41k|  init_simd();
  470|       |
  471|       |  /* The code is optimised for these values only */
  472|  4.41k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  4.41k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (472:7): [Folded, False: 4.41k]
  ------------------
  473|      0|    return 0;
  474|  4.41k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (474:7): [Folded, False: 4.41k]
  ------------------
  475|      0|    return 0;
  476|       |
  477|  4.41k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   26|  4.41k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (477:7): [True: 4.41k, False: 0]
  ------------------
  478|  4.41k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2))
  ------------------
  |  |   30|  4.41k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   27|  4.41k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (30:30): [True: 4.41k, False: 0]
  |  |  ------------------
  ------------------
  479|  4.41k|    return 1;
  480|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (480:7): [True: 0, False: 0]
  ------------------
  481|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
  ------------------
  |  |   29|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   27|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (29:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  482|      0|    return 1;
  483|       |
  484|      0|  return 0;
  485|      0|}
jsimd_h2v2_fancy_upsample:
  490|  3.83M|{
  491|  3.83M|  if (simd_support == ~0U)
  ------------------
  |  Branch (491:7): [True: 0, False: 3.83M]
  ------------------
  492|      0|    init_simd();
  493|       |
  494|  3.83M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  3.83M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (494:7): [True: 3.83M, False: 0]
  ------------------
  495|  3.83M|    jsimd_h2v2_fancy_upsample_avx2(cinfo->max_v_samp_factor,
  496|  3.83M|                                   compptr->downsampled_width, input_data,
  497|  3.83M|                                   output_data_ptr);
  498|      0|  else
  499|      0|    jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
  500|      0|                                   compptr->downsampled_width, input_data,
  501|      0|                                   output_data_ptr);
  502|  3.83M|}
jsimd_h2v1_fancy_upsample:
  507|  13.6M|{
  508|  13.6M|  if (simd_support == ~0U)
  ------------------
  |  Branch (508:7): [True: 0, False: 13.6M]
  ------------------
  509|      0|    init_simd();
  510|       |
  511|  13.6M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   26|  13.6M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (511:7): [True: 13.6M, False: 0]
  ------------------
  512|  13.6M|    jsimd_h2v1_fancy_upsample_avx2(cinfo->max_v_samp_factor,
  513|  13.6M|                                   compptr->downsampled_width, input_data,
  514|  13.6M|                                   output_data_ptr);
  515|      0|  else
  516|      0|    jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
  517|      0|                                   compptr->downsampled_width, input_data,
  518|      0|                                   output_data_ptr);
  519|  13.6M|}
jsimd_can_idct_float:
  979|  71.7k|{
  980|  71.7k|  init_simd();
  981|       |
  982|  71.7k|  if (DCTSIZE != 8)
  ------------------
  |  |   66|  71.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (982:7): [Folded, False: 71.7k]
  ------------------
  983|      0|    return 0;
  984|  71.7k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (984:7): [Folded, False: 71.7k]
  ------------------
  985|      0|    return 0;
  986|  71.7k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  71.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (986:7): [Folded, False: 71.7k]
  ------------------
  987|      0|    return 0;
  988|  71.7k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (988:7): [Folded, False: 71.7k]
  ------------------
  989|      0|    return 0;
  990|  71.7k|  if (sizeof(FAST_FLOAT) != 4)
  ------------------
  |  Branch (990:7): [Folded, False: 71.7k]
  ------------------
  991|      0|    return 0;
  992|  71.7k|  if (sizeof(FLOAT_MULT_TYPE) != 4)
  ------------------
  |  Branch (992:7): [Folded, False: 71.7k]
  ------------------
  993|      0|    return 0;
  994|       |
  995|  71.7k|  if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
  ------------------
  |  |   22|  71.7k|#define JSIMD_SSE2     0x08
  ------------------
                if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
  ------------------
  |  |   29|  71.7k|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   27|  71.7k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (29:30): [True: 71.7k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (995:7): [True: 71.7k, False: 0]
  ------------------
  996|  71.7k|    return 1;
  997|       |
  998|      0|  return 0;
  999|  71.7k|}
jsimd_idct_float:
 1030|  74.2M|{
 1031|  74.2M|  jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf,
 1032|  74.2M|                        output_col);
 1033|  74.2M|}
jsimd.c:init_simd:
   40|  84.9k|{
   41|  84.9k|#ifndef NO_GETENV
   42|  84.9k|  char env[2] = { 0 };
   43|  84.9k|#endif
   44|       |
   45|  84.9k|  if (simd_support != ~0U)
  ------------------
  |  Branch (45:7): [True: 84.9k, False: 1]
  ------------------
   46|  84.9k|    return;
   47|       |
   48|      1|  simd_support = jpeg_simd_cpu_support();
   49|       |
   50|      1|#ifndef NO_GETENV
   51|       |  /* Force different settings through environment variables */
   52|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (52:7): [True: 1, False: 0]
  |  Branch (52:47): [True: 0, False: 1]
  ------------------
   53|      0|    simd_support &= JSIMD_SSE2;
  ------------------
  |  |   22|      0|#define JSIMD_SSE2     0x08
  ------------------
   54|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCEAVX2") && !strcmp(env, "1"))
  ------------------
  |  Branch (54:7): [True: 1, False: 0]
  |  Branch (54:47): [True: 0, False: 1]
  ------------------
   55|      0|    simd_support &= JSIMD_AVX2;
  ------------------
  |  |   26|      0|#define JSIMD_AVX2     0x80
  ------------------
   56|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (56:7): [True: 1, False: 0]
  |  Branch (56:47): [True: 0, False: 1]
  ------------------
   57|      0|    simd_support = 0;
   58|      1|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (58:7): [True: 1, False: 0]
  |  Branch (58:47): [True: 0, False: 1]
  ------------------
   59|      0|    simd_huffman = 0;
   60|      1|#endif
   61|      1|}

jpeg_abort:
   33|  19.4k|{
   34|  19.4k|  int pool;
   35|       |
   36|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   37|  19.4k|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (37:7): [True: 0, False: 19.4k]
  ------------------
   38|      0|    return;
   39|       |
   40|       |  /* Releasing pools in reverse order might help avoid fragmentation
   41|       |   * with some (brain-damaged) malloc libraries.
   42|       |   */
   43|  38.9k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  19.4k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  38.9k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (43:35): [True: 19.4k, False: 19.4k]
  ------------------
   44|  19.4k|    (*cinfo->mem->free_pool) (cinfo, pool);
   45|  19.4k|  }
   46|       |
   47|       |  /* Reset overall state for possible reuse of object */
   48|  19.4k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (48:7): [True: 19.4k, False: 0]
  ------------------
   49|  19.4k|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  19.4k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   50|       |    /* Try to keep application from accessing now-deleted marker list.
   51|       |     * A bit kludgy to do it here, but this is the most central place.
   52|       |     */
   53|  19.4k|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   54|  19.4k|    ((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
   55|  19.4k|  } else {
   56|      0|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|      0|#define CSTATE_START     100    /* after create_compress */
  ------------------
   57|      0|  }
   58|  19.4k|}
jpeg_destroy:
   74|  6.97k|{
   75|       |  /* We need only tell the memory manager to release everything. */
   76|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
   77|  6.97k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (77:7): [True: 6.97k, False: 0]
  ------------------
   78|  6.97k|    (*cinfo->mem->self_destruct) (cinfo);
   79|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
   80|  6.97k|  cinfo->global_state = 0;      /* mark it destroyed */
   81|  6.97k|}
jpeg_alloc_quant_table:
   91|  4.24k|{
   92|  4.24k|  JQUANT_TBL *tbl;
   93|       |
   94|  4.24k|  tbl = (JQUANT_TBL *)
   95|  4.24k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|  4.24k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   96|  4.24k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  4.24k|#define FALSE   0               /* values of boolean */
  ------------------
   97|  4.24k|  return tbl;
   98|  4.24k|}
jpeg_alloc_huff_table:
  103|  7.83k|{
  104|  7.83k|  JHUFF_TBL *tbl;
  105|       |
  106|  7.83k|  tbl = (JHUFF_TBL *)
  107|  7.83k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  888|  7.83k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  108|  7.83k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  7.83k|#define FALSE   0               /* values of boolean */
  ------------------
  109|  7.83k|  return tbl;
  110|  7.83k|}

jpeg_CreateDecompress:
   37|  6.97k|{
   38|  6.97k|  int i;
   39|       |
   40|       |  /* Guard against version mismatches between library and caller. */
   41|  6.97k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   42|  6.97k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  6.97k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (42:7): [True: 0, False: 6.97k]
  ------------------
   43|      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)))
  ------------------
   44|  6.97k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (44:7): [True: 0, False: 6.97k]
  ------------------
   45|      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)))
  ------------------
   46|  6.97k|             (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
   47|       |
   48|       |  /* For debugging purposes, we zero the whole master structure.
   49|       |   * But the application has already set the err pointer, and may have set
   50|       |   * client_data, so we have to save and restore those fields.
   51|       |   * Note: if application hasn't set client_data, tools like Purify may
   52|       |   * complain here.
   53|       |   */
   54|  6.97k|  {
   55|  6.97k|    struct jpeg_error_mgr *err = cinfo->err;
   56|  6.97k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   57|  6.97k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   58|  6.97k|    cinfo->err = err;
   59|  6.97k|    cinfo->client_data = client_data;
   60|  6.97k|  }
   61|  6.97k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|  6.97k|#define TRUE    1
  ------------------
   62|       |
   63|       |  /* Initialize a memory manager instance for this object */
   64|  6.97k|  jinit_memory_mgr((j_common_ptr)cinfo);
   65|       |
   66|       |  /* Zero out pointers to permanent structures. */
   67|  6.97k|  cinfo->progress = NULL;
   68|  6.97k|  cinfo->src = NULL;
   69|       |
   70|  34.8k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|  34.8k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (70:15): [True: 27.8k, False: 6.97k]
  ------------------
   71|  27.8k|    cinfo->quant_tbl_ptrs[i] = NULL;
   72|       |
   73|  34.8k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  34.8k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 27.8k, False: 6.97k]
  ------------------
   74|  27.8k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   75|  27.8k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   76|  27.8k|  }
   77|       |
   78|       |  /* Initialize marker processor so application can override methods
   79|       |   * for COM, APPn markers before calling jpeg_read_header.
   80|       |   */
   81|  6.97k|  cinfo->marker_list = NULL;
   82|  6.97k|  jinit_marker_reader(cinfo);
   83|       |
   84|       |  /* And initialize the overall input controller. */
   85|  6.97k|  jinit_input_controller(cinfo);
   86|       |
   87|  6.97k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  6.97k|#define BITS_IN_JSAMPLE  8
  ------------------
   88|       |
   89|       |  /* OK, I'm ready */
   90|  6.97k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  6.97k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   91|       |
   92|       |  /* The master struct is used to store extension parameters, so we allocate it
   93|       |   * here.
   94|       |   */
   95|  6.97k|  cinfo->master = (struct jpeg_decomp_master *)
   96|  6.97k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.97k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   97|  6.97k|                                sizeof(my_decomp_master));
   98|  6.97k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
   99|  6.97k|}
jpeg_destroy_decompress:
  108|  6.97k|{
  109|  6.97k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  110|  6.97k|}
jpeg_abort_decompress:
  120|  3.95k|{
  121|  3.95k|  jpeg_abort((j_common_ptr)cinfo); /* use common routine */
  122|  3.95k|}
jpeg_read_header:
  268|  19.9k|{
  269|  19.9k|  int retcode;
  270|       |
  271|  19.9k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  39.8k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (271:7): [True: 317, False: 19.6k]
  ------------------
  272|    317|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|    317|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (272:7): [True: 317, False: 0]
  ------------------
  273|    317|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|    317|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    317|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    317|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  274|       |
  275|  19.9k|  retcode = jpeg_consume_input(cinfo);
  276|       |
  277|  19.9k|  switch (retcode) {
  ------------------
  |  Branch (277:11): [True: 18.9k, False: 1.01k]
  ------------------
  278|  18.1k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|  18.1k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (278:3): [True: 18.1k, False: 1.75k]
  ------------------
  279|  18.1k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|  18.1k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  280|  18.1k|    break;
  281|    700|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|    700|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (281:3): [True: 700, False: 19.2k]
  ------------------
  282|    700|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (282:9): [True: 700, False: 0]
  ------------------
  283|    700|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|    700|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    700|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|       |    /* Reset to start state; it would be safer to require the application to
  285|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  286|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  287|       |     */
  288|    700|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  289|    700|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|    700|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  290|    700|    break;
  291|     43|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|     43|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (291:3): [True: 43, False: 19.8k]
  ------------------
  292|       |    /* no work */
  293|     43|    break;
  294|  19.9k|  }
  295|       |
  296|  18.2k|  return retcode;
  297|  19.9k|}
jpeg_consume_input:
  314|  17.7M|{
  315|  17.7M|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|  17.7M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  316|       |
  317|       |  /* NB: every possible DSTATE value should be listed in this switch */
  318|  17.7M|  switch (cinfo->global_state) {
  319|  19.6k|  case DSTATE_START:
  ------------------
  |  |   48|  19.6k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (319:3): [True: 19.6k, False: 17.7M]
  ------------------
  320|       |    /* Start-of-datastream actions: reset appropriate modules */
  321|  19.6k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  322|       |    /* Initialize application's data source module */
  323|  19.6k|    (*cinfo->src->init_source) (cinfo);
  324|  19.6k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|  19.6k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  325|  19.6k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  19.6k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  326|  19.6k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|  19.6k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (326:3): [True: 0, False: 17.7M]
  ------------------
  327|  19.6k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  328|  19.6k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|  19.6k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (328:9): [True: 18.1k, False: 1.44k]
  ------------------
  329|       |      /* Set up default parameters based on header data */
  330|  18.1k|      default_decompress_parms(cinfo);
  331|       |      /* Set global state: ready for start_decompress */
  332|  18.1k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  18.1k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  333|  18.1k|    }
  334|  19.6k|    break;
  335|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (335:3): [True: 0, False: 17.7M]
  ------------------
  336|       |    /* Can't advance past first SOS until start_decompress is called */
  337|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  338|      0|    break;
  339|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (339:3): [True: 0, False: 17.7M]
  ------------------
  340|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (340:3): [True: 0, False: 17.7M]
  ------------------
  341|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (341:3): [True: 0, False: 17.7M]
  ------------------
  342|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (342:3): [True: 0, False: 17.7M]
  ------------------
  343|  17.7M|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|  17.7M|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (343:3): [True: 17.7M, False: 19.6k]
  ------------------
  344|  17.7M|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|  17.7M|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (344:3): [True: 0, False: 17.7M]
  ------------------
  345|  17.7M|  case DSTATE_STOPPING:
  ------------------
  |  |   58|  17.7M|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (345:3): [True: 0, False: 17.7M]
  ------------------
  346|  17.7M|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  347|  17.7M|    break;
  348|      0|  default:
  ------------------
  |  Branch (348:3): [True: 0, False: 17.7M]
  ------------------
  349|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|  17.7M|  }
  351|  17.7M|  return retcode;
  352|  17.7M|}
jpeg_input_complete:
  361|  36.8k|{
  362|       |  /* Check for valid jpeg object */
  363|  36.8k|  if (cinfo->global_state < DSTATE_START ||
  ------------------
  |  |   48|  73.6k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (363:7): [True: 0, False: 36.8k]
  ------------------
  364|  36.8k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   58|  36.8k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (364:7): [True: 0, False: 36.8k]
  ------------------
  365|      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)))
  ------------------
  366|  36.8k|  return cinfo->inputctl->eoi_reached;
  367|  36.8k|}
jpeg_has_multiple_scans:
  376|  18.1k|{
  377|       |  /* Only valid after jpeg_read_header completes */
  378|  18.1k|  if (cinfo->global_state < DSTATE_READY ||
  ------------------
  |  |   50|  36.3k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (378:7): [True: 15, False: 18.1k]
  ------------------
  379|  18.1k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   58|  18.1k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (379:7): [True: 0, False: 18.1k]
  ------------------
  380|     15|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|     15|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     15|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     15|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  381|  18.1k|  return cinfo->inputctl->has_multiple_scans;
  382|  18.1k|}
jpeg_finish_decompress:
  396|  16.5k|{
  397|  16.5k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  33.0k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (397:8): [True: 5.15k, False: 11.3k]
  ------------------
  398|  11.3k|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   54|  11.3k|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (398:8): [True: 0, False: 11.3k]
  |  Branch (398:49): [True: 5.15k, False: 0]
  ------------------
  399|       |    /* Terminate final pass of non-buffered mode */
  400|  5.15k|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (400:9): [True: 0, False: 5.15k]
  ------------------
  401|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  402|  5.15k|    (*cinfo->master->finish_output_pass) (cinfo);
  403|  5.15k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  5.15k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  404|  11.3k|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   55|  11.3k|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (404:14): [True: 11.1k, False: 205]
  ------------------
  405|       |    /* Finishing after a buffered-image operation */
  406|  11.1k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  11.1k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  407|  11.1k|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   58|    205|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (407:14): [True: 205, False: 0]
  ------------------
  408|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  409|    205|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|    205|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    205|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    205|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  410|    205|  }
  411|       |  /* Read until EOI */
  412|   146k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (412:10): [True: 129k, False: 16.0k]
  ------------------
  413|   129k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|   129k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (413:9): [True: 407, False: 129k]
  ------------------
  414|    407|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|    407|#define FALSE   0               /* values of boolean */
  ------------------
  415|   129k|  }
  416|       |  /* Do final cleanup */
  417|  16.0k|  (*cinfo->src->term_source) (cinfo);
  418|       |  /* We can use jpeg_abort to release memory and reset global_state */
  419|  16.0k|  jpeg_abort((j_common_ptr)cinfo);
  420|  16.0k|  return TRUE;
  ------------------
  |  |  210|  16.0k|#define TRUE    1
  ------------------
  421|  16.5k|}
jdapimin.c:default_decompress_parms:
  131|  18.1k|{
  132|       |  /* Guess the input colorspace, and set output colorspace accordingly. */
  133|       |  /* (Wish JPEG committee had provided a real way to specify this...) */
  134|       |  /* Note application may override our guesses. */
  135|  18.1k|  switch (cinfo->num_components) {
  136|  6.65k|  case 1:
  ------------------
  |  Branch (136:3): [True: 6.65k, False: 11.5k]
  ------------------
  137|  6.65k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  138|  6.65k|    cinfo->out_color_space = JCS_GRAYSCALE;
  139|  6.65k|    break;
  140|       |
  141|  9.95k|  case 3:
  ------------------
  |  Branch (141:3): [True: 9.95k, False: 8.21k]
  ------------------
  142|  9.95k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (142:9): [True: 604, False: 9.34k]
  ------------------
  143|    604|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  144|  9.34k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (144:16): [True: 108, False: 9.24k]
  ------------------
  145|    108|      switch (cinfo->Adobe_transform) {
  146|     32|      case 0:
  ------------------
  |  Branch (146:7): [True: 32, False: 76]
  ------------------
  147|     32|        cinfo->jpeg_color_space = JCS_RGB;
  148|     32|        break;
  149|     43|      case 1:
  ------------------
  |  Branch (149:7): [True: 43, False: 65]
  ------------------
  150|     43|        cinfo->jpeg_color_space = JCS_YCbCr;
  151|     43|        break;
  152|     33|      default:
  ------------------
  |  Branch (152:7): [True: 33, False: 75]
  ------------------
  153|     33|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|     33|  ((cinfo)->err->msg_code = (code), \
  |  |  287|     33|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|     33|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  154|     33|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  155|     33|        break;
  156|    108|      }
  157|  9.24k|    } else {
  158|       |      /* Saw no special markers, try to guess from the component IDs */
  159|  9.24k|      int cid0 = cinfo->comp_info[0].component_id;
  160|  9.24k|      int cid1 = cinfo->comp_info[1].component_id;
  161|  9.24k|      int cid2 = cinfo->comp_info[2].component_id;
  162|       |
  163|  9.24k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (163:11): [True: 5.39k, False: 3.84k]
  |  Branch (163:24): [True: 5.12k, False: 270]
  |  Branch (163:37): [True: 4.19k, False: 925]
  ------------------
  164|  4.19k|#ifdef D_LOSSLESS_SUPPORTED
  165|  4.19k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (165:13): [True: 1, False: 4.19k]
  ------------------
  166|      1|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  167|  4.19k|        else
  168|  4.19k|#endif
  169|  4.19k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  170|  5.04k|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (170:18): [True: 2.43k, False: 2.61k]
  |  Branch (170:32): [True: 2.41k, False: 14]
  |  Branch (170:46): [True: 2.10k, False: 308]
  ------------------
  171|  2.10k|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  172|  2.93k|      else {
  173|  2.93k|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|  2.93k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.93k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.93k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  2.93k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  2.93k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  2.93k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  174|  2.93k|#ifdef D_LOSSLESS_SUPPORTED
  175|  2.93k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (175:13): [True: 6, False: 2.92k]
  ------------------
  176|      6|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  177|  2.92k|        else
  178|  2.92k|#endif
  179|  2.92k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  180|  2.93k|      }
  181|  9.24k|    }
  182|       |    /* Always guess RGB is proper output colorspace. */
  183|  9.95k|    cinfo->out_color_space = JCS_RGB;
  184|  9.95k|    break;
  185|       |
  186|  1.15k|  case 4:
  ------------------
  |  Branch (186:3): [True: 1.15k, False: 17.0k]
  ------------------
  187|  1.15k|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (187:9): [True: 20, False: 1.13k]
  ------------------
  188|     20|      switch (cinfo->Adobe_transform) {
  189|      1|      case 0:
  ------------------
  |  Branch (189:7): [True: 1, False: 19]
  ------------------
  190|      1|        cinfo->jpeg_color_space = JCS_CMYK;
  191|      1|        break;
  192|      1|      case 2:
  ------------------
  |  Branch (192:7): [True: 1, False: 19]
  ------------------
  193|      1|        cinfo->jpeg_color_space = JCS_YCCK;
  194|      1|        break;
  195|     18|      default:
  ------------------
  |  Branch (195:7): [True: 18, False: 2]
  ------------------
  196|     18|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  287|     18|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|     18|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  197|     18|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  198|     18|        break;
  199|     20|      }
  200|  1.13k|    } else {
  201|       |      /* No special markers, assume straight CMYK. */
  202|  1.13k|      cinfo->jpeg_color_space = JCS_CMYK;
  203|  1.13k|    }
  204|  1.15k|    cinfo->out_color_space = JCS_CMYK;
  205|  1.15k|    break;
  206|       |
  207|    404|  default:
  ------------------
  |  Branch (207:3): [True: 404, False: 17.7k]
  ------------------
  208|    404|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  209|    404|    cinfo->out_color_space = JCS_UNKNOWN;
  210|    404|    break;
  211|  18.1k|  }
  212|       |
  213|       |  /* Set defaults for other decompression parameters. */
  214|  18.1k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  215|  18.1k|  cinfo->scale_denom = 1;
  216|  18.1k|  cinfo->output_gamma = 1.0;
  217|  18.1k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  218|  18.1k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  219|  18.1k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  18.1k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  220|  18.1k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|  18.1k|#define TRUE    1
  ------------------
  221|  18.1k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|  18.1k|#define TRUE    1
  ------------------
  222|  18.1k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  223|       |  /* We set these in case application only sets quantize_colors. */
  224|  18.1k|  cinfo->dither_mode = JDITHER_FS;
  225|  18.1k|#ifdef QUANT_2PASS_SUPPORTED
  226|  18.1k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|  18.1k|#define TRUE    1
  ------------------
  227|       |#else
  228|       |  cinfo->two_pass_quantize = FALSE;
  229|       |#endif
  230|  18.1k|  cinfo->desired_number_of_colors = 256;
  231|  18.1k|  cinfo->colormap = NULL;
  232|       |  /* Initialize for no mode change in buffered-image mode. */
  233|  18.1k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  234|  18.1k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  235|  18.1k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  236|  18.1k|}

jpeg_start_decompress:
   53|  18.1k|{
   54|  18.1k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  18.1k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (54:7): [True: 18.1k, False: 0]
  ------------------
   55|       |    /* First call: initialize master control, select active modules */
   56|  18.1k|    jinit_master_decompress(cinfo);
   57|  18.1k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (57:9): [True: 12.3k, False: 5.83k]
  ------------------
   58|       |      /* No more work here; expecting jpeg_start_output next */
   59|  12.3k|      cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   55|  12.3k|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
   60|  12.3k|      return TRUE;
  ------------------
  |  |  210|  12.3k|#define TRUE    1
  ------------------
   61|  12.3k|    }
   62|  5.83k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|  5.83k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   63|  5.83k|  }
   64|  5.83k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|  5.83k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (64:7): [True: 5.17k, False: 656]
  ------------------
   65|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   66|  5.17k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (66:9): [True: 0, False: 5.17k]
  ------------------
   67|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
   68|      0|      for (;;) {
   69|      0|        int retcode;
   70|       |        /* Call progress monitor hook if present */
   71|      0|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (71:13): [True: 0, False: 0]
  ------------------
   72|      0|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   73|       |        /* Absorb some more input */
   74|      0|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   75|      0|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (75:13): [True: 0, False: 0]
  ------------------
   76|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   77|      0|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (77:13): [True: 0, False: 0]
  ------------------
   78|      0|          break;
   79|       |        /* Advance progress counter if appropriate */
   80|      0|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (80:13): [True: 0, False: 0]
  ------------------
   81|      0|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1113|      0|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (81:14): [True: 0, False: 0]
  |  Branch (81:47): [True: 0, False: 0]
  ------------------
   82|      0|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (82:15): [True: 0, False: 0]
  ------------------
   83|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   84|      0|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   85|      0|          }
   86|      0|        }
   87|      0|      }
   88|       |#else
   89|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   90|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   91|      0|    }
   92|  5.17k|    cinfo->output_scan_number = cinfo->input_scan_number;
   93|  5.17k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|    656|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (93:14): [True: 0, False: 656]
  ------------------
   94|      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)))
  ------------------
   95|       |  /* Perform any dummy output passes, and set up for the final pass */
   96|  5.83k|  return output_pass_setup(cinfo);
   97|  5.83k|}
jpeg_read_scanlines:
  321|   112M|{
  322|   112M|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  323|   112M|  JDIMENSION row_ctr;
  324|       |
  325|   112M|#ifdef D_LOSSLESS_SUPPORTED
  326|   112M|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (326:7): [True: 6.15M, False: 105M]
  ------------------
  327|  6.15M|#if BITS_IN_JSAMPLE == 8
  328|  6.15M|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  12.3M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (328:9): [True: 11, False: 6.15M]
  |  Branch (328:52): [True: 0, False: 6.15M]
  ------------------
  329|       |#else
  330|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  331|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  332|       |#endif
  333|     11|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     11|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  334|  6.15M|  } else
  335|   105M|#endif
  336|   105M|  {
  337|   105M|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|   105M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (337:9): [True: 14, False: 105M]
  ------------------
  338|     14|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     14|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  339|   105M|  }
  340|       |
  341|   112M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|   112M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (341:7): [True: 0, False: 112M]
  ------------------
  342|      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)))
  ------------------
  343|   112M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (343:7): [True: 0, False: 112M]
  ------------------
  344|      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))
  ------------------
  345|      0|    return 0;
  346|      0|  }
  347|       |
  348|       |  /* Call progress monitor hook if present */
  349|   112M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (349:7): [True: 0, False: 112M]
  ------------------
  350|      0|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  351|      0|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  352|      0|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  353|      0|  }
  354|       |
  355|       |  /* Process some data */
  356|   112M|  row_ctr = 0;
  357|   112M|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  252|   112M|#define _process_data  process_data
  ------------------
  |  Branch (357:7): [True: 0, False: 112M]
  ------------------
  358|      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)))
  ------------------
  359|   112M|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  252|   112M|#define _process_data  process_data
  ------------------
  360|   112M|  cinfo->output_scanline += row_ctr;
  361|   112M|  return row_ctr;
  362|       |#else
  363|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  364|       |  return 0;
  365|       |#endif
  366|   112M|}
jpeg_skip_scanlines:
  490|  41.6k|{
  491|  41.6k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  492|  41.6k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  493|  41.6k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  494|  41.6k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  495|  41.6k|  JDIMENSION i, x;
  496|  41.6k|  int y;
  497|  41.6k|  JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
  498|  41.6k|  JDIMENSION lines_to_skip, lines_to_read;
  499|       |
  500|  41.6k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  41.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (500:7): [True: 81, False: 41.5k]
  ------------------
  501|     81|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     81|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     81|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     81|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  502|       |
  503|  41.6k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (503:7): [True: 0, False: 41.6k]
  ------------------
  504|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|       |  /* Two-pass color quantization is not supported. */
  507|  41.6k|  if (cinfo->quantize_colors && cinfo->two_pass_quantize)
  ------------------
  |  Branch (507:7): [True: 22.8k, False: 18.7k]
  |  Branch (507:33): [True: 0, False: 22.8k]
  ------------------
  508|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  509|       |
  510|  41.6k|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  41.6k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (510:7): [True: 0, False: 41.6k]
  ------------------
  511|      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)))
  ------------------
  512|       |
  513|       |  /* Do not skip past the bottom of the image. */
  514|  41.6k|  if ((unsigned long long)cinfo->output_scanline + num_lines >=
  ------------------
  |  Branch (514:7): [True: 1.17k, False: 40.4k]
  ------------------
  515|  41.6k|      cinfo->output_height) {
  516|  1.17k|    num_lines = cinfo->output_height - cinfo->output_scanline;
  517|  1.17k|    cinfo->output_scanline = cinfo->output_height;
  518|  1.17k|    (*cinfo->inputctl->finish_input_pass) (cinfo);
  519|  1.17k|    cinfo->inputctl->eoi_reached = TRUE;
  ------------------
  |  |  210|  1.17k|#define TRUE    1
  ------------------
  520|  1.17k|    return num_lines;
  521|  1.17k|  }
  522|       |
  523|  40.4k|  if (num_lines == 0)
  ------------------
  |  Branch (523:7): [True: 0, False: 40.4k]
  ------------------
  524|      0|    return 0;
  525|       |
  526|  40.4k|  lines_per_iMCU_row = cinfo->_min_DCT_scaled_size * cinfo->max_v_samp_factor;
  ------------------
  |  |   27|  40.4k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  527|  40.4k|  lines_left_in_iMCU_row =
  528|  40.4k|    (lines_per_iMCU_row - (cinfo->output_scanline % lines_per_iMCU_row)) %
  529|  40.4k|    lines_per_iMCU_row;
  530|  40.4k|  lines_after_iMCU_row = num_lines - lines_left_in_iMCU_row;
  531|       |
  532|       |  /* Skip the lines remaining in the current iMCU row.  When upsampling
  533|       |   * requires context rows, we need the previous and next rows in order to read
  534|       |   * the current row.  This adds some complexity.
  535|       |   */
  536|  40.4k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (536:7): [True: 14.5k, False: 25.8k]
  ------------------
  537|       |    /* If the skipped lines would not move us past the current iMCU row, we
  538|       |     * read the lines and ignore them.  There might be a faster way of doing
  539|       |     * this, but we are facing increasing complexity for diminishing returns.
  540|       |     * The increasing complexity would be a by-product of meddling with the
  541|       |     * state machine used to skip context rows.  Near the end of an iMCU row,
  542|       |     * the next iMCU row may have already been entropy-decoded.  In this unique
  543|       |     * case, we will read the next iMCU row if we cannot skip past it as well.
  544|       |     */
  545|  14.5k|    if ((num_lines < lines_left_in_iMCU_row + 1) ||
  ------------------
  |  Branch (545:9): [True: 3.41k, False: 11.1k]
  ------------------
  546|  11.1k|        (lines_left_in_iMCU_row <= 1 && main_ptr->buffer_full &&
  ------------------
  |  Branch (546:10): [True: 11.1k, False: 0]
  |  Branch (546:41): [True: 2.03k, False: 9.14k]
  ------------------
  547|  5.45k|         lines_after_iMCU_row < lines_per_iMCU_row + 1)) {
  ------------------
  |  Branch (547:10): [True: 2.03k, False: 0]
  ------------------
  548|  5.45k|      read_and_discard_scanlines(cinfo, num_lines);
  549|  5.45k|      return num_lines;
  550|  5.45k|    }
  551|       |
  552|       |    /* If the next iMCU row has already been entropy-decoded, make sure that
  553|       |     * we do not skip too far.
  554|       |     */
  555|  9.14k|    if (lines_left_in_iMCU_row <= 1 && main_ptr->buffer_full) {
  ------------------
  |  Branch (555:9): [True: 9.14k, False: 0]
  |  Branch (555:40): [True: 0, False: 9.14k]
  ------------------
  556|      0|      cinfo->output_scanline += lines_left_in_iMCU_row + lines_per_iMCU_row;
  557|      0|      lines_after_iMCU_row -= lines_per_iMCU_row;
  558|  9.14k|    } else {
  559|  9.14k|      cinfo->output_scanline += lines_left_in_iMCU_row;
  560|  9.14k|    }
  561|       |
  562|       |    /* If we have just completed the first block, adjust the buffer pointers */
  563|  9.14k|    if (main_ptr->iMCU_row_ctr == 0 ||
  ------------------
  |  Branch (563:9): [True: 9.14k, False: 0]
  ------------------
  564|      0|        (main_ptr->iMCU_row_ctr == 1 && lines_left_in_iMCU_row > 2))
  ------------------
  |  Branch (564:10): [True: 0, False: 0]
  |  Branch (564:41): [True: 0, False: 0]
  ------------------
  565|  9.14k|      set_wraparound_pointers(cinfo);
  566|  9.14k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  9.14k|#define FALSE   0               /* values of boolean */
  ------------------
  567|  9.14k|    main_ptr->rowgroup_ctr = 0;
  568|  9.14k|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  9.14k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  569|  9.14k|    if (!master->using_merged_upsample) {
  ------------------
  |  Branch (569:9): [True: 9.14k, False: 0]
  ------------------
  570|  9.14k|      upsample->next_row_out = cinfo->max_v_samp_factor;
  571|  9.14k|      upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
  572|  9.14k|    }
  573|  9.14k|  }
  574|       |
  575|       |  /* Skipping is much simpler when context rows are not required. */
  576|  25.8k|  else {
  577|  25.8k|    if (num_lines < lines_left_in_iMCU_row) {
  ------------------
  |  Branch (577:9): [True: 3.40k, False: 22.4k]
  ------------------
  578|  3.40k|      increment_simple_rowgroup_ctr(cinfo, num_lines);
  579|  3.40k|      return num_lines;
  580|  22.4k|    } else {
  581|  22.4k|      cinfo->output_scanline += lines_left_in_iMCU_row;
  582|  22.4k|      main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  22.4k|#define FALSE   0               /* values of boolean */
  ------------------
  583|  22.4k|      main_ptr->rowgroup_ctr = 0;
  584|  22.4k|      if (!master->using_merged_upsample) {
  ------------------
  |  Branch (584:11): [True: 22.3k, False: 81]
  ------------------
  585|  22.3k|        upsample->next_row_out = cinfo->max_v_samp_factor;
  586|  22.3k|        upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
  587|  22.3k|      }
  588|  22.4k|    }
  589|  25.8k|  }
  590|       |
  591|       |  /* Calculate how many full iMCU rows we can skip. */
  592|  31.6k|  if (cinfo->upsample->need_context_rows)
  ------------------
  |  Branch (592:7): [True: 9.14k, False: 22.4k]
  ------------------
  593|  9.14k|    lines_to_skip = ((lines_after_iMCU_row - 1) / lines_per_iMCU_row) *
  594|  9.14k|                    lines_per_iMCU_row;
  595|  22.4k|  else
  596|  22.4k|    lines_to_skip = (lines_after_iMCU_row / lines_per_iMCU_row) *
  597|  22.4k|                    lines_per_iMCU_row;
  598|       |  /* Calculate the number of lines that remain to be skipped after skipping all
  599|       |   * of the full iMCU rows that we can.  We will not read these lines unless we
  600|       |   * have to.
  601|       |   */
  602|  31.6k|  lines_to_read = lines_after_iMCU_row - lines_to_skip;
  603|       |
  604|       |  /* For images requiring multiple scans (progressive, non-interleaved, etc.),
  605|       |   * all of the entropy decoding occurs in jpeg_start_decompress(), assuming
  606|       |   * that the input data source is non-suspending.  This makes skipping easy.
  607|       |   */
  608|  31.6k|  if (cinfo->inputctl->has_multiple_scans || cinfo->buffered_image) {
  ------------------
  |  Branch (608:7): [True: 26.2k, False: 5.37k]
  |  Branch (608:46): [True: 0, False: 5.37k]
  ------------------
  609|  26.1k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (609:9): [True: 8.44k, False: 17.7k]
  ------------------
  610|  8.44k|      cinfo->output_scanline += lines_to_skip;
  611|  8.44k|      cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
  612|  8.44k|      main_ptr->iMCU_row_ctr += lines_to_skip / lines_per_iMCU_row;
  613|       |      /* It is complex to properly move to the middle of a context block, so
  614|       |       * read the remaining lines instead of skipping them.
  615|       |       */
  616|  8.44k|      read_and_discard_scanlines(cinfo, lines_to_read);
  617|  17.7k|    } else {
  618|  17.7k|      cinfo->output_scanline += lines_to_skip;
  619|  17.7k|      cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
  620|  17.7k|      increment_simple_rowgroup_ctr(cinfo, lines_to_read);
  621|  17.7k|    }
  622|  26.1k|    if (!master->using_merged_upsample)
  ------------------
  |  Branch (622:9): [True: 26.1k, False: 5]
  ------------------
  623|  26.1k|      upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
  624|  26.1k|    return num_lines;
  625|  26.1k|  }
  626|       |
  627|       |  /* Skip the iMCU rows that we can safely skip. */
  628|  8.67k|  for (i = 0; i < lines_to_skip; i += lines_per_iMCU_row) {
  ------------------
  |  Branch (628:15): [True: 3.21k, False: 5.45k]
  ------------------
  629|  6.43k|    for (y = 0; y < coef->MCU_rows_per_iMCU_row; y++) {
  ------------------
  |  Branch (629:17): [True: 3.21k, False: 3.21k]
  ------------------
  630|  2.70M|      for (x = 0; x < cinfo->MCUs_per_row; x++) {
  ------------------
  |  Branch (630:19): [True: 2.70M, False: 3.21k]
  ------------------
  631|       |        /* Calling decode_mcu() with a NULL pointer causes it to discard the
  632|       |         * decoded coefficients.  This is ~5% faster for large subsets, but
  633|       |         * it's tough to tell a difference for smaller images.
  634|       |         */
  635|  2.70M|        if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (635:13): [True: 991k, False: 1.71M]
  ------------------
  636|   991k|          cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  637|  2.70M|        (*cinfo->entropy->decode_mcu) (cinfo, NULL);
  638|  2.70M|      }
  639|  3.21k|    }
  640|  3.21k|    cinfo->input_iMCU_row++;
  641|  3.21k|    cinfo->output_iMCU_row++;
  642|  3.21k|    if (cinfo->input_iMCU_row < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (642:9): [True: 3.21k, False: 0]
  ------------------
  643|  3.21k|      start_iMCU_row(cinfo);
  644|      0|    else
  645|      0|      (*cinfo->inputctl->finish_input_pass) (cinfo);
  646|  3.21k|  }
  647|  5.45k|  cinfo->output_scanline += lines_to_skip;
  648|       |
  649|  5.45k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (649:7): [True: 699, False: 4.75k]
  ------------------
  650|       |    /* Context-based upsampling keeps track of iMCU rows. */
  651|    699|    main_ptr->iMCU_row_ctr += lines_to_skip / lines_per_iMCU_row;
  652|       |
  653|       |    /* It is complex to properly move to the middle of a context block, so
  654|       |     * read the remaining lines instead of skipping them.
  655|       |     */
  656|    699|    read_and_discard_scanlines(cinfo, lines_to_read);
  657|  4.75k|  } else {
  658|  4.75k|    increment_simple_rowgroup_ctr(cinfo, lines_to_read);
  659|  4.75k|  }
  660|       |
  661|       |  /* Since skipping lines involves skipping the upsampling step, the value of
  662|       |   * "rows_to_go" will become invalid unless we set it here.  NOTE: This is a
  663|       |   * bit odd, since "rows_to_go" seems to be redundantly keeping track of
  664|       |   * output_scanline.
  665|       |   */
  666|  5.45k|  if (!master->using_merged_upsample)
  ------------------
  |  Branch (666:7): [True: 5.37k, False: 81]
  ------------------
  667|  5.37k|    upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
  668|       |
  669|       |  /* Always skip the requested number of lines. */
  670|  5.45k|  return num_lines;
  671|  31.6k|}
jpeg_start_output:
  735|  25.2k|{
  736|  25.2k|  if (cinfo->global_state != DSTATE_BUFIMAGE &&
  ------------------
  |  |   55|  50.4k|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (736:7): [True: 0, False: 25.2k]
  ------------------
  737|      0|      cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (737:7): [True: 0, False: 0]
  ------------------
  738|      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)))
  ------------------
  739|       |  /* Limit scan number to valid range */
  740|  25.2k|  if (scan_number <= 0)
  ------------------
  |  Branch (740:7): [True: 0, False: 25.2k]
  ------------------
  741|      0|    scan_number = 1;
  742|  25.2k|  if (cinfo->inputctl->eoi_reached && scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (742:7): [True: 0, False: 25.2k]
  |  Branch (742:39): [True: 0, False: 0]
  ------------------
  743|      0|    scan_number = cinfo->input_scan_number;
  744|  25.2k|  cinfo->output_scan_number = scan_number;
  745|       |  /* Perform any dummy output passes, and set up for the real pass */
  746|  25.2k|  return output_pass_setup(cinfo);
  747|  25.2k|}
jpeg_finish_output:
  759|  25.0k|{
  760|  25.0k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  50.0k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (760:8): [True: 25.0k, False: 0]
  ------------------
  761|  25.0k|       cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (761:8): [True: 0, False: 0]
  |  Branch (761:49): [True: 25.0k, False: 0]
  ------------------
  762|       |    /* Terminate this pass. */
  763|       |    /* We do not require the whole pass to have been completed. */
  764|  25.0k|    (*cinfo->master->finish_output_pass) (cinfo);
  765|  25.0k|    cinfo->global_state = DSTATE_BUFPOST;
  ------------------
  |  |   56|  25.0k|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  766|  25.0k|  } else if (cinfo->global_state != DSTATE_BUFPOST) {
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (766:14): [True: 0, False: 0]
  ------------------
  767|       |    /* BUFPOST = repeat call after a suspension, anything else is error */
  768|      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)))
  ------------------
  769|      0|  }
  770|       |  /* Read markers looking for SOS or EOI */
  771|  43.2k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (771:10): [True: 22.6k, False: 20.5k]
  ------------------
  772|  22.6k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (772:10): [True: 18.3k, False: 4.26k]
  ------------------
  773|  18.3k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  18.3k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (773:9): [True: 182, False: 18.1k]
  ------------------
  774|    182|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|    182|#define FALSE   0               /* values of boolean */
  ------------------
  775|  18.3k|  }
  776|  24.8k|  cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   55|  24.8k|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  777|  24.8k|  return TRUE;
  ------------------
  |  |  210|  24.8k|#define TRUE    1
  ------------------
  778|  25.0k|}
jdapistd-8.c:output_pass_setup:
  110|  30.4k|{
  111|  30.4k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|  30.4k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (111:7): [True: 30.4k, False: 0]
  ------------------
  112|       |    /* First call: do pass setup */
  113|  30.4k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  114|  30.4k|    cinfo->output_scanline = 0;
  115|  30.4k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|  30.4k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  116|  30.4k|  }
  117|       |  /* Loop over any required dummy passes */
  118|  32.1k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (118:10): [True: 1.70k, False: 30.3k]
  ------------------
  119|  1.70k|#ifdef QUANT_2PASS_SUPPORTED
  120|       |    /* Crank through the dummy pass */
  121|  3.87M|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (121:12): [True: 3.87M, False: 1.68k]
  ------------------
  122|  3.87M|      JDIMENSION last_scanline;
  123|       |      /* Call progress monitor hook if present */
  124|  3.87M|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (124:11): [True: 0, False: 3.87M]
  ------------------
  125|      0|        cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  126|      0|        cinfo->progress->pass_limit = (long)cinfo->output_height;
  127|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  128|      0|      }
  129|       |      /* Process some data */
  130|  3.87M|      last_scanline = cinfo->output_scanline;
  131|  3.87M|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (131:11): [True: 3.87M, False: 0]
  ------------------
  132|  3.87M|        if (cinfo->main->process_data == NULL)
  ------------------
  |  Branch (132:13): [True: 0, False: 3.87M]
  ------------------
  133|      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)))
  ------------------
  134|  3.87M|        (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
  135|  3.87M|                                      &cinfo->output_scanline, (JDIMENSION)0);
  136|  3.87M|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (136:18): [True: 0, False: 0]
  ------------------
  137|      0|        if (cinfo->main->process_data_12 == NULL)
  ------------------
  |  Branch (137:13): [True: 0, False: 0]
  ------------------
  138|      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)))
  ------------------
  139|      0|        (*cinfo->main->process_data_12) (cinfo, (J12SAMPARRAY)NULL,
  140|      0|                                         &cinfo->output_scanline,
  141|      0|                                         (JDIMENSION)0);
  142|      0|      } else {
  143|      0|#ifdef D_LOSSLESS_SUPPORTED
  144|      0|        if (cinfo->main->process_data_16 == NULL)
  ------------------
  |  Branch (144:13): [True: 0, False: 0]
  ------------------
  145|      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)))
  ------------------
  146|      0|        (*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
  147|      0|                                         &cinfo->output_scanline,
  148|      0|                                         (JDIMENSION)0);
  149|       |#else
  150|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  151|       |#endif
  152|      0|      }
  153|  3.87M|      if (cinfo->output_scanline == last_scanline)
  ------------------
  |  Branch (153:11): [True: 23, False: 3.87M]
  ------------------
  154|     23|        return FALSE;           /* No progress made, must suspend */
  ------------------
  |  |  207|     23|#define FALSE   0               /* values of boolean */
  ------------------
  155|  3.87M|    }
  156|       |    /* Finish up dummy pass, and set up for another one */
  157|  1.68k|    (*cinfo->master->finish_output_pass) (cinfo);
  158|  1.68k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  159|  1.68k|    cinfo->output_scanline = 0;
  160|       |#else
  161|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  162|       |#endif /* QUANT_2PASS_SUPPORTED */
  163|  1.68k|  }
  164|       |  /* Ready for application to drive output pass through
  165|       |   * _jpeg_read_scanlines or _jpeg_read_raw_data.
  166|       |   */
  167|  30.3k|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   54|      0|#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|  60.7k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (167:25): [True: 0, False: 30.3k]
  ------------------
  168|  30.3k|  return TRUE;
  ------------------
  |  |  210|  30.3k|#define TRUE    1
  ------------------
  169|  30.4k|}
jdapistd-8.c:read_and_discard_scanlines:
  397|  40.3k|{
  398|  40.3k|  JDIMENSION n;
  399|  40.3k|#ifdef UPSAMPLE_MERGING_SUPPORTED
  400|  40.3k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  401|  40.3k|#endif
  402|  40.3k|  _JSAMPLE dummy_sample[1] = { 0 };
  ------------------
  |  |  220|  40.3k|#define _JSAMPLE  JSAMPLE
  ------------------
  403|  40.3k|  _JSAMPROW dummy_row = dummy_sample;
  ------------------
  |  |  225|  40.3k|#define _JSAMPROW  JSAMPROW
  ------------------
  404|  40.3k|  _JSAMPARRAY scanlines = NULL;
  ------------------
  |  |  226|  40.3k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  405|  40.3k|  void (*color_convert) (j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
  406|  40.3k|                         JDIMENSION input_row, _JSAMPARRAY output_buf,
  407|  40.3k|                         int num_rows) = NULL;
  408|  40.3k|  void (*color_quantize) (j_decompress_ptr cinfo, _JSAMPARRAY input_buf,
  409|  40.3k|                          _JSAMPARRAY output_buf, int num_rows) = NULL;
  410|       |
  411|  40.3k|  if (cinfo->cconvert &&
  ------------------
  |  Branch (411:7): [True: 40.3k, False: 0]
  ------------------
  412|  40.3k|#ifdef UPSAMPLE_MERGING_SUPPORTED
  413|  40.3k|      !master->using_merged_upsample &&
  ------------------
  |  Branch (413:7): [True: 40.3k, False: 0]
  ------------------
  414|  40.3k|#endif
  415|  40.3k|      cinfo->cconvert->_color_convert) {
  ------------------
  |  |  263|  40.3k|#define _color_convert  color_convert
  ------------------
  |  Branch (415:7): [True: 40.3k, False: 0]
  ------------------
  416|  40.3k|    color_convert = cinfo->cconvert->_color_convert;
  ------------------
  |  |  263|  40.3k|#define _color_convert  color_convert
  ------------------
  417|  40.3k|    cinfo->cconvert->_color_convert = noop_convert;
  ------------------
  |  |  263|  40.3k|#define _color_convert  color_convert
  ------------------
  418|       |    /* This just prevents UBSan from complaining about adding 0 to a NULL
  419|       |     * pointer.  The pointer isn't actually used.
  420|       |     */
  421|  40.3k|    scanlines = &dummy_row;
  422|  40.3k|  }
  423|       |
  424|  40.3k|  if (cinfo->quantize_colors && cinfo->cquantize &&
  ------------------
  |  Branch (424:7): [True: 22.1k, False: 18.2k]
  |  Branch (424:33): [True: 22.1k, False: 0]
  ------------------
  425|  22.1k|      cinfo->cquantize->_color_quantize) {
  ------------------
  |  |  265|  22.1k|#define _color_quantize  color_quantize
  ------------------
  |  Branch (425:7): [True: 22.1k, False: 0]
  ------------------
  426|  22.1k|    color_quantize = cinfo->cquantize->_color_quantize;
  ------------------
  |  |  265|  22.1k|#define _color_quantize  color_quantize
  ------------------
  427|  22.1k|    cinfo->cquantize->_color_quantize = noop_quantize;
  ------------------
  |  |  265|  22.1k|#define _color_quantize  color_quantize
  ------------------
  428|  22.1k|  }
  429|       |
  430|  40.3k|#ifdef UPSAMPLE_MERGING_SUPPORTED
  431|  40.3k|  if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
  ------------------
  |  Branch (431:7): [True: 0, False: 40.3k]
  |  Branch (431:40): [True: 0, False: 0]
  ------------------
  432|      0|    my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
  433|      0|    scanlines = &upsample->spare_row;
  434|      0|  }
  435|  40.3k|#endif
  436|       |
  437|   159k|  for (n = 0; n < num_lines; n++)
  ------------------
  |  Branch (437:15): [True: 119k, False: 40.3k]
  ------------------
  438|   119k|    _jpeg_read_scanlines(cinfo, scanlines, 1);
  ------------------
  |  |  232|   119k|#define _jpeg_read_scanlines  jpeg_read_scanlines
  ------------------
  439|       |
  440|  40.3k|  if (color_convert)
  ------------------
  |  Branch (440:7): [True: 40.3k, False: 5]
  ------------------
  441|  40.3k|    cinfo->cconvert->_color_convert = color_convert;
  ------------------
  |  |  263|  40.3k|#define _color_convert  color_convert
  ------------------
  442|       |
  443|  40.3k|  if (color_quantize)
  ------------------
  |  Branch (443:7): [True: 22.1k, False: 18.2k]
  ------------------
  444|  22.1k|    cinfo->cquantize->_color_quantize = color_quantize;
  ------------------
  |  |  265|  22.1k|#define _color_quantize  color_quantize
  ------------------
  445|  40.3k|}
jdapistd-8.c:noop_convert:
  375|   116k|{
  376|   116k|}
jdapistd-8.c:noop_quantize:
  383|  66.0k|{
  384|  66.0k|}
jdapistd-8.c:increment_simple_rowgroup_ctr:
  455|  25.7k|{
  456|  25.7k|  JDIMENSION rows_left;
  457|  25.7k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  458|  25.7k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  459|       |
  460|  25.7k|  if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
  ------------------
  |  Branch (460:7): [True: 0, False: 25.7k]
  |  Branch (460:40): [True: 0, False: 0]
  ------------------
  461|      0|    read_and_discard_scanlines(cinfo, rows);
  462|      0|    return;
  463|      0|  }
  464|       |
  465|       |  /* Increment the counter to the next row group after the skipped rows. */
  466|  25.7k|  main_ptr->rowgroup_ctr += rows / cinfo->max_v_samp_factor;
  467|       |
  468|       |  /* Partially skipping a row group would involve modifying the internal state
  469|       |   * of the upsampler, so read the remaining rows into a dummy buffer instead.
  470|       |   */
  471|  25.7k|  rows_left = rows % cinfo->max_v_samp_factor;
  472|  25.7k|  cinfo->output_scanline += rows - rows_left;
  473|       |
  474|  25.7k|  read_and_discard_scanlines(cinfo, rows_left);
  475|  25.7k|}

jinit_arith_decoder:
  751|  6.49k|{
  752|  6.49k|  arith_entropy_ptr entropy;
  753|  6.49k|  int i;
  754|       |
  755|  6.49k|  entropy = (arith_entropy_ptr)
  756|  6.49k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.49k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  6.49k|                                sizeof(arith_entropy_decoder));
  758|  6.49k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  6.49k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|   110k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   110k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 103k, False: 6.49k]
  ------------------
  763|   103k|    entropy->dc_stats[i] = NULL;
  764|   103k|    entropy->ac_stats[i] = NULL;
  765|   103k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  6.49k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  6.49k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 3.85k, False: 2.63k]
  ------------------
  771|       |    /* Create progression status table */
  772|  3.85k|    int *coef_bit_ptr, ci;
  773|  3.85k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  3.85k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.85k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  3.85k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  3.85k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  3.85k|                                  sizeof(int));
  777|  3.85k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  10.1k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 6.26k, False: 3.85k]
  ------------------
  779|   407k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|   407k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 400k, False: 6.26k]
  ------------------
  780|   400k|        *coef_bit_ptr++ = -1;
  781|  3.85k|  }
  782|  6.49k|}
jdarith.c:start_pass:
  633|  28.9k|{
  634|  28.9k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  28.9k|  int ci, tbl;
  636|  28.9k|  jpeg_component_info *compptr;
  637|       |
  638|  28.9k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 18.2k, False: 10.7k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  18.2k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 5.81k, False: 12.4k]
  ------------------
  641|  5.81k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 3, False: 5.80k]
  ------------------
  642|      3|        goto bad;
  643|  12.4k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  12.4k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|  12.3k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 11, False: 12.3k]
  |  Branch (645:36): [True: 10, False: 12.3k]
  ------------------
  646|     21|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  12.3k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 3, False: 12.3k]
  ------------------
  649|      3|        goto bad;
  650|  12.3k|    }
  651|  18.1k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 4.35k, False: 13.8k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  4.35k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 8, False: 4.34k]
  ------------------
  654|      8|        goto bad;
  655|  4.35k|    }
  656|  18.1k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 4, False: 18.1k]
  ------------------
  657|     39|bad:
  658|     39|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     39|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     39|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     39|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     39|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     39|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     39|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|     39|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|     39|    }
  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|  38.5k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 20.3k, False: 18.2k]
  ------------------
  666|  20.3k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  20.3k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  20.3k|      int *prev_coef_bit_ptr =
  669|  20.3k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  20.3k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 12.3k, False: 7.98k]
  |  Branch (670:24): [True: 8.04k, False: 4.32k]
  ------------------
  671|  8.04k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  8.04k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  8.04k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  8.04k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  8.04k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   451k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  447|  20.3k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 7.98k, False: 12.3k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  445|   451k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 352k, False: 99.0k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 431k, False: 20.3k]
  ------------------
  673|   431k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 354k, False: 76.5k]
  ------------------
  674|   354k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  76.5k|        else
  676|  76.5k|          prev_coef_bit_ptr[coefi] = 0;
  677|   431k|      }
  678|   331k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 310k, False: 20.3k]
  ------------------
  679|   310k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 80.1k, False: 230k]
  ------------------
  680|   310k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 98.0k, False: 212k]
  ------------------
  681|  98.0k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  98.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  98.0k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  98.0k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  98.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|   310k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|   310k|      }
  684|  20.3k|    }
  685|       |    /* Select MCU decoding routine */
  686|  18.2k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 13.8k, False: 4.38k]
  ------------------
  687|  13.8k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 4.75k, False: 9.07k]
  ------------------
  688|  4.75k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  9.07k|      else
  690|  9.07k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  13.8k|    } else {
  692|  4.38k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 1.04k, False: 3.33k]
  ------------------
  693|  1.04k|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|  3.33k|      else
  695|  3.33k|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  4.38k|    }
  697|  18.2k|  } 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|  10.7k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  4.52k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 6.25k, False: 4.52k]
  |  Branch (701:27): [True: 1.96k, False: 2.56k]
  ------------------
  702|  2.56k|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 326, False: 2.23k]
  |  Branch (702:27): [True: 1.96k, False: 270]
  ------------------
  703|  10.5k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  10.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  10.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  10.7k|    entropy->pub.decode_mcu = decode_mcu;
  706|  10.7k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  61.7k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 32.7k, False: 28.9k]
  ------------------
  710|  32.7k|    compptr = cinfo->cur_comp_info[ci];
  711|  32.7k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 12.3k, False: 20.3k]
  |  Branch (711:38): [True: 7.98k, False: 12.3k]
  |  Branch (711:56): [True: 5.91k, False: 2.06k]
  ------------------
  712|  18.2k|      tbl = compptr->dc_tbl_no;
  713|  18.2k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  18.2k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 18.2k]
  |  Branch (713:22): [True: 0, False: 18.2k]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|  18.2k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 6.63k, False: 11.6k]
  ------------------
  716|  6.63k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  6.63k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  6.63k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  6.63k|#define DC_STAT_BINS  64
  ------------------
  718|  18.2k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  18.2k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  18.2k|      entropy->last_dc_val[ci] = 0;
  721|  18.2k|      entropy->dc_context[ci] = 0;
  722|  18.2k|    }
  723|  32.7k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 12.3k, False: 20.3k]
  |  Branch (723:37): [True: 12.3k, False: 7.98k]
  ------------------
  724|  24.7k|      tbl = compptr->ac_tbl_no;
  725|  24.7k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  24.7k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 24.7k]
  |  Branch (725:22): [True: 0, False: 24.7k]
  ------------------
  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|  24.7k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 7.04k, False: 17.6k]
  ------------------
  728|  7.04k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  7.04k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|  7.04k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  7.04k|#define AC_STAT_BINS  256
  ------------------
  730|  24.7k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  24.7k|#define AC_STAT_BINS  256
  ------------------
  731|  24.7k|    }
  732|  32.7k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  28.9k|  entropy->c = 0;
  736|  28.9k|  entropy->a = 0;
  737|  28.9k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  28.9k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  28.9k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  28.9k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  28.9k|}
jdarith.c:decode_mcu_DC_first:
  251|  14.0M|{
  252|  14.0M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  14.0M|  JBLOCKROW block;
  254|  14.0M|  unsigned char *st;
  255|  14.0M|  int blkn, ci, tbl, sign;
  256|  14.0M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  14.0M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 251k, False: 13.7M]
  ------------------
  260|   251k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 5.37k, False: 246k]
  ------------------
  261|  5.37k|      process_restart(cinfo);
  262|   251k|    entropy->restarts_to_go--;
  263|   251k|  }
  264|       |
  265|  14.0M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   457k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 457k, False: 13.5M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  29.2M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 15.6M, False: 13.5M]
  ------------------
  270|  15.6M|    block = MCU_data[blkn];
  271|  15.6M|    ci = cinfo->MCU_membership[blkn];
  272|  15.6M|    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|  15.6M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  15.6M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 6.89M, False: 8.71M]
  ------------------
  281|  6.89M|      entropy->dc_context[ci] = 0;
  282|  8.71M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  8.71M|      sign = arith_decode(cinfo, st + 1);
  286|  8.71M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  8.71M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 5.82M, False: 2.89M]
  ------------------
  289|  5.82M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  14.0M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 8.23M, False: 5.82M]
  ------------------
  291|  8.23M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 970, False: 8.23M]
  ------------------
  292|    970|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    970|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    970|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|    970|            entropy->ct = -1;                   /* magnitude overflow */
  294|    970|            return TRUE;
  ------------------
  |  |  210|    970|#define TRUE    1
  ------------------
  295|    970|          }
  296|  8.23M|          st += 1;
  297|  8.23M|        }
  298|  5.82M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  8.71M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 328, False: 8.71M]
  ------------------
  301|    328|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  8.71M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 4.70M, False: 4.01M]
  ------------------
  303|  4.70M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  4.01M|      else
  305|  4.01M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  8.71M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  8.71M|      st += 14;
  309|  16.9M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 8.21M, False: 8.71M]
  ------------------
  310|  8.21M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 5.56M, False: 2.65M]
  ------------------
  311|  8.71M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 5.86M, False: 2.85M]
  ------------------
  312|  8.71M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  8.71M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  15.6M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  15.6M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  15.6M|  }
  318|       |
  319|  13.5M|  return TRUE;
  ------------------
  |  |  210|  13.5M|#define TRUE    1
  ------------------
  320|  13.5M|}
jdarith.c:process_restart:
  200|   175k|{
  201|   175k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|   175k|  int ci;
  203|   175k|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|   175k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 175k]
  ------------------
  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|   356k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 181k, False: 175k]
  ------------------
  211|   181k|    compptr = cinfo->cur_comp_info[ci];
  212|   181k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 11.9k, False: 169k]
  |  Branch (212:38): [True: 41.1k, False: 128k]
  |  Branch (212:56): [True: 7.88k, False: 33.2k]
  ------------------
  213|  19.8k|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  19.8k|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|  19.8k|      entropy->last_dc_val[ci] = 0;
  216|  19.8k|      entropy->dc_context[ci] = 0;
  217|  19.8k|    }
  218|   181k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 11.9k, False: 169k]
  |  Branch (218:37): [True: 128k, False: 41.1k]
  ------------------
  219|   140k|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|   140k|#define AC_STAT_BINS  256
  ------------------
  220|   140k|    }
  221|   181k|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|   175k|  entropy->c = 0;
  225|   175k|  entropy->a = 0;
  226|   175k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|   175k|  entropy->restarts_to_go = cinfo->restart_interval;
  230|   175k|}
jdarith.c:arith_decode:
  116|   307M|{
  117|   307M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|   307M|  register unsigned char nl, nm;
  119|   307M|  register JLONG qe, temp;
  120|   307M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   382M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 74.4M, False: 307M]
  ------------------
  124|  74.4M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 9.75M, False: 64.6M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  9.75M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 8.91M, False: 837k]
  ------------------
  127|  8.91M|        data = 0;               /* stuff zero data */
  128|   837k|      else {
  129|   837k|        data = get_byte(cinfo); /* read next input byte */
  130|   837k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 30.7k, False: 807k]
  ------------------
  131|  36.8k|          do data = get_byte(cinfo);
  132|  36.8k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 6.06k, False: 30.7k]
  ------------------
  133|  30.7k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 4.83k, False: 25.9k]
  ------------------
  134|  4.83k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  25.9k|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|  25.9k|            cinfo->unread_marker = data;
  143|  25.9k|            data = 0;
  144|  25.9k|          }
  145|  30.7k|        }
  146|   837k|      }
  147|  9.75M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  9.75M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 407k, False: 9.34M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|   407k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 203k, False: 203k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|   203k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  9.75M|    }
  154|  74.4M|    e->a <<= 1;
  155|  74.4M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|   307M|  sv = *st;
  161|   307M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|   307M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|   307M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|   307M|  temp = e->a - qe;
  167|   307M|  e->a = temp;
  168|   307M|  temp <<= e->ct;
  169|   307M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 21.7M, False: 286M]
  ------------------
  170|  21.7M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  21.7M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 6.03M, False: 15.7M]
  ------------------
  173|  6.03M|      e->a = qe;
  174|  6.03M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  15.7M|    } else {
  176|  15.7M|      e->a = qe;
  177|  15.7M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  15.7M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  15.7M|    }
  180|   286M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 33.7M, False: 252M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  33.7M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 12.6M, False: 21.1M]
  ------------------
  183|  12.6M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  12.6M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  21.1M|    } else {
  186|  21.1M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  21.1M|    }
  188|  33.7M|  }
  189|       |
  190|   307M|  return sv >> 7;
  191|   307M|}
jdarith.c:get_byte:
   76|   874k|{
   77|   874k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   874k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 4.51k, False: 870k]
  ------------------
   80|  4.51k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 4.51k]
  ------------------
   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|   874k|  src->bytes_in_buffer--;
   83|   874k|  return *src->next_input_byte++;
   84|   874k|}
jdarith.c:decode_mcu_AC_first:
  330|  12.0M|{
  331|  12.0M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  12.0M|  JBLOCKROW block;
  333|  12.0M|  unsigned char *st;
  334|  12.0M|  int tbl, sign, k;
  335|  12.0M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  12.0M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 762k, False: 11.2M]
  ------------------
  339|   762k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 105k, False: 657k]
  ------------------
  340|   105k|      process_restart(cinfo);
  341|   762k|    entropy->restarts_to_go--;
  342|   762k|  }
  343|       |
  344|  12.0M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  2.17M|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 2.17M, False: 9.82M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  9.82M|  block = MCU_data[0];
  348|  9.82M|  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|  15.8M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 15.8M, False: 17.8k]
  ------------------
  354|  15.8M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  15.8M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 9.80M, False: 6.02M]
  ------------------
  356|  11.9M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 5.93M, False: 6.01M]
  ------------------
  357|  5.93M|      st += 3;  k++;
  358|  5.93M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 797, False: 5.93M]
  ------------------
  359|    797|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    797|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    797|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|    797|        entropy->ct = -1;                       /* spectral overflow */
  361|    797|        return TRUE;
  ------------------
  |  |  210|    797|#define TRUE    1
  ------------------
  362|    797|      }
  363|  5.93M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  6.01M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  6.01M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  6.01M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 2.80M, False: 3.21M]
  ------------------
  370|  2.80M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 2.45M, False: 342k]
  ------------------
  371|  2.45M|        m <<= 1;
  372|  2.45M|        st = entropy->ac_stats[tbl] +
  373|  2.45M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 1.75M, False: 704k]
  ------------------
  374|  6.14M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 3.68M, False: 2.45M]
  ------------------
  375|  3.68M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 209, False: 3.68M]
  ------------------
  376|    209|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    209|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    209|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|    209|            entropy->ct = -1;                   /* magnitude overflow */
  378|    209|            return TRUE;
  ------------------
  |  |  210|    209|#define TRUE    1
  ------------------
  379|    209|          }
  380|  3.68M|          st += 1;
  381|  3.68M|        }
  382|  2.45M|      }
  383|  2.80M|    }
  384|  6.01M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  6.01M|    st += 14;
  387|  12.1M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 6.13M, False: 6.01M]
  ------------------
  388|  6.13M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 2.34M, False: 3.79M]
  ------------------
  389|  6.01M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 3.28M, False: 2.73M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  6.01M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  6.01M|  }
  393|       |
  394|  9.82M|  return TRUE;
  ------------------
  |  |  210|  9.82M|#define TRUE    1
  ------------------
  395|  9.82M|}
jdarith.c:decode_mcu_DC_refine:
  404|  2.14M|{
  405|  2.14M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|  2.14M|  unsigned char *st;
  407|  2.14M|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|  2.14M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 283k, False: 1.85M]
  ------------------
  411|   283k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 32.2k, False: 251k]
  ------------------
  412|  32.2k|      process_restart(cinfo);
  413|   283k|    entropy->restarts_to_go--;
  414|   283k|  }
  415|       |
  416|  2.14M|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|  2.14M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|  5.78M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 3.64M, False: 2.14M]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|  3.64M|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 1.86M, False: 1.78M]
  ------------------
  424|  1.86M|      MCU_data[blkn][0][0] |= p1;
  425|  3.64M|  }
  426|       |
  427|  2.14M|  return TRUE;
  ------------------
  |  |  210|  2.14M|#define TRUE    1
  ------------------
  428|  2.14M|}
jdarith.c:decode_mcu_AC_refine:
  437|  10.6M|{
  438|  10.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  10.6M|  JBLOCKROW block;
  440|  10.6M|  JCOEFPTR thiscoef;
  441|  10.6M|  unsigned char *st;
  442|  10.6M|  int tbl, k, kex;
  443|  10.6M|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  10.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 349k, False: 10.3M]
  ------------------
  447|   349k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 23.0k, False: 326k]
  ------------------
  448|  23.0k|      process_restart(cinfo);
  449|   349k|    entropy->restarts_to_go--;
  450|   349k|  }
  451|       |
  452|  10.6M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  6.67M|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 6.67M, False: 3.97M]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  3.97M|  block = MCU_data[0];
  456|  3.97M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  3.97M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  3.97M|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  3.97M|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|   137M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 134M, False: 2.72M]
  ------------------
  463|   134M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 1.24M, False: 133M]
  ------------------
  464|       |
  465|  14.5M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 14.3M, False: 173k]
  ------------------
  466|  14.3M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|  14.3M|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 7.23M, False: 7.14M]
  ------------------
  468|  7.23M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 3.80M, False: 3.43M]
  ------------------
  469|  15.5M|    for (;;) {
  470|  15.5M|      thiscoef = *block + jpeg_natural_order[k];
  471|  15.5M|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 5.60M, False: 9.90M]
  ------------------
  472|  5.60M|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 3.12M, False: 2.47M]
  ------------------
  473|  3.12M|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 1.47M, False: 1.65M]
  ------------------
  474|  1.47M|            *thiscoef += (JCOEF)m1;
  475|  1.65M|          else
  476|  1.65M|            *thiscoef += (JCOEF)p1;
  477|  3.12M|        }
  478|  5.60M|        break;
  479|  5.60M|      }
  480|  9.90M|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 4.97M, False: 4.92M]
  ------------------
  481|  4.97M|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 2.46M, False: 2.51M]
  ------------------
  482|  2.46M|          *thiscoef = (JCOEF)m1;
  483|  2.51M|        else
  484|  2.51M|          *thiscoef = (JCOEF)p1;
  485|  4.97M|        break;
  486|  4.97M|      }
  487|  4.92M|      st += 3;  k++;
  488|  4.92M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 1.68k, False: 4.92M]
  ------------------
  489|  1.68k|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|  1.68k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  1.68k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|  1.68k|        entropy->ct = -1;                       /* spectral overflow */
  491|  1.68k|        return TRUE;
  ------------------
  |  |  210|  1.68k|#define TRUE    1
  ------------------
  492|  1.68k|      }
  493|  4.92M|    }
  494|  10.5M|  }
  495|       |
  496|  3.97M|  return TRUE;
  ------------------
  |  |  210|  3.97M|#define TRUE    1
  ------------------
  497|  3.97M|}
jdarith.c:decode_mcu:
  506|  11.8M|{
  507|  11.8M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  11.8M|  jpeg_component_info *compptr;
  509|  11.8M|  JBLOCKROW block;
  510|  11.8M|  unsigned char *st;
  511|  11.8M|  int blkn, ci, tbl, sign, k;
  512|  11.8M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  11.8M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 874k, False: 10.9M]
  ------------------
  516|   874k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 8.68k, False: 865k]
  ------------------
  517|  8.68k|      process_restart(cinfo);
  518|   874k|    entropy->restarts_to_go--;
  519|   874k|  }
  520|       |
  521|  11.8M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  1.73M|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 1.73M, False: 10.1M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  22.3M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 12.1M, False: 10.1M]
  ------------------
  526|  12.1M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 11.4M, False: 794k]
  ------------------
  527|  12.1M|    ci = cinfo->MCU_membership[blkn];
  528|  12.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|  12.1M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  12.1M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  12.1M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 3.75M, False: 8.44M]
  ------------------
  539|  3.75M|      entropy->dc_context[ci] = 0;
  540|  8.44M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  8.44M|      sign = arith_decode(cinfo, st + 1);
  544|  8.44M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  8.44M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 6.72M, False: 1.72M]
  ------------------
  547|  6.72M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  28.6M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 21.9M, False: 6.72M]
  ------------------
  549|  21.9M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 1.13k, False: 21.9M]
  ------------------
  550|  1.13k|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|  1.13k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  1.13k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|  1.13k|            entropy->ct = -1;                   /* magnitude overflow */
  552|  1.13k|            return TRUE;
  ------------------
  |  |  210|  1.13k|#define TRUE    1
  ------------------
  553|  1.13k|          }
  554|  21.9M|          st += 1;
  555|  21.9M|        }
  556|  6.72M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  8.44M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 44.3k, False: 8.40M]
  ------------------
  559|  44.3k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  8.40M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 5.68M, False: 2.72M]
  ------------------
  561|  5.68M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  2.72M|      else
  563|  2.72M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  8.44M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  8.44M|      st += 14;
  567|  30.3M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 21.9M, False: 8.44M]
  ------------------
  568|  21.9M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 2.08M, False: 19.8M]
  ------------------
  569|  8.44M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 6.13M, False: 2.31M]
  ------------------
  570|  8.44M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  8.44M|    }
  572|       |
  573|  12.1M|    if (block)
  ------------------
  |  Branch (573:9): [True: 11.4M, False: 794k]
  ------------------
  574|  11.4M|      (*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|  12.1M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  22.1M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  22.1M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 22.1M, False: 42.4k]
  ------------------
  582|  22.1M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  22.1M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 12.1M, False: 9.95M]
  ------------------
  584|  23.5M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 13.5M, False: 9.95M]
  ------------------
  585|  13.5M|        st += 3;  k++;
  586|  13.5M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|  13.5M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 262, False: 13.5M]
  ------------------
  587|    262|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    262|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    262|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    262|          entropy->ct = -1;                     /* spectral overflow */
  589|    262|          return TRUE;
  ------------------
  |  |  210|    262|#define TRUE    1
  ------------------
  590|    262|        }
  591|  13.5M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  9.95M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  9.95M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  9.95M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 5.48M, False: 4.47M]
  ------------------
  598|  5.48M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 4.64M, False: 837k]
  ------------------
  599|  4.64M|          m <<= 1;
  600|  4.64M|          st = entropy->ac_stats[tbl] +
  601|  4.64M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 3.25M, False: 1.38M]
  ------------------
  602|  7.83M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 3.18M, False: 4.64M]
  ------------------
  603|  3.18M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 457, False: 3.18M]
  ------------------
  604|    457|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    457|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    457|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    457|              entropy->ct = -1;                 /* magnitude overflow */
  606|    457|              return TRUE;
  ------------------
  |  |  210|    457|#define TRUE    1
  ------------------
  607|    457|            }
  608|  3.18M|            st += 1;
  609|  3.18M|          }
  610|  4.64M|        }
  611|  5.48M|      }
  612|  9.95M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  9.95M|      st += 14;
  615|  17.7M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 7.82M, False: 9.95M]
  ------------------
  616|  7.82M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 4.25M, False: 3.57M]
  ------------------
  617|  9.95M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 4.71M, False: 5.24M]
  ------------------
  618|  9.95M|      if (block)
  ------------------
  |  Branch (618:11): [True: 9.75M, False: 199k]
  ------------------
  619|  9.75M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  9.95M|    }
  621|  12.1M|  }
  622|       |
  623|  10.1M|  return TRUE;
  ------------------
  |  |  210|  10.1M|#define TRUE    1
  ------------------
  624|  10.1M|}

jpeg_mem_src:
  260|  19.9k|{
  261|  19.9k|  struct jpeg_source_mgr *src;
  262|       |
  263|  19.9k|  if (inbuffer == NULL || insize == 0)  /* Treat empty input as fatal error */
  ------------------
  |  Branch (263:7): [True: 0, False: 19.9k]
  |  Branch (263:27): [True: 0, False: 19.9k]
  ------------------
  264|      0|    ERREXIT(cinfo, JERR_INPUT_EMPTY);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  265|       |
  266|       |  /* The source object is made permanent so that a series of JPEG images
  267|       |   * can be read from the same buffer by calling jpeg_mem_src only before
  268|       |   * the first one.
  269|       |   */
  270|  19.9k|  if (cinfo->src == NULL) {     /* first time for this JPEG object? */
  ------------------
  |  Branch (270:7): [True: 6.97k, False: 12.9k]
  ------------------
  271|  6.97k|    cinfo->src = (struct jpeg_source_mgr *)
  272|  6.97k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.97k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  273|  6.97k|                                  sizeof(struct jpeg_source_mgr));
  274|  12.9k|  } else if (cinfo->src->init_source != init_mem_source) {
  ------------------
  |  Branch (274:14): [True: 0, False: 12.9k]
  ------------------
  275|       |    /* It is unsafe to reuse the existing source manager unless it was created
  276|       |     * by this function.
  277|       |     */
  278|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  279|      0|  }
  280|       |
  281|  19.9k|  src = cinfo->src;
  282|  19.9k|  src->init_source = init_mem_source;
  283|  19.9k|  src->fill_input_buffer = fill_mem_input_buffer;
  284|  19.9k|  src->skip_input_data = skip_input_data;
  285|  19.9k|  src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  286|  19.9k|  src->term_source = term_source;
  287|  19.9k|  src->bytes_in_buffer = (size_t)insize;
  288|  19.9k|  src->next_input_byte = (const JOCTET *)inbuffer;
  289|  19.9k|}
jdatasrc.c:skip_input_data:
  160|  2.79k|{
  161|  2.79k|  struct jpeg_source_mgr *src = cinfo->src;
  162|       |
  163|       |  /* Just a dumb implementation for now.  Could use fseek() except
  164|       |   * it doesn't work on pipes.  Not clear that being smart is worth
  165|       |   * any trouble anyway --- large skips are infrequent.
  166|       |   */
  167|  2.79k|  if (num_bytes > 0) {
  ------------------
  |  Branch (167:7): [True: 2.79k, False: 0]
  ------------------
  168|  37.5M|    while (num_bytes > (long)src->bytes_in_buffer) {
  ------------------
  |  Branch (168:12): [True: 37.5M, False: 2.79k]
  ------------------
  169|  37.5M|      num_bytes -= (long)src->bytes_in_buffer;
  170|  37.5M|      (void)(*src->fill_input_buffer) (cinfo);
  171|       |      /* note we assume that fill_input_buffer will never return FALSE,
  172|       |       * so suspension need not be handled.
  173|       |       */
  174|  37.5M|    }
  175|  2.79k|    src->next_input_byte += (size_t)num_bytes;
  176|  2.79k|    src->bytes_in_buffer -= (size_t)num_bytes;
  177|  2.79k|  }
  178|  2.79k|}
jdatasrc.c:term_source:
  201|  15.5k|{
  202|       |  /* no work necessary here */
  203|  15.5k|}
jdatasrc.c:init_mem_source:
   61|  19.6k|{
   62|       |  /* no work necessary here */
   63|  19.6k|}
jdatasrc.c:fill_mem_input_buffer:
  126|  41.4M|{
  127|  41.4M|  static const JOCTET mybuffer[4] = {
  128|  41.4M|    (JOCTET)0xFF, (JOCTET)JPEG_EOI, 0, 0
  ------------------
  |  | 1167|  41.4M|#define JPEG_EOI        0xD9    /* EOI marker code */
  ------------------
  129|  41.4M|  };
  130|       |
  131|       |  /* The whole JPEG data is expected to reside in the supplied memory
  132|       |   * buffer, so any request for more data beyond the given buffer size
  133|       |   * is treated as an error.
  134|       |   */
  135|  41.4M|  WARNMS(cinfo, JWRN_JPEG_EOF);
  ------------------
  |  |  283|  41.4M|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  41.4M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  136|       |
  137|       |  /* Insert a fake EOI marker */
  138|       |
  139|  41.4M|  cinfo->src->next_input_byte = mybuffer;
  140|  41.4M|  cinfo->src->bytes_in_buffer = 2;
  141|       |
  142|  41.4M|  return TRUE;
  ------------------
  |  |  210|  41.4M|#define TRUE    1
  ------------------
  143|  41.4M|}

jinit_d_coef_controller:
  818|  15.7k|{
  819|  15.7k|  my_coef_ptr coef;
  820|       |
  821|  15.7k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  15.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (821:7): [True: 0, False: 15.7k]
  ------------------
  822|      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)))
  ------------------
  823|       |
  824|  15.7k|  coef = (my_coef_ptr)
  825|  15.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  15.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  826|  15.7k|                                sizeof(my_coef_controller));
  827|  15.7k|  memset(coef, 0, sizeof(my_coef_controller));
  828|  15.7k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  829|  15.7k|  coef->pub.start_input_pass = start_input_pass;
  830|  15.7k|  coef->pub.start_output_pass = start_output_pass;
  831|  15.7k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  832|  15.7k|  coef->coef_bits_latch = NULL;
  833|  15.7k|#endif
  834|       |
  835|       |  /* Create the coefficient buffer. */
  836|  15.7k|  if (need_full_buffer) {
  ------------------
  |  Branch (836:7): [True: 10.5k, False: 5.20k]
  ------------------
  837|  10.5k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  838|       |    /* Allocate a full-image virtual array for each component, */
  839|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  840|       |    /* Note we ask for a pre-zeroed array. */
  841|  10.5k|    int ci, access_rows;
  842|  10.5k|    jpeg_component_info *compptr;
  843|       |
  844|  35.3k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (844:46): [True: 24.8k, False: 10.5k]
  ------------------
  845|  24.8k|         ci++, compptr++) {
  846|  24.8k|      access_rows = compptr->v_samp_factor;
  847|  24.8k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  848|       |      /* If block smoothing could be used, need a bigger window */
  849|  24.8k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (849:11): [True: 13.7k, False: 11.0k]
  ------------------
  850|  13.7k|        access_rows *= 5;
  851|  24.8k|#endif
  852|  24.8k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  853|  24.8k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  24.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  24.8k|#define TRUE    1
  ------------------
  854|  24.8k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  855|  24.8k|                               (long)compptr->h_samp_factor),
  856|  24.8k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  857|  24.8k|                               (long)compptr->v_samp_factor),
  858|  24.8k|         (JDIMENSION)access_rows);
  859|  24.8k|    }
  860|  10.5k|    coef->pub.consume_data = consume_data;
  861|  10.5k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  254|  10.5k|#define _decompress_data  decompress_data
  ------------------
  862|  10.5k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  863|       |#else
  864|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  865|       |#endif
  866|  10.5k|  } else {
  867|       |    /* We only need a single-MCU buffer. */
  868|  5.20k|    JBLOCKROW buffer;
  869|  5.20k|    int i;
  870|       |
  871|  5.20k|    buffer = (JBLOCKROW)
  872|  5.20k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  5.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  873|  5.20k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  5.20k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  874|  57.2k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  57.2k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (874:17): [True: 52.0k, False: 5.20k]
  ------------------
  875|  52.0k|      coef->MCU_buffer[i] = buffer + i;
  876|  52.0k|    }
  877|  5.20k|    coef->pub.consume_data = dummy_consume_data;
  878|  5.20k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  254|  5.20k|#define _decompress_data  decompress_data
  ------------------
  879|  5.20k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  880|  5.20k|  }
  881|       |
  882|       |  /* Allocate the workspace buffer */
  883|  15.7k|  coef->workspace = (JCOEF *)
  884|  15.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  15.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  885|  15.7k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  15.7k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  886|  15.7k|}
jdcoefct-8.c:start_input_pass:
   47|  54.8k|{
   48|  54.8k|  cinfo->input_iMCU_row = 0;
   49|  54.8k|  start_iMCU_row(cinfo);
   50|  54.8k|}
jdcoefct-8.c:start_output_pass:
   59|  29.6k|{
   60|  29.6k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   61|  29.6k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   62|       |
   63|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   64|  29.6k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (64:7): [True: 24.5k, False: 5.13k]
  ------------------
   65|  24.5k|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (65:9): [True: 24.5k, False: 0]
  |  Branch (65:38): [True: 9.10k, False: 15.4k]
  ------------------
   66|  9.10k|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  254|  9.10k|#define _decompress_data  decompress_data
  ------------------
   67|  15.4k|    else
   68|  15.4k|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  254|  15.4k|#define _decompress_data  decompress_data
  ------------------
   69|  24.5k|  }
   70|  29.6k|#endif
   71|  29.6k|  cinfo->output_iMCU_row = 0;
   72|  29.6k|}
jdcoefct-8.c:smoothing_ok:
  361|  24.5k|{
  362|  24.5k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  363|  24.5k|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|  24.5k|#define FALSE   0               /* values of boolean */
  ------------------
  364|  24.5k|  int ci, coefi;
  365|  24.5k|  jpeg_component_info *compptr;
  366|  24.5k|  JQUANT_TBL *qtable;
  367|  24.5k|  int *coef_bits, *prev_coef_bits;
  368|  24.5k|  int *coef_bits_latch, *prev_coef_bits_latch;
  369|       |
  370|  24.5k|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (370:7): [True: 8.44k, False: 16.0k]
  |  Branch (370:35): [True: 0, False: 16.0k]
  ------------------
  371|  8.44k|    return FALSE;
  ------------------
  |  |  207|  8.44k|#define FALSE   0               /* values of boolean */
  ------------------
  372|       |
  373|       |  /* Allocate latch area if not already done */
  374|  16.0k|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (374:7): [True: 3.83k, False: 12.2k]
  ------------------
  375|  3.83k|    coef->coef_bits_latch = (int *)
  376|  3.83k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.83k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  377|  3.83k|                                  cinfo->num_components * 2 *
  378|  3.83k|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|  3.83k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  379|  16.0k|  coef_bits_latch = coef->coef_bits_latch;
  380|  16.0k|  prev_coef_bits_latch =
  381|  16.0k|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|  16.0k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  382|       |
  383|  39.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (383:44): [True: 30.6k, False: 9.21k]
  ------------------
  384|  30.6k|       ci++, compptr++) {
  385|       |    /* All components' quantization values must already be latched. */
  386|  30.6k|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (386:9): [True: 1.70k, False: 28.9k]
  ------------------
  387|  1.70k|      return FALSE;
  ------------------
  |  |  207|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  388|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  389|  28.9k|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (389:9): [True: 361, False: 28.6k]
  ------------------
  390|  28.6k|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  341|  28.6k|#define Q01_POS  1
  ------------------
  |  Branch (390:9): [True: 273, False: 28.3k]
  ------------------
  391|  28.3k|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  342|  28.3k|#define Q10_POS  8
  ------------------
  |  Branch (391:9): [True: 319, False: 28.0k]
  ------------------
  392|  28.0k|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  343|  28.0k|#define Q20_POS  16
  ------------------
  |  Branch (392:9): [True: 565, False: 27.4k]
  ------------------
  393|  27.4k|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  344|  27.4k|#define Q11_POS  9
  ------------------
  |  Branch (393:9): [True: 734, False: 26.7k]
  ------------------
  394|  26.7k|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  345|  26.7k|#define Q02_POS  2
  ------------------
  |  Branch (394:9): [True: 704, False: 26.0k]
  ------------------
  395|  26.0k|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  346|  26.0k|#define Q03_POS  3
  ------------------
  |  Branch (395:9): [True: 269, False: 25.7k]
  ------------------
  396|  25.7k|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  347|  25.7k|#define Q12_POS  10
  ------------------
  |  Branch (396:9): [True: 685, False: 25.0k]
  ------------------
  397|  25.0k|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  348|  25.0k|#define Q21_POS  17
  ------------------
  |  Branch (397:9): [True: 228, False: 24.8k]
  ------------------
  398|  24.8k|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  349|  24.8k|#define Q30_POS  24
  ------------------
  |  Branch (398:9): [True: 251, False: 24.5k]
  ------------------
  399|  4.38k|      return FALSE;
  ------------------
  |  |  207|  4.38k|#define FALSE   0               /* values of boolean */
  ------------------
  400|       |    /* DC values must be at least partly known for all components. */
  401|  24.5k|    coef_bits = cinfo->coef_bits[ci];
  402|  24.5k|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  403|  24.5k|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (403:9): [True: 771, False: 23.8k]
  ------------------
  404|    771|      return FALSE;
  ------------------
  |  |  207|    771|#define FALSE   0               /* values of boolean */
  ------------------
  405|  23.8k|    coef_bits_latch[0] = coef_bits[0];
  406|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  407|   238k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|   238k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (407:21): [True: 214k, False: 23.8k]
  ------------------
  408|   214k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (408:11): [True: 206k, False: 7.97k]
  ------------------
  409|   206k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  410|  7.97k|      else
  411|  7.97k|        prev_coef_bits_latch[coefi] = -1;
  412|   214k|      coef_bits_latch[coefi] = coef_bits[coefi];
  413|   214k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (413:11): [True: 203k, False: 10.5k]
  ------------------
  414|   203k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|   203k|#define TRUE    1
  ------------------
  415|   214k|    }
  416|  23.8k|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  23.8k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  417|  23.8k|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  23.8k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  418|  23.8k|  }
  419|       |
  420|  9.21k|  return smoothing_useful;
  421|  16.0k|}
jdcoefct-8.c:decompress_smooth_data:
  430|  1.57M|{
  431|  1.57M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  432|  1.57M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  433|  1.57M|  JDIMENSION block_num, last_block_column;
  434|  1.57M|  int ci, block_row, block_rows, access_rows, image_block_row,
  435|  1.57M|    image_block_rows;
  436|  1.57M|  JBLOCKARRAY buffer;
  437|  1.57M|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  438|  1.57M|  JBLOCKROW next_block_row, next_next_block_row;
  439|  1.57M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  226|  1.57M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  440|  1.57M|  JDIMENSION output_col;
  441|  1.57M|  jpeg_component_info *compptr;
  442|  1.57M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  258|  1.57M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  443|  1.57M|  boolean change_dc;
  444|  1.57M|  JCOEF *workspace;
  445|  1.57M|  int *coef_bits;
  446|  1.57M|  JQUANT_TBL *quanttbl;
  447|  1.57M|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  448|  1.57M|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  449|  1.57M|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  450|  1.57M|      DC25;
  451|  1.57M|  int Al, pred;
  452|       |
  453|       |  /* Keep a local variable to avoid looking it up more than once */
  454|  1.57M|  workspace = coef->workspace;
  455|       |
  456|       |  /* Force some input to be done if we are getting ahead of the input. */
  457|  3.06M|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (457:10): [True: 3.05M, False: 7.12k]
  ------------------
  458|  3.05M|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (458:10): [True: 3.05M, False: 1.25k]
  ------------------
  459|  3.05M|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (459:9): [True: 3.05M, False: 0]
  ------------------
  460|       |      /* If input is working on current scan, we ordinarily want it to
  461|       |       * have completed the current row.  But if input scan is DC,
  462|       |       * we want it to keep two rows ahead so that next two block rows' DC
  463|       |       * values are up to date.
  464|       |       */
  465|  3.05M|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (465:26): [True: 1.96M, False: 1.08M]
  ------------------
  466|  3.05M|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (466:11): [True: 1.56M, False: 1.49M]
  ------------------
  467|  1.56M|        break;
  468|  3.05M|    }
  469|  1.49M|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  1.49M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (469:9): [True: 3.18k, False: 1.48M]
  ------------------
  470|  3.18k|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|  3.18k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  471|  1.49M|  }
  472|       |
  473|       |  /* OK, output from the virtual arrays. */
  474|  4.43M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (474:44): [True: 2.86M, False: 1.57M]
  ------------------
  475|  2.86M|       ci++, compptr++) {
  476|       |    /* Don't bother to IDCT an uninteresting component. */
  477|  2.86M|    if (!compptr->component_needed)
  ------------------
  |  Branch (477:9): [True: 0, False: 2.86M]
  ------------------
  478|      0|      continue;
  479|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  480|  2.86M|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (480:9): [True: 2.83M, False: 29.3k]
  ------------------
  481|  2.83M|      block_rows = compptr->v_samp_factor;
  482|  2.83M|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  483|  2.83M|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (483:16): [True: 8.50k, False: 20.8k]
  ------------------
  484|  8.50k|      block_rows = compptr->v_samp_factor;
  485|  8.50k|      access_rows = block_rows * 2; /* this and next iMCU row */
  486|  20.8k|    } else {
  487|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  488|  20.8k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  489|  20.8k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (489:11): [True: 10.2k, False: 10.5k]
  ------------------
  490|  20.8k|      access_rows = block_rows; /* this iMCU row only */
  491|  20.8k|    }
  492|       |    /* Align the virtual buffer for this component. */
  493|  2.86M|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (493:9): [True: 2.83M, False: 27.6k]
  ------------------
  494|  2.83M|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  495|  2.83M|      buffer = (*cinfo->mem->access_virt_barray)
  496|  2.83M|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  497|  2.83M|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  498|  2.83M|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  2.83M|#define FALSE   0               /* values of boolean */
  ------------------
  499|  2.83M|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  500|  2.83M|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (500:16): [True: 9.40k, False: 18.2k]
  ------------------
  501|  9.40k|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  502|  9.40k|      buffer = (*cinfo->mem->access_virt_barray)
  503|  9.40k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  504|  9.40k|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  505|  9.40k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  9.40k|#define FALSE   0               /* values of boolean */
  ------------------
  506|  9.40k|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  507|  18.2k|    } else {
  508|  18.2k|      buffer = (*cinfo->mem->access_virt_barray)
  509|  18.2k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  510|  18.2k|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  18.2k|#define FALSE   0               /* values of boolean */
  ------------------
  511|  18.2k|    }
  512|       |    /* Fetch component-dependent info.
  513|       |     * If the current scan is incomplete, then we use the component-dependent
  514|       |     * info from the previous scan.
  515|       |     */
  516|  2.86M|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (516:9): [True: 1.88M, False: 978k]
  ------------------
  517|  1.88M|      coef_bits =
  518|  1.88M|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|  1.88M|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  519|   978k|    else
  520|   978k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|   978k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  521|       |
  522|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  523|  2.86M|    change_dc =
  524|  2.86M|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (524:7): [True: 2.44M, False: 422k]
  |  Branch (524:29): [True: 2.41M, False: 26.7k]
  |  Branch (524:51): [True: 2.40M, False: 10.8k]
  ------------------
  525|  2.40M|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (525:7): [True: 2.39M, False: 10.0k]
  |  Branch (525:29): [True: 2.35M, False: 39.4k]
  |  Branch (525:51): [True: 2.34M, False: 11.1k]
  ------------------
  526|  2.34M|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (526:7): [True: 2.33M, False: 6.14k]
  |  Branch (526:29): [True: 2.30M, False: 30.1k]
  |  Branch (526:51): [True: 2.26M, False: 40.9k]
  ------------------
  527|       |
  528|  2.86M|    quanttbl = compptr->quant_table;
  529|  2.86M|    Q00 = quanttbl->quantval[0];
  530|  2.86M|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  341|  2.86M|#define Q01_POS  1
  ------------------
  531|  2.86M|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  342|  2.86M|#define Q10_POS  8
  ------------------
  532|  2.86M|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  343|  2.86M|#define Q20_POS  16
  ------------------
  533|  2.86M|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  344|  2.86M|#define Q11_POS  9
  ------------------
  534|  2.86M|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  345|  2.86M|#define Q02_POS  2
  ------------------
  535|  2.86M|    if (change_dc) {
  ------------------
  |  Branch (535:9): [True: 2.26M, False: 597k]
  ------------------
  536|  2.26M|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  346|  2.26M|#define Q03_POS  3
  ------------------
  537|  2.26M|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  347|  2.26M|#define Q12_POS  10
  ------------------
  538|  2.26M|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  348|  2.26M|#define Q21_POS  17
  ------------------
  539|  2.26M|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  349|  2.26M|#define Q30_POS  24
  ------------------
  540|  2.26M|    }
  541|  2.86M|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  259|  2.86M|#define _inverse_DCT  inverse_DCT
  ------------------
  542|  2.86M|    output_ptr = output_buf[ci];
  543|       |    /* Loop over all DCT blocks to be processed. */
  544|  2.86M|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  545|  8.19M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (545:25): [True: 5.32M, False: 2.86M]
  ------------------
  546|  5.32M|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  547|  5.32M|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  548|       |
  549|  5.32M|      if (image_block_row > 0)
  ------------------
  |  Branch (549:11): [True: 5.30M, False: 18.2k]
  ------------------
  550|  5.30M|        prev_block_row =
  551|  5.30M|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  552|  18.2k|      else
  553|  18.2k|        prev_block_row = buffer_ptr;
  554|       |
  555|  5.32M|      if (image_block_row > 1)
  ------------------
  |  Branch (555:11): [True: 5.29M, False: 32.0k]
  ------------------
  556|  5.29M|        prev_prev_block_row =
  557|  5.29M|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  558|  32.0k|      else
  559|  32.0k|        prev_prev_block_row = prev_block_row;
  560|       |
  561|  5.32M|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (561:11): [True: 5.30M, False: 20.8k]
  ------------------
  562|  5.30M|        next_block_row =
  563|  5.30M|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  564|  20.8k|      else
  565|  20.8k|        next_block_row = buffer_ptr;
  566|       |
  567|  5.32M|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (567:11): [True: 5.29M, False: 31.4k]
  ------------------
  568|  5.29M|        next_next_block_row =
  569|  5.29M|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  570|  31.4k|      else
  571|  31.4k|        next_next_block_row = next_block_row;
  572|       |
  573|       |      /* We fetch the surrounding DC values using a sliding-register approach.
  574|       |       * Initialize all 25 here so as to do the right thing on narrow pics.
  575|       |       */
  576|  5.32M|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  577|  5.32M|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  578|  5.32M|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  579|  5.32M|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  580|  5.32M|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  581|  5.32M|      output_col = 0;
  582|  5.32M|      last_block_column = compptr->width_in_blocks - 1;
  583|  5.32M|      for (block_num = cinfo->master->first_MCU_col[ci];
  584|  20.7M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (584:12): [True: 15.4M, False: 5.32M]
  ------------------
  585|       |        /* Fetch current DCT block into workspace so we can modify it. */
  586|  15.4M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  587|       |        /* Update DC values */
  588|  15.4M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (588:13): [True: 5.32M, False: 10.1M]
  ------------------
  589|  5.32M|            block_num < last_block_column) {
  ------------------
  |  Branch (589:13): [True: 808k, False: 4.51M]
  ------------------
  590|   808k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  591|   808k|          DC09 = DC10 = (int)prev_block_row[1][0];
  592|   808k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  593|   808k|          DC19 = DC20 = (int)next_block_row[1][0];
  594|   808k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  595|   808k|        }
  596|  15.4M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (596:13): [True: 9.29M, False: 6.13M]
  ------------------
  597|  9.29M|          DC05 = (int)prev_prev_block_row[2][0];
  598|  9.29M|          DC10 = (int)prev_block_row[2][0];
  599|  9.29M|          DC15 = (int)buffer_ptr[2][0];
  600|  9.29M|          DC20 = (int)next_block_row[2][0];
  601|  9.29M|          DC25 = (int)next_next_block_row[2][0];
  602|  9.29M|        }
  603|       |        /* If DC interpolation is enabled, compute coefficient estimates using
  604|       |         * a Gaussian-like kernel, keeping the averages of the DC values.
  605|       |         *
  606|       |         * If DC interpolation is disabled, compute coefficient estimates using
  607|       |         * an algorithm similar to the one described in Section K.8 of the JPEG
  608|       |         * standard, except applied to a 5x5 window rather than a 3x3 window.
  609|       |         *
  610|       |         * An estimate is applied only if the coefficient is still zero and is
  611|       |         * not known to be fully accurate.
  612|       |         */
  613|       |        /* AC01 */
  614|  15.4M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (614:13): [True: 14.9M, False: 500k]
  |  Branch (614:41): [True: 13.8M, False: 1.07M]
  ------------------
  615|  13.8M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (615:24): [True: 8.53M, False: 5.32M]
  ------------------
  616|  8.53M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  617|  8.53M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  618|  8.53M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  619|  8.53M|                 DC21 - DC22 + DC24 + DC25) :
  620|  13.8M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  621|  13.8M|          if (num >= 0) {
  ------------------
  |  Branch (621:15): [True: 10.9M, False: 2.93M]
  ------------------
  622|  10.9M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  623|  10.9M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (623:17): [True: 2.38M, False: 8.54M]
  |  Branch (623:27): [True: 973k, False: 1.40M]
  ------------------
  624|   973k|              pred = (1 << Al) - 1;
  625|  10.9M|          } else {
  626|  2.93M|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  627|  2.93M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (627:17): [True: 1.58M, False: 1.35M]
  |  Branch (627:27): [True: 733k, False: 850k]
  ------------------
  628|   733k|              pred = (1 << Al) - 1;
  629|  2.93M|            pred = -pred;
  630|  2.93M|          }
  631|  13.8M|          workspace[1] = (JCOEF)pred;
  632|  13.8M|        }
  633|       |        /* AC10 */
  634|  15.4M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (634:13): [True: 14.8M, False: 623k]
  |  Branch (634:41): [True: 13.9M, False: 888k]
  ------------------
  635|  13.9M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (635:24): [True: 8.53M, False: 5.37M]
  ------------------
  636|  8.53M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  637|  8.53M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  638|  8.53M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  639|  8.53M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  640|  13.9M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  641|  13.9M|          if (num >= 0) {
  ------------------
  |  Branch (641:15): [True: 10.8M, False: 3.02M]
  ------------------
  642|  10.8M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  643|  10.8M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (643:17): [True: 2.37M, False: 8.51M]
  |  Branch (643:27): [True: 1.73M, False: 644k]
  ------------------
  644|  1.73M|              pred = (1 << Al) - 1;
  645|  10.8M|          } else {
  646|  3.02M|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  647|  3.02M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (647:17): [True: 1.72M, False: 1.30M]
  |  Branch (647:27): [True: 1.30M, False: 421k]
  ------------------
  648|  1.30M|              pred = (1 << Al) - 1;
  649|  3.02M|            pred = -pred;
  650|  3.02M|          }
  651|  13.9M|          workspace[8] = (JCOEF)pred;
  652|  13.9M|        }
  653|       |        /* AC20 */
  654|  15.4M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (654:13): [True: 14.8M, False: 594k]
  |  Branch (654:41): [True: 14.1M, False: 691k]
  ------------------
  655|  14.1M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (655:24): [True: 8.53M, False: 5.60M]
  ------------------
  656|  8.53M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  657|  8.53M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  658|  14.1M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  659|  14.1M|          if (num >= 0) {
  ------------------
  |  Branch (659:15): [True: 10.1M, False: 4.01M]
  ------------------
  660|  10.1M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  661|  10.1M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (661:17): [True: 2.53M, False: 7.59M]
  |  Branch (661:27): [True: 1.08M, False: 1.44M]
  ------------------
  662|  1.08M|              pred = (1 << Al) - 1;
  663|  10.1M|          } else {
  664|  4.01M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  665|  4.01M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (665:17): [True: 2.01M, False: 1.99M]
  |  Branch (665:27): [True: 1.07M, False: 939k]
  ------------------
  666|  1.07M|              pred = (1 << Al) - 1;
  667|  4.01M|            pred = -pred;
  668|  4.01M|          }
  669|  14.1M|          workspace[16] = (JCOEF)pred;
  670|  14.1M|        }
  671|       |        /* AC11 */
  672|  15.4M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (672:13): [True: 14.7M, False: 634k]
  |  Branch (672:41): [True: 14.0M, False: 732k]
  ------------------
  673|  14.0M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (673:24): [True: 8.53M, False: 5.52M]
  ------------------
  674|  8.53M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  675|  8.53M|                 9 * DC19 + DC21 - DC25) :
  676|  14.0M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  677|  5.52M|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  678|  14.0M|          if (num >= 0) {
  ------------------
  |  Branch (678:15): [True: 11.3M, False: 2.66M]
  ------------------
  679|  11.3M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  680|  11.3M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (680:17): [True: 3.13M, False: 8.25M]
  |  Branch (680:27): [True: 610k, False: 2.52M]
  ------------------
  681|   610k|              pred = (1 << Al) - 1;
  682|  11.3M|          } else {
  683|  2.66M|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  684|  2.66M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (684:17): [True: 1.76M, False: 903k]
  |  Branch (684:27): [True: 637k, False: 1.12M]
  ------------------
  685|   637k|              pred = (1 << Al) - 1;
  686|  2.66M|            pred = -pred;
  687|  2.66M|          }
  688|  14.0M|          workspace[9] = (JCOEF)pred;
  689|  14.0M|        }
  690|       |        /* AC02 */
  691|  15.4M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (691:13): [True: 14.7M, False: 681k]
  |  Branch (691:41): [True: 13.9M, False: 755k]
  ------------------
  692|  13.9M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (692:24): [True: 8.53M, False: 5.45M]
  ------------------
  693|  8.53M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  694|  8.53M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  695|  13.9M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  696|  13.9M|          if (num >= 0) {
  ------------------
  |  Branch (696:15): [True: 10.0M, False: 3.90M]
  ------------------
  697|  10.0M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  698|  10.0M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (698:17): [True: 2.93M, False: 7.15M]
  |  Branch (698:27): [True: 578k, False: 2.35M]
  ------------------
  699|   578k|              pred = (1 << Al) - 1;
  700|  10.0M|          } else {
  701|  3.90M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  702|  3.90M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (702:17): [True: 2.04M, False: 1.85M]
  |  Branch (702:27): [True: 580k, False: 1.46M]
  ------------------
  703|   580k|              pred = (1 << Al) - 1;
  704|  3.90M|            pred = -pred;
  705|  3.90M|          }
  706|  13.9M|          workspace[2] = (JCOEF)pred;
  707|  13.9M|        }
  708|  15.4M|        if (change_dc) {
  ------------------
  |  Branch (708:13): [True: 8.53M, False: 6.89M]
  ------------------
  709|       |          /* AC03 */
  710|  8.53M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (710:15): [True: 8.53M, False: 0]
  |  Branch (710:43): [True: 8.53M, False: 888]
  ------------------
  711|  8.53M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  712|  8.53M|            if (num >= 0) {
  ------------------
  |  Branch (712:17): [True: 7.60M, False: 933k]
  ------------------
  713|  7.60M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  714|  7.60M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (714:19): [True: 0, False: 7.60M]
  |  Branch (714:29): [True: 0, False: 0]
  ------------------
  715|      0|                pred = (1 << Al) - 1;
  716|  7.60M|            } else {
  717|   933k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  718|   933k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (718:19): [True: 0, False: 933k]
  |  Branch (718:29): [True: 0, False: 0]
  ------------------
  719|      0|                pred = (1 << Al) - 1;
  720|   933k|              pred = -pred;
  721|   933k|            }
  722|  8.53M|            workspace[3] = (JCOEF)pred;
  723|  8.53M|          }
  724|       |          /* AC12 */
  725|  8.53M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (725:15): [True: 8.53M, False: 0]
  |  Branch (725:43): [True: 8.53M, False: 827]
  ------------------
  726|  8.53M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  727|  8.53M|            if (num >= 0) {
  ------------------
  |  Branch (727:17): [True: 6.26M, False: 2.27M]
  ------------------
  728|  6.26M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  729|  6.26M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (729:19): [True: 0, False: 6.26M]
  |  Branch (729:29): [True: 0, False: 0]
  ------------------
  730|      0|                pred = (1 << Al) - 1;
  731|  6.26M|            } else {
  732|  2.27M|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  733|  2.27M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (733:19): [True: 0, False: 2.27M]
  |  Branch (733:29): [True: 0, False: 0]
  ------------------
  734|      0|                pred = (1 << Al) - 1;
  735|  2.27M|              pred = -pred;
  736|  2.27M|            }
  737|  8.53M|            workspace[10] = (JCOEF)pred;
  738|  8.53M|          }
  739|       |          /* AC21 */
  740|  8.53M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (740:15): [True: 8.53M, False: 0]
  |  Branch (740:43): [True: 8.53M, False: 663]
  ------------------
  741|  8.53M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  742|  8.53M|            if (num >= 0) {
  ------------------
  |  Branch (742:17): [True: 6.78M, False: 1.75M]
  ------------------
  743|  6.78M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  744|  6.78M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (744:19): [True: 0, False: 6.78M]
  |  Branch (744:29): [True: 0, False: 0]
  ------------------
  745|      0|                pred = (1 << Al) - 1;
  746|  6.78M|            } else {
  747|  1.75M|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  748|  1.75M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (748:19): [True: 0, False: 1.75M]
  |  Branch (748:29): [True: 0, False: 0]
  ------------------
  749|      0|                pred = (1 << Al) - 1;
  750|  1.75M|              pred = -pred;
  751|  1.75M|            }
  752|  8.53M|            workspace[17] = (JCOEF)pred;
  753|  8.53M|          }
  754|       |          /* AC30 */
  755|  8.53M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (755:15): [True: 8.53M, False: 0]
  |  Branch (755:43): [True: 8.53M, False: 988]
  ------------------
  756|  8.53M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  757|  8.53M|            if (num >= 0) {
  ------------------
  |  Branch (757:17): [True: 7.57M, False: 963k]
  ------------------
  758|  7.57M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  759|  7.57M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (759:19): [True: 0, False: 7.57M]
  |  Branch (759:29): [True: 0, False: 0]
  ------------------
  760|      0|                pred = (1 << Al) - 1;
  761|  7.57M|            } else {
  762|   963k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  763|   963k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (763:19): [True: 0, False: 963k]
  |  Branch (763:29): [True: 0, False: 0]
  ------------------
  764|      0|                pred = (1 << Al) - 1;
  765|   963k|              pred = -pred;
  766|   963k|            }
  767|  8.53M|            workspace[24] = (JCOEF)pred;
  768|  8.53M|          }
  769|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  770|       |           * be called.
  771|       |           */
  772|  8.53M|          num = Q00 *
  773|  8.53M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  774|  8.53M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  775|  8.53M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  776|  8.53M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  777|  8.53M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  778|  8.53M|          if (num >= 0) {
  ------------------
  |  Branch (778:15): [True: 6.25M, False: 2.27M]
  ------------------
  779|  6.25M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  780|  6.25M|          } else {
  781|  2.27M|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  782|  2.27M|            pred = -pred;
  783|  2.27M|          }
  784|  8.53M|          workspace[0] = (JCOEF)pred;
  785|  8.53M|        }  /* change_dc */
  786|       |
  787|       |        /* OK, do the IDCT */
  788|  15.4M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  789|  15.4M|                        output_col);
  790|       |        /* Advance for next column */
  791|  15.4M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  792|  15.4M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  793|  15.4M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  794|  15.4M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  795|  15.4M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  796|  15.4M|        buffer_ptr++, prev_block_row++, next_block_row++,
  797|  15.4M|          prev_prev_block_row++, next_next_block_row++;
  798|  15.4M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  15.4M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  799|  15.4M|      }
  800|  5.32M|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.32M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  801|  5.32M|    }
  802|  2.86M|  }
  803|       |
  804|  1.57M|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (804:7): [True: 1.56M, False: 8.30k]
  ------------------
  805|  1.56M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  1.56M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  806|  8.30k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  8.30k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  807|  1.57M|}
jdcoefct-8.c:consume_data:
  194|  13.8M|{
  195|  13.8M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  196|  13.8M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  197|  13.8M|  int blkn, ci, xindex, yindex, yoffset;
  198|  13.8M|  JDIMENSION start_col;
  199|  13.8M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  200|  13.8M|  JBLOCKROW buffer_ptr;
  201|  13.8M|  jpeg_component_info *compptr;
  202|       |
  203|       |  /* Align the virtual buffers for the components used in this scan. */
  204|  31.2M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (204:16): [True: 17.3M, False: 13.8M]
  ------------------
  205|  17.3M|    compptr = cinfo->cur_comp_info[ci];
  206|  17.3M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  207|  17.3M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  208|  17.3M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  209|  17.3M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  17.3M|#define TRUE    1
  ------------------
  210|       |    /* Note: entropy decoder expects buffer to be zeroed,
  211|       |     * but this is handled automatically by the memory manager
  212|       |     * because we requested a pre-zeroed array.
  213|       |     */
  214|  17.3M|  }
  215|       |
  216|       |  /* Loop to process one whole iMCU row */
  217|  38.1M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (217:41): [True: 24.3M, False: 13.8M]
  ------------------
  218|  24.3M|       yoffset++) {
  219|  96.6M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (219:39): [True: 72.3M, False: 24.3M]
  ------------------
  220|  72.3M|         MCU_col_num++) {
  221|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  222|  72.3M|      blkn = 0;                 /* index of current DCT block within MCU */
  223|   151M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (223:20): [True: 78.8M, False: 72.3M]
  ------------------
  224|  78.8M|        compptr = cinfo->cur_comp_info[ci];
  225|  78.8M|        start_col = MCU_col_num * compptr->MCU_width;
  226|   163M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (226:26): [True: 84.5M, False: 78.8M]
  ------------------
  227|  84.5M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  228|   173M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (228:28): [True: 89.2M, False: 84.5M]
  ------------------
  229|  89.2M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  230|  89.2M|          }
  231|  84.5M|        }
  232|  78.8M|      }
  233|  72.3M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (233:11): [True: 45.0M, False: 27.2M]
  ------------------
  234|  45.0M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  235|       |      /* Try to fetch the MCU. */
  236|  72.3M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (236:11): [True: 0, False: 72.3M]
  ------------------
  237|       |        /* Suspension forced; update state counters and exit */
  238|      0|        coef->MCU_vert_offset = yoffset;
  239|      0|        coef->MCU_ctr = MCU_col_num;
  240|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  241|      0|      }
  242|  72.3M|    }
  243|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  244|  24.3M|    coef->MCU_ctr = 0;
  245|  24.3M|  }
  246|       |  /* Completed the iMCU row, advance counters for next one */
  247|  13.8M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (247:7): [True: 13.8M, False: 49.3k]
  ------------------
  248|  13.8M|    start_iMCU_row(cinfo);
  249|  13.8M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  13.8M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  250|  13.8M|  }
  251|       |  /* Completed the scan */
  252|  49.3k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  253|  49.3k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  49.3k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  254|  13.8M|}
jdcoefct-8.c:decompress_data:
  267|  3.27M|{
  268|  3.27M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  269|  3.27M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  270|  3.27M|  JDIMENSION block_num;
  271|  3.27M|  int ci, block_row, block_rows;
  272|  3.27M|  JBLOCKARRAY buffer;
  273|  3.27M|  JBLOCKROW buffer_ptr;
  274|  3.27M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  226|  3.27M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  275|  3.27M|  JDIMENSION output_col;
  276|  3.27M|  jpeg_component_info *compptr;
  277|  3.27M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  258|  3.27M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  278|       |
  279|       |  /* Force some input to be done if we are getting ahead of the input. */
  280|  6.42M|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (280:10): [True: 0, False: 6.42M]
  ------------------
  281|  6.42M|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (281:11): [True: 6.42M, False: 0]
  ------------------
  282|  6.42M|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (282:11): [True: 3.15M, False: 3.27M]
  ------------------
  283|  3.15M|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  3.15M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (283:9): [True: 0, False: 3.15M]
  ------------------
  284|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  285|  3.15M|  }
  286|       |
  287|       |  /* OK, output from the virtual arrays. */
  288|  11.1M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (288:44): [True: 7.91M, False: 3.27M]
  ------------------
  289|  7.91M|       ci++, compptr++) {
  290|       |    /* Don't bother to IDCT an uninteresting component. */
  291|  7.91M|    if (!compptr->component_needed)
  ------------------
  |  Branch (291:9): [True: 0, False: 7.91M]
  ------------------
  292|      0|      continue;
  293|       |    /* Align the virtual buffer for this component. */
  294|  7.91M|    buffer = (*cinfo->mem->access_virt_barray)
  295|  7.91M|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  296|  7.91M|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  297|  7.91M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  7.91M|#define FALSE   0               /* values of boolean */
  ------------------
  298|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  299|  7.91M|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (299:9): [True: 7.87M, False: 37.4k]
  ------------------
  300|  7.87M|      block_rows = compptr->v_samp_factor;
  301|  37.4k|    else {
  302|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  303|  37.4k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  304|  37.4k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (304:11): [True: 25.7k, False: 11.6k]
  ------------------
  305|  37.4k|    }
  306|  7.91M|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  259|  7.91M|#define _inverse_DCT  inverse_DCT
  ------------------
  307|  7.91M|    output_ptr = output_buf[ci];
  308|       |    /* Loop over all DCT blocks to be processed. */
  309|  21.2M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (309:25): [True: 13.3M, False: 7.91M]
  ------------------
  310|  13.3M|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  311|  13.3M|      output_col = 0;
  312|  13.3M|      for (block_num = cinfo->master->first_MCU_col[ci];
  313|  50.0M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (313:12): [True: 36.6M, False: 13.3M]
  ------------------
  314|  36.6M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  315|  36.6M|                        output_col);
  316|  36.6M|        buffer_ptr++;
  317|  36.6M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  36.6M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  318|  36.6M|      }
  319|  13.3M|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  13.3M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  320|  13.3M|    }
  321|  7.91M|  }
  322|       |
  323|  3.27M|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (323:7): [True: 3.25M, False: 14.9k]
  ------------------
  324|  3.25M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  3.25M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  325|  14.9k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  14.9k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  326|  3.27M|}
jdcoefct-8.c:decompress_onepass:
   87|  1.03M|{
   88|  1.03M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   89|  1.03M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   90|  1.03M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   91|  1.03M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   92|  1.03M|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   93|  1.03M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  226|  1.03M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   94|  1.03M|  JDIMENSION start_col, output_col;
   95|  1.03M|  jpeg_component_info *compptr;
   96|  1.03M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  258|  1.03M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
   97|       |
   98|       |  /* Loop to process as much as one whole iMCU row */
   99|  2.22M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (99:41): [True: 1.18M, False: 1.03M]
  ------------------
  100|  1.18M|       yoffset++) {
  101|  12.3M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (101:39): [True: 11.1M, False: 1.18M]
  ------------------
  102|  11.1M|         MCU_col_num++) {
  103|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  104|  11.1M|      jzero_far((void *)coef->MCU_buffer[0],
  105|  11.1M|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  106|  11.1M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (106:11): [True: 3.10M, False: 8.01M]
  ------------------
  107|  3.10M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  108|  11.1M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (108:11): [True: 0, False: 11.1M]
  ------------------
  109|       |        /* Suspension forced; update state counters and exit */
  110|      0|        coef->MCU_vert_offset = yoffset;
  111|      0|        coef->MCU_ctr = MCU_col_num;
  112|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  113|      0|      }
  114|       |
  115|       |      /* Only perform the IDCT on blocks that are contained within the desired
  116|       |       * cropping region.
  117|       |       */
  118|  11.1M|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (118:11): [True: 11.1M, False: 0]
  ------------------
  119|  11.1M|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (119:11): [True: 11.1M, False: 0]
  ------------------
  120|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  121|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  122|       |         * incremented past them!).  Note the inner loop relies on having
  123|       |         * allocated the MCU_buffer[] blocks sequentially.
  124|       |         */
  125|  11.1M|        blkn = 0;               /* index of current DCT block within MCU */
  126|  28.6M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:22): [True: 17.4M, False: 11.1M]
  ------------------
  127|  17.4M|          compptr = cinfo->cur_comp_info[ci];
  128|       |          /* Don't bother to IDCT an uninteresting component. */
  129|  17.4M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (129:15): [True: 0, False: 17.4M]
  ------------------
  130|      0|            blkn += compptr->MCU_blocks;
  131|      0|            continue;
  132|      0|          }
  133|  17.4M|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  259|  17.4M|#define _inverse_DCT  inverse_DCT
  ------------------
  134|  17.4M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (134:26): [True: 15.2M, False: 2.19M]
  ------------------
  135|  15.2M|                         compptr->MCU_width : compptr->last_col_width;
  136|  17.4M|          output_ptr = output_buf[compptr->component_index] +
  137|  17.4M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  17.4M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  138|  17.4M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  139|  17.4M|                      compptr->MCU_sample_width;
  140|  38.6M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (140:28): [True: 21.1M, False: 17.4M]
  ------------------
  141|  21.1M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (141:17): [True: 10.4M, False: 10.7M]
  ------------------
  142|  19.8M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (142:17): [True: 9.44M, False: 1.31M]
  ------------------
  143|  19.8M|              output_col = start_col;
  144|  42.0M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (144:32): [True: 22.1M, False: 19.8M]
  ------------------
  145|  22.1M|                (*inverse_DCT) (cinfo, compptr,
  146|  22.1M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  147|  22.1M|                                output_ptr, output_col);
  148|  22.1M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  22.1M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  149|  22.1M|              }
  150|  19.8M|            }
  151|  21.1M|            blkn += compptr->MCU_width;
  152|  21.1M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  21.1M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  153|  21.1M|          }
  154|  17.4M|        }
  155|  11.1M|      }
  156|  11.1M|    }
  157|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  158|  1.18M|    coef->MCU_ctr = 0;
  159|  1.18M|  }
  160|       |  /* Completed the iMCU row, advance counters for next one */
  161|  1.03M|  cinfo->output_iMCU_row++;
  162|  1.03M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (162:7): [True: 1.03M, False: 4.54k]
  ------------------
  163|  1.03M|    start_iMCU_row(cinfo);
  164|  1.03M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  1.03M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  165|  1.03M|  }
  166|       |  /* Completed the scan */
  167|  4.54k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  168|  4.54k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  4.54k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  169|  1.03M|}
j12init_d_coef_controller:
  818|    962|{
  819|    962|  my_coef_ptr coef;
  820|       |
  821|    962|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    962|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (821:7): [True: 0, False: 962]
  ------------------
  822|      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)))
  ------------------
  823|       |
  824|    962|  coef = (my_coef_ptr)
  825|    962|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    962|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  826|    962|                                sizeof(my_coef_controller));
  827|    962|  memset(coef, 0, sizeof(my_coef_controller));
  828|    962|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  829|    962|  coef->pub.start_input_pass = start_input_pass;
  830|    962|  coef->pub.start_output_pass = start_output_pass;
  831|    962|#ifdef BLOCK_SMOOTHING_SUPPORTED
  832|    962|  coef->coef_bits_latch = NULL;
  833|    962|#endif
  834|       |
  835|       |  /* Create the coefficient buffer. */
  836|    962|  if (need_full_buffer) {
  ------------------
  |  Branch (836:7): [True: 944, False: 18]
  ------------------
  837|    944|#ifdef D_MULTISCAN_FILES_SUPPORTED
  838|       |    /* Allocate a full-image virtual array for each component, */
  839|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  840|       |    /* Note we ask for a pre-zeroed array. */
  841|    944|    int ci, access_rows;
  842|    944|    jpeg_component_info *compptr;
  843|       |
  844|  2.95k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (844:46): [True: 2.01k, False: 944]
  ------------------
  845|  2.01k|         ci++, compptr++) {
  846|  2.01k|      access_rows = compptr->v_samp_factor;
  847|  2.01k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  848|       |      /* If block smoothing could be used, need a bigger window */
  849|  2.01k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (849:11): [True: 1.48k, False: 529]
  ------------------
  850|  1.48k|        access_rows *= 5;
  851|  2.01k|#endif
  852|  2.01k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  853|  2.01k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  2.01k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  2.01k|#define TRUE    1
  ------------------
  854|  2.01k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  855|  2.01k|                               (long)compptr->h_samp_factor),
  856|  2.01k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  857|  2.01k|                               (long)compptr->v_samp_factor),
  858|  2.01k|         (JDIMENSION)access_rows);
  859|  2.01k|    }
  860|    944|    coef->pub.consume_data = consume_data;
  861|    944|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  140|    944|#define _decompress_data  decompress_data_12
  ------------------
  862|    944|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  863|       |#else
  864|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  865|       |#endif
  866|    944|  } else {
  867|       |    /* We only need a single-MCU buffer. */
  868|     18|    JBLOCKROW buffer;
  869|     18|    int i;
  870|       |
  871|     18|    buffer = (JBLOCKROW)
  872|     18|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     18|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  873|     18|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|     18|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  874|    198|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|    198|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (874:17): [True: 180, False: 18]
  ------------------
  875|    180|      coef->MCU_buffer[i] = buffer + i;
  876|    180|    }
  877|     18|    coef->pub.consume_data = dummy_consume_data;
  878|     18|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  140|     18|#define _decompress_data  decompress_data_12
  ------------------
  879|     18|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  880|     18|  }
  881|       |
  882|       |  /* Allocate the workspace buffer */
  883|    962|  coef->workspace = (JCOEF *)
  884|    962|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    962|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  885|    962|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    962|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  886|    962|}
jdcoefct-12.c:start_input_pass:
   47|    879|{
   48|    879|  cinfo->input_iMCU_row = 0;
   49|    879|  start_iMCU_row(cinfo);
   50|    879|}
jdcoefct-12.c:start_output_pass:
   59|     95|{
   60|     95|#ifdef BLOCK_SMOOTHING_SUPPORTED
   61|     95|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   62|       |
   63|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   64|     95|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (64:7): [True: 81, False: 14]
  ------------------
   65|     81|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (65:9): [True: 81, False: 0]
  |  Branch (65:38): [True: 30, False: 51]
  ------------------
   66|     30|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  140|     30|#define _decompress_data  decompress_data_12
  ------------------
   67|     51|    else
   68|     51|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  140|     51|#define _decompress_data  decompress_data_12
  ------------------
   69|     81|  }
   70|     95|#endif
   71|     95|  cinfo->output_iMCU_row = 0;
   72|     95|}
jdcoefct-12.c:smoothing_ok:
  361|     81|{
  362|     81|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  363|     81|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|     81|#define FALSE   0               /* values of boolean */
  ------------------
  364|     81|  int ci, coefi;
  365|     81|  jpeg_component_info *compptr;
  366|     81|  JQUANT_TBL *qtable;
  367|     81|  int *coef_bits, *prev_coef_bits;
  368|     81|  int *coef_bits_latch, *prev_coef_bits_latch;
  369|       |
  370|     81|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (370:7): [True: 10, False: 71]
  |  Branch (370:35): [True: 0, False: 71]
  ------------------
  371|     10|    return FALSE;
  ------------------
  |  |  207|     10|#define FALSE   0               /* values of boolean */
  ------------------
  372|       |
  373|       |  /* Allocate latch area if not already done */
  374|     71|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (374:7): [True: 71, False: 0]
  ------------------
  375|     71|    coef->coef_bits_latch = (int *)
  376|     71|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     71|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  377|     71|                                  cinfo->num_components * 2 *
  378|     71|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     71|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  379|     71|  coef_bits_latch = coef->coef_bits_latch;
  380|     71|  prev_coef_bits_latch =
  381|     71|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     71|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  382|       |
  383|    112|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (383:44): [True: 82, False: 30]
  ------------------
  384|     82|       ci++, compptr++) {
  385|       |    /* All components' quantization values must already be latched. */
  386|     82|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (386:9): [True: 4, False: 78]
  ------------------
  387|      4|      return FALSE;
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  388|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  389|     78|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (389:9): [True: 3, False: 75]
  ------------------
  390|     75|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  341|     75|#define Q01_POS  1
  ------------------
  |  Branch (390:9): [True: 4, False: 71]
  ------------------
  391|     71|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  342|     71|#define Q10_POS  8
  ------------------
  |  Branch (391:9): [True: 1, False: 70]
  ------------------
  392|     70|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  343|     70|#define Q20_POS  16
  ------------------
  |  Branch (392:9): [True: 3, False: 67]
  ------------------
  393|     67|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  344|     67|#define Q11_POS  9
  ------------------
  |  Branch (393:9): [True: 3, False: 64]
  ------------------
  394|     64|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  345|     64|#define Q02_POS  2
  ------------------
  |  Branch (394:9): [True: 1, False: 63]
  ------------------
  395|     63|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  346|     63|#define Q03_POS  3
  ------------------
  |  Branch (395:9): [True: 5, False: 58]
  ------------------
  396|     58|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  347|     58|#define Q12_POS  10
  ------------------
  |  Branch (396:9): [True: 3, False: 55]
  ------------------
  397|     55|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  348|     55|#define Q21_POS  17
  ------------------
  |  Branch (397:9): [True: 4, False: 51]
  ------------------
  398|     51|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  349|     51|#define Q30_POS  24
  ------------------
  |  Branch (398:9): [True: 2, False: 49]
  ------------------
  399|     29|      return FALSE;
  ------------------
  |  |  207|     29|#define FALSE   0               /* values of boolean */
  ------------------
  400|       |    /* DC values must be at least partly known for all components. */
  401|     49|    coef_bits = cinfo->coef_bits[ci];
  402|     49|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  403|     49|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (403:9): [True: 8, False: 41]
  ------------------
  404|      8|      return FALSE;
  ------------------
  |  |  207|      8|#define FALSE   0               /* values of boolean */
  ------------------
  405|     41|    coef_bits_latch[0] = coef_bits[0];
  406|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  407|    410|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|    410|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (407:21): [True: 369, False: 41]
  ------------------
  408|    369|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (408:11): [True: 279, False: 90]
  ------------------
  409|    279|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  410|     90|      else
  411|     90|        prev_coef_bits_latch[coefi] = -1;
  412|    369|      coef_bits_latch[coefi] = coef_bits[coefi];
  413|    369|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (413:11): [True: 333, False: 36]
  ------------------
  414|    333|        smoothing_useful = TRUE;
  ------------------
  |  |  210|    333|#define TRUE    1
  ------------------
  415|    369|    }
  416|     41|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|     41|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  417|     41|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|     41|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  418|     41|  }
  419|       |
  420|     30|  return smoothing_useful;
  421|     71|}
jdcoefct-12.c:consume_data:
  194|   486k|{
  195|   486k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  196|   486k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  197|   486k|  int blkn, ci, xindex, yindex, yoffset;
  198|   486k|  JDIMENSION start_col;
  199|   486k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  200|   486k|  JBLOCKROW buffer_ptr;
  201|   486k|  jpeg_component_info *compptr;
  202|       |
  203|       |  /* Align the virtual buffers for the components used in this scan. */
  204|  1.01M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (204:16): [True: 532k, False: 486k]
  ------------------
  205|   532k|    compptr = cinfo->cur_comp_info[ci];
  206|   532k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  207|   532k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  208|   532k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  209|   532k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   532k|#define TRUE    1
  ------------------
  210|       |    /* Note: entropy decoder expects buffer to be zeroed,
  211|       |     * but this is handled automatically by the memory manager
  212|       |     * because we requested a pre-zeroed array.
  213|       |     */
  214|   532k|  }
  215|       |
  216|       |  /* Loop to process one whole iMCU row */
  217|  1.12M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (217:41): [True: 636k, False: 486k]
  ------------------
  218|   636k|       yoffset++) {
  219|  3.81M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (219:39): [True: 3.17M, False: 636k]
  ------------------
  220|  3.17M|         MCU_col_num++) {
  221|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  222|  3.17M|      blkn = 0;                 /* index of current DCT block within MCU */
  223|  6.48M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (223:20): [True: 3.30M, False: 3.17M]
  ------------------
  224|  3.30M|        compptr = cinfo->cur_comp_info[ci];
  225|  3.30M|        start_col = MCU_col_num * compptr->MCU_width;
  226|  6.71M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (226:26): [True: 3.41M, False: 3.30M]
  ------------------
  227|  3.41M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  228|  7.22M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (228:28): [True: 3.81M, False: 3.41M]
  ------------------
  229|  3.81M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  230|  3.81M|          }
  231|  3.41M|        }
  232|  3.30M|      }
  233|  3.17M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (233:11): [True: 2.41M, False: 760k]
  ------------------
  234|  2.41M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  235|       |      /* Try to fetch the MCU. */
  236|  3.17M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (236:11): [True: 0, False: 3.17M]
  ------------------
  237|       |        /* Suspension forced; update state counters and exit */
  238|      0|        coef->MCU_vert_offset = yoffset;
  239|      0|        coef->MCU_ctr = MCU_col_num;
  240|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  241|      0|      }
  242|  3.17M|    }
  243|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  244|   636k|    coef->MCU_ctr = 0;
  245|   636k|  }
  246|       |  /* Completed the iMCU row, advance counters for next one */
  247|   486k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (247:7): [True: 485k, False: 817]
  ------------------
  248|   485k|    start_iMCU_row(cinfo);
  249|   485k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   485k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  250|   485k|  }
  251|       |  /* Completed the scan */
  252|    817|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  253|    817|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    817|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  254|   486k|}

jdapistd-8.c:start_iMCU_row:
   68|  3.21k|{
   69|  3.21k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   70|       |
   71|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   72|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   73|       |   * But at the bottom of the image, process only what's left.
   74|       |   */
   75|  3.21k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 368, False: 2.84k]
  ------------------
   76|    368|    coef->MCU_rows_per_iMCU_row = 1;
   77|  2.84k|  } else {
   78|  2.84k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 1.77k, False: 1.07k]
  ------------------
   79|  1.77k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  1.07k|    else
   81|  1.07k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  2.84k|  }
   83|       |
   84|  3.21k|  coef->MCU_ctr = 0;
   85|  3.21k|  coef->MCU_vert_offset = 0;
   86|  3.21k|}
jdcoefct-8.c:start_iMCU_row:
   68|  14.9M|{
   69|  14.9M|  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|  14.9M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 2.72M, False: 12.1M]
  ------------------
   76|  2.72M|    coef->MCU_rows_per_iMCU_row = 1;
   77|  12.1M|  } else {
   78|  12.1M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 12.1M, False: 41.7k]
  ------------------
   79|  12.1M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  41.7k|    else
   81|  41.7k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  12.1M|  }
   83|       |
   84|  14.9M|  coef->MCU_ctr = 0;
   85|  14.9M|  coef->MCU_vert_offset = 0;
   86|  14.9M|}
jdcoefct-12.c:start_iMCU_row:
   68|   486k|{
   69|   486k|  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|   486k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 45.5k, False: 440k]
  ------------------
   76|  45.5k|    coef->MCU_rows_per_iMCU_row = 1;
   77|   440k|  } else {
   78|   440k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 439k, False: 688]
  ------------------
   79|   439k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|    688|    else
   81|    688|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|   440k|  }
   83|       |
   84|   486k|  coef->MCU_ctr = 0;
   85|   486k|  coef->MCU_vert_offset = 0;
   86|   486k|}

jdcolor-8.c:ycc_rgb565_convert_le:
   23|  11.5M|{
   24|  11.5M|#if BITS_IN_JSAMPLE != 16
   25|  11.5M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   26|  11.5M|  register int y, cb, cr;
   27|  11.5M|  register _JSAMPROW outptr;
   28|  11.5M|  register _JSAMPROW inptr0, inptr1, inptr2;
   29|  11.5M|  register JDIMENSION col;
   30|  11.5M|  JDIMENSION num_cols = cinfo->output_width;
   31|       |  /* copy these pointers into registers if possible */
   32|  11.5M|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
   33|  11.5M|  register int *Crrtab = cconvert->Cr_r_tab;
   34|  11.5M|  register int *Cbbtab = cconvert->Cb_b_tab;
   35|  11.5M|  register JLONG *Crgtab = cconvert->Cr_g_tab;
   36|  11.5M|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
   37|  11.5M|  SHIFT_TEMPS
   38|       |
   39|  23.1M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (39:10): [True: 11.5M, False: 11.5M]
  ------------------
   40|  11.5M|    JLONG rgb;
   41|  11.5M|    unsigned int r, g, b;
   42|  11.5M|    inptr0 = input_buf[0][input_row];
   43|  11.5M|    inptr1 = input_buf[1][input_row];
   44|  11.5M|    inptr2 = input_buf[2][input_row];
   45|  11.5M|    input_row++;
   46|  11.5M|    outptr = *output_buf++;
   47|       |
   48|  11.5M|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|  11.5M|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 11.5M]
  |  |  ------------------
  ------------------
   49|      0|      y  = *inptr0++;
   50|      0|      cb = *inptr1++;
   51|      0|      cr = *inptr2++;
   52|      0|      r = range_limit[y + Crrtab[cr]];
   53|      0|      g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|      0|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
   54|      0|                                            SCALEBITS))];
   55|      0|      b = range_limit[y + Cbbtab[cb]];
   56|      0|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
   57|      0|      *(INT16 *)outptr = (INT16)rgb;
   58|      0|      outptr += 2;
   59|      0|      num_cols--;
   60|      0|    }
   61|   155M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (61:19): [True: 143M, False: 11.5M]
  ------------------
   62|   143M|      y  = *inptr0++;
   63|   143M|      cb = *inptr1++;
   64|   143M|      cr = *inptr2++;
   65|   143M|      r = range_limit[y + Crrtab[cr]];
   66|   143M|      g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|   143M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
   67|   143M|                                            SCALEBITS))];
   68|   143M|      b = range_limit[y + Cbbtab[cb]];
   69|   143M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|   143M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|   143M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
   70|       |
   71|   143M|      y  = *inptr0++;
   72|   143M|      cb = *inptr1++;
   73|   143M|      cr = *inptr2++;
   74|   143M|      r = range_limit[y + Crrtab[cr]];
   75|   143M|      g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|   143M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
   76|   143M|                                            SCALEBITS))];
   77|   143M|      b = range_limit[y + Cbbtab[cb]];
   78|   143M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
  ------------------
  |  |  639|   143M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|   143M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
   79|       |
   80|   143M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|   143M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
   81|   143M|      outptr += 4;
   82|   143M|    }
   83|  11.5M|    if (num_cols & 1) {
  ------------------
  |  Branch (83:9): [True: 3.71M, False: 7.87M]
  ------------------
   84|  3.71M|      y  = *inptr0;
   85|  3.71M|      cb = *inptr1;
   86|  3.71M|      cr = *inptr2;
   87|  3.71M|      r = range_limit[y + Crrtab[cr]];
   88|  3.71M|      g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|  3.71M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
   89|  3.71M|                                            SCALEBITS))];
   90|  3.71M|      b = range_limit[y + Cbbtab[cb]];
   91|  3.71M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|  3.71M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  3.71M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
   92|  3.71M|      *(INT16 *)outptr = (INT16)rgb;
   93|  3.71M|    }
   94|  11.5M|  }
   95|       |#else
   96|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
   97|       |#endif
   98|  11.5M|}
jdcolor-8.c:gray_rgb565_convert_le:
  310|  7.60M|{
  311|  7.60M|  register _JSAMPROW inptr, outptr;
  312|  7.60M|  register JDIMENSION col;
  313|  7.60M|  JDIMENSION num_cols = cinfo->output_width;
  314|       |
  315|  15.2M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (315:10): [True: 7.60M, False: 7.60M]
  ------------------
  316|  7.60M|    JLONG rgb;
  317|  7.60M|    unsigned int g;
  318|       |
  319|  7.60M|    inptr = input_buf[0][input_row++];
  320|  7.60M|    outptr = *output_buf++;
  321|  7.60M|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|  7.60M|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 7.60M]
  |  |  ------------------
  ------------------
  322|      0|      g = *inptr++;
  323|      0|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  324|      0|      *(INT16 *)outptr = (INT16)rgb;
  325|      0|      outptr += 2;
  326|      0|      num_cols--;
  327|      0|    }
  328|   172M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (328:19): [True: 165M, False: 7.60M]
  ------------------
  329|   165M|      g = *inptr++;
  330|   165M|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|   165M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|   165M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  331|   165M|      g = *inptr++;
  332|   165M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g));
  ------------------
  |  |  639|   165M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|   165M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
  333|   165M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|   165M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
  334|   165M|      outptr += 4;
  335|   165M|    }
  336|  7.60M|    if (num_cols & 1) {
  ------------------
  |  Branch (336:9): [True: 3.07M, False: 4.53M]
  ------------------
  337|  3.07M|      g = *inptr;
  338|  3.07M|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|  3.07M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  3.07M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  339|  3.07M|      *(INT16 *)outptr = (INT16)rgb;
  340|  3.07M|    }
  341|  7.60M|  }
  342|  7.60M|}
jdcolor-8.c:rgb_rgb565_convert_le:
  196|   690k|{
  197|   690k|  register _JSAMPROW outptr;
  198|   690k|  register _JSAMPROW inptr0, inptr1, inptr2;
  199|   690k|  register JDIMENSION col;
  200|   690k|  JDIMENSION num_cols = cinfo->output_width;
  201|   690k|  SHIFT_TEMPS
  202|       |
  203|  1.38M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (203:10): [True: 690k, False: 690k]
  ------------------
  204|   690k|    JLONG rgb;
  205|   690k|    unsigned int r, g, b;
  206|       |
  207|   690k|    inptr0 = input_buf[0][input_row];
  208|   690k|    inptr1 = input_buf[1][input_row];
  209|   690k|    inptr2 = input_buf[2][input_row];
  210|   690k|    input_row++;
  211|   690k|    outptr = *output_buf++;
  212|   690k|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|   690k|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 690k]
  |  |  ------------------
  ------------------
  213|      0|      r = *inptr0++;
  214|      0|      g = *inptr1++;
  215|      0|      b = *inptr2++;
  216|      0|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  217|      0|      *(INT16 *)outptr = (INT16)rgb;
  218|      0|      outptr += 2;
  219|      0|      num_cols--;
  220|      0|    }
  221|  24.1M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (221:19): [True: 23.5M, False: 690k]
  ------------------
  222|  23.5M|      r = *inptr0++;
  223|  23.5M|      g = *inptr1++;
  224|  23.5M|      b = *inptr2++;
  225|  23.5M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|  23.5M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  23.5M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  226|       |
  227|  23.5M|      r = *inptr0++;
  228|  23.5M|      g = *inptr1++;
  229|  23.5M|      b = *inptr2++;
  230|  23.5M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
  ------------------
  |  |  639|  23.5M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|  23.5M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
  231|       |
  232|  23.5M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|  23.5M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
  233|  23.5M|      outptr += 4;
  234|  23.5M|    }
  235|   690k|    if (num_cols & 1) {
  ------------------
  |  Branch (235:9): [True: 502k, False: 188k]
  ------------------
  236|   502k|      r = *inptr0;
  237|   502k|      g = *inptr1;
  238|   502k|      b = *inptr2;
  239|   502k|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|   502k|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|   502k|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  240|   502k|      *(INT16 *)outptr = (INT16)rgb;
  241|   502k|    }
  242|   690k|  }
  243|   690k|}
jdcolor-8.c:ycc_rgb565D_convert_le:
  106|  10.8M|{
  107|  10.8M|#if BITS_IN_JSAMPLE != 16
  108|  10.8M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  109|  10.8M|  register int y, cb, cr;
  110|  10.8M|  register _JSAMPROW outptr;
  111|  10.8M|  register _JSAMPROW inptr0, inptr1, inptr2;
  112|  10.8M|  register JDIMENSION col;
  113|  10.8M|  JDIMENSION num_cols = cinfo->output_width;
  114|       |  /* copy these pointers into registers if possible */
  115|  10.8M|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  116|  10.8M|  register int *Crrtab = cconvert->Cr_r_tab;
  117|  10.8M|  register int *Cbbtab = cconvert->Cb_b_tab;
  118|  10.8M|  register JLONG *Crgtab = cconvert->Cr_g_tab;
  119|  10.8M|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
  120|  10.8M|  JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
  ------------------
  |  |  617|  10.8M|#define DITHER_MASK       0x3
  ------------------
  121|  10.8M|  SHIFT_TEMPS
  122|       |
  123|  21.6M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (123:10): [True: 10.8M, False: 10.8M]
  ------------------
  124|  10.8M|    JLONG rgb;
  125|  10.8M|    unsigned int r, g, b;
  126|       |
  127|  10.8M|    inptr0 = input_buf[0][input_row];
  128|  10.8M|    inptr1 = input_buf[1][input_row];
  129|  10.8M|    inptr2 = input_buf[2][input_row];
  130|  10.8M|    input_row++;
  131|  10.8M|    outptr = *output_buf++;
  132|  10.8M|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|  10.8M|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 10.8M]
  |  |  ------------------
  ------------------
  133|      0|      y  = *inptr0++;
  134|      0|      cb = *inptr1++;
  135|      0|      cr = *inptr2++;
  136|      0|      r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
  ------------------
  |  |  606|      0|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  137|      0|      g = range_limit[DITHER_565_G(y +
  ------------------
  |  |  607|      0|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  138|      0|                                   ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  139|      0|                                                     SCALEBITS)), d0)];
  140|      0|      b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
  ------------------
  |  |  608|      0|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  141|      0|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  142|      0|      *(INT16 *)outptr = (INT16)rgb;
  143|      0|      outptr += 2;
  144|      0|      num_cols--;
  145|      0|    }
  146|   134M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (146:19): [True: 123M, False: 10.8M]
  ------------------
  147|   123M|      y  = *inptr0++;
  148|   123M|      cb = *inptr1++;
  149|   123M|      cr = *inptr2++;
  150|   123M|      r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
  ------------------
  |  |  606|   123M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  151|   123M|      g = range_limit[DITHER_565_G(y +
  ------------------
  |  |  607|   123M|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  152|   123M|                                   ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  153|   123M|                                                     SCALEBITS)), d0)];
  154|   123M|      b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
  ------------------
  |  |  608|   123M|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  155|   123M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|   123M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  156|   123M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|   123M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|   123M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  157|       |
  158|   123M|      y  = *inptr0++;
  159|   123M|      cb = *inptr1++;
  160|   123M|      cr = *inptr2++;
  161|   123M|      r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
  ------------------
  |  |  606|   123M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  162|   123M|      g = range_limit[DITHER_565_G(y +
  ------------------
  |  |  607|   123M|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  163|   123M|                                   ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  164|   123M|                                                     SCALEBITS)), d0)];
  165|   123M|      b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
  ------------------
  |  |  608|   123M|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  166|   123M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|   123M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  167|   123M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
  ------------------
  |  |  639|   123M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|   123M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
  168|       |
  169|   123M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|   123M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
  170|   123M|      outptr += 4;
  171|   123M|    }
  172|  10.8M|    if (num_cols & 1) {
  ------------------
  |  Branch (172:9): [True: 3.43M, False: 7.37M]
  ------------------
  173|  3.43M|      y  = *inptr0;
  174|  3.43M|      cb = *inptr1;
  175|  3.43M|      cr = *inptr2;
  176|  3.43M|      r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
  ------------------
  |  |  606|  3.43M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  177|  3.43M|      g = range_limit[DITHER_565_G(y +
  ------------------
  |  |  607|  3.43M|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  178|  3.43M|                                   ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  179|  3.43M|                                                     SCALEBITS)), d0)];
  180|  3.43M|      b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
  ------------------
  |  |  608|  3.43M|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  181|  3.43M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|  3.43M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  3.43M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  182|  3.43M|      *(INT16 *)outptr = (INT16)rgb;
  183|  3.43M|    }
  184|  10.8M|  }
  185|       |#else
  186|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  187|       |#endif
  188|  10.8M|}
jdcolor-8.c:gray_rgb565D_convert_le:
  350|  4.34M|{
  351|  4.34M|  register _JSAMPROW inptr, outptr;
  352|  4.34M|  register JDIMENSION col;
  353|  4.34M|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  354|  4.34M|  JDIMENSION num_cols = cinfo->output_width;
  355|  4.34M|  JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
  ------------------
  |  |  617|  4.34M|#define DITHER_MASK       0x3
  ------------------
  356|       |
  357|  8.68M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (357:10): [True: 4.34M, False: 4.34M]
  ------------------
  358|  4.34M|    JLONG rgb;
  359|  4.34M|    unsigned int g;
  360|       |
  361|  4.34M|    inptr = input_buf[0][input_row++];
  362|  4.34M|    outptr = *output_buf++;
  363|  4.34M|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|  4.34M|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 4.34M]
  |  |  ------------------
  ------------------
  364|      0|      g = *inptr++;
  365|      0|      g = range_limit[DITHER_565_R(g, d0)];
  ------------------
  |  |  606|      0|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  366|      0|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  367|      0|      *(INT16 *)outptr = (INT16)rgb;
  368|      0|      outptr += 2;
  369|      0|      num_cols--;
  370|      0|    }
  371|  93.9M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (371:19): [True: 89.5M, False: 4.34M]
  ------------------
  372|  89.5M|      g = *inptr++;
  373|  89.5M|      g = range_limit[DITHER_565_R(g, d0)];
  ------------------
  |  |  606|  89.5M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  374|  89.5M|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|  89.5M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  89.5M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  375|  89.5M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|  89.5M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  376|       |
  377|  89.5M|      g = *inptr++;
  378|  89.5M|      g = range_limit[DITHER_565_R(g, d0)];
  ------------------
  |  |  606|  89.5M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  379|  89.5M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g));
  ------------------
  |  |  639|  89.5M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|  89.5M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
  380|  89.5M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|  89.5M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  381|       |
  382|  89.5M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|  89.5M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
  383|  89.5M|      outptr += 4;
  384|  89.5M|    }
  385|  4.34M|    if (num_cols & 1) {
  ------------------
  |  Branch (385:9): [True: 2.27M, False: 2.06M]
  ------------------
  386|  2.27M|      g = *inptr;
  387|  2.27M|      g = range_limit[DITHER_565_R(g, d0)];
  ------------------
  |  |  606|  2.27M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  388|  2.27M|      rgb = PACK_SHORT_565(g, g, g);
  ------------------
  |  |  638|  2.27M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  2.27M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  389|  2.27M|      *(INT16 *)outptr = (INT16)rgb;
  390|  2.27M|    }
  391|  4.34M|  }
  392|  4.34M|}
jdcolor-8.c:rgb_rgb565D_convert_le:
  251|   603k|{
  252|   603k|  register _JSAMPROW outptr;
  253|   603k|  register _JSAMPROW inptr0, inptr1, inptr2;
  254|   603k|  register JDIMENSION col;
  255|   603k|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  256|   603k|  JDIMENSION num_cols = cinfo->output_width;
  257|   603k|  JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
  ------------------
  |  |  617|   603k|#define DITHER_MASK       0x3
  ------------------
  258|   603k|  SHIFT_TEMPS
  259|       |
  260|  1.20M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (260:10): [True: 603k, False: 603k]
  ------------------
  261|   603k|    JLONG rgb;
  262|   603k|    unsigned int r, g, b;
  263|       |
  264|   603k|    inptr0 = input_buf[0][input_row];
  265|   603k|    inptr1 = input_buf[1][input_row];
  266|   603k|    inptr2 = input_buf[2][input_row];
  267|   603k|    input_row++;
  268|   603k|    outptr = *output_buf++;
  269|   603k|    if (PACK_NEED_ALIGNMENT(outptr)) {
  ------------------
  |  |  602|   603k|#define PACK_NEED_ALIGNMENT(ptr)    (((size_t)(ptr)) & 3)
  |  |  ------------------
  |  |  |  Branch (602:37): [True: 0, False: 603k]
  |  |  ------------------
  ------------------
  270|      0|      r = range_limit[DITHER_565_R(*inptr0++, d0)];
  ------------------
  |  |  606|      0|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  271|      0|      g = range_limit[DITHER_565_G(*inptr1++, d0)];
  ------------------
  |  |  607|      0|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  272|      0|      b = range_limit[DITHER_565_B(*inptr2++, d0)];
  ------------------
  |  |  608|      0|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  273|      0|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|      0|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|      0|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  274|      0|      *(INT16 *)outptr = (INT16)rgb;
  275|      0|      outptr += 2;
  276|      0|      num_cols--;
  277|      0|    }
  278|  22.3M|    for (col = 0; col < (num_cols >> 1); col++) {
  ------------------
  |  Branch (278:19): [True: 21.7M, False: 603k]
  ------------------
  279|  21.7M|      r = range_limit[DITHER_565_R(*inptr0++, d0)];
  ------------------
  |  |  606|  21.7M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  280|  21.7M|      g = range_limit[DITHER_565_G(*inptr1++, d0)];
  ------------------
  |  |  607|  21.7M|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  281|  21.7M|      b = range_limit[DITHER_565_B(*inptr2++, d0)];
  ------------------
  |  |  608|  21.7M|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  282|  21.7M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|  21.7M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  283|  21.7M|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|  21.7M|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|  21.7M|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  284|       |
  285|  21.7M|      r = range_limit[DITHER_565_R(*inptr0++, d0)];
  ------------------
  |  |  606|  21.7M|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  286|  21.7M|      g = range_limit[DITHER_565_G(*inptr1++, d0)];
  ------------------
  |  |  607|  21.7M|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  287|  21.7M|      b = range_limit[DITHER_565_B(*inptr2++, d0)];
  ------------------
  |  |  608|  21.7M|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  288|  21.7M|      d0 = DITHER_ROTATE(d0);
  ------------------
  |  |  618|  21.7M|#define DITHER_ROTATE(x)  ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
  ------------------
  289|  21.7M|      rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
  ------------------
  |  |  639|  21.7M|#define PACK_TWO_PIXELS  PACK_TWO_PIXELS_LE
  |  |  ------------------
  |  |  |  |  599|  21.7M|#define PACK_TWO_PIXELS_LE(l, r)    ((r << 16) | l)
  |  |  ------------------
  ------------------
  290|       |
  291|  21.7M|      WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
  ------------------
  |  |  604|  21.7M|#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels)  ((*(int *)(addr)) = pixels)
  ------------------
  292|  21.7M|      outptr += 4;
  293|  21.7M|    }
  294|   603k|    if (num_cols & 1) {
  ------------------
  |  Branch (294:9): [True: 431k, False: 171k]
  ------------------
  295|   431k|      r = range_limit[DITHER_565_R(*inptr0, d0)];
  ------------------
  |  |  606|   431k|#define DITHER_565_R(r, dither)  ((r) + ((dither) & 0xFF))
  ------------------
  296|   431k|      g = range_limit[DITHER_565_G(*inptr1, d0)];
  ------------------
  |  |  607|   431k|#define DITHER_565_G(g, dither)  ((g) + (((dither) & 0xFF) >> 1))
  ------------------
  297|   431k|      b = range_limit[DITHER_565_B(*inptr2, d0)];
  ------------------
  |  |  608|   431k|#define DITHER_565_B(b, dither)  ((b) + ((dither) & 0xFF))
  ------------------
  298|   431k|      rgb = PACK_SHORT_565(r, g, b);
  ------------------
  |  |  638|   431k|#define PACK_SHORT_565  PACK_SHORT_565_LE
  |  |  ------------------
  |  |  |  |  595|   431k|  ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
  |  |  ------------------
  ------------------
  299|   431k|      *(INT16 *)outptr = (INT16)rgb;
  300|   431k|    }
  301|   603k|  }
  302|   603k|}

jdcolor-8.c:rgb_extbgr_convert_internal:
  121|  1.61M|{
  122|  1.61M|  register _JSAMPROW inptr0, inptr1, inptr2;
  123|  1.61M|  register _JSAMPROW outptr;
  124|  1.61M|  register JDIMENSION col;
  125|  1.61M|  JDIMENSION num_cols = cinfo->output_width;
  126|       |
  127|  3.44M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (127:10): [True: 1.82M, False: 1.61M]
  ------------------
  128|  1.82M|    inptr0 = input_buf[0][input_row];
  129|  1.82M|    inptr1 = input_buf[1][input_row];
  130|  1.82M|    inptr2 = input_buf[2][input_row];
  131|  1.82M|    input_row++;
  132|  1.82M|    outptr = *output_buf++;
  133|   141M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (133:19): [True: 139M, False: 1.82M]
  ------------------
  134|   139M|      outptr[RGB_RED] = inptr0[col];
  ------------------
  |  |  139|   139M|#define RGB_RED  EXT_BGR_RED
  |  |  ------------------
  |  |  |  |  316|   139M|#define EXT_BGR_RED         2
  |  |  ------------------
  ------------------
  135|   139M|      outptr[RGB_GREEN] = inptr1[col];
  ------------------
  |  |  140|   139M|#define RGB_GREEN  EXT_BGR_GREEN
  |  |  ------------------
  |  |  |  |  317|   139M|#define EXT_BGR_GREEN       1
  |  |  ------------------
  ------------------
  136|   139M|      outptr[RGB_BLUE] = inptr2[col];
  ------------------
  |  |  141|   139M|#define RGB_BLUE  EXT_BGR_BLUE
  |  |  ------------------
  |  |  |  |  318|   139M|#define EXT_BGR_BLUE        0
  |  |  ------------------
  ------------------
  137|       |      /* Set unused byte to _MAXJSAMPLE so it can be interpreted as an */
  138|       |      /* opaque alpha channel value */
  139|       |#ifdef RGB_ALPHA
  140|       |      outptr[RGB_ALPHA] = _MAXJSAMPLE;
  141|       |#endif
  142|   139M|      outptr += RGB_PIXELSIZE;
  ------------------
  |  |  142|   139M|#define RGB_PIXELSIZE  EXT_BGR_PIXELSIZE
  |  |  ------------------
  |  |  |  |  319|   139M|#define EXT_BGR_PIXELSIZE   3
  |  |  ------------------
  ------------------
  143|   139M|    }
  144|  1.82M|  }
  145|  1.61M|}

jinit_color_deconverter:
  758|  16.3k|{
  759|  16.3k|  my_cconvert_ptr cconvert;
  760|  16.3k|  int ci;
  761|       |
  762|  16.3k|#ifdef D_LOSSLESS_SUPPORTED
  763|  16.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (763:7): [True: 588, False: 15.7k]
  ------------------
  764|    588|#if BITS_IN_JSAMPLE == 8
  765|    588|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.17k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (765:9): [True: 0, False: 588]
  |  Branch (765:52): [True: 0, False: 588]
  ------------------
  766|       |#else
  767|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  768|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  769|       |#endif
  770|      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)))
  ------------------
  771|    588|  } else
  772|  15.7k|#endif
  773|  15.7k|  {
  774|  15.7k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  15.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (774:9): [True: 0, False: 15.7k]
  ------------------
  775|      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)))
  ------------------
  776|  15.7k|  }
  777|       |
  778|  16.3k|  cconvert = (my_cconvert_ptr)
  779|  16.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  16.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  780|  16.3k|                                sizeof(my_color_deconverter));
  781|  16.3k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  782|  16.3k|  cconvert->pub.start_pass = start_pass_dcolor;
  783|       |
  784|       |  /* Make sure num_components agrees with jpeg_color_space */
  785|  16.3k|  switch (cinfo->jpeg_color_space) {
  786|  6.17k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (786:3): [True: 6.17k, False: 10.1k]
  ------------------
  787|  6.17k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (787:9): [True: 0, False: 6.17k]
  ------------------
  788|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  789|  6.17k|    break;
  790|       |
  791|  2.12k|  case JCS_RGB:
  ------------------
  |  Branch (791:3): [True: 2.12k, False: 14.1k]
  ------------------
  792|  9.49k|  case JCS_YCbCr:
  ------------------
  |  Branch (792:3): [True: 7.36k, False: 8.95k]
  ------------------
  793|  9.49k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (793:9): [True: 0, False: 9.49k]
  ------------------
  794|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  795|  9.49k|    break;
  796|       |
  797|    481|  case JCS_CMYK:
  ------------------
  |  Branch (797:3): [True: 481, False: 15.8k]
  ------------------
  798|    496|  case JCS_YCCK:
  ------------------
  |  Branch (798:3): [True: 15, False: 16.3k]
  ------------------
  799|    496|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (799:9): [True: 0, False: 496]
  ------------------
  800|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  801|    496|    break;
  802|       |
  803|    162|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (803:3): [True: 162, False: 16.1k]
  ------------------
  804|    162|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (804:9): [True: 0, False: 162]
  ------------------
  805|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  806|    162|    break;
  807|  16.3k|  }
  808|       |
  809|       |  /* Set out_color_components and conversion method based on requested space.
  810|       |   * Also clear the component_needed flags for any unused components,
  811|       |   * so that earlier pipeline stages can avoid useless computation.
  812|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  813|       |   * mode.
  814|       |   */
  815|       |
  816|  16.3k|  switch (cinfo->out_color_space) {
  817|  3.24k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (817:3): [True: 3.24k, False: 13.0k]
  ------------------
  818|  3.24k|#ifdef D_LOSSLESS_SUPPORTED
  819|  3.24k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (819:9): [True: 0, False: 3.24k]
  ------------------
  820|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (820:9): [True: 0, False: 0]
  ------------------
  821|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  822|  3.24k|#endif
  823|  3.24k|    cinfo->out_color_components = 1;
  824|  3.24k|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (824:9): [True: 3.24k, False: 0]
  ------------------
  825|  3.24k|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (825:9): [True: 0, False: 0]
  ------------------
  826|  3.24k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  263|  3.24k|#define _color_convert  color_convert
  ------------------
  827|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  828|  3.24k|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (828:20): [True: 0, False: 3.24k]
  ------------------
  829|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  830|  3.24k|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (830:16): [True: 0, False: 0]
  ------------------
  831|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  263|      0|#define _color_convert  color_convert
  ------------------
  832|      0|      build_rgb_y_table(cinfo);
  833|      0|    } else
  834|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  835|  3.24k|    break;
  836|       |
  837|  2.57k|  case JCS_RGB:
  ------------------
  |  Branch (837:3): [True: 2.57k, False: 13.7k]
  ------------------
  838|  2.57k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (838:3): [True: 0, False: 16.3k]
  ------------------
  839|  2.57k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (839:3): [True: 0, False: 16.3k]
  ------------------
  840|  6.46k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (840:3): [True: 3.88k, False: 12.4k]
  ------------------
  841|  6.46k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (841:3): [True: 0, False: 16.3k]
  ------------------
  842|  6.46k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (842:3): [True: 0, False: 16.3k]
  ------------------
  843|  6.46k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (843:3): [True: 0, False: 16.3k]
  ------------------
  844|  6.46k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (844:3): [True: 0, False: 16.3k]
  ------------------
  845|  6.46k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (845:3): [True: 0, False: 16.3k]
  ------------------
  846|  6.46k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (846:3): [True: 0, False: 16.3k]
  ------------------
  847|  6.46k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (847:3): [True: 0, False: 16.3k]
  ------------------
  848|  6.46k|#ifdef D_LOSSLESS_SUPPORTED
  849|  6.46k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (849:9): [True: 0, False: 6.46k]
  |  Branch (849:36): [True: 0, False: 0]
  ------------------
  850|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  851|  6.46k|#endif
  852|  6.46k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  853|  6.46k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (853:9): [True: 4.98k, False: 1.47k]
  ------------------
  854|  4.98k|#ifdef WITH_SIMD
  855|  4.98k|      if (jsimd_can_ycc_rgb())
  ------------------
  |  Branch (855:11): [True: 4.98k, False: 0]
  ------------------
  856|  4.98k|        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  ------------------
  |  |  263|  4.98k|#define _color_convert  color_convert
  ------------------
  857|      0|      else
  858|      0|#endif
  859|      0|      {
  860|      0|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  263|      0|#define _color_convert  color_convert
  ------------------
  861|      0|        build_ycc_rgb_table(cinfo);
  862|      0|      }
  863|  4.98k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (863:16): [True: 0, False: 1.47k]
  ------------------
  864|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  263|      0|#define _color_convert  color_convert
  ------------------
  865|  1.47k|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (865:16): [True: 1.47k, False: 0]
  ------------------
  866|  1.47k|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (866:11): [True: 575, False: 903]
  ------------------
  867|    575|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (867:11): [True: 575, False: 0]
  ------------------
  868|    575|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (868:11): [True: 575, False: 0]
  ------------------
  869|    575|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (869:11): [True: 575, False: 0]
  ------------------
  870|    575|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  263|    575|#define _color_convert  color_convert
  ------------------
  871|    903|      else
  872|    903|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  263|    903|#define _color_convert  color_convert
  ------------------
  873|  1.47k|    } else
  874|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  875|  6.46k|    break;
  876|       |
  877|  5.96k|  case JCS_RGB565:
  ------------------
  |  Branch (877:3): [True: 5.96k, False: 10.3k]
  ------------------
  878|  5.96k|#ifdef D_LOSSLESS_SUPPORTED
  879|  5.96k|    if (cinfo->master->lossless)
  ------------------
  |  Branch (879:9): [True: 9, False: 5.95k]
  ------------------
  880|      9|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  881|  5.96k|#endif
  882|  5.96k|    cinfo->out_color_components = 3;
  883|  5.96k|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (883:9): [True: 3.58k, False: 2.37k]
  ------------------
  884|  3.58k|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (884:11): [True: 1.36k, False: 2.22k]
  ------------------
  885|  1.36k|#ifdef WITH_SIMD
  886|  1.36k|        if (jsimd_can_ycc_rgb565())
  ------------------
  |  Branch (886:13): [True: 0, False: 1.36k]
  ------------------
  887|      0|          cconvert->pub._color_convert = jsimd_ycc_rgb565_convert;
  ------------------
  |  |  263|      0|#define _color_convert  color_convert
  ------------------
  888|  1.36k|        else
  889|  1.36k|#endif
  890|  1.36k|        {
  891|  1.36k|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  263|  1.36k|#define _color_convert  color_convert
  ------------------
  892|  1.36k|          build_ycc_rgb_table(cinfo);
  893|  1.36k|        }
  894|  2.22k|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (894:18): [True: 1.86k, False: 355]
  ------------------
  895|  1.86k|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  263|  1.86k|#define _color_convert  color_convert
  ------------------
  896|  1.86k|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (896:18): [True: 355, False: 0]
  ------------------
  897|    355|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  263|    355|#define _color_convert  color_convert
  ------------------
  898|    355|      } else
  899|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  900|  3.58k|    } else {
  901|       |      /* only ordered dithering is supported */
  902|  2.37k|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (902:11): [True: 1.01k, False: 1.35k]
  ------------------
  903|  1.01k|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  263|  1.01k|#define _color_convert  color_convert
  ------------------
  904|  1.01k|        build_ycc_rgb_table(cinfo);
  905|  1.35k|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (905:18): [True: 1.06k, False: 298]
  ------------------
  906|  1.06k|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  263|  1.06k|#define _color_convert  color_convert
  ------------------
  907|  1.06k|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (907:18): [True: 289, False: 9]
  ------------------
  908|    289|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  263|    289|#define _color_convert  color_convert
  ------------------
  909|    289|      } else
  910|      9|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  911|  2.37k|    }
  912|  5.96k|    break;
  913|       |
  914|    496|  case JCS_CMYK:
  ------------------
  |  Branch (914:3): [True: 496, False: 15.8k]
  ------------------
  915|    496|#ifdef D_LOSSLESS_SUPPORTED
  916|    496|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (916:9): [True: 472, False: 24]
  ------------------
  917|    472|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (917:9): [True: 1, False: 471]
  ------------------
  918|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  919|    496|#endif
  920|    496|    cinfo->out_color_components = 4;
  921|    496|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (921:9): [True: 14, False: 482]
  ------------------
  922|     14|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  263|     14|#define _color_convert  color_convert
  ------------------
  923|     14|      build_ycc_rgb_table(cinfo);
  924|    482|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (924:16): [True: 481, False: 1]
  ------------------
  925|    481|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  263|    481|#define _color_convert  color_convert
  ------------------
  926|    481|    } else
  927|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  928|    496|    break;
  929|       |
  930|    162|  default:
  ------------------
  |  Branch (930:3): [True: 162, False: 16.1k]
  ------------------
  931|       |    /* Permit null conversion to same output space */
  932|    162|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (932:9): [True: 162, False: 0]
  ------------------
  933|    162|      cinfo->out_color_components = cinfo->num_components;
  934|    162|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  263|    162|#define _color_convert  color_convert
  ------------------
  935|    162|    } else                      /* unsupported non-null conversion */
  936|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  937|    162|    break;
  938|  16.3k|  }
  939|       |
  940|  16.3k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (940:7): [True: 9.70k, False: 6.60k]
  ------------------
  941|  9.70k|    cinfo->output_components = 1; /* single colormapped output component */
  942|  6.60k|  else
  943|  6.60k|    cinfo->output_components = cinfo->out_color_components;
  944|  16.3k|}
jdcolor-8.c:start_pass_dcolor:
  747|  30.3k|{
  748|       |  /* no work needed */
  749|  30.3k|}
jdcolor-8.c:grayscale_convert:
  440|  12.8M|{
  441|  12.8M|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  293|  12.8M|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  442|  12.8M|                     cinfo->output_width);
  443|  12.8M|}
jdcolor-8.c:build_ycc_rgb_table:
  216|  2.39k|{
  217|  2.39k|#if BITS_IN_JSAMPLE != 16
  218|  2.39k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  219|  2.39k|  int i;
  220|  2.39k|  JLONG x;
  221|  2.39k|  SHIFT_TEMPS
  222|       |
  223|  2.39k|  cconvert->Cr_r_tab = (int *)
  224|  2.39k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  225|  2.39k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  222|  2.39k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.39k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  226|  2.39k|  cconvert->Cb_b_tab = (int *)
  227|  2.39k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  228|  2.39k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  222|  2.39k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.39k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  229|  2.39k|  cconvert->Cr_g_tab = (JLONG *)
  230|  2.39k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  231|  2.39k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  222|  2.39k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.39k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  232|  2.39k|  cconvert->Cb_g_tab = (JLONG *)
  233|  2.39k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  234|  2.39k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  222|  2.39k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.39k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  235|       |
  236|   615k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  223|  2.39k|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  ------------------
  |  |  |  |   53|  2.39k|#define CENTERJSAMPLE    128
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  222|   615k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   615k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (236:36): [True: 612k, False: 2.39k]
  ------------------
  237|       |    /* i is the actual input pixel value, in the range 0.._MAXJSAMPLE */
  238|       |    /* The Cb or Cr value we are thinking of is x = i - _CENTERJSAMPLE */
  239|       |    /* Cr=>R value is nearest int to 1.40200 * x */
  240|   612k|    cconvert->Cr_r_tab[i] = (int)
  241|   612k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|   612k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  242|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  243|   612k|    cconvert->Cb_b_tab[i] = (int)
  244|   612k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|   612k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  245|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  246|   612k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   82|   612k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|   612k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  247|       |    /* Cb=>G value is scaled-up -0.34414 * x */
  248|       |    /* We also add in ONE_HALF so that need not do it in inner loop */
  249|   612k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   82|   612k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|   612k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   81|   612k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   80|   612k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  250|   612k|  }
  251|       |#else
  252|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  253|       |#endif
  254|  2.39k|}
jdcolor-8.c:null_convert:
  379|  7.35M|{
  380|  7.35M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  381|  7.35M|  register JDIMENSION col;
  382|  7.35M|  register int num_components = cinfo->num_components;
  383|  7.35M|  JDIMENSION num_cols = cinfo->output_width;
  384|  7.35M|  int ci;
  385|       |
  386|  7.35M|  if (num_components == 3) {
  ------------------
  |  Branch (386:7): [True: 1.00M, False: 6.35M]
  ------------------
  387|  2.21M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (387:12): [True: 1.20M, False: 1.00M]
  ------------------
  388|  1.20M|      inptr0 = input_buf[0][input_row];
  389|  1.20M|      inptr1 = input_buf[1][input_row];
  390|  1.20M|      inptr2 = input_buf[2][input_row];
  391|  1.20M|      input_row++;
  392|  1.20M|      outptr = *output_buf++;
  393|  92.2M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (393:21): [True: 91.0M, False: 1.20M]
  ------------------
  394|  91.0M|        *outptr++ = inptr0[col];
  395|  91.0M|        *outptr++ = inptr1[col];
  396|  91.0M|        *outptr++ = inptr2[col];
  397|  91.0M|      }
  398|  1.20M|    }
  399|  6.35M|  } else if (num_components == 4) {
  ------------------
  |  Branch (399:14): [True: 6.13M, False: 213k]
  ------------------
  400|  12.2M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (400:12): [True: 6.13M, False: 6.13M]
  ------------------
  401|  6.13M|      inptr0 = input_buf[0][input_row];
  402|  6.13M|      inptr1 = input_buf[1][input_row];
  403|  6.13M|      inptr2 = input_buf[2][input_row];
  404|  6.13M|      inptr3 = input_buf[3][input_row];
  405|  6.13M|      input_row++;
  406|  6.13M|      outptr = *output_buf++;
  407|  46.5M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (407:21): [True: 40.3M, False: 6.13M]
  ------------------
  408|  40.3M|        *outptr++ = inptr0[col];
  409|  40.3M|        *outptr++ = inptr1[col];
  410|  40.3M|        *outptr++ = inptr2[col];
  411|  40.3M|        *outptr++ = inptr3[col];
  412|  40.3M|      }
  413|  6.13M|    }
  414|  6.13M|  } else {
  415|   427k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (415:12): [True: 213k, False: 213k]
  ------------------
  416|   881k|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (416:20): [True: 668k, False: 213k]
  ------------------
  417|   668k|        inptr = input_buf[ci][input_row];
  418|   668k|        outptr = *output_buf;
  419|  56.8M|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (419:23): [True: 56.1M, False: 668k]
  ------------------
  420|  56.1M|          outptr[ci] = inptr[col];
  421|  56.1M|          outptr += num_components;
  422|  56.1M|        }
  423|   668k|      }
  424|   213k|      output_buf++;
  425|   213k|      input_row++;
  426|   213k|    }
  427|   213k|  }
  428|  7.35M|}
jdcolor-8.c:rgb_rgb_convert:
  498|  1.61M|{
  499|  1.61M|  switch (cinfo->out_color_space) {
  500|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (500:3): [True: 0, False: 1.61M]
  ------------------
  501|      0|    rgb_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  502|      0|                                num_rows);
  503|      0|    break;
  504|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (504:3): [True: 0, False: 1.61M]
  ------------------
  505|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (505:3): [True: 0, False: 1.61M]
  ------------------
  506|      0|    rgb_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
  507|      0|                                 num_rows);
  508|      0|    break;
  509|  1.61M|  case JCS_EXT_BGR:
  ------------------
  |  Branch (509:3): [True: 1.61M, False: 0]
  ------------------
  510|  1.61M|    rgb_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
  511|  1.61M|                                num_rows);
  512|  1.61M|    break;
  513|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (513:3): [True: 0, False: 1.61M]
  ------------------
  514|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (514:3): [True: 0, False: 1.61M]
  ------------------
  515|      0|    rgb_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
  516|      0|                                 num_rows);
  517|      0|    break;
  518|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (518:3): [True: 0, False: 1.61M]
  ------------------
  519|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (519:3): [True: 0, False: 1.61M]
  ------------------
  520|      0|    rgb_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
  521|      0|                                 num_rows);
  522|      0|    break;
  523|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (523:3): [True: 0, False: 1.61M]
  ------------------
  524|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (524:3): [True: 0, False: 1.61M]
  ------------------
  525|      0|    rgb_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  526|      0|                                 num_rows);
  527|      0|    break;
  528|      0|  default:
  ------------------
  |  Branch (528:3): [True: 0, False: 1.61M]
  ------------------
  529|      0|    rgb_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
  530|      0|                             num_rows);
  531|      0|    break;
  532|  1.61M|  }
  533|  1.61M|}
jdcolor-8.c:ycc_rgb565_convert:
  678|  11.5M|{
  679|  11.5M|  if (is_big_endian())
  ------------------
  |  Branch (679:7): [True: 0, False: 11.5M]
  ------------------
  680|      0|    ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  681|  11.5M|  else
  682|  11.5M|    ycc_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  683|  11.5M|}
jdcolor-8.c:is_big_endian:
  628|  35.6M|{
  629|  35.6M|  int test_value = 1;
  630|  35.6M|  if (*(char *)&test_value != 1)
  ------------------
  |  Branch (630:7): [True: 0, False: 35.6M]
  ------------------
  631|      0|    return TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  632|  35.6M|  return FALSE;
  ------------------
  |  |  207|  35.6M|#define FALSE   0               /* values of boolean */
  ------------------
  633|  35.6M|}
jdcolor-8.c:gray_rgb565_convert:
  722|  7.60M|{
  723|  7.60M|  if (is_big_endian())
  ------------------
  |  Branch (723:7): [True: 0, False: 7.60M]
  ------------------
  724|      0|    gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  725|  7.60M|  else
  726|  7.60M|    gray_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  727|  7.60M|}
jdcolor-8.c:rgb_rgb565_convert:
  700|   690k|{
  701|   690k|  if (is_big_endian())
  ------------------
  |  Branch (701:7): [True: 0, False: 690k]
  ------------------
  702|      0|    rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  703|   690k|  else
  704|   690k|    rgb_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  705|   690k|}
jdcolor-8.c:ycc_rgb565D_convert:
  689|  10.8M|{
  690|  10.8M|  if (is_big_endian())
  ------------------
  |  Branch (690:7): [True: 0, False: 10.8M]
  ------------------
  691|      0|    ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  692|  10.8M|  else
  693|  10.8M|    ycc_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  694|  10.8M|}
jdcolor-8.c:gray_rgb565D_convert:
  733|  4.34M|{
  734|  4.34M|  if (is_big_endian())
  ------------------
  |  Branch (734:7): [True: 0, False: 4.34M]
  ------------------
  735|      0|    gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  736|  4.34M|  else
  737|  4.34M|    gray_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  738|  4.34M|}
jdcolor-8.c:rgb_rgb565D_convert:
  711|   603k|{
  712|   603k|  if (is_big_endian())
  ------------------
  |  Branch (712:7): [True: 0, False: 603k]
  ------------------
  713|      0|    rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
  714|   603k|  else
  715|   603k|    rgb_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
  716|   603k|}
jdcolor-8.c:ycck_cmyk_convert:
  546|  2.79k|{
  547|  2.79k|#if BITS_IN_JSAMPLE != 16
  548|  2.79k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  549|  2.79k|  register int y, cb, cr;
  550|  2.79k|  register _JSAMPROW outptr;
  551|  2.79k|  register _JSAMPROW inptr0, inptr1, inptr2, inptr3;
  552|  2.79k|  register JDIMENSION col;
  553|  2.79k|  JDIMENSION num_cols = cinfo->output_width;
  554|       |  /* copy these pointers into registers if possible */
  555|  2.79k|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  556|  2.79k|  register int *Crrtab = cconvert->Cr_r_tab;
  557|  2.79k|  register int *Cbbtab = cconvert->Cb_b_tab;
  558|  2.79k|  register JLONG *Crgtab = cconvert->Cr_g_tab;
  559|  2.79k|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
  560|  2.79k|  SHIFT_TEMPS
  561|       |
  562|  5.59k|  while (--num_rows >= 0) {
  ------------------
  |  Branch (562:10): [True: 2.79k, False: 2.79k]
  ------------------
  563|  2.79k|    inptr0 = input_buf[0][input_row];
  564|  2.79k|    inptr1 = input_buf[1][input_row];
  565|  2.79k|    inptr2 = input_buf[2][input_row];
  566|  2.79k|    inptr3 = input_buf[3][input_row];
  567|  2.79k|    input_row++;
  568|  2.79k|    outptr = *output_buf++;
  569|   772k|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (569:19): [True: 769k, False: 2.79k]
  ------------------
  570|   769k|      y  = inptr0[col];
  571|   769k|      cb = inptr1[col];
  572|   769k|      cr = inptr2[col];
  573|       |      /* Range-limiting is essential due to noise introduced by DCT losses. */
  574|   769k|      outptr[0] = range_limit[_MAXJSAMPLE - (y + Crrtab[cr])];  /* red */
  ------------------
  |  |  222|   769k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   769k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  575|   769k|      outptr[1] = range_limit[_MAXJSAMPLE - (y +                /* green */
  ------------------
  |  |  222|   769k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   769k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  576|   769k|                              ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  474|   769k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  577|   769k|                                                 SCALEBITS)))];
  578|   769k|      outptr[2] = range_limit[_MAXJSAMPLE - (y + Cbbtab[cb])];  /* blue */
  ------------------
  |  |  222|   769k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   769k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  579|       |      /* K passes through unchanged */
  580|   769k|      outptr[3] = inptr3[col];
  581|   769k|      outptr += 4;
  582|   769k|    }
  583|  2.79k|  }
  584|       |#else
  585|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  586|       |#endif
  587|  2.79k|}
j12init_color_deconverter:
  758|  1.39k|{
  759|  1.39k|  my_cconvert_ptr cconvert;
  760|  1.39k|  int ci;
  761|       |
  762|  1.39k|#ifdef D_LOSSLESS_SUPPORTED
  763|  1.39k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (763:7): [True: 427, False: 968]
  ------------------
  764|       |#if BITS_IN_JSAMPLE == 8
  765|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  766|       |#else
  767|    427|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    854|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (767:9): [True: 0, False: 427]
  ------------------
  768|    427|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    427|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (768:9): [True: 0, False: 427]
  ------------------
  769|      0|#endif
  770|      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)))
  ------------------
  771|    427|  } else
  772|    968|#endif
  773|    968|  {
  774|    968|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    968|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (774:9): [True: 0, False: 968]
  ------------------
  775|      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)))
  ------------------
  776|    968|  }
  777|       |
  778|  1.39k|  cconvert = (my_cconvert_ptr)
  779|  1.39k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  780|  1.39k|                                sizeof(my_color_deconverter));
  781|  1.39k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  782|  1.39k|  cconvert->pub.start_pass = start_pass_dcolor;
  783|       |
  784|       |  /* Make sure num_components agrees with jpeg_color_space */
  785|  1.39k|  switch (cinfo->jpeg_color_space) {
  786|    479|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (786:3): [True: 479, False: 916]
  ------------------
  787|    479|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (787:9): [True: 0, False: 479]
  ------------------
  788|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  789|    479|    break;
  790|       |
  791|     17|  case JCS_RGB:
  ------------------
  |  Branch (791:3): [True: 17, False: 1.37k]
  ------------------
  792|    434|  case JCS_YCbCr:
  ------------------
  |  Branch (792:3): [True: 417, False: 978]
  ------------------
  793|    434|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (793:9): [True: 0, False: 434]
  ------------------
  794|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  795|    434|    break;
  796|       |
  797|    355|  case JCS_CMYK:
  ------------------
  |  Branch (797:3): [True: 355, False: 1.04k]
  ------------------
  798|    357|  case JCS_YCCK:
  ------------------
  |  Branch (798:3): [True: 2, False: 1.39k]
  ------------------
  799|    357|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (799:9): [True: 0, False: 357]
  ------------------
  800|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  801|    357|    break;
  802|       |
  803|    125|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (803:3): [True: 125, False: 1.27k]
  ------------------
  804|    125|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (804:9): [True: 0, False: 125]
  ------------------
  805|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  806|    125|    break;
  807|  1.39k|  }
  808|       |
  809|       |  /* Set out_color_components and conversion method based on requested space.
  810|       |   * Also clear the component_needed flags for any unused components,
  811|       |   * so that earlier pipeline stages can avoid useless computation.
  812|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  813|       |   * mode.
  814|       |   */
  815|       |
  816|  1.39k|  switch (cinfo->out_color_space) {
  817|    192|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (817:3): [True: 192, False: 1.20k]
  ------------------
  818|    192|#ifdef D_LOSSLESS_SUPPORTED
  819|    192|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (819:9): [True: 0, False: 192]
  ------------------
  820|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (820:9): [True: 0, False: 0]
  ------------------
  821|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  822|    192|#endif
  823|    192|    cinfo->out_color_components = 1;
  824|    192|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (824:9): [True: 192, False: 0]
  ------------------
  825|    192|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (825:9): [True: 0, False: 0]
  ------------------
  826|    192|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  149|    192|#define _color_convert  color_convert_12
  ------------------
  827|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  828|    192|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (828:20): [True: 0, False: 192]
  ------------------
  829|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  830|    192|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (830:16): [True: 0, False: 0]
  ------------------
  831|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  149|      0|#define _color_convert  color_convert_12
  ------------------
  832|      0|      build_rgb_y_table(cinfo);
  833|      0|    } else
  834|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  835|    192|    break;
  836|       |
  837|    102|  case JCS_RGB:
  ------------------
  |  Branch (837:3): [True: 102, False: 1.29k]
  ------------------
  838|    102|  case JCS_EXT_RGB:
  ------------------
  |  Branch (838:3): [True: 0, False: 1.39k]
  ------------------
  839|    102|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (839:3): [True: 0, False: 1.39k]
  ------------------
  840|    255|  case JCS_EXT_BGR:
  ------------------
  |  Branch (840:3): [True: 153, False: 1.24k]
  ------------------
  841|    255|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (841:3): [True: 0, False: 1.39k]
  ------------------
  842|    255|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (842:3): [True: 0, False: 1.39k]
  ------------------
  843|    255|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (843:3): [True: 0, False: 1.39k]
  ------------------
  844|    255|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (844:3): [True: 0, False: 1.39k]
  ------------------
  845|    255|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (845:3): [True: 0, False: 1.39k]
  ------------------
  846|    255|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (846:3): [True: 0, False: 1.39k]
  ------------------
  847|    255|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (847:3): [True: 0, False: 1.39k]
  ------------------
  848|    255|#ifdef D_LOSSLESS_SUPPORTED
  849|    255|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (849:9): [True: 0, False: 255]
  |  Branch (849:36): [True: 0, False: 0]
  ------------------
  850|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  851|    255|#endif
  852|    255|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  853|    255|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (853:9): [True: 250, False: 5]
  ------------------
  854|       |#ifdef WITH_SIMD
  855|       |      if (jsimd_can_ycc_rgb())
  856|       |        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  857|       |      else
  858|       |#endif
  859|    250|      {
  860|    250|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  149|    250|#define _color_convert  color_convert_12
  ------------------
  861|    250|        build_ycc_rgb_table(cinfo);
  862|    250|      }
  863|    250|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (863:16): [True: 0, False: 5]
  ------------------
  864|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  149|      0|#define _color_convert  color_convert_12
  ------------------
  865|      5|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (865:16): [True: 5, False: 0]
  ------------------
  866|      5|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (866:11): [True: 2, False: 3]
  ------------------
  867|      2|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (867:11): [True: 2, False: 0]
  ------------------
  868|      2|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (868:11): [True: 2, False: 0]
  ------------------
  869|      2|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (869:11): [True: 2, False: 0]
  ------------------
  870|      2|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  149|      2|#define _color_convert  color_convert_12
  ------------------
  871|      3|      else
  872|      3|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  149|      3|#define _color_convert  color_convert_12
  ------------------
  873|      5|    } else
  874|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  875|    255|    break;
  876|       |
  877|    466|  case JCS_RGB565:
  ------------------
  |  Branch (877:3): [True: 466, False: 929]
  ------------------
  878|    466|#ifdef D_LOSSLESS_SUPPORTED
  879|    466|    if (cinfo->master->lossless)
  ------------------
  |  Branch (879:9): [True: 5, False: 461]
  ------------------
  880|      5|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  881|    466|#endif
  882|    466|    cinfo->out_color_components = 3;
  883|    466|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (883:9): [True: 346, False: 120]
  ------------------
  884|    346|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (884:11): [True: 117, False: 229]
  ------------------
  885|       |#ifdef WITH_SIMD
  886|       |        if (jsimd_can_ycc_rgb565())
  887|       |          cconvert->pub._color_convert = jsimd_ycc_rgb565_convert;
  888|       |        else
  889|       |#endif
  890|    117|        {
  891|    117|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  149|    117|#define _color_convert  color_convert_12
  ------------------
  892|    117|          build_ycc_rgb_table(cinfo);
  893|    117|        }
  894|    229|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (894:18): [True: 221, False: 8]
  ------------------
  895|    221|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  149|    221|#define _color_convert  color_convert_12
  ------------------
  896|    221|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (896:18): [True: 8, False: 0]
  ------------------
  897|      8|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  149|      8|#define _color_convert  color_convert_12
  ------------------
  898|      8|      } else
  899|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  900|    346|    } else {
  901|       |      /* only ordered dithering is supported */
  902|    120|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (902:11): [True: 50, False: 70]
  ------------------
  903|     50|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  149|     50|#define _color_convert  color_convert_12
  ------------------
  904|     50|        build_ycc_rgb_table(cinfo);
  905|     70|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (905:18): [True: 64, False: 6]
  ------------------
  906|     64|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  149|     64|#define _color_convert  color_convert_12
  ------------------
  907|     64|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (907:18): [True: 1, False: 5]
  ------------------
  908|      1|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  149|      1|#define _color_convert  color_convert_12
  ------------------
  909|      1|      } else
  910|      5|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  911|    120|    }
  912|    466|    break;
  913|       |
  914|    357|  case JCS_CMYK:
  ------------------
  |  Branch (914:3): [True: 357, False: 1.03k]
  ------------------
  915|    357|#ifdef D_LOSSLESS_SUPPORTED
  916|    357|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (916:9): [True: 346, False: 11]
  ------------------
  917|    346|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (917:9): [True: 1, False: 345]
  ------------------
  918|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  919|    357|#endif
  920|    357|    cinfo->out_color_components = 4;
  921|    357|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (921:9): [True: 1, False: 356]
  ------------------
  922|      1|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  149|      1|#define _color_convert  color_convert_12
  ------------------
  923|      1|      build_ycc_rgb_table(cinfo);
  924|    356|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (924:16): [True: 355, False: 1]
  ------------------
  925|    355|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  149|    355|#define _color_convert  color_convert_12
  ------------------
  926|    355|    } else
  927|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  928|    357|    break;
  929|       |
  930|    125|  default:
  ------------------
  |  Branch (930:3): [True: 125, False: 1.27k]
  ------------------
  931|       |    /* Permit null conversion to same output space */
  932|    125|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (932:9): [True: 125, False: 0]
  ------------------
  933|    125|      cinfo->out_color_components = cinfo->num_components;
  934|    125|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  149|    125|#define _color_convert  color_convert_12
  ------------------
  935|    125|    } else                      /* unsupported non-null conversion */
  936|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  937|    125|    break;
  938|  1.39k|  }
  939|       |
  940|  1.38k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (940:7): [True: 447, False: 942]
  ------------------
  941|    447|    cinfo->output_components = 1; /* single colormapped output component */
  942|    942|  else
  943|    942|    cinfo->output_components = cinfo->out_color_components;
  944|  1.38k|}
jdcolor-12.c:start_pass_dcolor:
  747|    100|{
  748|       |  /* no work needed */
  749|    100|}
jdcolor-12.c:build_ycc_rgb_table:
  216|    418|{
  217|    418|#if BITS_IN_JSAMPLE != 16
  218|    418|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  219|    418|  int i;
  220|    418|  JLONG x;
  221|    418|  SHIFT_TEMPS
  222|       |
  223|    418|  cconvert->Cr_r_tab = (int *)
  224|    418|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    418|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  225|    418|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  108|    418|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    418|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  226|    418|  cconvert->Cb_b_tab = (int *)
  227|    418|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    418|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  228|    418|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  108|    418|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    418|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  229|    418|  cconvert->Cr_g_tab = (JLONG *)
  230|    418|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    418|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  231|    418|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  108|    418|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    418|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  232|    418|  cconvert->Cb_g_tab = (JLONG *)
  233|    418|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    418|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  234|    418|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  108|    418|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    418|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  235|       |
  236|  1.71M|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  109|    418|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|    418|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  108|  1.71M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  1.71M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (236:36): [True: 1.71M, False: 418]
  ------------------
  237|       |    /* i is the actual input pixel value, in the range 0.._MAXJSAMPLE */
  238|       |    /* The Cb or Cr value we are thinking of is x = i - _CENTERJSAMPLE */
  239|       |    /* Cr=>R value is nearest int to 1.40200 * x */
  240|  1.71M|    cconvert->Cr_r_tab[i] = (int)
  241|  1.71M|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|  1.71M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  242|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  243|  1.71M|    cconvert->Cb_b_tab[i] = (int)
  244|  1.71M|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  474|  1.71M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  245|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  246|  1.71M|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   82|  1.71M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|  1.71M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  247|       |    /* Cb=>G value is scaled-up -0.34414 * x */
  248|       |    /* We also add in ONE_HALF so that need not do it in inner loop */
  249|  1.71M|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   82|  1.71M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   80|  1.71M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   81|  1.71M|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   80|  1.71M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  250|  1.71M|  }
  251|       |#else
  252|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  253|       |#endif
  254|    418|}
j16init_color_deconverter:
  758|    418|{
  759|    418|  my_cconvert_ptr cconvert;
  760|    418|  int ci;
  761|       |
  762|    418|#ifdef D_LOSSLESS_SUPPORTED
  763|    418|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (763:7): [True: 418, False: 0]
  ------------------
  764|       |#if BITS_IN_JSAMPLE == 8
  765|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  766|       |#else
  767|    418|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    836|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (767:9): [True: 0, False: 418]
  ------------------
  768|    418|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    418|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (768:9): [True: 0, False: 418]
  ------------------
  769|      0|#endif
  770|      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)))
  ------------------
  771|    418|  } else
  772|      0|#endif
  773|      0|  {
  774|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (774:9): [True: 0, False: 0]
  ------------------
  775|      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)))
  ------------------
  776|      0|  }
  777|       |
  778|    418|  cconvert = (my_cconvert_ptr)
  779|    418|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    418|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  780|    418|                                sizeof(my_color_deconverter));
  781|    418|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  782|    418|  cconvert->pub.start_pass = start_pass_dcolor;
  783|       |
  784|       |  /* Make sure num_components agrees with jpeg_color_space */
  785|    418|  switch (cinfo->jpeg_color_space) {
  786|      4|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (786:3): [True: 4, False: 414]
  ------------------
  787|      4|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (787:9): [True: 0, False: 4]
  ------------------
  788|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  789|      4|    break;
  790|       |
  791|      1|  case JCS_RGB:
  ------------------
  |  Branch (791:3): [True: 1, False: 417]
  ------------------
  792|      2|  case JCS_YCbCr:
  ------------------
  |  Branch (792:3): [True: 1, False: 417]
  ------------------
  793|      2|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (793:9): [True: 0, False: 2]
  ------------------
  794|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  795|      2|    break;
  796|       |
  797|    294|  case JCS_CMYK:
  ------------------
  |  Branch (797:3): [True: 294, False: 124]
  ------------------
  798|    295|  case JCS_YCCK:
  ------------------
  |  Branch (798:3): [True: 1, False: 417]
  ------------------
  799|    295|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (799:9): [True: 0, False: 295]
  ------------------
  800|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  801|    295|    break;
  802|       |
  803|    117|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (803:3): [True: 117, False: 301]
  ------------------
  804|    117|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (804:9): [True: 0, False: 117]
  ------------------
  805|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  806|    117|    break;
  807|    418|  }
  808|       |
  809|       |  /* Set out_color_components and conversion method based on requested space.
  810|       |   * Also clear the component_needed flags for any unused components,
  811|       |   * so that earlier pipeline stages can avoid useless computation.
  812|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  813|       |   * mode.
  814|       |   */
  815|       |
  816|    418|  switch (cinfo->out_color_space) {
  817|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (817:3): [True: 0, False: 418]
  ------------------
  818|      0|#ifdef D_LOSSLESS_SUPPORTED
  819|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (819:9): [True: 0, False: 0]
  ------------------
  820|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (820:9): [True: 0, False: 0]
  ------------------
  821|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  822|      0|#endif
  823|      0|    cinfo->out_color_components = 1;
  824|      0|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (824:9): [True: 0, False: 0]
  ------------------
  825|      0|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (825:9): [True: 0, False: 0]
  ------------------
  826|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  827|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  828|      0|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (828:20): [True: 0, False: 0]
  ------------------
  829|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  830|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (830:16): [True: 0, False: 0]
  ------------------
  831|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  832|      0|      build_rgb_y_table(cinfo);
  833|      0|    } else
  834|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  835|      0|    break;
  836|       |
  837|      0|  case JCS_RGB:
  ------------------
  |  Branch (837:3): [True: 0, False: 418]
  ------------------
  838|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (838:3): [True: 0, False: 418]
  ------------------
  839|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (839:3): [True: 0, False: 418]
  ------------------
  840|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (840:3): [True: 0, False: 418]
  ------------------
  841|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (841:3): [True: 0, False: 418]
  ------------------
  842|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (842:3): [True: 0, False: 418]
  ------------------
  843|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (843:3): [True: 0, False: 418]
  ------------------
  844|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (844:3): [True: 0, False: 418]
  ------------------
  845|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (845:3): [True: 0, False: 418]
  ------------------
  846|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (846:3): [True: 0, False: 418]
  ------------------
  847|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (847:3): [True: 0, False: 418]
  ------------------
  848|      0|#ifdef D_LOSSLESS_SUPPORTED
  849|      0|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (849:9): [True: 0, False: 0]
  |  Branch (849:36): [True: 0, False: 0]
  ------------------
  850|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  851|      0|#endif
  852|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  853|      0|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (853:9): [True: 0, False: 0]
  ------------------
  854|       |#ifdef WITH_SIMD
  855|       |      if (jsimd_can_ycc_rgb())
  856|       |        cconvert->pub._color_convert = jsimd_ycc_rgb_convert;
  857|       |      else
  858|       |#endif
  859|      0|      {
  860|      0|        cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  861|      0|        build_ycc_rgb_table(cinfo);
  862|      0|      }
  863|      0|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (863:16): [True: 0, False: 0]
  ------------------
  864|      0|      cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  865|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (865:16): [True: 0, False: 0]
  ------------------
  866|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (866:11): [True: 0, False: 0]
  ------------------
  867|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (867:11): [True: 0, False: 0]
  ------------------
  868|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (868:11): [True: 0, False: 0]
  ------------------
  869|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (869:11): [True: 0, False: 0]
  ------------------
  870|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  871|      0|      else
  872|      0|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  873|      0|    } else
  874|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  875|      0|    break;
  876|       |
  877|      6|  case JCS_RGB565:
  ------------------
  |  Branch (877:3): [True: 6, False: 412]
  ------------------
  878|      6|#ifdef D_LOSSLESS_SUPPORTED
  879|      6|    if (cinfo->master->lossless)
  ------------------
  |  Branch (879:9): [True: 6, False: 0]
  ------------------
  880|      6|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  881|      6|#endif
  882|      6|    cinfo->out_color_components = 3;
  883|      6|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (883:9): [True: 0, False: 6]
  ------------------
  884|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (884:11): [True: 0, False: 0]
  ------------------
  885|       |#ifdef WITH_SIMD
  886|       |        if (jsimd_can_ycc_rgb565())
  887|       |          cconvert->pub._color_convert = jsimd_ycc_rgb565_convert;
  888|       |        else
  889|       |#endif
  890|      0|        {
  891|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  892|      0|          build_ycc_rgb_table(cinfo);
  893|      0|        }
  894|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (894:18): [True: 0, False: 0]
  ------------------
  895|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  896|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (896:18): [True: 0, False: 0]
  ------------------
  897|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  898|      0|      } else
  899|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  900|      6|    } else {
  901|       |      /* only ordered dithering is supported */
  902|      6|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (902:11): [True: 0, False: 6]
  ------------------
  903|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  904|      0|        build_ycc_rgb_table(cinfo);
  905|      6|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (905:18): [True: 0, False: 6]
  ------------------
  906|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  907|      6|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (907:18): [True: 0, False: 6]
  ------------------
  908|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  909|      0|      } else
  910|      6|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  911|      6|    }
  912|      6|    break;
  913|       |
  914|    295|  case JCS_CMYK:
  ------------------
  |  Branch (914:3): [True: 295, False: 123]
  ------------------
  915|    295|#ifdef D_LOSSLESS_SUPPORTED
  916|    295|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (916:9): [True: 295, False: 0]
  ------------------
  917|    295|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (917:9): [True: 1, False: 294]
  ------------------
  918|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  919|    295|#endif
  920|    295|    cinfo->out_color_components = 4;
  921|    295|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (921:9): [True: 0, False: 295]
  ------------------
  922|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  923|      0|      build_ycc_rgb_table(cinfo);
  924|    295|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (924:16): [True: 294, False: 1]
  ------------------
  925|    294|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|    294|#define _color_convert  color_convert_16
  ------------------
  926|    294|    } else
  927|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  928|    295|    break;
  929|       |
  930|    117|  default:
  ------------------
  |  Branch (930:3): [True: 117, False: 301]
  ------------------
  931|       |    /* Permit null conversion to same output space */
  932|    117|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (932:9): [True: 117, False: 0]
  ------------------
  933|    117|      cinfo->out_color_components = cinfo->num_components;
  934|    117|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|    117|#define _color_convert  color_convert_16
  ------------------
  935|    117|    } else                      /* unsupported non-null conversion */
  936|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  937|    117|    break;
  938|    418|  }
  939|       |
  940|    411|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (940:7): [True: 0, False: 411]
  ------------------
  941|      0|    cinfo->output_components = 1; /* single colormapped output component */
  942|    411|  else
  943|    411|    cinfo->output_components = cinfo->out_color_components;
  944|    411|}
jdcolor-16.c:start_pass_dcolor:
  747|      6|{
  748|       |  /* no work needed */
  749|      6|}

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

jinit_d_diff_controller:
  348|    567|{
  349|    567|  my_diff_ptr diff;
  350|    567|  int ci;
  351|    567|  jpeg_component_info *compptr;
  352|       |
  353|    567|#if BITS_IN_JSAMPLE == 8
  354|    567|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.13k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 567]
  |  Branch (354:50): [True: 0, False: 567]
  ------------------
  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|    567|  diff = (my_diff_ptr)
  362|    567|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    567|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    567|                                sizeof(my_diff_controller));
  364|    567|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    567|  diff->pub.start_input_pass = start_input_pass;
  366|    567|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  2.69k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 2.12k, False: 567]
  ------------------
  370|  2.12k|       ci++, compptr++) {
  371|  2.12k|    diff->diff_buf[ci] =
  372|  2.12k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  2.12k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  2.12k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  2.12k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  2.12k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  2.12k|                                         (long)compptr->h_samp_factor),
  375|  2.12k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  2.12k|    diff->undiff_buf[ci] =
  377|  2.12k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  2.12k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  2.12k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  2.12k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  2.12k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  2.12k|                                         (long)compptr->h_samp_factor),
  380|  2.12k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  2.12k|  }
  382|       |
  383|    567|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 534, False: 33]
  ------------------
  384|    534|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    534|    int access_rows;
  387|       |
  388|  2.53k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.99k, False: 534]
  ------------------
  389|  1.99k|         ci++, compptr++) {
  390|  1.99k|      access_rows = compptr->v_samp_factor;
  391|  1.99k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.99k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.99k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.99k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.99k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.99k|                               (long)compptr->h_samp_factor),
  395|  1.99k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.99k|                               (long)compptr->v_samp_factor),
  397|  1.99k|         (JDIMENSION)access_rows);
  398|  1.99k|    }
  399|    534|    diff->pub.consume_data = consume_data;
  400|    534|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  254|    534|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    534|  } else {
  405|     33|    diff->pub.consume_data = dummy_consume_data;
  406|     33|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  254|     33|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|     33|  }
  409|    567|}
jddiffct-8.c:start_input_pass:
   94|  1.67k|{
   95|  1.67k|  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|  1.67k|  (*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|  1.67k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 8, False: 1.66k]
  ------------------
  108|      8|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      8|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  1.67k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  1.67k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  1.67k|  cinfo->input_iMCU_row = 0;
  115|  1.67k|  start_iMCU_row(cinfo);
  116|  1.67k|}
jddiffct-8.c:start_iMCU_row:
   67|  5.68M|{
   68|  5.68M|  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|  5.68M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 3.33M, False: 2.35M]
  ------------------
   75|  3.33M|    diff->MCU_rows_per_iMCU_row = 1;
   76|  3.33M|  } else {
   77|  2.35M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 2.35M, False: 763]
  ------------------
   78|  2.35M|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    763|    else
   80|    763|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  2.35M|  }
   82|       |
   83|  5.68M|  diff->MCU_ctr = 0;
   84|  5.68M|  diff->MCU_vert_offset = 0;
   85|  5.68M|}
jddiffct-8.c:start_output_pass:
  147|    667|{
  148|    667|  cinfo->output_iMCU_row = 0;
  149|    667|}
jddiffct-8.c:consume_data:
  266|  5.68M|{
  267|  5.68M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  5.68M|  int ci, compi;
  269|  5.68M|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  226|  5.68M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  270|  5.68M|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  18.0M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 12.3M, False: 5.68M]
  ------------------
  274|  12.3M|    compptr = cinfo->cur_comp_info[ci];
  275|  12.3M|    compi = compptr->component_index;
  276|  12.3M|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  12.3M|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  12.3M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  12.3M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  12.3M|#define TRUE    1
  ------------------
  280|  12.3M|  }
  281|       |
  282|  5.68M|  return decompress_data(cinfo, buffer);
  283|  5.68M|}
jddiffct-8.c:output_data:
  296|  1.59M|{
  297|  1.59M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  298|  1.59M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  299|  1.59M|  int ci, samp_rows, row;
  300|  1.59M|  _JSAMPARRAY buffer;
  ------------------
  |  |  226|  1.59M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  301|  1.59M|  jpeg_component_info *compptr;
  302|       |
  303|       |  /* Force some input to be done if we are getting ahead of the input. */
  304|  3.18M|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (304:10): [True: 0, False: 3.18M]
  ------------------
  305|  3.18M|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (305:11): [True: 3.18M, False: 0]
  ------------------
  306|  3.18M|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (306:11): [True: 1.59M, False: 1.59M]
  ------------------
  307|  1.59M|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  1.59M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (307:9): [True: 0, False: 1.59M]
  ------------------
  308|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  309|  1.59M|  }
  310|       |
  311|       |  /* OK, output from the virtual arrays. */
  312|  7.95M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (312:44): [True: 6.35M, False: 1.59M]
  ------------------
  313|  6.35M|       ci++, compptr++) {
  314|       |    /* Align the virtual buffer for this component. */
  315|  6.35M|    buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  316|  6.35M|      ((j_common_ptr)cinfo, diff->whole_image[ci],
  317|  6.35M|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  318|  6.35M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  6.35M|#define FALSE   0               /* values of boolean */
  ------------------
  319|       |
  320|  6.35M|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (320:9): [True: 6.35M, False: 2.44k]
  ------------------
  321|  6.35M|      samp_rows = compptr->v_samp_factor;
  322|  2.44k|    else {
  323|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  324|  2.44k|      samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  325|  2.44k|      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (325:11): [True: 1.45k, False: 985]
  ------------------
  326|  2.44k|    }
  327|       |
  328|  18.8M|    for (row = 0; row < samp_rows; row++) {
  ------------------
  |  Branch (328:19): [True: 12.5M, False: 6.35M]
  ------------------
  329|  12.5M|      memcpy(output_buf[ci][row], buffer[row],
  330|  12.5M|             compptr->width_in_blocks * sizeof(_JSAMPLE));
  331|  12.5M|    }
  332|  6.35M|  }
  333|       |
  334|  1.59M|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (334:7): [True: 1.59M, False: 640]
  ------------------
  335|  1.59M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  1.59M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  336|    640|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    640|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  337|  1.59M|}
jddiffct-8.c:decompress_data:
  164|  5.68M|{
  165|  5.68M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  5.68M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  5.68M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  5.68M|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  5.68M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  5.68M|  int ci, compi, row, prev_row;
  171|  5.68M|  unsigned int yoffset;
  172|  5.68M|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  12.6M|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 6.93M, False: 5.68M]
  ------------------
  176|  6.93M|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  6.93M|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 1.26M, False: 5.66M]
  ------------------
  180|  1.26M|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 29.3k, False: 1.23M]
  ------------------
  181|  29.3k|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 29.3k]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  1.26M|    }
  184|       |
  185|  6.93M|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  6.93M|    MCU_count =
  188|  6.93M|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  6.93M|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  6.93M|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  6.93M|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 6.93M]
  ------------------
  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|  6.93M|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 1.26M, False: 5.66M]
  ------------------
  200|  1.26M|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  6.93M|    diff->MCU_ctr = 0;
  204|  6.93M|  }
  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|  18.0M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 12.3M, False: 5.68M]
  ------------------
  212|  12.3M|    compptr = cinfo->cur_comp_info[ci];
  213|  12.3M|    compi = compptr->component_index;
  214|  12.3M|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  36.5M|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 24.1M, False: 12.3M]
  |  Branch (215:17): [True: 8.06k, False: 36.4M]
  ------------------
  216|  36.4M|                compptr->last_row_height : compptr->v_samp_factor);
  217|  24.1M|         prev_row = row, row++) {
  218|  24.1M|      (*losslessd->predict_undifference[compi])
  219|  24.1M|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  24.1M|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  24.1M|          compptr->width_in_blocks);
  222|  24.1M|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  24.1M|                                  output_buf[compi][row],
  224|  24.1M|                                  compptr->width_in_blocks);
  225|  24.1M|    }
  226|  12.3M|  }
  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|  5.68M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 5.68M, False: 1.62k]
  ------------------
  235|  5.68M|    start_iMCU_row(cinfo);
  236|  5.68M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  5.68M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  5.68M|  }
  238|       |  /* Completed the scan */
  239|  1.62k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  1.62k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.62k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  5.68M|}
jddiffct-8.c:process_restart:
  126|  29.3k|{
  127|  29.3k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|  29.3k|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 29.3k]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|  29.3k|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|  29.3k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|  29.3k|  return TRUE;
  ------------------
  |  |  210|  29.3k|#define TRUE    1
  ------------------
  138|  29.3k|}
j12init_d_diff_controller:
  348|    411|{
  349|    411|  my_diff_ptr diff;
  350|    411|  int ci;
  351|    411|  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|    411|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    822|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 411]
  ------------------
  357|    411|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    411|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 411]
  ------------------
  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|    411|  diff = (my_diff_ptr)
  362|    411|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    411|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    411|                                sizeof(my_diff_controller));
  364|    411|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    411|  diff->pub.start_input_pass = start_input_pass;
  366|    411|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  1.97k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1.56k, False: 411]
  ------------------
  370|  1.56k|       ci++, compptr++) {
  371|  1.56k|    diff->diff_buf[ci] =
  372|  1.56k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.56k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.56k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.56k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  1.56k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  1.56k|                                         (long)compptr->h_samp_factor),
  375|  1.56k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  1.56k|    diff->undiff_buf[ci] =
  377|  1.56k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.56k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.56k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.56k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  1.56k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  1.56k|                                         (long)compptr->h_samp_factor),
  380|  1.56k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  1.56k|  }
  382|       |
  383|    411|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 408, False: 3]
  ------------------
  384|    408|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    408|    int access_rows;
  387|       |
  388|  1.96k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.55k, False: 408]
  ------------------
  389|  1.55k|         ci++, compptr++) {
  390|  1.55k|      access_rows = compptr->v_samp_factor;
  391|  1.55k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.55k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.55k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.55k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.55k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.55k|                               (long)compptr->h_samp_factor),
  395|  1.55k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.55k|                               (long)compptr->v_samp_factor),
  397|  1.55k|         (JDIMENSION)access_rows);
  398|  1.55k|    }
  399|    408|    diff->pub.consume_data = consume_data;
  400|    408|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  140|    408|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    408|  } else {
  405|      3|    diff->pub.consume_data = dummy_consume_data;
  406|      3|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  140|      3|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      3|  }
  409|    411|}
jddiffct-12.c:start_input_pass:
   94|    358|{
   95|    358|  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|    358|  (*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|    358|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 9, False: 349]
  ------------------
  108|      9|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      9|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      9|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|    358|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    358|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    358|  cinfo->input_iMCU_row = 0;
  115|    358|  start_iMCU_row(cinfo);
  116|    358|}
jddiffct-12.c:start_iMCU_row:
   67|  1.97M|{
   68|  1.97M|  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|  1.97M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 473k, False: 1.50M]
  ------------------
   75|   473k|    diff->MCU_rows_per_iMCU_row = 1;
   76|  1.50M|  } else {
   77|  1.50M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 1.50M, False: 283]
  ------------------
   78|  1.50M|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    283|    else
   80|    283|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  1.50M|  }
   82|       |
   83|  1.97M|  diff->MCU_ctr = 0;
   84|  1.97M|  diff->MCU_vert_offset = 0;
   85|  1.97M|}
jddiffct-12.c:start_output_pass:
  147|      5|{
  148|      5|  cinfo->output_iMCU_row = 0;
  149|      5|}
jddiffct-12.c:consume_data:
  266|  1.97M|{
  267|  1.97M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  1.97M|  int ci, compi;
  269|  1.97M|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  112|  1.97M|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  270|  1.97M|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  4.89M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 2.91M, False: 1.97M]
  ------------------
  274|  2.91M|    compptr = cinfo->cur_comp_info[ci];
  275|  2.91M|    compi = compptr->component_index;
  276|  2.91M|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  2.91M|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  2.91M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  2.91M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  2.91M|#define TRUE    1
  ------------------
  280|  2.91M|  }
  281|       |
  282|  1.97M|  return decompress_data(cinfo, buffer);
  283|  1.97M|}
jddiffct-12.c:decompress_data:
  164|  1.97M|{
  165|  1.97M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  1.97M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  1.97M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  1.97M|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  1.97M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  1.97M|  int ci, compi, row, prev_row;
  171|  1.97M|  unsigned int yoffset;
  172|  1.97M|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  4.45M|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 2.47M, False: 1.97M]
  ------------------
  176|  2.47M|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  2.47M|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 668k, False: 1.80M]
  ------------------
  180|   668k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 17.9k, False: 651k]
  ------------------
  181|  17.9k|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 17.9k]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|   668k|    }
  184|       |
  185|  2.47M|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  2.47M|    MCU_count =
  188|  2.47M|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  2.47M|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  2.47M|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  2.47M|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 2.47M]
  ------------------
  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|  2.47M|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 668k, False: 1.80M]
  ------------------
  200|   668k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  2.47M|    diff->MCU_ctr = 0;
  204|  2.47M|  }
  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|  4.89M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 2.91M, False: 1.97M]
  ------------------
  212|  2.91M|    compptr = cinfo->cur_comp_info[ci];
  213|  2.91M|    compi = compptr->component_index;
  214|  2.91M|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  6.85M|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 3.93M, False: 2.91M]
  |  Branch (215:17): [True: 1.02k, False: 6.85M]
  ------------------
  216|  6.85M|                compptr->last_row_height : compptr->v_samp_factor);
  217|  3.93M|         prev_row = row, row++) {
  218|  3.93M|      (*losslessd->predict_undifference[compi])
  219|  3.93M|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  3.93M|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  3.93M|          compptr->width_in_blocks);
  222|  3.93M|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  3.93M|                                  output_buf[compi][row],
  224|  3.93M|                                  compptr->width_in_blocks);
  225|  3.93M|    }
  226|  2.91M|  }
  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|  1.97M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 1.97M, False: 328]
  ------------------
  235|  1.97M|    start_iMCU_row(cinfo);
  236|  1.97M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  1.97M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  1.97M|  }
  238|       |  /* Completed the scan */
  239|    328|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    328|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    328|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  1.97M|}
jddiffct-12.c:process_restart:
  126|  17.9k|{
  127|  17.9k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|  17.9k|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 17.9k]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|  17.9k|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|  17.9k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|  17.9k|  return TRUE;
  ------------------
  |  |  210|  17.9k|#define TRUE    1
  ------------------
  138|  17.9k|}
j16init_d_diff_controller:
  348|    391|{
  349|    391|  my_diff_ptr diff;
  350|    391|  int ci;
  351|    391|  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|    391|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    782|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (356:7): [True: 0, False: 391]
  ------------------
  357|    391|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    391|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (357:7): [True: 0, False: 391]
  ------------------
  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|    391|  diff = (my_diff_ptr)
  362|    391|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    391|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    391|                                sizeof(my_diff_controller));
  364|    391|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    391|  diff->pub.start_input_pass = start_input_pass;
  366|    391|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  1.78k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1.39k, False: 391]
  ------------------
  370|  1.39k|       ci++, compptr++) {
  371|  1.39k|    diff->diff_buf[ci] =
  372|  1.39k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.39k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.39k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.39k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  1.39k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  1.39k|                                         (long)compptr->h_samp_factor),
  375|  1.39k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  1.39k|    diff->undiff_buf[ci] =
  377|  1.39k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.39k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.39k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.39k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  1.39k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  1.39k|                                         (long)compptr->h_samp_factor),
  380|  1.39k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  1.39k|  }
  382|       |
  383|    391|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 388, False: 3]
  ------------------
  384|    388|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    388|    int access_rows;
  387|       |
  388|  1.77k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.38k, False: 388]
  ------------------
  389|  1.38k|         ci++, compptr++) {
  390|  1.38k|      access_rows = compptr->v_samp_factor;
  391|  1.38k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.38k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.38k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.38k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.38k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.38k|                               (long)compptr->h_samp_factor),
  395|  1.38k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.38k|                               (long)compptr->v_samp_factor),
  397|  1.38k|         (JDIMENSION)access_rows);
  398|  1.38k|    }
  399|    388|    diff->pub.consume_data = consume_data;
  400|    388|    diff->pub._decompress_data = output_data;
  ------------------
  |  |   53|    388|#define _decompress_data  decompress_data_16
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    388|  } else {
  405|      3|    diff->pub.consume_data = dummy_consume_data;
  406|      3|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |   53|      3|#define _decompress_data  decompress_data_16
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      3|  }
  409|    391|}
jddiffct-16.c:start_input_pass:
   94|    358|{
   95|    358|  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|    358|  (*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|    358|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 15, False: 343]
  ------------------
  108|     15|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|     15|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     15|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     15|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     15|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|    358|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    358|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    358|  cinfo->input_iMCU_row = 0;
  115|    358|  start_iMCU_row(cinfo);
  116|    358|}
jddiffct-16.c:start_iMCU_row:
   67|  2.03M|{
   68|  2.03M|  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|  2.03M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 80.5k, False: 1.95M]
  ------------------
   75|  80.5k|    diff->MCU_rows_per_iMCU_row = 1;
   76|  1.95M|  } else {
   77|  1.95M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 1.95M, False: 295]
  ------------------
   78|  1.95M|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    295|    else
   80|    295|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  1.95M|  }
   82|       |
   83|  2.03M|  diff->MCU_ctr = 0;
   84|  2.03M|  diff->MCU_vert_offset = 0;
   85|  2.03M|}
jddiffct-16.c:start_output_pass:
  147|      6|{
  148|      6|  cinfo->output_iMCU_row = 0;
  149|      6|}
jddiffct-16.c:consume_data:
  266|  2.03M|{
  267|  2.03M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  2.03M|  int ci, compi;
  269|  2.03M|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |   28|  2.03M|#define _JSAMPARRAY  J16SAMPARRAY
  ------------------
  270|  2.03M|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  4.22M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 2.19M, False: 2.03M]
  ------------------
  274|  2.19M|    compptr = cinfo->cur_comp_info[ci];
  275|  2.19M|    compi = compptr->component_index;
  276|  2.19M|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  2.19M|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  2.19M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  2.19M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  2.19M|#define TRUE    1
  ------------------
  280|  2.19M|  }
  281|       |
  282|  2.03M|  return decompress_data(cinfo, buffer);
  283|  2.03M|}
jddiffct-16.c:decompress_data:
  164|  2.03M|{
  165|  2.03M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  2.03M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  2.03M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  2.03M|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  2.03M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  2.03M|  int ci, compi, row, prev_row;
  171|  2.03M|  unsigned int yoffset;
  172|  2.03M|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  4.45M|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 2.41M, False: 2.03M]
  ------------------
  176|  2.41M|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  2.41M|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 502k, False: 1.91M]
  ------------------
  180|   502k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 639, False: 502k]
  ------------------
  181|    639|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 639]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|   502k|    }
  184|       |
  185|  2.41M|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  2.41M|    MCU_count =
  188|  2.41M|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  2.41M|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  2.41M|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  2.41M|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 2.41M]
  ------------------
  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|  2.41M|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 502k, False: 1.91M]
  ------------------
  200|   502k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  2.41M|    diff->MCU_ctr = 0;
  204|  2.41M|  }
  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|  4.22M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 2.19M, False: 2.03M]
  ------------------
  212|  2.19M|    compptr = cinfo->cur_comp_info[ci];
  213|  2.19M|    compi = compptr->component_index;
  214|  2.19M|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  4.82M|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 2.63M, False: 2.19M]
  |  Branch (215:17): [True: 888, False: 4.82M]
  ------------------
  216|  4.82M|                compptr->last_row_height : compptr->v_samp_factor);
  217|  2.63M|         prev_row = row, row++) {
  218|  2.63M|      (*losslessd->predict_undifference[compi])
  219|  2.63M|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  2.63M|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  2.63M|          compptr->width_in_blocks);
  222|  2.63M|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  2.63M|                                  output_buf[compi][row],
  224|  2.63M|                                  compptr->width_in_blocks);
  225|  2.63M|    }
  226|  2.19M|  }
  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|  2.03M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 2.03M, False: 317]
  ------------------
  235|  2.03M|    start_iMCU_row(cinfo);
  236|  2.03M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.03M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  2.03M|  }
  238|       |  /* Completed the scan */
  239|    317|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    317|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    317|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  2.03M|}
jddiffct-16.c:process_restart:
  126|    639|{
  127|    639|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|    639|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 639]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|    639|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|    639|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|    639|  return TRUE;
  ------------------
  |  |  210|    639|#define TRUE    1
  ------------------
  138|    639|}

jpeg_make_d_derived_tbl:
  145|  52.7k|{
  146|  52.7k|  JHUFF_TBL *htbl;
  147|  52.7k|  d_derived_tbl *dtbl;
  148|  52.7k|  int p, i, l, si, numsymbols;
  149|  52.7k|  int lookbits, ctr;
  150|  52.7k|  char huffsize[257];
  151|  52.7k|  unsigned int huffcode[257];
  152|  52.7k|  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|  52.7k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  52.7k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 52.7k]
  |  Branch (159:20): [True: 20, False: 52.7k]
  ------------------
  160|     20|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     20|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  52.7k|  htbl =
  162|  52.7k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 28.1k, False: 24.5k]
  ------------------
  163|  52.7k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 60, False: 52.6k]
  ------------------
  164|     60|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     60|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     60|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     60|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  52.7k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 18.2k, False: 34.4k]
  ------------------
  168|  18.2k|    *pdtbl = (d_derived_tbl *)
  169|  18.2k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  18.2k|                                  sizeof(d_derived_tbl));
  171|  52.7k|  dtbl = *pdtbl;
  172|  52.7k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  52.7k|  p = 0;
  177|   894k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 842k, False: 52.7k]
  ------------------
  178|   842k|    i = (int)htbl->bits[l];
  179|   842k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 842k]
  |  Branch (179:18): [True: 0, False: 842k]
  ------------------
  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|  4.00M|    while (i--)
  ------------------
  |  Branch (181:12): [True: 3.16M, False: 842k]
  ------------------
  182|  3.16M|      huffsize[p++] = (char)l;
  183|   842k|  }
  184|  52.7k|  huffsize[p] = 0;
  185|  52.7k|  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|  52.7k|  code = 0;
  191|  52.7k|  si = huffsize[0];
  192|  52.7k|  p = 0;
  193|   559k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 507k, False: 52.7k]
  ------------------
  194|  3.67M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 3.16M, False: 507k]
  ------------------
  195|  3.16M|      huffcode[p++] = code;
  196|  3.16M|      code++;
  197|  3.16M|    }
  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|   507k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 16, False: 507k]
  ------------------
  202|     16|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     16|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|   507k|    code <<= 1;
  204|   507k|    si++;
  205|   507k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  52.7k|  p = 0;
  210|   894k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 841k, False: 52.7k]
  ------------------
  211|   841k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 453k, False: 388k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   453k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   453k|      p += htbl->bits[l];
  217|   453k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|   453k|    } else {
  219|   388k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|   388k|    }
  221|   841k|  }
  222|  52.7k|  dtbl->valoffset[17] = 0;
  223|  52.7k|  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|  13.5M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  13.5M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 13.4M, False: 52.7k]
  ------------------
  233|  13.4M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  13.4M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  13.4M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  52.7k|  p = 0;
  236|   473k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|   473k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 420k, False: 52.7k]
  ------------------
  237|  1.06M|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 640k, False: 420k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|   640k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|   640k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  13.1M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|   640k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 12.4M, False: 640k]
  ------------------
  242|  12.4M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  12.4M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  12.4M|        lookbits++;
  244|  12.4M|      }
  245|   640k|    }
  246|   420k|  }
  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|  52.7k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 28.1k, False: 24.6k]
  ------------------
  255|   284k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 256k, False: 28.1k]
  ------------------
  256|   256k|      int sym = htbl->huffval[i];
  257|   256k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 256k]
  |  Branch (257:22): [True: 24, False: 256k]
  |  Branch (257:29): [True: 14.0k, False: 242k]
  ------------------
  258|     24|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|   256k|    }
  260|  28.1k|  }
  261|  52.7k|}
jpeg_fill_bit_buffer:
  291|  2.68M|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|  2.68M|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|  2.68M|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|  2.68M|  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|  2.68M|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 168k, False: 2.51M]
  ------------------
  302|  1.19M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  1.19M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.19M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 1.05M, False: 137k]
  ------------------
  303|  1.05M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  1.05M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 6.17k, False: 1.05M]
  ------------------
  307|  6.17k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 6.17k]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|  6.17k|        next_input_byte = cinfo->src->next_input_byte;
  310|  6.17k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|  6.17k|      }
  312|  1.05M|      bytes_in_buffer--;
  313|  1.05M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  1.05M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 52.4k, False: 1.00M]
  ------------------
  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|  73.7k|        do {
  323|  73.7k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 275, False: 73.4k]
  ------------------
  324|    275|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 275]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|    275|            next_input_byte = cinfo->src->next_input_byte;
  327|    275|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|    275|          }
  329|  73.7k|          bytes_in_buffer--;
  330|  73.7k|          c = *next_input_byte++;
  331|  73.7k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 21.2k, False: 52.4k]
  ------------------
  332|       |
  333|  52.4k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 22.0k, False: 30.4k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  22.0k|          c = 0xFF;
  336|  30.4k|        } 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|  30.4k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  30.4k|          goto no_more_bytes;
  348|  30.4k|        }
  349|  52.4k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.02M|      get_buffer = (get_buffer << 8) | c;
  353|  1.02M|      bits_left += 8;
  354|  1.02M|    } /* end while */
  355|  2.51M|  } else {
  356|  2.54M|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|  2.54M|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 772k, False: 1.77M]
  ------------------
  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|   772k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 25.6k, False: 746k]
  ------------------
  368|  25.6k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  25.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  25.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  25.6k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|  25.6k|#define TRUE    1
  ------------------
  370|  25.6k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|   772k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|   772k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   772k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|   772k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|   772k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   772k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|   772k|    }
  375|  2.54M|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|  2.68M|  state->next_input_byte = next_input_byte;
  379|  2.68M|  state->bytes_in_buffer = bytes_in_buffer;
  380|  2.68M|  state->get_buffer = get_buffer;
  381|  2.68M|  state->bits_left = bits_left;
  382|       |
  383|  2.68M|  return TRUE;
  ------------------
  |  |  210|  2.68M|#define TRUE    1
  ------------------
  384|  2.68M|}
jpeg_huff_decode:
  439|  1.78M|{
  440|  1.78M|  register int l = min_bits;
  441|  1.78M|  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|  1.78M|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  1.78M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.78M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 191k, False: 1.59M]
  |  |  ------------------
  |  |  162|   191k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 191k]
  |  |  ------------------
  |  |  163|   191k|      { action; } \
  |  |  164|   191k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|   191k|  } \
  |  |  166|  1.78M|}
  ------------------
  447|  1.78M|  code = GET_BITS(l);
  ------------------
  |  |  169|  1.78M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  448|       |
  449|       |  /* Collect the rest of the Huffman code one bit at a time. */
  450|       |  /* This is per Figure F.16. */
  451|       |
  452|  2.25M|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 467k, False: 1.78M]
  ------------------
  453|   467k|    code <<= 1;
  454|   467k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|   467k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   467k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 43.5k, False: 424k]
  |  |  ------------------
  |  |  162|  43.5k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 43.5k]
  |  |  ------------------
  |  |  163|  43.5k|      { action; } \
  |  |  164|  43.5k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  43.5k|  } \
  |  |  166|   467k|}
  ------------------
  455|   467k|    code |= GET_BITS(1);
  ------------------
  |  |  169|   467k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|   467k|    l++;
  457|   467k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  1.78M|  state->get_buffer = get_buffer;
  461|  1.78M|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  1.78M|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 20.0k, False: 1.76M]
  ------------------
  466|  20.0k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  20.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  20.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|  20.0k|    return 0;                   /* fake a zero as the safest result */
  468|  20.0k|  }
  469|       |
  470|  1.76M|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  1.78M|}
jinit_huff_decoder:
  815|  6.43k|{
  816|  6.43k|  huff_entropy_ptr entropy;
  817|  6.43k|  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|  6.43k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  6.43k|  entropy = (huff_entropy_ptr)
  826|  6.43k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.43k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  6.43k|                                sizeof(huff_entropy_decoder));
  828|  6.43k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  6.43k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  6.43k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  32.1k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  32.1k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 25.7k, False: 6.43k]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  25.7k|  }
  836|  6.43k|}
jdhuff.c:start_pass_huff_decoder:
   80|  13.6k|{
   81|  13.6k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  13.6k|  int ci, blkn, dctbl, actbl;
   83|  13.6k|  d_derived_tbl **pdtbl;
   84|  13.6k|  jpeg_component_info *compptr;
   85|       |
   86|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   87|       |   * This ought to be an error condition, but we make it a warning because
   88|       |   * there are some baseline files out there with all zeroes in these bytes.
   89|       |   */
   90|  13.6k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  4.96k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 8.67k, False: 4.96k]
  |  Branch (90:25): [True: 4.15k, False: 808]
  ------------------
   91|    808|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 247, False: 561]
  |  Branch (91:25): [True: 266, False: 295]
  ------------------
   92|  13.3k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  13.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  13.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  33.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 19.5k, False: 13.6k]
  ------------------
   95|  19.5k|    compptr = cinfo->cur_comp_info[ci];
   96|  19.5k|    dctbl = compptr->dc_tbl_no;
   97|  19.5k|    actbl = compptr->ac_tbl_no;
   98|       |    /* Compute derived values for Huffman tables */
   99|       |    /* We may do this more than once for a table, but it's not expensive */
  100|  19.5k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  19.5k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|  19.5k|#define TRUE    1
  ------------------
  102|  19.5k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  19.5k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|  19.5k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  19.5k|    entropy->saved.last_dc_val[ci] = 0;
  106|  19.5k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  41.2k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 27.6k, False: 13.6k]
  ------------------
  110|  27.6k|    ci = cinfo->MCU_membership[blkn];
  111|  27.6k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  27.6k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  27.6k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  27.6k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 27.6k, False: 0]
  ------------------
  117|  27.6k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|  27.6k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  27.6k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  27.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  27.6k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  27.6k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  13.6k|  entropy->bitstate.bits_left = 0;
  127|  13.6k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  13.6k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  13.6k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  13.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  13.6k|}
jdhuff.c:decode_mcu:
  771|  20.6M|{
  772|  20.6M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|  20.6M|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|  20.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 1.60M, False: 19.0M]
  ------------------
  777|  1.60M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 139k, False: 1.46M]
  ------------------
  778|   139k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 139k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  1.60M|    usefast = 0;
  781|  1.60M|  }
  782|       |
  783|  20.6M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|  20.6M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|  20.6M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 19.4M, False: 1.16M]
  ------------------
  784|  1.16M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 1.10M, False: 58.1k]
  ------------------
  785|  20.5M|    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|  20.6M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 164k, False: 20.4M]
  ------------------
  791|       |
  792|   164k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 57.2k, False: 107k]
  ------------------
  793|  57.2k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 4.30k, False: 52.9k]
  ------------------
  794|   107k|    } else {
  795|   111k|use_slow:
  796|   111k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 111k]
  ------------------
  797|   111k|    }
  798|       |
  799|   164k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|  20.6M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 1.60M, False: 19.0M]
  ------------------
  803|  1.60M|    entropy->restarts_to_go--;
  804|       |
  805|  20.6M|  return TRUE;
  ------------------
  |  |  210|  20.6M|#define TRUE    1
  ------------------
  806|  20.6M|}
jdhuff.c:process_restart:
  513|   139k|{
  514|   139k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|   139k|  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|   139k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|   139k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|   139k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 139k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|   280k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 141k, False: 139k]
  ------------------
  528|   141k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|   139k|  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|   139k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 1.45k, False: 138k]
  ------------------
  539|  1.45k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  1.45k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|   139k|  return TRUE;
  ------------------
  |  |  210|   139k|#define TRUE    1
  ------------------
  542|   139k|}
jdhuff.c:decode_mcu_fast:
  664|  57.2k|{
  665|  57.2k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|  57.2k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  57.2k|  register bit_buf_type get_buffer; \
  |  |  126|  57.2k|  register int bits_left; \
  |  |  127|  57.2k|  bitread_working_state br_state
  ------------------
  667|  57.2k|  JOCTET *buffer;
  668|  57.2k|  int blkn;
  669|  57.2k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|  57.2k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  57.2k|  br_state.cinfo = cinfop; \
  |  |  131|  57.2k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  57.2k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  57.2k|  get_buffer = permstate.get_buffer; \
  |  |  134|  57.2k|  bits_left = permstate.bits_left;
  ------------------
  674|  57.2k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|  57.2k|  state = entropy->saved;
  676|       |
  677|   116k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 59.5k, False: 57.2k]
  ------------------
  678|  59.5k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 49.4k, False: 10.0k]
  ------------------
  679|  59.5k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|  59.5k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|  59.5k|    register int s, k, r, l;
  682|       |
  683|  59.5k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|  59.5k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  59.5k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 11.9k, False: 47.5k]
  |  |  |  |  ------------------
  |  |  |  |  416|  11.9k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.56k, False: 10.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.56k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.56k|    buffer++; \
  |  |  |  |  |  |  401|  1.56k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 657, False: 903]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    657|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    657|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    657|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    657|      buffer -= 2; \
  |  |  |  |  |  |  406|    657|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    657|    } \
  |  |  |  |  |  |  408|  1.56k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.10k, False: 9.83k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.10k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.10k|    buffer++; \
  |  |  |  |  |  |  401|  2.10k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.15k, False: 948]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.15k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.15k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.15k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.15k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.15k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.15k|    } \
  |  |  |  |  |  |  408|  2.10k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.35k, False: 9.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.35k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.35k|    buffer++; \
  |  |  |  |  |  |  401|  2.35k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.40k, False: 954]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.40k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.40k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.40k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.40k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.40k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.40k|    } \
  |  |  |  |  |  |  408|  2.35k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.70k, False: 9.23k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.70k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.70k|    buffer++; \
  |  |  |  |  |  |  401|  2.70k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.53k, False: 1.17k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.53k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.53k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.53k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.53k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.53k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.53k|    } \
  |  |  |  |  |  |  408|  2.70k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.54k, False: 9.39k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.54k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.54k|    buffer++; \
  |  |  |  |  |  |  401|  2.54k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.75k, False: 785]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.75k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.75k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.75k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.75k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.75k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.75k|    } \
  |  |  |  |  |  |  408|  2.54k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.12k, False: 8.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.12k|    buffer++; \
  |  |  |  |  |  |  401|  3.12k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.94k, False: 1.17k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.94k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.94k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.94k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.94k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.94k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.94k|    } \
  |  |  |  |  |  |  408|  3.12k|  } \
  |  |  |  |  |  |  409|  11.9k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  11.9k|  }
  |  |  ------------------
  |  |  225|  59.5k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  59.5k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  59.5k|  s = htbl->lookup[s]; \
  |  |  227|  59.5k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  59.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  59.5k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  59.5k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  59.5k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  59.5k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  59.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  59.5k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   119k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 3.20k, False: 56.3k]
  |  |  ------------------
  |  |  232|  3.20k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  3.20k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  3.20k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  18.3k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 15.1k, False: 3.20k]
  |  |  ------------------
  |  |  236|  15.1k|      s <<= 1; \
  |  |  237|  15.1k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  15.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  15.1k|      nb++; \
  |  |  239|  15.1k|    } \
  |  |  240|  3.20k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1.85k, False: 1.35k]
  |  |  ------------------
  |  |  241|  3.20k|      s = 0; \
  |  |  242|  3.20k|    else \
  |  |  243|  3.20k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  3.20k|  }
  ------------------
  684|  59.5k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 34.1k, False: 25.4k]
  ------------------
  685|  34.1k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  34.1k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 2.84k, False: 31.2k]
  |  |  ------------------
  |  |  416|  2.84k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 701, False: 2.14k]
  |  |  |  |  ------------------
  |  |  |  |  399|    701|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    701|    buffer++; \
  |  |  |  |  401|    701|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 236, False: 465]
  |  |  |  |  ------------------
  |  |  |  |  402|    236|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    236|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    236|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    236|      buffer -= 2; \
  |  |  |  |  406|    236|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    236|    } \
  |  |  |  |  408|    701|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 905, False: 1.93k]
  |  |  |  |  ------------------
  |  |  |  |  399|    905|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    905|    buffer++; \
  |  |  |  |  401|    905|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 558, False: 347]
  |  |  |  |  ------------------
  |  |  |  |  402|    558|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    558|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    558|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    558|      buffer -= 2; \
  |  |  |  |  406|    558|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    558|    } \
  |  |  |  |  408|    905|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.03k, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.03k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.03k|    buffer++; \
  |  |  |  |  401|  1.03k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 588, False: 442]
  |  |  |  |  ------------------
  |  |  |  |  402|    588|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    588|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    588|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    588|      buffer -= 2; \
  |  |  |  |  406|    588|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    588|    } \
  |  |  |  |  408|  1.03k|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 957, False: 1.88k]
  |  |  |  |  ------------------
  |  |  |  |  399|    957|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    957|    buffer++; \
  |  |  |  |  401|    957|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 642, False: 315]
  |  |  |  |  ------------------
  |  |  |  |  402|    642|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    642|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    642|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    642|      buffer -= 2; \
  |  |  |  |  406|    642|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    642|    } \
  |  |  |  |  408|    957|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.07k, False: 1.77k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.07k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.07k|    buffer++; \
  |  |  |  |  401|  1.07k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 654, False: 416]
  |  |  |  |  ------------------
  |  |  |  |  402|    654|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    654|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    654|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    654|      buffer -= 2; \
  |  |  |  |  406|    654|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    654|    } \
  |  |  |  |  408|  1.07k|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  2.84k|#define GET_BYTE { \
  |  |  |  |  392|  2.84k|  register int c0, c1; \
  |  |  |  |  393|  2.84k|  c0 = *buffer++; \
  |  |  |  |  394|  2.84k|  c1 = *buffer; \
  |  |  |  |  395|  2.84k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  2.84k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  2.84k|  bits_left += 8; \
  |  |  |  |  398|  2.84k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.04k, False: 1.79k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.04k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.04k|    buffer++; \
  |  |  |  |  401|  1.04k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 676, False: 367]
  |  |  |  |  ------------------
  |  |  |  |  402|    676|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    676|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    676|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    676|      buffer -= 2; \
  |  |  |  |  406|    676|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    676|    } \
  |  |  |  |  408|  1.04k|  } \
  |  |  |  |  409|  2.84k|}
  |  |  ------------------
  |  |  417|  2.84k|  }
  ------------------
  686|  34.1k|      r = GET_BITS(s);
  ------------------
  |  |  169|  34.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  34.1k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  34.1k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  34.1k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  34.1k|    }
  689|       |
  690|  59.5k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 59.5k, False: 0]
  ------------------
  691|  59.5k|      int ci = cinfo->MCU_membership[blkn];
  692|       |      /* Refer to the comment in decode_mcu_slow() regarding the supression of
  693|       |       * a UBSan integer overflow error in this line of code.
  694|       |       */
  695|  59.5k|      s += state.last_dc_val[ci];
  696|  59.5k|      state.last_dc_val[ci] = s;
  697|  59.5k|      if (block)
  ------------------
  |  Branch (697:11): [True: 49.4k, False: 10.0k]
  ------------------
  698|  49.4k|        (*block)[0] = (JCOEF)s;
  699|  59.5k|    }
  700|       |
  701|  59.5k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 59.5k, False: 0]
  |  Branch (701:37): [True: 49.4k, False: 10.0k]
  ------------------
  702|       |
  703|   269k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   269k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 265k, False: 3.84k]
  ------------------
  704|   265k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|   265k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   265k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 9.17k, False: 256k]
  |  |  |  |  ------------------
  |  |  |  |  416|  9.17k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.68k, False: 6.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.68k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.68k|    buffer++; \
  |  |  |  |  |  |  401|  2.68k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.89k, False: 792]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.89k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.89k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.89k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.89k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.89k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.89k|    } \
  |  |  |  |  |  |  408|  2.68k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.93k, False: 6.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.93k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.93k|    buffer++; \
  |  |  |  |  |  |  401|  2.93k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.11k, False: 819]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.11k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.11k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.11k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.11k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.11k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.11k|    } \
  |  |  |  |  |  |  408|  2.93k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.12k, False: 6.04k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.12k|    buffer++; \
  |  |  |  |  |  |  401|  3.12k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.23k, False: 892]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.23k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.23k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.23k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.23k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.23k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.23k|    } \
  |  |  |  |  |  |  408|  3.12k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.09k, False: 6.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.09k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.09k|    buffer++; \
  |  |  |  |  |  |  401|  3.09k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.37k, False: 714]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.37k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.37k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.37k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.37k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.37k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.37k|    } \
  |  |  |  |  |  |  408|  3.09k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.35k, False: 5.82k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.35k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.35k|    buffer++; \
  |  |  |  |  |  |  401|  3.35k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.47k, False: 882]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.47k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.47k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.47k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.47k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.47k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.47k|    } \
  |  |  |  |  |  |  408|  3.35k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  9.17k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  9.17k|  register int c0, c1; \
  |  |  |  |  |  |  393|  9.17k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  9.17k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  9.17k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  9.17k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  9.17k|  bits_left += 8; \
  |  |  |  |  |  |  398|  9.17k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.30k, False: 5.86k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.30k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.30k|    buffer++; \
  |  |  |  |  |  |  401|  3.30k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.55k, False: 755]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.55k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.55k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.55k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.55k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.55k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.55k|    } \
  |  |  |  |  |  |  408|  3.30k|  } \
  |  |  |  |  |  |  409|  9.17k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  9.17k|  }
  |  |  ------------------
  |  |  225|   265k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   265k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   265k|  s = htbl->lookup[s]; \
  |  |  227|   265k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   265k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   265k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   265k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   265k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   265k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   265k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   265k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   531k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 13.8k, False: 252k]
  |  |  ------------------
  |  |  232|  13.8k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  13.8k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  13.8k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  86.7k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 72.8k, False: 13.8k]
  |  |  ------------------
  |  |  236|  72.8k|      s <<= 1; \
  |  |  237|  72.8k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  72.8k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  72.8k|      nb++; \
  |  |  239|  72.8k|    } \
  |  |  240|  13.8k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 6.93k, False: 6.89k]
  |  |  ------------------
  |  |  241|  13.8k|      s = 0; \
  |  |  242|  13.8k|    else \
  |  |  243|  13.8k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  13.8k|  }
  ------------------
  705|   265k|        r = s >> 4;
  706|   265k|        s &= 15;
  707|       |
  708|   265k|        if (s) {
  ------------------
  |  Branch (708:13): [True: 218k, False: 47.0k]
  ------------------
  709|   218k|          k += r;
  710|   218k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   218k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 12.1k, False: 206k]
  |  |  ------------------
  |  |  416|  12.1k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.29k, False: 8.89k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.29k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.29k|    buffer++; \
  |  |  |  |  401|  3.29k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.39k, False: 908]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.39k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.39k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.39k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.39k|      buffer -= 2; \
  |  |  |  |  406|  2.39k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.39k|    } \
  |  |  |  |  408|  3.29k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.32k, False: 8.87k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.32k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.32k|    buffer++; \
  |  |  |  |  401|  3.32k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.47k, False: 841]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.47k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.47k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.47k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.47k|      buffer -= 2; \
  |  |  |  |  406|  2.47k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.47k|    } \
  |  |  |  |  408|  3.32k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.40k, False: 8.78k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.40k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.40k|    buffer++; \
  |  |  |  |  401|  3.40k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.54k, False: 861]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.54k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.54k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.54k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.54k|      buffer -= 2; \
  |  |  |  |  406|  2.54k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.54k|    } \
  |  |  |  |  408|  3.40k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.45k, False: 8.73k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.45k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.45k|    buffer++; \
  |  |  |  |  401|  3.45k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.77k, False: 686]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.77k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.77k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.77k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.77k|      buffer -= 2; \
  |  |  |  |  406|  2.77k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.77k|    } \
  |  |  |  |  408|  3.45k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.72k, False: 8.47k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.72k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.72k|    buffer++; \
  |  |  |  |  401|  3.72k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.84k, False: 877]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.84k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.84k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.84k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.84k|      buffer -= 2; \
  |  |  |  |  406|  2.84k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.84k|    } \
  |  |  |  |  408|  3.72k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  12.1k|#define GET_BYTE { \
  |  |  |  |  392|  12.1k|  register int c0, c1; \
  |  |  |  |  393|  12.1k|  c0 = *buffer++; \
  |  |  |  |  394|  12.1k|  c1 = *buffer; \
  |  |  |  |  395|  12.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  12.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  12.1k|  bits_left += 8; \
  |  |  |  |  398|  12.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.72k, False: 8.46k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.72k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.72k|    buffer++; \
  |  |  |  |  401|  3.72k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 2.89k, False: 835]
  |  |  |  |  ------------------
  |  |  |  |  402|  2.89k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  2.89k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  2.89k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  2.89k|      buffer -= 2; \
  |  |  |  |  406|  2.89k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  2.89k|    } \
  |  |  |  |  408|  3.72k|  } \
  |  |  |  |  409|  12.1k|}
  |  |  ------------------
  |  |  417|  12.1k|  }
  ------------------
  711|   218k|          r = GET_BITS(s);
  ------------------
  |  |  169|   218k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|   218k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   218k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   218k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|   218k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|   218k|        } else {
  715|  47.0k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 45.6k, False: 1.41k]
  ------------------
  716|  1.41k|          k += 15;
  717|  1.41k|        }
  718|   265k|      }
  719|       |
  720|  49.4k|    } else {
  721|       |
  722|   107k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   107k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (722:19): [True: 105k, False: 2.25k]
  ------------------
  723|   105k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|   105k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   105k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 5.63k, False: 99.9k]
  |  |  |  |  ------------------
  |  |  |  |  416|  5.63k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.14k, False: 4.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.14k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.14k|    buffer++; \
  |  |  |  |  |  |  401|  1.14k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 521, False: 624]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    521|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    521|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    521|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    521|      buffer -= 2; \
  |  |  |  |  |  |  406|    521|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    521|    } \
  |  |  |  |  |  |  408|  1.14k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.25k, False: 4.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.25k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.25k|    buffer++; \
  |  |  |  |  |  |  401|  1.25k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 528, False: 723]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    528|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    528|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    528|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    528|      buffer -= 2; \
  |  |  |  |  |  |  406|    528|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    528|    } \
  |  |  |  |  |  |  408|  1.25k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.18k, False: 4.44k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.18k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.18k|    buffer++; \
  |  |  |  |  |  |  401|  1.18k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 553, False: 635]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    553|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    553|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    553|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    553|      buffer -= 2; \
  |  |  |  |  |  |  406|    553|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    553|    } \
  |  |  |  |  |  |  408|  1.18k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.24k, False: 4.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.24k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.24k|    buffer++; \
  |  |  |  |  |  |  401|  1.24k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 587, False: 657]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    587|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    587|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    587|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    587|      buffer -= 2; \
  |  |  |  |  |  |  406|    587|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    587|    } \
  |  |  |  |  |  |  408|  1.24k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.24k, False: 4.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.24k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.24k|    buffer++; \
  |  |  |  |  |  |  401|  1.24k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 594, False: 649]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    594|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    594|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    594|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    594|      buffer -= 2; \
  |  |  |  |  |  |  406|    594|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    594|    } \
  |  |  |  |  |  |  408|  1.24k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  5.63k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  5.63k|  register int c0, c1; \
  |  |  |  |  |  |  393|  5.63k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  5.63k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  5.63k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  5.63k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  5.63k|  bits_left += 8; \
  |  |  |  |  |  |  398|  5.63k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.28k, False: 4.35k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.28k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.28k|    buffer++; \
  |  |  |  |  |  |  401|  1.28k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 623, False: 658]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    623|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    623|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    623|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    623|      buffer -= 2; \
  |  |  |  |  |  |  406|    623|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    623|    } \
  |  |  |  |  |  |  408|  1.28k|  } \
  |  |  |  |  |  |  409|  5.63k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  5.63k|  }
  |  |  ------------------
  |  |  225|   105k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   105k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   105k|  s = htbl->lookup[s]; \
  |  |  227|   105k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   105k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   105k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   105k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   105k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   105k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   105k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   105k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   211k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 7.46k, False: 98.1k]
  |  |  ------------------
  |  |  232|  7.46k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  7.46k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  7.46k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  31.5k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 24.0k, False: 7.46k]
  |  |  ------------------
  |  |  236|  24.0k|      s <<= 1; \
  |  |  237|  24.0k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  24.0k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  24.0k|      nb++; \
  |  |  239|  24.0k|    } \
  |  |  240|  7.46k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1.29k, False: 6.16k]
  |  |  ------------------
  |  |  241|  7.46k|      s = 0; \
  |  |  242|  7.46k|    else \
  |  |  243|  7.46k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  7.46k|  }
  ------------------
  724|   105k|        r = s >> 4;
  725|   105k|        s &= 15;
  726|       |
  727|   105k|        if (s) {
  ------------------
  |  Branch (727:13): [True: 95.8k, False: 9.74k]
  ------------------
  728|  95.8k|          k += r;
  729|  95.8k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  95.8k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 5.34k, False: 90.4k]
  |  |  ------------------
  |  |  416|  5.34k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.61k, False: 3.73k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.61k|    buffer++; \
  |  |  |  |  401|  1.61k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 702, False: 910]
  |  |  |  |  ------------------
  |  |  |  |  402|    702|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    702|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    702|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    702|      buffer -= 2; \
  |  |  |  |  406|    702|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    702|    } \
  |  |  |  |  408|  1.61k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.79k, False: 3.54k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.79k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.79k|    buffer++; \
  |  |  |  |  401|  1.79k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 749, False: 1.05k]
  |  |  |  |  ------------------
  |  |  |  |  402|    749|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    749|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    749|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    749|      buffer -= 2; \
  |  |  |  |  406|    749|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    749|    } \
  |  |  |  |  408|  1.79k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.63k, False: 3.71k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.63k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.63k|    buffer++; \
  |  |  |  |  401|  1.63k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 785, False: 852]
  |  |  |  |  ------------------
  |  |  |  |  402|    785|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    785|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    785|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    785|      buffer -= 2; \
  |  |  |  |  406|    785|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    785|    } \
  |  |  |  |  408|  1.63k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.83k, False: 3.51k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.83k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.83k|    buffer++; \
  |  |  |  |  401|  1.83k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 839, False: 995]
  |  |  |  |  ------------------
  |  |  |  |  402|    839|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    839|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    839|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    839|      buffer -= 2; \
  |  |  |  |  406|    839|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    839|    } \
  |  |  |  |  408|  1.83k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.66k, False: 3.67k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.66k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.66k|    buffer++; \
  |  |  |  |  401|  1.66k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 893, False: 775]
  |  |  |  |  ------------------
  |  |  |  |  402|    893|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    893|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    893|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    893|      buffer -= 2; \
  |  |  |  |  406|    893|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    893|    } \
  |  |  |  |  408|  1.66k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  5.34k|#define GET_BYTE { \
  |  |  |  |  392|  5.34k|  register int c0, c1; \
  |  |  |  |  393|  5.34k|  c0 = *buffer++; \
  |  |  |  |  394|  5.34k|  c1 = *buffer; \
  |  |  |  |  395|  5.34k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  5.34k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  5.34k|  bits_left += 8; \
  |  |  |  |  398|  5.34k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.88k, False: 3.46k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.88k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.88k|    buffer++; \
  |  |  |  |  401|  1.88k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 950, False: 933]
  |  |  |  |  ------------------
  |  |  |  |  402|    950|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    950|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    950|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    950|      buffer -= 2; \
  |  |  |  |  406|    950|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    950|    } \
  |  |  |  |  408|  1.88k|  } \
  |  |  |  |  409|  5.34k|}
  |  |  ------------------
  |  |  417|  5.34k|  }
  ------------------
  730|  95.8k|          DROP_BITS(s);
  ------------------
  |  |  175|  95.8k|  (bits_left -= (nbits))
  ------------------
  731|  95.8k|        } else {
  732|  9.74k|          if (r != 15) break;
  ------------------
  |  Branch (732:15): [True: 7.81k, False: 1.93k]
  ------------------
  733|  1.93k|          k += 15;
  734|  1.93k|        }
  735|   105k|      }
  736|  10.0k|    }
  737|  59.5k|  }
  738|       |
  739|  57.2k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 4.30k, False: 52.9k]
  ------------------
  740|  4.30k|    cinfo->unread_marker = 0;
  741|  4.30k|    return FALSE;
  ------------------
  |  |  207|  4.30k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  4.30k|  }
  743|       |
  744|  52.9k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|  52.9k|  br_state.next_input_byte = buffer;
  746|  52.9k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  52.9k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  52.9k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  52.9k|  permstate.get_buffer = get_buffer; \
  |  |  140|  52.9k|  permstate.bits_left = bits_left
  ------------------
  747|  52.9k|  entropy->saved = state;
  748|  52.9k|  return TRUE;
  ------------------
  |  |  210|  52.9k|#define TRUE    1
  ------------------
  749|  57.2k|}
jdhuff.c:decode_mcu_slow:
  553|   111k|{
  554|   111k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|   111k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   111k|  register bit_buf_type get_buffer; \
  |  |  126|   111k|  register int bits_left; \
  |  |  127|   111k|  bitread_working_state br_state
  ------------------
  556|   111k|  int blkn;
  557|   111k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|   111k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   111k|  br_state.cinfo = cinfop; \
  |  |  131|   111k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   111k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   111k|  get_buffer = permstate.get_buffer; \
  |  |  134|   111k|  bits_left = permstate.bits_left;
  ------------------
  562|   111k|  state = entropy->saved;
  563|       |
  564|   236k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 124k, False: 111k]
  ------------------
  565|   124k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 105k, False: 19.4k]
  ------------------
  566|   124k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|   124k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|   124k|    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|   124k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|   124k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   124k|  register int nb, look; \
  |  |  202|   124k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   124k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 19.6k, False: 104k]
  |  |  ------------------
  |  |  203|  19.6k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 19.6k]
  |  |  ------------------
  |  |  204|  19.6k|      { failaction; } \
  |  |  205|  19.6k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  19.6k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  19.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 6.53k, False: 13.0k]
  |  |  ------------------
  |  |  207|  6.53k|      nb = 1;  goto slowlabel; \
  |  |  208|  6.53k|    } \
  |  |  209|  19.6k|  } \
  |  |  210|   124k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   118k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   118k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   118k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   118k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 113k, False: 5.05k]
  |  |  ------------------
  |  |  212|   113k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   113k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   113k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   113k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   113k|  } else { \
  |  |  215|  11.5k|slowlabel: \
  |  |  216|  11.5k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 11.5k]
  |  |  ------------------
  |  |  217|  11.5k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  11.5k|      { failaction; } \
  |  |  219|  11.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  11.5k|  } \
  |  |  221|   118k|}
  ------------------
  574|   124k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 31.9k, False: 92.6k]
  ------------------
  575|  31.9k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  31.9k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  31.9k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 917, False: 31.0k]
  |  |  ------------------
  |  |  162|    917|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 917]
  |  |  ------------------
  |  |  163|    917|      { action; } \
  |  |  164|    917|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    917|  } \
  |  |  166|  31.9k|}
  ------------------
  576|  31.9k|      r = GET_BITS(s);
  ------------------
  |  |  169|  31.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  31.9k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  31.9k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  31.9k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  31.9k|    }
  579|       |
  580|   124k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 124k, False: 0]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|   124k|      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|   124k|      s += state.last_dc_val[ci];
  592|   124k|      state.last_dc_val[ci] = s;
  593|   124k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 105k, False: 19.4k]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|   105k|        (*block)[0] = (JCOEF)s;
  596|   105k|      }
  597|   124k|    }
  598|       |
  599|   124k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 124k, False: 0]
  |  Branch (599:37): [True: 105k, False: 19.4k]
  ------------------
  600|       |
  601|       |      /* Section F.2.2.2: decode the AC coefficients */
  602|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  603|  1.53M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  1.53M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 1.50M, False: 27.7k]
  ------------------
  604|  1.50M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  1.50M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  1.50M|  register int nb, look; \
  |  |  202|  1.50M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.50M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 195k, False: 1.31M]
  |  |  ------------------
  |  |  203|   195k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 195k]
  |  |  ------------------
  |  |  204|   195k|      { failaction; } \
  |  |  205|   195k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   195k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   195k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 174k, False: 20.7k]
  |  |  ------------------
  |  |  207|   174k|      nb = 1;  goto slowlabel; \
  |  |  208|   174k|    } \
  |  |  209|   195k|  } \
  |  |  210|  1.50M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.33M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  1.33M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.33M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.33M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.32M, False: 11.4k]
  |  |  ------------------
  |  |  212|  1.32M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.32M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.32M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.32M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.32M|  } else { \
  |  |  215|   186k|slowlabel: \
  |  |  216|   186k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 186k]
  |  |  ------------------
  |  |  217|   186k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   186k|      { failaction; } \
  |  |  219|   186k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   186k|  } \
  |  |  221|  1.33M|}
  ------------------
  605|       |
  606|  1.50M|        r = s >> 4;
  607|  1.50M|        s &= 15;
  608|       |
  609|  1.50M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 1.41M, False: 97.6k]
  ------------------
  610|  1.41M|          k += r;
  611|  1.41M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  1.41M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.41M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 17.9k, False: 1.39M]
  |  |  ------------------
  |  |  162|  17.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 17.9k]
  |  |  ------------------
  |  |  163|  17.9k|      { action; } \
  |  |  164|  17.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  17.9k|  } \
  |  |  166|  1.41M|}
  ------------------
  612|  1.41M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.41M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  1.41M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  1.41M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  1.41M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  614|       |          /* Output coefficient in natural (dezigzagged) order.
  615|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  616|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  617|       |           */
  618|  1.41M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  1.41M|        } else {
  620|  97.6k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 77.3k, False: 20.2k]
  ------------------
  621|  77.3k|            break;
  622|  20.2k|          k += 15;
  623|  20.2k|        }
  624|  1.50M|      }
  625|       |
  626|   105k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|   204k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   204k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 199k, False: 5.94k]
  ------------------
  631|   199k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  200|   199k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   199k|  register int nb, look; \
  |  |  202|   199k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   199k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 21.2k, False: 177k]
  |  |  ------------------
  |  |  203|  21.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 21.2k]
  |  |  ------------------
  |  |  204|  21.2k|      { failaction; } \
  |  |  205|  21.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  21.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  21.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 13.1k, False: 8.05k]
  |  |  ------------------
  |  |  207|  13.1k|      nb = 1;  goto slowlabel; \
  |  |  208|  13.1k|    } \
  |  |  209|  21.2k|  } \
  |  |  210|   199k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   185k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   185k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   185k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   185k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 177k, False: 8.25k]
  |  |  ------------------
  |  |  212|   177k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   177k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   177k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   177k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   177k|  } else { \
  |  |  215|  21.4k|slowlabel: \
  |  |  216|  21.4k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 21.4k]
  |  |  ------------------
  |  |  217|  21.4k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  21.4k|      { failaction; } \
  |  |  219|  21.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  21.4k|  } \
  |  |  221|   185k|}
  ------------------
  632|       |
  633|   199k|        r = s >> 4;
  634|   199k|        s &= 15;
  635|       |
  636|   199k|        if (s) {
  ------------------
  |  Branch (636:13): [True: 174k, False: 24.8k]
  ------------------
  637|   174k|          k += r;
  638|   174k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   174k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   174k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 2.31k, False: 171k]
  |  |  ------------------
  |  |  162|  2.31k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 2.31k]
  |  |  ------------------
  |  |  163|  2.31k|      { action; } \
  |  |  164|  2.31k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  2.31k|  } \
  |  |  166|   174k|}
  ------------------
  639|   174k|          DROP_BITS(s);
  ------------------
  |  |  175|   174k|  (bits_left -= (nbits))
  ------------------
  640|   174k|        } else {
  641|  24.8k|          if (r != 15)
  ------------------
  |  Branch (641:15): [True: 13.4k, False: 11.3k]
  ------------------
  642|  13.4k|            break;
  643|  11.3k|          k += 15;
  644|  11.3k|        }
  645|   199k|      }
  646|  19.4k|    }
  647|   124k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|   111k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   111k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   111k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   111k|  permstate.get_buffer = get_buffer; \
  |  |  140|   111k|  permstate.bits_left = bits_left
  ------------------
  651|   111k|  entropy->saved = state;
  652|   111k|  return TRUE;
  ------------------
  |  |  210|   111k|#define TRUE    1
  ------------------
  653|   111k|}

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

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

jinit_lossless_decompressor:
  281|    571|{
  282|    571|  lossless_decomp_ptr losslessd;
  283|       |
  284|    571|#if BITS_IN_JSAMPLE == 8
  285|    571|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.14k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 571]
  |  Branch (285:50): [True: 0, False: 571]
  ------------------
  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|    571|  losslessd = (lossless_decomp_ptr)
  294|    571|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    571|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    571|                                sizeof(jpeg_lossless_decompressor));
  296|    571|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    571|  losslessd->pub.start_pass = start_pass_lossless;
  298|    571|}
jdlossls-8.c:start_pass_lossless:
  243|  6.92M|{
  244|  6.92M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  6.92M|  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|  6.92M|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 2, False: 6.92M]
  |  Branch (257:24): [True: 15, False: 6.92M]
  ------------------
  258|  6.92M|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 10, False: 6.92M]
  |  Branch (258:25): [True: 3, False: 6.92M]
  ------------------
  259|  6.92M|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 6.92M]
  |  Branch (259:24): [True: 4, False: 6.92M]
  ------------------
  260|     34|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     34|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     34|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     34|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     34|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     34|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     34|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  6.92M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  34.1M|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 27.2M, False: 6.92M]
  ------------------
  265|  27.2M|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  6.92M|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 694k, False: 6.22M]
  ------------------
  269|   694k|    losslessd->scaler_scale = simple_upscale;
  270|  6.22M|  else
  271|  6.22M|    losslessd->scaler_scale = noscale;
  272|  6.92M|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|  12.2M|{
  178|  12.2M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  12.2M|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  12.2M|  int Ra; \
  |  |   60|  12.2M|  \
  |  |   61|  12.2M|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  12.2M|  *undiff_buf++ = Ra; \
  |  |   63|  12.2M|  \
  |  |   64|  58.3M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 46.1M, False: 12.2M]
  |  |  ------------------
  |  |   65|  46.1M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  46.1M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  46.1M|    *undiff_buf++ = Ra; \
  |  |   67|  46.1M|  }
  ------------------
  181|       |
  182|       |  /*
  183|       |   * Now that we have undifferenced the first row, we want to use the
  184|       |   * undifferencer that corresponds to the predictor specified in the
  185|       |   * scan header.
  186|       |   */
  187|  12.2M|  switch (cinfo->Ss) {
  188|  9.23M|  case 1:
  ------------------
  |  Branch (188:3): [True: 9.23M, False: 3.01M]
  ------------------
  189|  9.23M|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  9.23M|    break;
  191|   464k|  case 2:
  ------------------
  |  Branch (191:3): [True: 464k, False: 11.7M]
  ------------------
  192|   464k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|   464k|    break;
  194|   163k|  case 3:
  ------------------
  |  Branch (194:3): [True: 163k, False: 12.0M]
  ------------------
  195|   163k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|   163k|    break;
  197|  90.5k|  case 4:
  ------------------
  |  Branch (197:3): [True: 90.5k, False: 12.1M]
  ------------------
  198|  90.5k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  90.5k|    break;
  200|   734k|  case 5:
  ------------------
  |  Branch (200:3): [True: 734k, False: 11.5M]
  ------------------
  201|   734k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|   734k|    break;
  203|   496k|  case 6:
  ------------------
  |  Branch (203:3): [True: 496k, False: 11.7M]
  ------------------
  204|   496k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|   496k|    break;
  206|  1.06M|  case 7:
  ------------------
  |  Branch (206:3): [True: 1.06M, False: 11.1M]
  ------------------
  207|  1.06M|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  1.06M|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 12.2M]
  ------------------
  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|  12.2M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  12.2M|  }
  213|  12.2M|}
jdlossls-8.c:jpeg_undifference1:
  111|  9.33M|{
  112|  9.33M|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  9.33M|  int Ra; \
  |  |   60|  9.33M|  \
  |  |   61|  9.33M|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  9.33M|  *undiff_buf++ = Ra; \
  |  |   63|  9.33M|  \
  |  |   64|  31.9M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 22.5M, False: 9.33M]
  |  |  ------------------
  |  |   65|  22.5M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  22.5M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  22.5M|    *undiff_buf++ = Ra; \
  |  |   67|  22.5M|  }
  ------------------
  113|  9.33M|}
jdlossls-8.c:jpeg_undifference2:
  119|   691k|{
  120|   691k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|   691k|  int Ra, Rb, Rc; \
  |  |   87|   691k|  \
  |  |   88|   691k|  Rb = *prev_row++; \
  |  |   89|   691k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   691k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   691k|  *undiff_buf++ = Ra; \
  |  |   91|   691k|  \
  |  |   92|  6.55M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 5.85M, False: 691k]
  |  |  ------------------
  |  |   93|  5.85M|    Rc = Rb; \
  |  |   94|  5.85M|    Rb = *prev_row++; \
  |  |   95|  5.85M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  5.85M|    *undiff_buf++ = Ra; \
  |  |   97|  5.85M|  }
  ------------------
  121|   691k|  (void)(Rc);
  122|   691k|}
jdlossls-8.c:jpeg_undifference3:
  128|  83.2k|{
  129|  83.2k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  83.2k|  int Ra, Rb, Rc; \
  |  |   87|  83.2k|  \
  |  |   88|  83.2k|  Rb = *prev_row++; \
  |  |   89|  83.2k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  83.2k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  83.2k|  *undiff_buf++ = Ra; \
  |  |   91|  83.2k|  \
  |  |   92|   880k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 797k, False: 83.2k]
  |  |  ------------------
  |  |   93|   797k|    Rc = Rb; \
  |  |   94|   797k|    Rb = *prev_row++; \
  |  |   95|   797k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   797k|    *undiff_buf++ = Ra; \
  |  |   97|   797k|  }
  ------------------
  130|  83.2k|}
jdlossls-8.c:jpeg_undifference4:
  136|  93.1k|{
  137|  93.1k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  93.1k|  int Ra, Rb, Rc; \
  |  |   87|  93.1k|  \
  |  |   88|  93.1k|  Rb = *prev_row++; \
  |  |   89|  93.1k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  93.1k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  93.1k|  *undiff_buf++ = Ra; \
  |  |   91|  93.1k|  \
  |  |   92|   464k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 371k, False: 93.1k]
  |  |  ------------------
  |  |   93|   371k|    Rc = Rb; \
  |  |   94|   371k|    Rb = *prev_row++; \
  |  |   95|   371k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   371k|    *undiff_buf++ = Ra; \
  |  |   97|   371k|  }
  ------------------
  138|  93.1k|}
jdlossls-8.c:jpeg_undifference5:
  144|  13.8k|{
  145|  13.8k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  13.8k|  int Ra, Rb, Rc; \
  |  |   87|  13.8k|  \
  |  |   88|  13.8k|  Rb = *prev_row++; \
  |  |   89|  13.8k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  13.8k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  13.8k|  *undiff_buf++ = Ra; \
  |  |   91|  13.8k|  \
  |  |   92|  3.39M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.38M, False: 13.8k]
  |  |  ------------------
  |  |   93|  3.38M|    Rc = Rb; \
  |  |   94|  3.38M|    Rb = *prev_row++; \
  |  |   95|  3.38M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.38M|    *undiff_buf++ = Ra; \
  |  |   97|  3.38M|  }
  ------------------
  146|  13.8k|}
jdlossls-8.c:jpeg_undifference6:
  152|   278k|{
  153|   278k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|   278k|  int Ra, Rb, Rc; \
  |  |   87|   278k|  \
  |  |   88|   278k|  Rb = *prev_row++; \
  |  |   89|   278k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   278k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   278k|  *undiff_buf++ = Ra; \
  |  |   91|   278k|  \
  |  |   92|  3.64M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.36M, False: 278k]
  |  |  ------------------
  |  |   93|  3.36M|    Rc = Rb; \
  |  |   94|  3.36M|    Rb = *prev_row++; \
  |  |   95|  3.36M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.36M|    *undiff_buf++ = Ra; \
  |  |   97|  3.36M|  }
  ------------------
  154|   278k|}
jdlossls-8.c:jpeg_undifference7:
  160|  1.40M|{
  161|  1.40M|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  1.40M|  int Ra, Rb, Rc; \
  |  |   87|  1.40M|  \
  |  |   88|  1.40M|  Rb = *prev_row++; \
  |  |   89|  1.40M|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.40M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.40M|  *undiff_buf++ = Ra; \
  |  |   91|  1.40M|  \
  |  |   92|  5.42M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 4.02M, False: 1.40M]
  |  |  ------------------
  |  |   93|  4.02M|    Rc = Rb; \
  |  |   94|  4.02M|    Rb = *prev_row++; \
  |  |   95|  4.02M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  4.02M|    *undiff_buf++ = Ra; \
  |  |   97|  4.02M|  }
  ------------------
  162|  1.40M|  (void)(Rc);
  163|  1.40M|}
jdlossls-8.c:simple_upscale:
  221|  1.15M|{
  222|  24.9M|  do {
  223|  24.9M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  24.9M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 23.7M, False: 1.15M]
  ------------------
  225|  1.15M|}
jdlossls-8.c:noscale:
  230|  22.9M|{
  231|  85.6M|  do {
  232|  85.6M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  85.6M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 62.6M, False: 22.9M]
  ------------------
  234|  22.9M|}
j12init_lossless_decompressor:
  281|    413|{
  282|    413|  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|    413|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    826|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 413]
  ------------------
  288|    413|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    413|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 413]
  ------------------
  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|    413|  losslessd = (lossless_decomp_ptr)
  294|    413|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    413|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    413|                                sizeof(jpeg_lossless_decompressor));
  296|    413|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    413|  losslessd->pub.start_pass = start_pass_lossless;
  298|    413|}
jdlossls-12.c:start_pass_lossless:
  243|  2.48M|{
  244|  2.48M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  2.48M|  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|  2.48M|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 2.48M]
  |  Branch (257:24): [True: 9, False: 2.48M]
  ------------------
  258|  2.48M|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 3, False: 2.48M]
  |  Branch (258:25): [True: 3, False: 2.48M]
  ------------------
  259|  2.48M|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 2.48M]
  |  Branch (259:24): [True: 1, False: 2.48M]
  ------------------
  260|     17|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     17|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     17|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     17|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     17|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     17|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     17|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  2.48M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  11.9M|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 9.46M, False: 2.48M]
  ------------------
  265|  9.46M|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  2.48M|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 444k, False: 2.04M]
  ------------------
  269|   444k|    losslessd->scaler_scale = simple_upscale;
  270|  2.04M|  else
  271|  2.04M|    losslessd->scaler_scale = noscale;
  272|  2.48M|}
jdlossls-12.c:jpeg_undifference_first_row:
  177|  2.89M|{
  178|  2.89M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  2.89M|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  2.89M|  int Ra; \
  |  |   60|  2.89M|  \
  |  |   61|  2.89M|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  2.89M|  *undiff_buf++ = Ra; \
  |  |   63|  2.89M|  \
  |  |   64|  21.6M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 18.7M, False: 2.89M]
  |  |  ------------------
  |  |   65|  18.7M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  18.7M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  18.7M|    *undiff_buf++ = Ra; \
  |  |   67|  18.7M|  }
  ------------------
  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|  2.89M|  switch (cinfo->Ss) {
  188|   292k|  case 1:
  ------------------
  |  Branch (188:3): [True: 292k, False: 2.60M]
  ------------------
  189|   292k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|   292k|    break;
  191|   178k|  case 2:
  ------------------
  |  Branch (191:3): [True: 178k, False: 2.72M]
  ------------------
  192|   178k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|   178k|    break;
  194|   308k|  case 3:
  ------------------
  |  Branch (194:3): [True: 308k, False: 2.59M]
  ------------------
  195|   308k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|   308k|    break;
  197|   144k|  case 4:
  ------------------
  |  Branch (197:3): [True: 144k, False: 2.75M]
  ------------------
  198|   144k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|   144k|    break;
  200|  66.5k|  case 5:
  ------------------
  |  Branch (200:3): [True: 66.5k, False: 2.83M]
  ------------------
  201|  66.5k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  66.5k|    break;
  203|   696k|  case 6:
  ------------------
  |  Branch (203:3): [True: 696k, False: 2.20M]
  ------------------
  204|   696k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|   696k|    break;
  206|  1.21M|  case 7:
  ------------------
  |  Branch (206:3): [True: 1.21M, False: 1.68M]
  ------------------
  207|  1.21M|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  1.21M|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 2.89M]
  ------------------
  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|  2.89M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  2.89M|  }
  213|  2.89M|}
jdlossls-12.c:jpeg_undifference1:
  111|  76.2k|{
  112|  76.2k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  76.2k|  int Ra; \
  |  |   60|  76.2k|  \
  |  |   61|  76.2k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  76.2k|  *undiff_buf++ = Ra; \
  |  |   63|  76.2k|  \
  |  |   64|  1.25M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 1.18M, False: 76.2k]
  |  |  ------------------
  |  |   65|  1.18M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  1.18M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  1.18M|    *undiff_buf++ = Ra; \
  |  |   67|  1.18M|  }
  ------------------
  113|  76.2k|}
jdlossls-12.c:jpeg_undifference2:
  119|  71.2k|{
  120|  71.2k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  71.2k|  int Ra, Rb, Rc; \
  |  |   87|  71.2k|  \
  |  |   88|  71.2k|  Rb = *prev_row++; \
  |  |   89|  71.2k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  71.2k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  71.2k|  *undiff_buf++ = Ra; \
  |  |   91|  71.2k|  \
  |  |   92|  1.76M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.69M, False: 71.2k]
  |  |  ------------------
  |  |   93|  1.69M|    Rc = Rb; \
  |  |   94|  1.69M|    Rb = *prev_row++; \
  |  |   95|  1.69M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.69M|    *undiff_buf++ = Ra; \
  |  |   97|  1.69M|  }
  ------------------
  121|  71.2k|  (void)(Rc);
  122|  71.2k|}
jdlossls-12.c:jpeg_undifference3:
  128|   121k|{
  129|   121k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|   121k|  int Ra, Rb, Rc; \
  |  |   87|   121k|  \
  |  |   88|   121k|  Rb = *prev_row++; \
  |  |   89|   121k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   121k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   121k|  *undiff_buf++ = Ra; \
  |  |   91|   121k|  \
  |  |   92|  1.69M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.57M, False: 121k]
  |  |  ------------------
  |  |   93|  1.57M|    Rc = Rb; \
  |  |   94|  1.57M|    Rb = *prev_row++; \
  |  |   95|  1.57M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.57M|    *undiff_buf++ = Ra; \
  |  |   97|  1.57M|  }
  ------------------
  130|   121k|}
jdlossls-12.c:jpeg_undifference4:
  136|  38.6k|{
  137|  38.6k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  38.6k|  int Ra, Rb, Rc; \
  |  |   87|  38.6k|  \
  |  |   88|  38.6k|  Rb = *prev_row++; \
  |  |   89|  38.6k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  38.6k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  38.6k|  *undiff_buf++ = Ra; \
  |  |   91|  38.6k|  \
  |  |   92|  1.92M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.88M, False: 38.6k]
  |  |  ------------------
  |  |   93|  1.88M|    Rc = Rb; \
  |  |   94|  1.88M|    Rb = *prev_row++; \
  |  |   95|  1.88M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.88M|    *undiff_buf++ = Ra; \
  |  |   97|  1.88M|  }
  ------------------
  138|  38.6k|}
jdlossls-12.c:jpeg_undifference5:
  144|  53.5k|{
  145|  53.5k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  53.5k|  int Ra, Rb, Rc; \
  |  |   87|  53.5k|  \
  |  |   88|  53.5k|  Rb = *prev_row++; \
  |  |   89|  53.5k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  53.5k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  53.5k|  *undiff_buf++ = Ra; \
  |  |   91|  53.5k|  \
  |  |   92|  2.45M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.40M, False: 53.5k]
  |  |  ------------------
  |  |   93|  2.40M|    Rc = Rb; \
  |  |   94|  2.40M|    Rb = *prev_row++; \
  |  |   95|  2.40M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.40M|    *undiff_buf++ = Ra; \
  |  |   97|  2.40M|  }
  ------------------
  146|  53.5k|}
jdlossls-12.c:jpeg_undifference6:
  152|   237k|{
  153|   237k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|   237k|  int Ra, Rb, Rc; \
  |  |   87|   237k|  \
  |  |   88|   237k|  Rb = *prev_row++; \
  |  |   89|   237k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   237k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   237k|  *undiff_buf++ = Ra; \
  |  |   91|   237k|  \
  |  |   92|  3.21M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.98M, False: 237k]
  |  |  ------------------
  |  |   93|  2.98M|    Rc = Rb; \
  |  |   94|  2.98M|    Rb = *prev_row++; \
  |  |   95|  2.98M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.98M|    *undiff_buf++ = Ra; \
  |  |   97|  2.98M|  }
  ------------------
  154|   237k|}
jdlossls-12.c:jpeg_undifference7:
  160|   437k|{
  161|   437k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|   437k|  int Ra, Rb, Rc; \
  |  |   87|   437k|  \
  |  |   88|   437k|  Rb = *prev_row++; \
  |  |   89|   437k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   437k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   437k|  *undiff_buf++ = Ra; \
  |  |   91|   437k|  \
  |  |   92|  2.84M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.40M, False: 437k]
  |  |  ------------------
  |  |   93|  2.40M|    Rc = Rb; \
  |  |   94|  2.40M|    Rb = *prev_row++; \
  |  |   95|  2.40M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.40M|    *undiff_buf++ = Ra; \
  |  |   97|  2.40M|  }
  ------------------
  162|   437k|  (void)(Rc);
  163|   437k|}
jdlossls-12.c:simple_upscale:
  221|   500k|{
  222|  15.0M|  do {
  223|  15.0M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  15.0M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 14.5M, False: 500k]
  ------------------
  225|   500k|}
jdlossls-12.c:noscale:
  230|  3.43M|{
  231|  21.7M|  do {
  232|  21.7M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  21.7M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 18.3M, False: 3.43M]
  ------------------
  234|  3.43M|}
j16init_lossless_decompressor:
  281|    397|{
  282|    397|  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|    397|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    794|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 397]
  ------------------
  288|    397|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    397|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 397]
  ------------------
  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|    397|  losslessd = (lossless_decomp_ptr)
  294|    397|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    397|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    397|                                sizeof(jpeg_lossless_decompressor));
  296|    397|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    397|  losslessd->pub.start_pass = start_pass_lossless;
  298|    397|}
jdlossls-16.c:start_pass_lossless:
  243|  2.41M|{
  244|  2.41M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  2.41M|  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|  2.41M|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 3, False: 2.41M]
  |  Branch (257:24): [True: 6, False: 2.41M]
  ------------------
  258|  2.41M|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 7, False: 2.41M]
  |  Branch (258:25): [True: 2, False: 2.41M]
  ------------------
  259|  2.41M|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 2.41M]
  |  Branch (259:24): [True: 2, False: 2.41M]
  ------------------
  260|     20|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     20|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     20|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     20|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     20|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  2.41M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  11.3M|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 8.96M, False: 2.41M]
  ------------------
  265|  8.96M|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  2.41M|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 880k, False: 1.53M]
  ------------------
  269|   880k|    losslessd->scaler_scale = simple_upscale;
  270|  1.53M|  else
  271|  1.53M|    losslessd->scaler_scale = noscale;
  272|  2.41M|}
jdlossls-16.c:jpeg_undifference_first_row:
  177|  2.19M|{
  178|  2.19M|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  2.19M|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  2.19M|  int Ra; \
  |  |   60|  2.19M|  \
  |  |   61|  2.19M|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  2.19M|  *undiff_buf++ = Ra; \
  |  |   63|  2.19M|  \
  |  |   64|  19.4M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 17.2M, False: 2.19M]
  |  |  ------------------
  |  |   65|  17.2M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  17.2M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  17.2M|    *undiff_buf++ = Ra; \
  |  |   67|  17.2M|  }
  ------------------
  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|  2.19M|  switch (cinfo->Ss) {
  188|   447k|  case 1:
  ------------------
  |  Branch (188:3): [True: 447k, False: 1.74M]
  ------------------
  189|   447k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|   447k|    break;
  191|   310k|  case 2:
  ------------------
  |  Branch (191:3): [True: 310k, False: 1.88M]
  ------------------
  192|   310k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|   310k|    break;
  194|   212k|  case 3:
  ------------------
  |  Branch (194:3): [True: 212k, False: 1.97M]
  ------------------
  195|   212k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|   212k|    break;
  197|   186k|  case 4:
  ------------------
  |  Branch (197:3): [True: 186k, False: 2.00M]
  ------------------
  198|   186k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|   186k|    break;
  200|   292k|  case 5:
  ------------------
  |  Branch (200:3): [True: 292k, False: 1.89M]
  ------------------
  201|   292k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|   292k|    break;
  203|   663k|  case 6:
  ------------------
  |  Branch (203:3): [True: 663k, False: 1.52M]
  ------------------
  204|   663k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|   663k|    break;
  206|  77.9k|  case 7:
  ------------------
  |  Branch (206:3): [True: 77.9k, False: 2.11M]
  ------------------
  207|  77.9k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  77.9k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 2.19M]
  ------------------
  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|  2.19M|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  2.19M|  }
  213|  2.19M|}
jdlossls-16.c:jpeg_undifference1:
  111|   110k|{
  112|   110k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|   110k|  int Ra; \
  |  |   60|   110k|  \
  |  |   61|   110k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   110k|  *undiff_buf++ = Ra; \
  |  |   63|   110k|  \
  |  |   64|  1.96M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 1.85M, False: 110k]
  |  |  ------------------
  |  |   65|  1.85M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  1.85M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  1.85M|    *undiff_buf++ = Ra; \
  |  |   67|  1.85M|  }
  ------------------
  113|   110k|}
jdlossls-16.c:jpeg_undifference2:
  119|  5.72k|{
  120|  5.72k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  5.72k|  int Ra, Rb, Rc; \
  |  |   87|  5.72k|  \
  |  |   88|  5.72k|  Rb = *prev_row++; \
  |  |   89|  5.72k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.72k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.72k|  *undiff_buf++ = Ra; \
  |  |   91|  5.72k|  \
  |  |   92|  2.19M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.19M, False: 5.72k]
  |  |  ------------------
  |  |   93|  2.19M|    Rc = Rb; \
  |  |   94|  2.19M|    Rb = *prev_row++; \
  |  |   95|  2.19M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.19M|    *undiff_buf++ = Ra; \
  |  |   97|  2.19M|  }
  ------------------
  121|  5.72k|  (void)(Rc);
  122|  5.72k|}
jdlossls-16.c:jpeg_undifference3:
  128|  35.8k|{
  129|  35.8k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  35.8k|  int Ra, Rb, Rc; \
  |  |   87|  35.8k|  \
  |  |   88|  35.8k|  Rb = *prev_row++; \
  |  |   89|  35.8k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  35.8k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  35.8k|  *undiff_buf++ = Ra; \
  |  |   91|  35.8k|  \
  |  |   92|   826k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 790k, False: 35.8k]
  |  |  ------------------
  |  |   93|   790k|    Rc = Rb; \
  |  |   94|   790k|    Rb = *prev_row++; \
  |  |   95|   790k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   790k|    *undiff_buf++ = Ra; \
  |  |   97|   790k|  }
  ------------------
  130|  35.8k|}
jdlossls-16.c:jpeg_undifference4:
  136|  62.1k|{
  137|  62.1k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  62.1k|  int Ra, Rb, Rc; \
  |  |   87|  62.1k|  \
  |  |   88|  62.1k|  Rb = *prev_row++; \
  |  |   89|  62.1k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  62.1k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  62.1k|  *undiff_buf++ = Ra; \
  |  |   91|  62.1k|  \
  |  |   92|  1.55M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.49M, False: 62.1k]
  |  |  ------------------
  |  |   93|  1.49M|    Rc = Rb; \
  |  |   94|  1.49M|    Rb = *prev_row++; \
  |  |   95|  1.49M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.49M|    *undiff_buf++ = Ra; \
  |  |   97|  1.49M|  }
  ------------------
  138|  62.1k|}
jdlossls-16.c:jpeg_undifference5:
  144|  42.7k|{
  145|  42.7k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  42.7k|  int Ra, Rb, Rc; \
  |  |   87|  42.7k|  \
  |  |   88|  42.7k|  Rb = *prev_row++; \
  |  |   89|  42.7k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  42.7k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  42.7k|  *undiff_buf++ = Ra; \
  |  |   91|  42.7k|  \
  |  |   92|  2.86M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.81M, False: 42.7k]
  |  |  ------------------
  |  |   93|  2.81M|    Rc = Rb; \
  |  |   94|  2.81M|    Rb = *prev_row++; \
  |  |   95|  2.81M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.81M|    *undiff_buf++ = Ra; \
  |  |   97|  2.81M|  }
  ------------------
  146|  42.7k|}
jdlossls-16.c:jpeg_undifference6:
  152|  70.8k|{
  153|  70.8k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  70.8k|  int Ra, Rb, Rc; \
  |  |   87|  70.8k|  \
  |  |   88|  70.8k|  Rb = *prev_row++; \
  |  |   89|  70.8k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  70.8k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  70.8k|  *undiff_buf++ = Ra; \
  |  |   91|  70.8k|  \
  |  |   92|  2.51M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.44M, False: 70.8k]
  |  |  ------------------
  |  |   93|  2.44M|    Rc = Rb; \
  |  |   94|  2.44M|    Rb = *prev_row++; \
  |  |   95|  2.44M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.44M|    *undiff_buf++ = Ra; \
  |  |   97|  2.44M|  }
  ------------------
  154|  70.8k|}
jdlossls-16.c:jpeg_undifference7:
  160|   113k|{
  161|   113k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|   113k|  int Ra, Rb, Rc; \
  |  |   87|   113k|  \
  |  |   88|   113k|  Rb = *prev_row++; \
  |  |   89|   113k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|   113k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|   113k|  *undiff_buf++ = Ra; \
  |  |   91|   113k|  \
  |  |   92|  4.70M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 4.58M, False: 113k]
  |  |  ------------------
  |  |   93|  4.58M|    Rc = Rb; \
  |  |   94|  4.58M|    Rb = *prev_row++; \
  |  |   95|  4.58M|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  4.58M|    *undiff_buf++ = Ra; \
  |  |   97|  4.58M|  }
  ------------------
  162|   113k|  (void)(Rc);
  163|   113k|}
jdlossls-16.c:simple_upscale:
  221|   880k|{
  222|  17.3M|  do {
  223|  17.3M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  17.3M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 16.4M, False: 880k]
  ------------------
  225|   880k|}
jdlossls-16.c:noscale:
  230|  1.75M|{
  231|  18.7M|  do {
  232|  18.7M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  18.7M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 16.9M, False: 1.75M]
  ------------------
  234|  1.75M|}

jinit_d_main_controller:
  429|  16.2k|{
  430|  16.2k|  my_main_ptr main_ptr;
  431|  16.2k|  int ci, rgroup, ngroups;
  432|  16.2k|  jpeg_component_info *compptr;
  433|       |
  434|  16.2k|#ifdef D_LOSSLESS_SUPPORTED
  435|  16.2k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 567, False: 15.7k]
  ------------------
  436|    567|#if BITS_IN_JSAMPLE == 8
  437|    567|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.13k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 567]
  |  Branch (437:52): [True: 0, False: 567]
  ------------------
  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|    567|  } else
  444|  15.7k|#endif
  445|  15.7k|  {
  446|  15.7k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  15.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 15.7k]
  ------------------
  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|  15.7k|  }
  449|       |
  450|  16.2k|  main_ptr = (my_main_ptr)
  451|  16.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  16.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  16.2k|                                sizeof(my_main_controller));
  453|  16.2k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  16.2k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  16.2k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  16.2k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 16.2k]
  ------------------
  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|  16.2k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 4.32k, False: 11.9k]
  ------------------
  464|  4.32k|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|  4.32k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 4.32k]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|  4.32k|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|  4.32k|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|  4.32k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  11.9k|  } else {
  469|  11.9k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  11.9k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  11.9k|  }
  471|       |
  472|  53.3k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 37.0k, False: 16.2k]
  ------------------
  473|  37.0k|       ci++, compptr++) {
  474|  37.0k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  37.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  37.0k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  37.0k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  37.0k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  37.0k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  37.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  37.0k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  37.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  37.0k|                         (JDIMENSION)(rgroup * ngroups));
  480|  37.0k|  }
  481|  16.2k|}
jdmainct-8.c:start_pass_main:
  259|  31.9k|{
  260|  31.9k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  31.9k|  switch (pass_mode) {
  263|  30.3k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 30.3k, False: 1.67k]
  ------------------
  264|  30.3k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 12.8k, False: 17.4k]
  ------------------
  265|  12.8k|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  252|  12.8k|#define _process_data  process_data
  ------------------
  266|  12.8k|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|  12.8k|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|  12.8k|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  12.8k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|  12.8k|      main_ptr->iMCU_row_ctr = 0;
  270|  17.4k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  17.4k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  252|  17.4k|#define _process_data  process_data
  ------------------
  273|  17.4k|    }
  274|  30.3k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|  30.3k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  30.3k|    main_ptr->rowgroup_ctr = 0;
  276|  30.3k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|  1.67k|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 1.67k, False: 30.3k]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|  1.67k|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  252|  1.67k|#define _process_data  process_data
  ------------------
  281|  1.67k|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 31.9k]
  ------------------
  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|  31.9k|  }
  287|  31.9k|}
jdmainct-8.c:process_data_context_main:
  337|  31.6M|{
  338|  31.6M|  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|  31.6M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 1.38M, False: 30.2M]
  ------------------
  342|  1.38M|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  254|  1.38M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (342:9): [True: 2.87k, False: 1.37M]
  ------------------
  343|  1.38M|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|  2.87k|      return;                   /* suspension forced, can do nothing more */
  345|  1.37M|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  1.37M|#define TRUE    1
  ------------------
  346|  1.37M|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|  1.37M|  }
  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|  31.6M|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 31.6M, False: 7]
  ------------------
  355|  3.93M|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|  3.93M|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 3.93M, False: 27.6M]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|  3.93M|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  256|  3.93M|#define _post_process_data  post_process_data
  ------------------
  358|  3.93M|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|  3.93M|                                        &main_ptr->rowgroup_ctr,
  360|  3.93M|                                        main_ptr->rowgroups_avail, output_buf,
  361|  3.93M|                                        out_row_ctr, out_rows_avail);
  362|  3.93M|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 2.57M, False: 1.36M]
  ------------------
  363|  2.57M|      return;                   /* Need to suspend */
  364|  1.36M|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  1.36M|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|  1.36M|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 1.36M, False: 0]
  ------------------
  366|  1.36M|      return;                   /* Postprocessor exactly filled output buf */
  367|      0|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|  1.37M|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|  1.37M|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 1.37M, False: 30.2M]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|  1.37M|    main_ptr->rowgroup_ctr = 0;
  371|  1.37M|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|  1.37M|#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|  1.37M|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 11.8k, False: 1.36M]
  ------------------
  376|  11.8k|      set_bottom_pointers(cinfo);
  377|  1.37M|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|  1.37M|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|  1.37M|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  1.37M|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|  27.6M|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|  27.6M|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 26.3M, False: 5.31M]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|  27.6M|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  256|  27.6M|#define _post_process_data  post_process_data
  ------------------
  382|  27.6M|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|  27.6M|                                        &main_ptr->rowgroup_ctr,
  384|  27.6M|                                        main_ptr->rowgroups_avail, output_buf,
  385|  27.6M|                                        out_row_ctr, out_rows_avail);
  386|  27.6M|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 26.3M, False: 1.36M]
  ------------------
  387|  26.3M|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|  1.36M|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 7.88k, False: 1.36M]
  ------------------
  390|  7.88k|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|  1.36M|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|  1.36M|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  1.36M|#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|  1.36M|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|  1.36M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|  1.36M|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|  1.36M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|  1.36M|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|  1.36M|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|  31.6M|  }
  400|  31.6M|}
jdmainct-8.c:set_bottom_pointers:
  222|  11.8k|{
  223|  11.8k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|  11.8k|  int ci, i, rgroup, iMCUheight, rows_left;
  225|  11.8k|  jpeg_component_info *compptr;
  226|  11.8k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  226|  11.8k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  227|       |
  228|  47.3k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 35.5k, False: 11.8k]
  ------------------
  229|  35.5k|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|  35.5k|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  35.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|  35.5k|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  35.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|  35.5k|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|  35.5k|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 3.84k, False: 31.7k]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|  35.5k|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 11.8k, False: 23.7k]
  ------------------
  240|  11.8k|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|  11.8k|    }
  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|  35.5k|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|   183k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 148k, False: 35.5k]
  ------------------
  247|   148k|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|   148k|    }
  249|  35.5k|  }
  250|  11.8k|}
jdmainct-8.c:make_funny_pointers:
  181|  12.8k|{
  182|  12.8k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|  12.8k|  int ci, i, rgroup;
  184|  12.8k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  12.8k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|  12.8k|  jpeg_component_info *compptr;
  186|  12.8k|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  226|  12.8k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  187|       |
  188|  51.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 38.6k, False: 12.8k]
  ------------------
  189|  38.6k|       ci++, compptr++) {
  190|  38.6k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  38.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|  38.6k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  38.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|  38.6k|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|  38.6k|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|  38.6k|    buf = main_ptr->buffer[ci];
  196|   844k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 805k, False: 38.6k]
  ------------------
  197|   805k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|   805k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|   199k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 161k, False: 38.6k]
  ------------------
  201|   161k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|   161k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|   161k|    }
  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|   119k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 80.5k, False: 38.6k]
  ------------------
  210|  80.5k|      xbuf0[i - rgroup] = xbuf0[0];
  211|  80.5k|    }
  212|  38.6k|  }
  213|  12.8k|}
jdmainct-8.c:process_data_simple_main:
  298|  74.4M|{
  299|  74.4M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  74.4M|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  74.4M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 6.10M, False: 68.3M]
  ------------------
  304|  6.10M|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  254|  6.10M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 303, False: 6.10M]
  ------------------
  305|    303|      return;                   /* suspension forced, can do nothing more */
  306|  6.10M|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  6.10M|#define TRUE    1
  ------------------
  307|  6.10M|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  74.4M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  74.4M|#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|  74.4M|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  256|  74.4M|#define _post_process_data  post_process_data
  ------------------
  318|  74.4M|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  74.4M|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  74.4M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 6.08M, False: 68.3M]
  ------------------
  323|  6.08M|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  6.08M|#define FALSE   0               /* values of boolean */
  ------------------
  324|  6.08M|    main_ptr->rowgroup_ctr = 0;
  325|  6.08M|  }
  326|  74.4M|}
jdmainct-8.c:process_data_crank_post:
  414|  9.87M|{
  415|  9.87M|  (*cinfo->post->_post_process_data) (cinfo, (_JSAMPIMAGE)NULL,
  ------------------
  |  |  256|  9.87M|#define _post_process_data  post_process_data
  ------------------
  416|       |                                      (JDIMENSION *)NULL, (JDIMENSION)0,
  417|  9.87M|                                      output_buf, out_row_ctr, out_rows_avail);
  418|  9.87M|}
jdmainct-8.c:alloc_funny_pointers:
  139|  4.32k|{
  140|  4.32k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|  4.32k|  int ci, rgroup;
  142|  4.32k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  4.32k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|  4.32k|  jpeg_component_info *compptr;
  144|  4.32k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  226|  4.32k|#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|  4.32k|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|  4.32k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  4.32k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|  4.32k|                                cinfo->num_components * 2 *
  152|  4.32k|                                sizeof(_JSAMPARRAY));
  153|  4.32k|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  17.3k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 13.0k, False: 4.32k]
  ------------------
  156|  13.0k|       ci++, compptr++) {
  157|  13.0k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  13.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|  13.0k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  13.0k|#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|  13.0k|    xbuf = (_JSAMPARRAY)
  163|  13.0k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|  13.0k|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|  13.0k|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|  13.0k|    main_ptr->xbuffer[0][ci] = xbuf;
  167|  13.0k|    xbuf += rgroup * (M + 4);
  168|  13.0k|    main_ptr->xbuffer[1][ci] = xbuf;
  169|  13.0k|  }
  170|  4.32k|}
j12init_d_main_controller:
  429|  1.37k|{
  430|  1.37k|  my_main_ptr main_ptr;
  431|  1.37k|  int ci, rgroup, ngroups;
  432|  1.37k|  jpeg_component_info *compptr;
  433|       |
  434|  1.37k|#ifdef D_LOSSLESS_SUPPORTED
  435|  1.37k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 411, False: 962]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    411|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    822|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 411]
  ------------------
  440|    411|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    411|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 411]
  ------------------
  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|    411|  } else
  444|    962|#endif
  445|    962|  {
  446|    962|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    962|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 962]
  ------------------
  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|    962|  }
  449|       |
  450|  1.37k|  main_ptr = (my_main_ptr)
  451|  1.37k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.37k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  1.37k|                                sizeof(my_main_controller));
  453|  1.37k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  1.37k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  1.37k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  1.37k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 1.37k]
  ------------------
  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.37k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 183, False: 1.19k]
  ------------------
  464|    183|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|    183|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 183]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|    183|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|    183|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|    183|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  1.19k|  } else {
  469|  1.19k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.19k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  1.19k|  }
  471|       |
  472|  4.98k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 3.61k, False: 1.37k]
  ------------------
  473|  3.61k|       ci++, compptr++) {
  474|  3.61k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  3.61k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  3.61k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  3.61k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  3.61k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  3.61k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.61k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  3.61k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  3.61k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  3.61k|                         (JDIMENSION)(rgroup * ngroups));
  480|  3.61k|  }
  481|  1.37k|}
jdmainct-12.c:start_pass_main:
  259|    100|{
  260|    100|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    100|  switch (pass_mode) {
  263|    100|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 100, False: 0]
  ------------------
  264|    100|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 13, False: 87]
  ------------------
  265|     13|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  138|     13|#define _process_data  process_data_12
  ------------------
  266|     13|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|     13|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|     13|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|     13|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|     13|      main_ptr->iMCU_row_ctr = 0;
  270|     87|    } else {
  271|       |      /* Simple case with no context needed */
  272|     87|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  138|     87|#define _process_data  process_data_12
  ------------------
  273|     87|    }
  274|    100|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|    100|#define FALSE   0               /* values of boolean */
  ------------------
  275|    100|    main_ptr->rowgroup_ctr = 0;
  276|    100|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 100]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  138|      0|#define _process_data  process_data_12
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 100]
  ------------------
  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|    100|  }
  287|    100|}
jdmainct-12.c:make_funny_pointers:
  181|     13|{
  182|     13|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|     13|  int ci, i, rgroup;
  184|     13|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     13|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|     13|  jpeg_component_info *compptr;
  186|     13|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  112|     13|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  187|       |
  188|     87|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 74, False: 13]
  ------------------
  189|     74|       ci++, compptr++) {
  190|     74|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     74|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|     74|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|     74|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|     74|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|     74|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|     74|    buf = main_ptr->buffer[ci];
  196|  1.53k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 1.46k, False: 74]
  ------------------
  197|  1.46k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|  1.46k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|    366|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 292, False: 74]
  ------------------
  201|    292|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|    292|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|    292|    }
  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|    220|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 146, False: 74]
  ------------------
  210|    146|      xbuf0[i - rgroup] = xbuf0[0];
  211|    146|    }
  212|     74|  }
  213|     13|}
jdmainct-12.c:alloc_funny_pointers:
  139|    183|{
  140|    183|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|    183|  int ci, rgroup;
  142|    183|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    183|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|    183|  jpeg_component_info *compptr;
  144|    183|  _JSAMPARRAY xbuf;
  ------------------
  |  |  112|    183|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  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|    183|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|    183|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    183|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|    183|                                cinfo->num_components * 2 *
  152|    183|                                sizeof(_JSAMPARRAY));
  153|    183|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|    817|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 634, False: 183]
  ------------------
  156|    634|       ci++, compptr++) {
  157|    634|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    634|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|    634|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    634|#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|    634|    xbuf = (_JSAMPARRAY)
  163|    634|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    634|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|    634|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|    634|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|    634|    main_ptr->xbuffer[0][ci] = xbuf;
  167|    634|    xbuf += rgroup * (M + 4);
  168|    634|    main_ptr->xbuffer[1][ci] = xbuf;
  169|    634|  }
  170|    183|}
j16init_d_main_controller:
  429|    391|{
  430|    391|  my_main_ptr main_ptr;
  431|    391|  int ci, rgroup, ngroups;
  432|    391|  jpeg_component_info *compptr;
  433|       |
  434|    391|#ifdef D_LOSSLESS_SUPPORTED
  435|    391|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 391, False: 0]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    391|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    782|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (439:9): [True: 0, False: 391]
  ------------------
  440|    391|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    391|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (440:9): [True: 0, False: 391]
  ------------------
  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|    391|  } else
  444|      0|#endif
  445|      0|  {
  446|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  ------------------
  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|      0|  }
  449|       |
  450|    391|  main_ptr = (my_main_ptr)
  451|    391|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    391|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    391|                                sizeof(my_main_controller));
  453|    391|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    391|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    391|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    391|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 391]
  ------------------
  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|    391|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 391]
  ------------------
  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|    391|  } else {
  469|    391|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    391|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    391|  }
  471|       |
  472|  1.78k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 1.39k, False: 391]
  ------------------
  473|  1.39k|       ci++, compptr++) {
  474|  1.39k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.39k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  1.39k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  1.39k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  1.39k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  1.39k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  1.39k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  1.39k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  1.39k|                         (JDIMENSION)(rgroup * ngroups));
  480|  1.39k|  }
  481|    391|}
jdmainct-16.c:start_pass_main:
  259|      6|{
  260|      6|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|      6|  switch (pass_mode) {
  263|      6|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 6, False: 0]
  ------------------
  264|      6|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 6]
  ------------------
  265|      0|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |   51|      0|#define _process_data  process_data_16
  ------------------
  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|      6|    } else {
  271|       |      /* Simple case with no context needed */
  272|      6|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |   51|      6|#define _process_data  process_data_16
  ------------------
  273|      6|    }
  274|      6|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|      6|#define FALSE   0               /* values of boolean */
  ------------------
  275|      6|    main_ptr->rowgroup_ctr = 0;
  276|      6|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 6]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |   51|      0|#define _process_data  process_data_16
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 6]
  ------------------
  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|      6|  }
  287|      6|}

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

jpeg_resync_to_restart:
 1217|   612k|{
 1218|   612k|  int marker = cinfo->unread_marker;
 1219|   612k|  int action = 1;
 1220|       |
 1221|       |  /* Always put up a warning. */
 1222|   612k|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|   612k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   612k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   612k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   612k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1223|       |
 1224|       |  /* Outer loop handles repeated decision after scanning forward. */
 1225|   614k|  for (;;) {
 1226|   614k|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1226:9): [True: 635, False: 613k]
  ------------------
 1227|    635|      action = 2;               /* invalid marker */
 1228|   613k|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1228:14): [True: 14.1k, False: 599k]
  |  Branch (1228:38): [True: 594k, False: 4.79k]
  ------------------
 1229|   608k|      action = 3;               /* valid non-restart marker */
 1230|  4.79k|    else {
 1231|  4.79k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1231:11): [True: 1.00k, False: 3.79k]
  ------------------
 1232|  3.79k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1232:11): [True: 635, False: 3.16k]
  ------------------
 1233|  1.63k|        action = 3;             /* one of the next two expected restarts */
 1234|  3.16k|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1234:16): [True: 336, False: 2.82k]
  ------------------
 1235|  2.82k|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1235:16): [True: 406, False: 2.42k]
  ------------------
 1236|    742|        action = 2;             /* a prior restart, so advance */
 1237|  2.42k|      else
 1238|  2.42k|        action = 1;             /* desired restart or too far away */
 1239|  4.79k|    }
 1240|   614k|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|   614k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|   614k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|   614k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|   614k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1241|   614k|    switch (action) {
  ------------------
  |  Branch (1241:13): [True: 614k, False: 0]
  ------------------
 1242|  2.42k|    case 1:
  ------------------
  |  Branch (1242:5): [True: 2.42k, False: 611k]
  ------------------
 1243|       |      /* Discard marker and let entropy decoder resume processing. */
 1244|  2.42k|      cinfo->unread_marker = 0;
 1245|  2.42k|      return TRUE;
  ------------------
  |  |  210|  2.42k|#define TRUE    1
  ------------------
 1246|  1.37k|    case 2:
  ------------------
  |  Branch (1246:5): [True: 1.37k, False: 612k]
  ------------------
 1247|       |      /* Scan to the next marker, and repeat the decision loop. */
 1248|  1.37k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1248:11): [True: 0, False: 1.37k]
  ------------------
 1249|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1250|  1.37k|      marker = cinfo->unread_marker;
 1251|  1.37k|      break;
 1252|   610k|    case 3:
  ------------------
  |  Branch (1252:5): [True: 610k, False: 3.79k]
  ------------------
 1253|       |      /* Return without advancing past this marker. */
 1254|       |      /* Entropy decoder will be forced to process an empty segment. */
 1255|   610k|      return TRUE;
  ------------------
  |  |  210|   610k|#define TRUE    1
  ------------------
 1256|   614k|    }
 1257|   614k|  } /* end loop */
 1258|   612k|}
jinit_marker_reader:
 1287|  6.97k|{
 1288|  6.97k|  my_marker_ptr marker;
 1289|  6.97k|  int i;
 1290|       |
 1291|       |  /* Create subobject in permanent pool */
 1292|  6.97k|  marker = (my_marker_ptr)
 1293|  6.97k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.97k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1294|  6.97k|                                sizeof(my_marker_reader));
 1295|  6.97k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1296|       |  /* Initialize public method pointers */
 1297|  6.97k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1298|  6.97k|  marker->pub.read_markers = read_markers;
 1299|  6.97k|  marker->pub.read_restart_marker = read_restart_marker;
 1300|       |  /* Initialize COM/APPn processing.
 1301|       |   * By default, we examine and then discard APP0 and APP14,
 1302|       |   * but simply discard COM and all other APPn.
 1303|       |   */
 1304|  6.97k|  marker->process_COM = skip_variable;
 1305|  6.97k|  marker->length_limit_COM = 0;
 1306|   118k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1306:15): [True: 111k, False: 6.97k]
  ------------------
 1307|   111k|    marker->process_APPn[i] = skip_variable;
 1308|   111k|    marker->length_limit_APPn[i] = 0;
 1309|   111k|  }
 1310|  6.97k|  marker->process_APPn[0] = get_interesting_appn;
 1311|  6.97k|  marker->process_APPn[14] = get_interesting_appn;
 1312|       |  /* Reset marker processing state */
 1313|  6.97k|  reset_marker_reader(cinfo);
 1314|  6.97k|}
jpeg_save_markers:
 1326|   298k|{
 1327|   298k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1328|   298k|  long maxlength;
 1329|   298k|  jpeg_marker_parser_method processor;
 1330|       |
 1331|       |  /* Length limit mustn't be larger than what we can allocate
 1332|       |   * (should only be a concern in a 16-bit environment).
 1333|       |   */
 1334|   298k|  maxlength = cinfo->mem->max_alloc_chunk - sizeof(struct jpeg_marker_struct);
 1335|   298k|  if (((long)length_limit) > maxlength)
  ------------------
  |  Branch (1335:7): [True: 0, False: 298k]
  ------------------
 1336|      0|    length_limit = (unsigned int)maxlength;
 1337|       |
 1338|       |  /* Choose processor routine to use.
 1339|       |   * APP0/APP14 have special requirements.
 1340|       |   */
 1341|   298k|  if (length_limit) {
  ------------------
  |  Branch (1341:7): [True: 298k, False: 0]
  ------------------
 1342|   298k|    processor = save_marker;
 1343|       |    /* If saving APP0/APP14, save at least enough for our internal use. */
 1344|   298k|    if (marker_code == (int)M_APP0 && length_limit < APP0_DATA_LEN)
  ------------------
  |  |  599|  19.9k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (1344:9): [True: 19.9k, False: 278k]
  |  Branch (1344:39): [True: 0, False: 19.9k]
  ------------------
 1345|      0|      length_limit = APP0_DATA_LEN;
  ------------------
  |  |  599|      0|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
 1346|   298k|    else if (marker_code == (int)M_APP14 && length_limit < APP14_DATA_LEN)
  ------------------
  |  |  600|  19.9k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (1346:14): [True: 19.9k, False: 278k]
  |  Branch (1346:45): [True: 0, False: 19.9k]
  ------------------
 1347|      0|      length_limit = APP14_DATA_LEN;
  ------------------
  |  |  600|      0|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
 1348|   298k|  } else {
 1349|      0|    processor = skip_variable;
 1350|       |    /* If discarding APP0/APP14, use our regular on-the-fly processor. */
 1351|      0|    if (marker_code == (int)M_APP0 || marker_code == (int)M_APP14)
  ------------------
  |  Branch (1351:9): [True: 0, False: 0]
  |  Branch (1351:39): [True: 0, False: 0]
  ------------------
 1352|      0|      processor = get_interesting_appn;
 1353|      0|  }
 1354|       |
 1355|   298k|  if (marker_code == (int)M_COM) {
  ------------------
  |  Branch (1355:7): [True: 0, False: 298k]
  ------------------
 1356|      0|    marker->process_COM = processor;
 1357|      0|    marker->length_limit_COM = length_limit;
 1358|   298k|  } else if (marker_code >= (int)M_APP0 && marker_code <= (int)M_APP15) {
  ------------------
  |  Branch (1358:14): [True: 298k, False: 0]
  |  Branch (1358:44): [True: 298k, False: 0]
  ------------------
 1359|   298k|    marker->process_APPn[marker_code - (int)M_APP0] = processor;
 1360|   298k|    marker->length_limit_APPn[marker_code - (int)M_APP0] = length_limit;
 1361|   298k|  } else
 1362|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1363|   298k|}
jpeg_set_marker_processor:
 1375|  19.9k|{
 1376|  19.9k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1377|       |
 1378|  19.9k|  if (marker_code == (int)M_COM)
  ------------------
  |  Branch (1378:7): [True: 0, False: 19.9k]
  ------------------
 1379|      0|    marker->process_COM = routine;
 1380|  19.9k|  else if (marker_code >= (int)M_APP0 && marker_code <= (int)M_APP15)
  ------------------
  |  Branch (1380:12): [True: 19.9k, False: 0]
  |  Branch (1380:42): [True: 19.9k, False: 0]
  ------------------
 1381|  19.9k|    marker->process_APPn[marker_code - (int)M_APP0] = routine;
 1382|      0|  else
 1383|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1384|  19.9k|}
jdmarker.c:next_marker:
  891|   377k|{
  892|   377k|  int c;
  893|   377k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   377k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   377k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   377k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  894|       |
  895|   411k|  for (;;) {
  896|   411k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   411k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   416k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.89k]
  |  |  |  |  |  Branch (279:38): [True: 1.89k, False: 409k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 411k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   411k|            bytes_in_buffer--; \
  |  |  156|   411k|            V = *next_input_byte++; )
  ------------------
  897|       |    /* Skip any non-FF bytes.
  898|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  899|       |     * We sync after each discarded byte so that a suspending data source
  900|       |     * can discard the byte from its buffer.
  901|       |     */
  902|  13.6M|    while (c != 0xFF) {
  ------------------
  |  Branch (902:12): [True: 13.2M, False: 411k]
  ------------------
  903|  13.2M|      cinfo->marker->discarded_bytes++;
  904|  13.2M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  13.2M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  13.2M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  905|  13.2M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  13.2M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.2M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.15k]
  |  |  |  |  |  Branch (279:38): [True: 2.15k, False: 13.2M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 13.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  13.2M|            bytes_in_buffer--; \
  |  |  156|  13.2M|            V = *next_input_byte++; )
  ------------------
  906|  13.2M|    }
  907|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  908|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  909|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  910|       |     * data source's input buffer.
  911|       |     */
  912|   430k|    do {
  913|   430k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   430k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   430k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 92]
  |  |  |  |  |  Branch (279:38): [True: 92, False: 430k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 430k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   430k|            bytes_in_buffer--; \
  |  |  156|   430k|            V = *next_input_byte++; )
  ------------------
  914|   430k|    } while (c == 0xFF);
  ------------------
  |  Branch (914:14): [True: 19.3k, False: 411k]
  ------------------
  915|   411k|    if (c != 0)
  ------------------
  |  Branch (915:9): [True: 377k, False: 33.2k]
  ------------------
  916|   377k|      break;                    /* found a valid marker, exit loop */
  917|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  918|       |     * Discard it and loop back to try again.
  919|       |     */
  920|  33.2k|    cinfo->marker->discarded_bytes += 2;
  921|  33.2k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  33.2k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  33.2k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  922|  33.2k|  }
  923|       |
  924|   377k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (924:7): [True: 318k, False: 59.1k]
  ------------------
  925|   318k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|   318k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   318k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   318k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   318k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  926|   318k|    cinfo->marker->discarded_bytes = 0;
  927|   318k|  }
  928|       |
  929|   377k|  cinfo->unread_marker = c;
  930|       |
  931|   377k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   377k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   377k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  932|   377k|  return TRUE;
  ------------------
  |  |  210|   377k|#define TRUE    1
  ------------------
  933|   377k|}
jdmarker.c:reset_marker_reader:
 1267|  26.5k|{
 1268|  26.5k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1269|       |
 1270|  26.5k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1271|  26.5k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1272|  26.5k|  cinfo->unread_marker = 0;             /* no pending marker */
 1273|  26.5k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|  26.5k|#define FALSE   0               /* values of boolean */
  ------------------
 1274|  26.5k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|  26.5k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  26.5k|  marker->pub.discarded_bytes = 0;
 1276|       |  marker->cur_marker = NULL;
 1277|  26.5k|}
jdmarker.c:read_markers:
  969|  84.4k|{
  970|       |  /* Outer loop repeats once for each marker. */
  971|   456k|  for (;;) {
  972|       |    /* Collect the marker proper, unless we already did. */
  973|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  974|   456k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (974:9): [True: 395k, False: 60.8k]
  ------------------
  975|   395k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (975:11): [True: 19.6k, False: 376k]
  ------------------
  976|  19.6k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (976:13): [True: 0, False: 19.6k]
  ------------------
  977|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  978|   376k|      } else {
  979|   376k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (979:13): [True: 0, False: 376k]
  ------------------
  980|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  981|   376k|      }
  982|   395k|    }
  983|       |    /* At this point cinfo->unread_marker contains the marker code and the
  984|       |     * input point is just past the marker proper, but before any parameters.
  985|       |     * A suspension will cause us to return with this state still true.
  986|       |     */
  987|   456k|    switch (cinfo->unread_marker) {
  988|  19.7k|    case M_SOI:
  ------------------
  |  Branch (988:5): [True: 19.7k, False: 436k]
  ------------------
  989|  19.7k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (989:11): [True: 0, False: 19.7k]
  ------------------
  990|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  991|  19.7k|      break;
  992|       |
  993|  19.7k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (993:5): [True: 4.01k, False: 452k]
  ------------------
  994|  6.63k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (994:5): [True: 2.62k, False: 453k]
  ------------------
  995|  6.63k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  6.63k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  6.63k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  6.63k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (995:11): [True: 0, False: 6.63k]
  ------------------
  996|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  997|  6.63k|      break;
  998|       |
  999|  6.63k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (999:5): [True: 3.83k, False: 452k]
  ------------------
 1000|  3.83k|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|  3.83k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  3.83k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  3.83k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1000:11): [True: 0, False: 3.83k]
  ------------------
 1001|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1002|  3.83k|      break;
 1003|       |
 1004|  3.83k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1004:5): [True: 1.50k, False: 454k]
  ------------------
 1005|  1.50k|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  1.50k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|  1.50k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  1.50k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1005:11): [True: 0, False: 1.50k]
  ------------------
 1006|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1007|  1.50k|      break;
 1008|       |
 1009|  2.66k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1009:5): [True: 2.66k, False: 453k]
  ------------------
 1010|  2.66k|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  2.66k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  2.66k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|  2.66k|#define TRUE    1
  ------------------
  |  Branch (1010:11): [True: 0, False: 2.66k]
  ------------------
 1011|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1012|  2.66k|      break;
 1013|       |
 1014|  3.94k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1014:5): [True: 3.94k, False: 452k]
  ------------------
 1015|  3.94k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  3.94k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|  3.94k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  3.94k|#define TRUE    1
  ------------------
  |  Branch (1015:11): [True: 0, False: 3.94k]
  ------------------
 1016|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1017|  3.94k|      break;
 1018|       |
 1019|  3.94k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1019:5): [True: 49, False: 456k]
  ------------------
 1020|     49|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|     49|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     49|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     49|#define TRUE    1
  ------------------
  |  Branch (1020:11): [True: 0, False: 49]
  ------------------
 1021|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1022|     49|      break;
 1023|       |
 1024|       |    /* Currently unsupported SOFn types */
 1025|     49|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1025:5): [True: 4, False: 456k]
  ------------------
 1026|     14|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1026:5): [True: 10, False: 456k]
  ------------------
 1027|     25|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1027:5): [True: 11, False: 456k]
  ------------------
 1028|     35|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1028:5): [True: 10, False: 456k]
  ------------------
 1029|     42|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1029:5): [True: 7, False: 456k]
  ------------------
 1030|     54|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 12, False: 456k]
  ------------------
 1031|     63|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 9, False: 456k]
  ------------------
 1032|     63|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|     63|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     63|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     63|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1033|     63|      break;
 1034|       |
 1035|  59.1k|    case M_SOS:
  ------------------
  |  Branch (1035:5): [True: 59.1k, False: 397k]
  ------------------
 1036|  59.1k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1036:11): [True: 0, False: 59.1k]
  ------------------
 1037|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1038|  59.1k|      cinfo->unread_marker = 0; /* processed the marker */
 1039|  59.1k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|  59.1k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1040|       |
 1041|  15.0k|    case M_EOI:
  ------------------
  |  Branch (1041:5): [True: 15.0k, False: 441k]
  ------------------
 1042|  15.0k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|  15.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  15.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1043|  15.0k|      cinfo->unread_marker = 0; /* processed the marker */
 1044|  15.0k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|  15.0k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1045|       |
 1046|  2.02k|    case M_DAC:
  ------------------
  |  Branch (1046:5): [True: 2.02k, False: 454k]
  ------------------
 1047|  2.02k|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1047:11): [True: 0, False: 2.02k]
  ------------------
 1048|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1049|  2.02k|      break;
 1050|       |
 1051|  9.67k|    case M_DHT:
  ------------------
  |  Branch (1051:5): [True: 9.67k, False: 446k]
  ------------------
 1052|  9.67k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1052:11): [True: 0, False: 9.67k]
  ------------------
 1053|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1054|  9.67k|      break;
 1055|       |
 1056|  19.0k|    case M_DQT:
  ------------------
  |  Branch (1056:5): [True: 19.0k, False: 437k]
  ------------------
 1057|  19.0k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1057:11): [True: 0, False: 19.0k]
  ------------------
 1058|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1059|  19.0k|      break;
 1060|       |
 1061|  19.0k|    case M_DRI:
  ------------------
  |  Branch (1061:5): [True: 4.04k, False: 452k]
  ------------------
 1062|  4.04k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1062:11): [True: 0, False: 4.04k]
  ------------------
 1063|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1064|  4.04k|      break;
 1065|       |
 1066|  5.64k|    case M_APP0:
  ------------------
  |  Branch (1066:5): [True: 5.64k, False: 450k]
  ------------------
 1067|   277k|    case M_APP1:
  ------------------
  |  Branch (1067:5): [True: 272k, False: 184k]
  ------------------
 1068|   278k|    case M_APP2:
  ------------------
  |  Branch (1068:5): [True: 340, False: 456k]
  ------------------
 1069|   293k|    case M_APP3:
  ------------------
  |  Branch (1069:5): [True: 15.0k, False: 441k]
  ------------------
 1070|   293k|    case M_APP4:
  ------------------
  |  Branch (1070:5): [True: 272, False: 456k]
  ------------------
 1071|   293k|    case M_APP5:
  ------------------
  |  Branch (1071:5): [True: 376, False: 456k]
  ------------------
 1072|   294k|    case M_APP6:
  ------------------
  |  Branch (1072:5): [True: 295, False: 456k]
  ------------------
 1073|   294k|    case M_APP7:
  ------------------
  |  Branch (1073:5): [True: 324, False: 456k]
  ------------------
 1074|   294k|    case M_APP8:
  ------------------
  |  Branch (1074:5): [True: 530, False: 455k]
  ------------------
 1075|   295k|    case M_APP9:
  ------------------
  |  Branch (1075:5): [True: 303, False: 456k]
  ------------------
 1076|   295k|    case M_APP10:
  ------------------
  |  Branch (1076:5): [True: 231, False: 456k]
  ------------------
 1077|   295k|    case M_APP11:
  ------------------
  |  Branch (1077:5): [True: 259, False: 456k]
  ------------------
 1078|   296k|    case M_APP12:
  ------------------
  |  Branch (1078:5): [True: 396, False: 456k]
  ------------------
 1079|   296k|    case M_APP13:
  ------------------
  |  Branch (1079:5): [True: 236, False: 456k]
  ------------------
 1080|   298k|    case M_APP14:
  ------------------
  |  Branch (1080:5): [True: 1.88k, False: 454k]
  ------------------
 1081|   298k|    case M_APP15:
  ------------------
  |  Branch (1081:5): [True: 404, False: 456k]
  ------------------
 1082|   298k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1082:11): [True: 8.75k, False: 289k]
  ------------------
 1083|   298k|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1084|  8.75k|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|  8.75k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1085|   289k|      break;
 1086|       |
 1087|   289k|    case M_COM:
  ------------------
  |  Branch (1087:5): [True: 2.44k, False: 454k]
  ------------------
 1088|  2.44k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1088:11): [True: 0, False: 2.44k]
  ------------------
 1089|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1090|  2.44k|      break;
 1091|       |
 1092|  2.44k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1092:5): [True: 546, False: 455k]
  ------------------
 1093|  1.27k|    case M_RST1:
  ------------------
  |  Branch (1093:5): [True: 732, False: 455k]
  ------------------
 1094|  1.90k|    case M_RST2:
  ------------------
  |  Branch (1094:5): [True: 623, False: 455k]
  ------------------
 1095|  2.43k|    case M_RST3:
  ------------------
  |  Branch (1095:5): [True: 535, False: 455k]
  ------------------
 1096|  2.96k|    case M_RST4:
  ------------------
  |  Branch (1096:5): [True: 532, False: 455k]
  ------------------
 1097|  3.59k|    case M_RST5:
  ------------------
  |  Branch (1097:5): [True: 626, False: 455k]
  ------------------
 1098|  4.30k|    case M_RST6:
  ------------------
  |  Branch (1098:5): [True: 713, False: 455k]
  ------------------
 1099|  4.81k|    case M_RST7:
  ------------------
  |  Branch (1099:5): [True: 505, False: 455k]
  ------------------
 1100|  6.36k|    case M_TEM:
  ------------------
  |  Branch (1100:5): [True: 1.55k, False: 454k]
  ------------------
 1101|  6.36k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  6.36k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  6.36k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  6.36k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1102|  6.36k|      break;
 1103|       |
 1104|  1.07k|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1104:5): [True: 1.07k, False: 455k]
  ------------------
 1105|  1.07k|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1105:11): [True: 0, False: 1.07k]
  ------------------
 1106|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1107|  1.07k|      break;
 1108|       |
 1109|  1.07k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1109:5): [True: 456, False: 456k]
  ------------------
 1110|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1111|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1112|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1113|       |       * ought to change!
 1114|       |       */
 1115|    456|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|    456|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    456|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    456|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1116|    456|      break;
 1117|   456k|    }
 1118|       |    /* Successfully processed marker, so reset state variable */
 1119|   372k|    cinfo->unread_marker = 0;
 1120|   372k|  } /* end loop */
 1121|  84.4k|}
jdmarker.c:first_marker:
  944|  19.6k|{
  945|  19.6k|  int c, c2;
  946|  19.6k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  19.6k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  19.6k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  19.6k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  947|       |
  948|  19.6k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  19.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 19.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  19.6k|            bytes_in_buffer--; \
  |  |  156|  19.6k|            V = *next_input_byte++; )
  ------------------
  949|  19.6k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  19.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 19.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  19.6k|            bytes_in_buffer--; \
  |  |  156|  19.6k|            V = *next_input_byte++; )
  ------------------
  950|  19.6k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (950:7): [True: 16, False: 19.5k]
  |  Branch (950:20): [True: 12, False: 19.5k]
  ------------------
  951|     28|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     28|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     28|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     28|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  952|       |
  953|  19.6k|  cinfo->unread_marker = c2;
  954|       |
  955|  19.6k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  19.6k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  19.6k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  956|  19.6k|  return TRUE;
  ------------------
  |  |  210|  19.6k|#define TRUE    1
  ------------------
  957|  19.6k|}
jdmarker.c:get_soi:
  204|  19.7k|{
  205|  19.7k|  int i;
  206|       |
  207|  19.7k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  19.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  19.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  19.7k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 136, False: 19.5k]
  ------------------
  210|    136|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|    136|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    136|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|   332k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   332k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 313k, False: 19.7k]
  ------------------
  215|   313k|    cinfo->arith_dc_L[i] = 0;
  216|   313k|    cinfo->arith_dc_U[i] = 1;
  217|   313k|    cinfo->arith_ac_K[i] = 5;
  218|   313k|  }
  219|  19.7k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  19.7k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  19.7k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|  19.7k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  19.7k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|  19.7k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  19.7k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  19.7k|  cinfo->JFIF_minor_version = 1;
  229|  19.7k|  cinfo->density_unit = 0;
  230|  19.7k|  cinfo->X_density = 1;
  231|  19.7k|  cinfo->Y_density = 1;
  232|  19.7k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|  19.7k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  19.7k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  19.7k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|  19.7k|#define TRUE    1
  ------------------
  236|       |
  237|  19.7k|  return TRUE;
  ------------------
  |  |  210|  19.7k|#define TRUE    1
  ------------------
  238|  19.7k|}
jdmarker.c:get_sof:
  245|  18.6k|{
  246|  18.6k|  JLONG length;
  247|  18.6k|  int c, ci;
  248|  18.6k|  jpeg_component_info *compptr;
  249|  18.6k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  18.6k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  18.6k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  18.6k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  18.6k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 120, False: 18.5k]
  ------------------
  252|    120|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|    120|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    120|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  18.6k|  cinfo->progressive_mode = is_prog;
  255|  18.6k|  cinfo->master->lossless = is_lossless;
  256|  18.6k|  cinfo->arith_code = is_arith;
  257|       |
  258|  18.6k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  37.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 18.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 18.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  18.6k|            bytes_in_buffer--; \
  |  |  164|  18.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  18.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  18.6k|            bytes_in_buffer--; \
  |  |  167|  18.6k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  18.6k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  18.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 18.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  18.6k|            bytes_in_buffer--; \
  |  |  156|  18.6k|            V = *next_input_byte++; )
  ------------------
  261|  18.6k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  37.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 21]
  |  |  |  |  |  Branch (279:38): [True: 21, False: 18.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 20]
  |  |  |  |  |  Branch (279:38): [True: 20, False: 18.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  18.6k|            bytes_in_buffer--; \
  |  |  164|  18.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  18.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  18.6k|            bytes_in_buffer--; \
  |  |  167|  18.6k|            V += *next_input_byte++; )
  ------------------
  262|  18.6k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  37.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 29]
  |  |  |  |  |  Branch (279:38): [True: 29, False: 18.5k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 28]
  |  |  |  |  |  Branch (279:38): [True: 28, False: 18.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  18.6k|            bytes_in_buffer--; \
  |  |  164|  18.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  18.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  18.6k|            bytes_in_buffer--; \
  |  |  167|  18.6k|            V += *next_input_byte++; )
  ------------------
  263|  18.6k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  18.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 37]
  |  |  |  |  |  Branch (279:38): [True: 37, False: 18.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  18.6k|            bytes_in_buffer--; \
  |  |  156|  18.6k|            V = *next_input_byte++; )
  ------------------
  264|       |
  265|  18.6k|  length -= 8;
  266|       |
  267|  18.6k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  18.6k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  18.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  18.6k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  18.6k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  18.6k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  268|  18.6k|           (int)cinfo->image_width, (int)cinfo->image_height,
  269|  18.6k|           cinfo->num_components);
  270|       |
  271|       |  /* We don't support files in which the image height is initially specified */
  272|       |  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  273|       |  /* might as well have a general sanity check. */
  274|  18.6k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (274:7): [True: 122, False: 18.5k]
  |  Branch (274:35): [True: 2, False: 18.4k]
  ------------------
  275|  18.4k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (275:7): [True: 1, False: 18.4k]
  ------------------
  276|      5|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  277|       |
  278|  18.6k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (278:7): [True: 93, False: 18.5k]
  ------------------
  279|     93|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     93|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     93|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |
  281|  18.6k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (281:7): [True: 18.4k, False: 218]
  ------------------
  282|  18.4k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  283|  18.4k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  284|  18.4k|                         cinfo->num_components * sizeof(jpeg_component_info));
  285|       |
  286|  63.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (286:44): [True: 44.8k, False: 18.6k]
  ------------------
  287|  44.8k|       ci++, compptr++) {
  288|  44.8k|    compptr->component_index = ci;
  289|  44.8k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  44.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  47.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.01k]
  |  |  |  |  |  Branch (279:38): [True: 1.01k, False: 43.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 44.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  44.8k|            bytes_in_buffer--; \
  |  |  156|  44.8k|            V = *next_input_byte++; )
  ------------------
  290|  44.8k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  44.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  47.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.01k]
  |  |  |  |  |  Branch (279:38): [True: 1.01k, False: 43.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 44.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  44.8k|            bytes_in_buffer--; \
  |  |  156|  44.8k|            V = *next_input_byte++; )
  ------------------
  291|  44.8k|    compptr->h_samp_factor = (c >> 4) & 15;
  292|  44.8k|    compptr->v_samp_factor = (c     ) & 15;
  293|  44.8k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  44.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  47.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.02k]
  |  |  |  |  |  Branch (279:38): [True: 1.02k, False: 43.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 44.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  44.8k|            bytes_in_buffer--; \
  |  |  156|  44.8k|            V = *next_input_byte++; )
  ------------------
  294|       |
  295|  44.8k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  44.8k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  44.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 44.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  44.8k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  44.8k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  44.8k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  296|  44.8k|             compptr->component_id, compptr->h_samp_factor,
  297|  44.8k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  298|  44.8k|  }
  299|       |
  300|  18.6k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|  18.6k|#define TRUE    1
  ------------------
  301|       |
  302|  18.6k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  18.6k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  18.6k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  303|  18.6k|  return TRUE;
  ------------------
  |  |  210|  18.6k|#define TRUE    1
  ------------------
  304|  18.6k|}
jdmarker.c:get_sos:
  310|  59.1k|{
  311|  59.1k|  JLONG length;
  312|  59.1k|  int i, ci, n, c, cc, pi;
  313|  59.1k|  jpeg_component_info *compptr;
  314|  59.1k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  59.1k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  59.1k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  59.1k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  315|       |
  316|  59.1k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (316:7): [True: 5, False: 59.1k]
  ------------------
  317|      5|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|       |
  319|  59.1k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  59.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   118k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 40]
  |  |  |  |  |  Branch (279:38): [True: 40, False: 59.0k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 26]
  |  |  |  |  |  Branch (279:38): [True: 26, False: 59.1k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  59.1k|            bytes_in_buffer--; \
  |  |  164|  59.1k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  59.1k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  59.1k|            bytes_in_buffer--; \
  |  |  167|  59.1k|            V += *next_input_byte++; )
  ------------------
  320|       |
  321|  59.1k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  59.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  59.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 52]
  |  |  |  |  |  Branch (279:38): [True: 52, False: 59.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  59.1k|            bytes_in_buffer--; \
  |  |  156|  59.1k|            V = *next_input_byte++; )
  ------------------
  322|       |
  323|  59.1k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  59.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  59.1k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  59.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  324|       |
  325|  59.1k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  58.9k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (325:7): [True: 158, False: 58.9k]
  |  Branch (325:32): [True: 3, False: 58.9k]
  |  Branch (325:41): [True: 8, False: 58.9k]
  ------------------
  326|    164|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    164|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    164|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  327|       |
  328|  59.1k|  cinfo->comps_in_scan = n;
  329|       |
  330|       |  /* Collect the component-spec parameters */
  331|       |
  332|   295k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|   295k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (332:15): [True: 235k, False: 59.1k]
  ------------------
  333|   235k|    cinfo->cur_comp_info[i] = NULL;
  334|       |
  335|   143k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (335:15): [True: 84.3k, False: 59.0k]
  ------------------
  336|  84.3k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  84.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  84.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 183]
  |  |  |  |  |  Branch (279:38): [True: 183, False: 84.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 84.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  84.3k|            bytes_in_buffer--; \
  |  |  156|  84.3k|            V = *next_input_byte++; )
  ------------------
  337|  84.3k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  84.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  86.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 694]
  |  |  |  |  |  Branch (279:38): [True: 694, False: 83.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 84.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  84.3k|            bytes_in_buffer--; \
  |  |  156|  84.3k|            V = *next_input_byte++; )
  ------------------
  338|       |
  339|  84.3k|    for (ci = 0, compptr = cinfo->comp_info;
  340|   154k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|   154k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (340:10): [True: 154k, False: 59]
  |  Branch (340:40): [True: 154k, False: 1]
  ------------------
  341|   154k|         ci++, compptr++) {
  342|   154k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (342:11): [True: 84.9k, False: 69.3k]
  |  Branch (342:42): [True: 84.3k, False: 633]
  ------------------
  343|  84.3k|        goto id_found;
  344|   154k|    }
  345|       |
  346|     60|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|     60|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     60|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     60|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  347|       |
  348|  84.3k|id_found:
  349|       |
  350|  84.3k|    cinfo->cur_comp_info[i] = compptr;
  351|  84.3k|    compptr->dc_tbl_no = (c >> 4) & 15;
  352|  84.3k|    compptr->ac_tbl_no = (c     ) & 15;
  353|       |
  354|  84.3k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  84.3k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  84.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 84.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  84.3k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  84.3k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  84.3k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  355|  84.3k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  356|       |
  357|       |    /* This CSi (cc) should differ from the previous CSi */
  358|   121k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (358:18): [True: 37.6k, False: 84.3k]
  ------------------
  359|  37.6k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (359:11): [True: 8, False: 37.6k]
  ------------------
  360|      8|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|      8|      }
  362|  37.6k|    }
  363|  84.3k|  }
  364|       |
  365|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  366|  59.0k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  59.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  66.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.47k]
  |  |  |  |  |  Branch (279:38): [True: 2.47k, False: 56.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  59.0k|            bytes_in_buffer--; \
  |  |  156|  59.0k|            V = *next_input_byte++; )
  ------------------
  367|  59.0k|  cinfo->Ss = c;
  368|  59.0k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  59.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  62.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.15k]
  |  |  |  |  |  Branch (279:38): [True: 1.15k, False: 57.9k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  59.0k|            bytes_in_buffer--; \
  |  |  156|  59.0k|            V = *next_input_byte++; )
  ------------------
  369|  59.0k|  cinfo->Se = c;
  370|  59.0k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  59.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  67.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.75k]
  |  |  |  |  |  Branch (279:38): [True: 2.75k, False: 56.3k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  59.0k|            bytes_in_buffer--; \
  |  |  156|  59.0k|            V = *next_input_byte++; )
  ------------------
  371|  59.0k|  cinfo->Ah = (c >> 4) & 15;
  372|  59.0k|  cinfo->Al = (c     ) & 15;
  373|       |
  374|  59.0k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  59.0k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  59.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 59.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  59.0k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  59.0k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  59.0k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  375|  59.0k|           cinfo->Ah, cinfo->Al);
  376|       |
  377|       |  /* Prepare to scan data & restart markers */
  378|  59.0k|  cinfo->marker->next_restart_num = 0;
  379|       |
  380|       |  /* Count another SOS marker */
  381|  59.0k|  cinfo->input_scan_number++;
  382|       |
  383|  59.0k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  59.0k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  59.0k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  384|  59.0k|  return TRUE;
  ------------------
  |  |  210|  59.0k|#define TRUE    1
  ------------------
  385|  59.0k|}
jdmarker.c:get_dac:
  393|  2.02k|{
  394|  2.02k|  JLONG length;
  395|  2.02k|  int index, val;
  396|  2.02k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.02k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.02k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.02k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  397|       |
  398|  2.02k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.02k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 15]
  |  |  |  |  |  Branch (279:38): [True: 15, False: 2.00k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 19]
  |  |  |  |  |  Branch (279:38): [True: 19, False: 2.00k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.02k|            bytes_in_buffer--; \
  |  |  164|  2.02k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.02k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.02k|            bytes_in_buffer--; \
  |  |  167|  2.02k|            V += *next_input_byte++; )
  ------------------
  399|  2.02k|  length -= 2;
  400|       |
  401|  4.89k|  while (length > 0) {
  ------------------
  |  Branch (401:10): [True: 2.87k, False: 2.02k]
  ------------------
  402|  2.87k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  2.87k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.95k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 28]
  |  |  |  |  |  Branch (279:38): [True: 28, False: 2.84k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.87k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.87k|            bytes_in_buffer--; \
  |  |  156|  2.87k|            V = *next_input_byte++; )
  ------------------
  403|  2.87k|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|  2.87k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.13k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 88]
  |  |  |  |  |  Branch (279:38): [True: 88, False: 2.78k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.87k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.87k|            bytes_in_buffer--; \
  |  |  156|  2.87k|            V = *next_input_byte++; )
  ------------------
  404|       |
  405|  2.87k|    length -= 2;
  406|       |
  407|  2.87k|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|  2.87k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  2.87k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  2.87k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  2.87k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  408|       |
  409|  2.87k|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|  2.87k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (409:9): [True: 0, False: 2.87k]
  |  Branch (409:22): [True: 96, False: 2.77k]
  ------------------
  410|     96|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|     96|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     96|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     96|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  411|       |
  412|  2.87k|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|  2.87k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (412:9): [True: 1.76k, False: 1.10k]
  ------------------
  413|  1.76k|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|  1.76k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  414|  1.76k|    } else {                    /* define DC table */
  415|  1.10k|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  416|  1.10k|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  417|  1.10k|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (417:11): [True: 10, False: 1.09k]
  ------------------
  418|     10|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     10|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  419|  1.10k|    }
  420|  2.87k|  }
  421|       |
  422|  2.02k|  if (length != 0)
  ------------------
  |  Branch (422:7): [True: 5, False: 2.01k]
  ------------------
  423|      5|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  424|       |
  425|  2.02k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.02k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.02k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  426|  2.02k|  return TRUE;
  ------------------
  |  |  210|  2.02k|#define TRUE    1
  ------------------
  427|  2.02k|}
jdmarker.c:get_dht:
  439|  9.67k|{
  440|  9.67k|  JLONG length;
  441|  9.67k|  UINT8 bits[17];
  442|  9.67k|  UINT8 huffval[256];
  443|  9.67k|  int i, index, count;
  444|  9.67k|  JHUFF_TBL **htblptr;
  445|  9.67k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  9.67k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  9.67k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  9.67k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  446|       |
  447|  9.67k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  9.67k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 26]
  |  |  |  |  |  Branch (279:38): [True: 26, False: 9.65k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 27]
  |  |  |  |  |  Branch (279:38): [True: 27, False: 9.65k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 9.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  9.67k|            bytes_in_buffer--; \
  |  |  164|  9.67k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  9.67k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  9.67k|            bytes_in_buffer--; \
  |  |  167|  9.67k|            V += *next_input_byte++; )
  ------------------
  448|  9.67k|  length -= 2;
  449|       |
  450|  20.1k|  while (length > 16) {
  ------------------
  |  Branch (450:10): [True: 10.4k, False: 9.67k]
  ------------------
  451|  10.4k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  10.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  10.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 59]
  |  |  |  |  |  Branch (279:38): [True: 59, False: 10.4k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 10.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  10.4k|            bytes_in_buffer--; \
  |  |  156|  10.4k|            V = *next_input_byte++; )
  ------------------
  452|       |
  453|  10.4k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  10.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  10.4k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  10.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  454|       |
  455|  10.4k|    bits[0] = 0;
  456|  10.4k|    count = 0;
  457|   178k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (457:17): [True: 167k, False: 10.4k]
  ------------------
  458|   167k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|   167k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   171k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.20k]
  |  |  |  |  |  Branch (279:38): [True: 1.20k, False: 166k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   167k|            bytes_in_buffer--; \
  |  |  156|   167k|            V = *next_input_byte++; )
  ------------------
  459|   167k|      count += bits[i];
  460|   167k|    }
  461|       |
  462|  10.4k|    length -= 1 + 16;
  463|       |
  464|  10.4k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  10.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  10.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 10.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  10.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  10.4k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  10.4k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  10.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  465|  10.4k|             bits[1], bits[2], bits[3], bits[4],
  466|  10.4k|             bits[5], bits[6], bits[7], bits[8]);
  467|  10.4k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  10.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  10.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 10.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  10.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  10.4k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  10.4k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  10.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  468|  10.4k|             bits[9], bits[10], bits[11], bits[12],
  469|  10.4k|             bits[13], bits[14], bits[15], bits[16]);
  470|       |
  471|       |    /* Here we just do minimal validation of the counts to avoid walking
  472|       |     * off the end of our table space.  jdhuff.c will check more carefully.
  473|       |     */
  474|  10.4k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (474:9): [True: 219, False: 10.2k]
  |  Branch (474:24): [True: 22, False: 10.2k]
  ------------------
  475|    241|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    241|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    241|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  476|       |
  477|   127k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (477:17): [True: 117k, False: 10.4k]
  ------------------
  478|   117k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|   117k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   135k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.20k]
  |  |  |  |  |  Branch (279:38): [True: 6.20k, False: 111k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 117k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  10.4k|            bytes_in_buffer--; \
  |  |  156|  10.4k|            V = *next_input_byte++; )
  ------------------
  479|       |
  480|  10.4k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  481|       |
  482|  10.4k|    length -= count;
  483|       |
  484|  10.4k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (484:9): [True: 5.59k, False: 4.89k]
  ------------------
  485|  5.59k|      index -= 0x10;
  486|  5.59k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  5.59k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (486:11): [True: 0, False: 5.59k]
  |  Branch (486:24): [True: 13, False: 5.58k]
  ------------------
  487|     13|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  488|  5.59k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  489|  5.59k|    } else {                    /* DC table definition */
  490|  4.89k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  4.65k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (490:11): [True: 241, False: 4.65k]
  |  Branch (490:24): [True: 10, False: 4.64k]
  ------------------
  491|     10|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     10|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  492|  4.89k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  493|  4.89k|    }
  494|       |
  495|  10.4k|    if (*htblptr == NULL)
  ------------------
  |  Branch (495:9): [True: 2.31k, False: 8.17k]
  ------------------
  496|  2.31k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  497|       |
  498|  10.4k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  499|  10.4k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  500|  10.4k|  }
  501|       |
  502|  9.67k|  if (length != 0)
  ------------------
  |  Branch (502:7): [True: 24, False: 9.65k]
  ------------------
  503|     24|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  504|       |
  505|  9.67k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  9.67k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  9.67k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  506|  9.67k|  return TRUE;
  ------------------
  |  |  210|  9.67k|#define TRUE    1
  ------------------
  507|  9.67k|}
jdmarker.c:get_dqt:
  513|  19.0k|{
  514|  19.0k|  JLONG length;
  515|  19.0k|  int n, i, prec;
  516|  19.0k|  unsigned int tmp;
  517|  19.0k|  JQUANT_TBL *quant_ptr;
  518|  19.0k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  19.0k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  19.0k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  19.0k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  519|       |
  520|  19.0k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  19.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  38.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 9]
  |  |  |  |  |  Branch (279:38): [True: 9, False: 19.0k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 17]
  |  |  |  |  |  Branch (279:38): [True: 17, False: 19.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  19.0k|            bytes_in_buffer--; \
  |  |  164|  19.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  19.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  19.0k|            bytes_in_buffer--; \
  |  |  167|  19.0k|            V += *next_input_byte++; )
  ------------------
  521|  19.0k|  length -= 2;
  522|       |
  523|  38.1k|  while (length > 0) {
  ------------------
  |  Branch (523:10): [True: 19.0k, False: 19.0k]
  ------------------
  524|  19.0k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  19.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 45]
  |  |  |  |  |  Branch (279:38): [True: 45, False: 19.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  19.0k|            bytes_in_buffer--; \
  |  |  156|  19.0k|            V = *next_input_byte++; )
  ------------------
  525|  19.0k|    prec = n >> 4;
  526|  19.0k|    n &= 0x0F;
  527|       |
  528|  19.0k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  19.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  19.0k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  19.0k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  19.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  529|       |
  530|  19.0k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  19.0k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (530:9): [True: 103, False: 18.9k]
  ------------------
  531|    103|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|    103|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    103|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    103|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  532|       |
  533|  19.0k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (533:9): [True: 4.24k, False: 14.8k]
  ------------------
  534|  4.24k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  535|  19.0k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  536|       |
  537|  1.23M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  1.23M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (537:17): [True: 1.21M, False: 19.0k]
  ------------------
  538|  1.21M|      if (prec)
  ------------------
  |  Branch (538:11): [True: 51.3k, False: 1.16M]
  ------------------
  539|  1.21M|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  51.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   113k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.43k]
  |  |  |  |  |  Branch (279:38): [True: 2.43k, False: 48.8k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.29k]
  |  |  |  |  |  Branch (279:38): [True: 1.29k, False: 50.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 51.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.21M|            bytes_in_buffer--; \
  |  |  164|  1.21M|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.21M|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.21M|            bytes_in_buffer--; \
  |  |  167|  1.21M|            V += *next_input_byte++; )
  ------------------
  540|  1.16M|      else
  541|  1.21M|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  1.16M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.17M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.85k]
  |  |  |  |  |  Branch (279:38): [True: 3.85k, False: 1.15M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.16M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.21M|            bytes_in_buffer--; \
  |  |  156|  1.21M|            V = *next_input_byte++; )
  ------------------
  542|       |      /* We convert the zigzag-order table to natural array order. */
  543|  1.21M|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  544|  1.21M|    }
  545|       |
  546|  19.0k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (546:9): [True: 0, False: 19.0k]
  ------------------
  547|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (547:19): [True: 0, False: 0]
  ------------------
  548|      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)); )
  ------------------
  549|      0|                 quant_ptr->quantval[i],     quant_ptr->quantval[i + 1],
  550|      0|                 quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
  551|      0|                 quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
  552|      0|                 quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
  553|      0|      }
  554|      0|    }
  555|       |
  556|  19.0k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  19.0k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  557|  19.0k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|    802|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (557:9): [True: 802, False: 18.2k]
  ------------------
  558|  19.0k|  }
  559|       |
  560|  19.0k|  if (length != 0)
  ------------------
  |  Branch (560:7): [True: 51, False: 19.0k]
  ------------------
  561|     51|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     51|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     51|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  562|       |
  563|  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 )
  ------------------
  564|  19.0k|  return TRUE;
  ------------------
  |  |  210|  19.0k|#define TRUE    1
  ------------------
  565|  19.0k|}
jdmarker.c:get_dri:
  571|  4.04k|{
  572|  4.04k|  JLONG length;
  573|  4.04k|  unsigned int tmp;
  574|  4.04k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  4.04k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  4.04k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  4.04k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  575|       |
  576|  4.04k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  4.04k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  8.17k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 4.03k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 15]
  |  |  |  |  |  Branch (279:38): [True: 15, False: 4.03k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  4.04k|            bytes_in_buffer--; \
  |  |  164|  4.04k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  4.04k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  4.04k|            bytes_in_buffer--; \
  |  |  167|  4.04k|            V += *next_input_byte++; )
  ------------------
  577|       |
  578|  4.04k|  if (length != 4)
  ------------------
  |  Branch (578:7): [True: 36, False: 4.01k]
  ------------------
  579|     36|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     36|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     36|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  580|       |
  581|  4.04k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  4.04k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  8.16k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 4.03k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 4.03k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  4.04k|            bytes_in_buffer--; \
  |  |  164|  4.04k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  4.04k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  4.04k|            bytes_in_buffer--; \
  |  |  167|  4.04k|            V += *next_input_byte++; )
  ------------------
  582|       |
  583|  4.04k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|  4.04k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  4.04k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  4.04k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  584|       |
  585|  4.04k|  cinfo->restart_interval = tmp;
  586|       |
  587|  4.04k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  4.04k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  4.04k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  588|  4.04k|  return TRUE;
  ------------------
  |  |  210|  4.04k|#define TRUE    1
  ------------------
  589|  4.04k|}
jdmarker.c:read_restart_marker:
 1138|   614k|{
 1139|       |  /* Obtain a marker unless we already did. */
 1140|       |  /* Note that next_marker will complain if it skips any data. */
 1141|   614k|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1141:7): [True: 489, False: 613k]
  ------------------
 1142|    489|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1142:9): [True: 0, False: 489]
  ------------------
 1143|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1144|    489|  }
 1145|       |
 1146|   614k|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1146:7): [True: 1.42k, False: 612k]
  ------------------
 1147|   614k|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1148|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1149|  1.42k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  1.42k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.42k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.42k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1150|  1.42k|    cinfo->unread_marker = 0;
 1151|   612k|  } else {
 1152|       |    /* Uh-oh, the restart markers have been messed up. */
 1153|       |    /* Let the data source manager determine how to resync. */
 1154|   612k|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1154:9): [True: 0, False: 612k]
  ------------------
 1155|   612k|                                           cinfo->marker->next_restart_num))
 1156|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1157|   612k|  }
 1158|       |
 1159|       |  /* Update next-restart state */
 1160|   614k|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1161|       |
 1162|   614k|  return TRUE;
  ------------------
  |  |  210|   614k|#define TRUE    1
  ------------------
 1163|   614k|}
jdmarker.c:skip_variable:
  863|  3.51k|{
  864|  3.51k|  JLONG length;
  865|  3.51k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  3.51k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  3.51k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  3.51k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  866|       |
  867|  3.51k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  3.51k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  7.48k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 50]
  |  |  |  |  |  Branch (279:38): [True: 50, False: 3.46k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 103]
  |  |  |  |  |  Branch (279:38): [True: 103, False: 3.41k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  3.51k|            bytes_in_buffer--; \
  |  |  164|  3.51k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  3.51k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  3.51k|            bytes_in_buffer--; \
  |  |  167|  3.51k|            V += *next_input_byte++; )
  ------------------
  868|  3.51k|  length -= 2;
  869|       |
  870|  3.51k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  3.51k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  3.51k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  3.51k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  3.51k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  871|       |
  872|  3.51k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  3.51k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  3.51k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  873|  3.51k|  if (length > 0)
  ------------------
  |  Branch (873:7): [True: 1.16k, False: 2.35k]
  ------------------
  874|  1.16k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  875|       |
  876|  3.51k|  return TRUE;
  ------------------
  |  |  210|  3.51k|#define TRUE    1
  ------------------
  877|  3.51k|}
jdmarker.c:examine_app0:
  611|  5.64k|{
  612|  5.64k|  JLONG totallen = (JLONG)datalen + remaining;
  613|       |
  614|  5.64k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  599|  11.2k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (614:7): [True: 4.54k, False: 1.10k]
  ------------------
  615|  4.54k|      data[0] == 0x4A &&
  ------------------
  |  Branch (615:7): [True: 3.93k, False: 617]
  ------------------
  616|  3.93k|      data[1] == 0x46 &&
  ------------------
  |  Branch (616:7): [True: 3.62k, False: 305]
  ------------------
  617|  3.62k|      data[2] == 0x49 &&
  ------------------
  |  Branch (617:7): [True: 2.18k, False: 1.44k]
  ------------------
  618|  2.18k|      data[3] == 0x46 &&
  ------------------
  |  Branch (618:7): [True: 1.86k, False: 319]
  ------------------
  619|  1.86k|      data[4] == 0) {
  ------------------
  |  Branch (619:7): [True: 1.59k, False: 265]
  ------------------
  620|       |    /* Found JFIF APP0 marker: save info */
  621|  1.59k|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|  1.59k|#define TRUE    1
  ------------------
  622|  1.59k|    cinfo->JFIF_major_version = data[5];
  623|  1.59k|    cinfo->JFIF_minor_version = data[6];
  624|  1.59k|    cinfo->density_unit = data[7];
  625|  1.59k|    cinfo->X_density = (data[8] << 8) + data[9];
  626|  1.59k|    cinfo->Y_density = (data[10] << 8) + data[11];
  627|       |    /* Check version.
  628|       |     * Major version must be 1, anything else signals an incompatible change.
  629|       |     * (We used to treat this as an error, but now it's a nonfatal warning,
  630|       |     * because some bozo at Hijaak couldn't read the spec.)
  631|       |     * Minor version should be 0..2, but process anyway if newer.
  632|       |     */
  633|  1.59k|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (633:9): [True: 360, False: 1.23k]
  ------------------
  634|    360|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|    360|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    360|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    360|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    360|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  635|  1.59k|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  636|       |    /* Generate trace messages */
  637|  1.59k|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|  1.59k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.59k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.59k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  1.59k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|  1.59k|           _mp[4] = (p5); \
  |  |  322|  1.59k|           (cinfo)->err->msg_code = (code); \
  |  |  323|  1.59k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  638|  1.59k|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  639|  1.59k|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  640|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  641|  1.59k|    if (data[12] | data[13])
  ------------------
  |  Branch (641:9): [True: 933, False: 663]
  ------------------
  642|    933|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    933|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    933|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    933|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    933|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  643|  1.59k|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  599|  1.59k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  644|  1.59k|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (644:9): [True: 761, False: 835]
  ------------------
  645|    761|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    761|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    761|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    761|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  646|  4.05k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (646:14): [True: 3.24k, False: 811]
  ------------------
  647|  3.24k|             data[0] == 0x4A &&
  ------------------
  |  Branch (647:14): [True: 2.58k, False: 655]
  ------------------
  648|  2.58k|             data[1] == 0x46 &&
  ------------------
  |  Branch (648:14): [True: 2.05k, False: 530]
  ------------------
  649|  2.05k|             data[2] == 0x58 &&
  ------------------
  |  Branch (649:14): [True: 1.33k, False: 725]
  ------------------
  650|  1.33k|             data[3] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 1.10k, False: 224]
  ------------------
  651|  1.10k|             data[4] == 0) {
  ------------------
  |  Branch (651:14): [True: 882, False: 226]
  ------------------
  652|       |    /* Found JFIF "JFXX" extension APP0 marker */
  653|       |    /* The library doesn't actually do anything with these,
  654|       |     * but we try to produce a helpful trace message.
  655|       |     */
  656|    882|    switch (data[5]) {
  657|    235|    case 0x10:
  ------------------
  |  Branch (657:5): [True: 235, False: 647]
  ------------------
  658|    235|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|    235|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    235|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    235|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  659|    235|      break;
  660|    213|    case 0x11:
  ------------------
  |  Branch (660:5): [True: 213, False: 669]
  ------------------
  661|    213|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|    213|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    213|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    213|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  662|    213|      break;
  663|    207|    case 0x13:
  ------------------
  |  Branch (663:5): [True: 207, False: 675]
  ------------------
  664|    207|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|    207|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    207|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    207|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  665|    207|      break;
  666|    227|    default:
  ------------------
  |  Branch (666:5): [True: 227, False: 655]
  ------------------
  667|    227|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|    227|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    227|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    227|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    227|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  668|    227|      break;
  669|    882|    }
  670|  3.17k|  } else {
  671|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  672|  3.17k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|  3.17k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  3.17k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  3.17k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  673|  3.17k|  }
  674|  5.64k|}
jdmarker.c:examine_app14:
  684|  1.88k|{
  685|  1.88k|  unsigned int version, flags0, flags1, transform;
  686|       |
  687|  1.88k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  600|  3.77k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (687:7): [True: 1.57k, False: 311]
  ------------------
  688|  1.57k|      data[0] == 0x41 &&
  ------------------
  |  Branch (688:7): [True: 1.21k, False: 362]
  ------------------
  689|  1.21k|      data[1] == 0x64 &&
  ------------------
  |  Branch (689:7): [True: 990, False: 223]
  ------------------
  690|    990|      data[2] == 0x6F &&
  ------------------
  |  Branch (690:7): [True: 766, False: 224]
  ------------------
  691|    766|      data[3] == 0x62 &&
  ------------------
  |  Branch (691:7): [True: 540, False: 226]
  ------------------
  692|    540|      data[4] == 0x65) {
  ------------------
  |  Branch (692:7): [True: 321, False: 219]
  ------------------
  693|       |    /* Found Adobe APP14 marker */
  694|    321|    version = (data[5] << 8) + data[6];
  695|    321|    flags0 = (data[7] << 8) + data[8];
  696|    321|    flags1 = (data[9] << 8) + data[10];
  697|    321|    transform = data[11];
  698|    321|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|    321|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    321|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 321]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    321|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    321|           (cinfo)->err->msg_code = (code); \
  |  |  317|    321|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  699|    321|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|    321|#define TRUE    1
  ------------------
  700|    321|    cinfo->Adobe_transform = (UINT8)transform;
  701|  1.56k|  } else {
  702|       |    /* Start of APP14 does not match "Adobe", or too short */
  703|  1.56k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  1.56k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.56k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.56k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  704|  1.56k|  }
  705|  1.88k|}
jdmarker.c:save_marker:
  759|   283k|{
  760|   283k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  761|   283k|  jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
  762|   283k|  unsigned int bytes_read, data_length;
  763|   283k|  JOCTET *data;
  764|   283k|  JLONG length = 0;
  765|   283k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   283k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   283k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   283k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  766|       |
  767|   283k|  if (cur_marker == NULL) {
  ------------------
  |  Branch (767:7): [True: 283k, False: 0]
  ------------------
  768|       |    /* begin reading a marker */
  769|   283k|    INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   283k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   568k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 158]
  |  |  |  |  |  Branch (279:38): [True: 158, False: 283k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 241]
  |  |  |  |  |  Branch (279:38): [True: 241, False: 283k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 283k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   283k|            bytes_in_buffer--; \
  |  |  164|   283k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   283k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   283k|            bytes_in_buffer--; \
  |  |  167|   283k|            V += *next_input_byte++; )
  ------------------
  770|   283k|    length -= 2;
  771|   283k|    if (length >= 0) {          /* watch out for bogus length word */
  ------------------
  |  Branch (771:9): [True: 215k, False: 68.3k]
  ------------------
  772|       |      /* figure out how much we want to save */
  773|   215k|      unsigned int limit;
  774|   215k|      if (cinfo->unread_marker == (int)M_COM)
  ------------------
  |  Branch (774:11): [True: 0, False: 215k]
  ------------------
  775|      0|        limit = marker->length_limit_COM;
  776|   215k|      else
  777|   215k|        limit = marker->length_limit_APPn[cinfo->unread_marker - (int)M_APP0];
  778|   215k|      if ((unsigned int)length < limit)
  ------------------
  |  Branch (778:11): [True: 213k, False: 1.63k]
  ------------------
  779|   213k|        limit = (unsigned int)length;
  780|       |      /* allocate and initialize the marker item */
  781|   215k|      cur_marker = (jpeg_saved_marker_ptr)
  782|   215k|        (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   215k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|   215k|                                    sizeof(struct jpeg_marker_struct) + limit);
  784|   215k|      cur_marker->next = NULL;
  785|   215k|      cur_marker->marker = (UINT8)cinfo->unread_marker;
  786|   215k|      cur_marker->original_length = (unsigned int)length;
  787|   215k|      cur_marker->data_length = limit;
  788|       |      /* data area is just beyond the jpeg_marker_struct */
  789|   215k|      data = cur_marker->data = (JOCTET *)(cur_marker + 1);
  790|   215k|      marker->cur_marker = cur_marker;
  791|   215k|      marker->bytes_read = 0;
  792|   215k|      bytes_read = 0;
  793|   215k|      data_length = limit;
  794|   215k|    } else {
  795|       |      /* deal with bogus length word */
  796|  68.3k|      bytes_read = data_length = 0;
  797|  68.3k|      data = NULL;
  798|  68.3k|    }
  799|   283k|  } else {
  800|       |    /* resume reading a marker */
  801|      0|    bytes_read = marker->bytes_read;
  802|      0|    data_length = cur_marker->data_length;
  803|      0|    data = cur_marker->data + bytes_read;
  804|      0|  }
  805|       |
  806|   401k|  while (bytes_read < data_length) {
  ------------------
  |  Branch (806:10): [True: 118k, False: 283k]
  ------------------
  807|   118k|    INPUT_SYNC(cinfo);          /* move the restart point to here */
  ------------------
  |  |  131|   118k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   118k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  808|   118k|    marker->bytes_read = bytes_read;
  809|       |    /* If there's not at least one byte in buffer, suspend */
  810|   118k|    MAKE_BYTE_AVAIL(cinfo, return FALSE);
  ------------------
  |  |  144|   118k|  if (bytes_in_buffer == 0) { \
  |  |  ------------------
  |  |  |  Branch (144:7): [True: 108k, False: 9.72k]
  |  |  ------------------
  |  |  145|   108k|    if (!(*datasrc->fill_input_buffer) (cinfo)) \
  |  |  ------------------
  |  |  |  Branch (145:9): [True: 0, False: 108k]
  |  |  ------------------
  |  |  146|   108k|      { action; } \
  |  |  147|   108k|    INPUT_RELOAD(cinfo); \
  |  |  ------------------
  |  |  |  |  136|   108k|  ( next_input_byte = datasrc->next_input_byte, \
  |  |  |  |  137|   108k|    bytes_in_buffer = datasrc->bytes_in_buffer )
  |  |  ------------------
  |  |  148|   108k|  }
  ------------------
  811|       |    /* Copy bytes with reasonable rapidity */
  812|   927k|    while (bytes_read < data_length && bytes_in_buffer > 0) {
  ------------------
  |  Branch (812:12): [True: 917k, False: 9.94k]
  |  Branch (812:40): [True: 809k, False: 108k]
  ------------------
  813|   809k|      *data++ = *next_input_byte++;
  814|   809k|      bytes_in_buffer--;
  815|   809k|      bytes_read++;
  816|   809k|    }
  817|   118k|  }
  818|       |
  819|       |  /* Done reading what we want to read */
  820|   283k|  if (cur_marker != NULL) {     /* will be NULL if bogus length word */
  ------------------
  |  Branch (820:7): [True: 215k, False: 68.3k]
  ------------------
  821|       |    /* Add new marker to end of list */
  822|   215k|    if (cinfo->marker_list == NULL || cinfo->master->marker_list_end == NULL) {
  ------------------
  |  Branch (822:9): [True: 3.23k, False: 212k]
  |  Branch (822:39): [True: 0, False: 212k]
  ------------------
  823|  3.23k|      cinfo->marker_list = cinfo->master->marker_list_end = cur_marker;
  824|   212k|    } else {
  825|   212k|      cinfo->master->marker_list_end->next = cur_marker;
  826|   212k|      cinfo->master->marker_list_end = cur_marker;
  827|   212k|    }
  828|       |    /* Reset pointer & calc remaining data length */
  829|   215k|    data = cur_marker->data;
  830|   215k|    length = cur_marker->original_length - data_length;
  831|   215k|  }
  832|       |  /* Reset to initial state for next marker */
  833|   283k|  marker->cur_marker = NULL;
  834|       |
  835|       |  /* Process the marker if interesting; else just make a generic trace msg */
  836|   283k|  switch (cinfo->unread_marker) {
  837|  5.64k|  case M_APP0:
  ------------------
  |  Branch (837:3): [True: 5.64k, False: 277k]
  ------------------
  838|  5.64k|    examine_app0(cinfo, data, data_length, length);
  839|  5.64k|    break;
  840|  1.88k|  case M_APP14:
  ------------------
  |  Branch (840:3): [True: 1.88k, False: 281k]
  ------------------
  841|  1.88k|    examine_app14(cinfo, data, data_length, length);
  842|  1.88k|    break;
  843|   276k|  default:
  ------------------
  |  Branch (843:3): [True: 276k, False: 7.53k]
  ------------------
  844|   276k|    TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
  ------------------
  |  |  304|   276k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|   276k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|   276k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|   276k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  845|   276k|             (int)(data_length + length));
  846|   276k|    break;
  847|   283k|  }
  848|       |
  849|       |  /* skip any remaining data -- could be lots */
  850|   283k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|   283k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   283k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  851|   283k|  if (length > 0)
  ------------------
  |  Branch (851:7): [True: 1.63k, False: 281k]
  ------------------
  852|  1.63k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  853|       |
  854|   283k|  return TRUE;
  ------------------
  |  |  210|   283k|#define TRUE    1
  ------------------
  855|   283k|}

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

jinit_phuff_decoder:
  654|  3.76k|{
  655|  3.76k|  phuff_entropy_ptr entropy;
  656|  3.76k|  int *coef_bit_ptr;
  657|  3.76k|  int ci, i;
  658|       |
  659|  3.76k|  entropy = (phuff_entropy_ptr)
  660|  3.76k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.76k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|  3.76k|                                sizeof(phuff_entropy_decoder));
  662|  3.76k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|  3.76k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  18.8k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  18.8k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 15.0k, False: 3.76k]
  ------------------
  667|  15.0k|    entropy->derived_tbls[i] = NULL;
  668|  15.0k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|  3.76k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|  3.76k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.76k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|  3.76k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  3.76k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|  3.76k|                                sizeof(int));
  675|  3.76k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  12.7k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 8.94k, False: 3.76k]
  ------------------
  677|   581k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|   581k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 572k, False: 8.94k]
  ------------------
  678|   572k|      *coef_bit_ptr++ = -1;
  679|  3.76k|}
jdphuff.c:start_pass_phuff_decoder:
   83|  13.3k|{
   84|  13.3k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  13.3k|  boolean is_DC_band, bad;
   86|  13.3k|  int ci, coefi, tbl;
   87|  13.3k|  d_derived_tbl **pdtbl;
   88|  13.3k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  13.3k|  jpeg_component_info *compptr;
   90|       |
   91|  13.3k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  13.3k|  bad = FALSE;
  ------------------
  |  |  207|  13.3k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  13.3k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 8.20k, False: 5.10k]
  ------------------
   96|  8.20k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 4, False: 8.20k]
  ------------------
   97|      4|      bad = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
   98|  8.20k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  5.10k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|  5.08k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 17, False: 5.08k]
  |  Branch (100:34): [True: 10, False: 5.07k]
  ------------------
  101|     27|      bad = TRUE;
  ------------------
  |  |  210|     27|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  5.10k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 4, False: 5.10k]
  ------------------
  104|      4|      bad = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  105|  5.10k|  }
  106|  13.3k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 8.77k, False: 4.53k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|  8.77k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 33, False: 8.74k]
  ------------------
  109|     33|      bad = TRUE;
  ------------------
  |  |  210|     33|#define TRUE    1
  ------------------
  110|  8.77k|  }
  111|  13.3k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 18, False: 13.2k]
  ------------------
  112|     18|    bad = TRUE;
  ------------------
  |  |  210|     18|#define TRUE    1
  ------------------
  113|       |  /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
  114|       |   * but the spec doesn't say so, and we try to be liberal about what we
  115|       |   * accept.  Note: large Al values could result in out-of-range DC
  116|       |   * coefficients during early scans, leading to bizarre displays due to
  117|       |   * overflows in the IDCT math.  But we won't crash.
  118|       |   */
  119|  13.3k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 37, False: 13.2k]
  ------------------
  120|     37|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     37|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     37|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     37|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     37|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     37|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  13.3k|             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|  40.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 26.9k, False: 13.3k]
  ------------------
  127|  26.9k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  26.9k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  26.9k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  26.9k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 5.07k, False: 21.8k]
  |  Branch (130:24): [True: 3.60k, False: 1.47k]
  ------------------
  131|  3.60k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  3.60k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  3.60k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  3.60k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  3.60k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   464k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  447|  26.9k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (447:26): [True: 21.8k, False: 5.07k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  445|   464k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (445:26): [True: 217k, False: 246k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 437k, False: 26.9k]
  ------------------
  133|   437k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 323k, False: 113k]
  ------------------
  134|   323k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|   113k|      else
  136|   113k|        prev_coef_bit_ptr[coefi] = 0;
  137|   437k|    }
  138|   227k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 200k, False: 26.9k]
  ------------------
  139|   200k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 77.2k, False: 123k]
  ------------------
  140|   200k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 122k, False: 77.9k]
  ------------------
  141|   122k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|   122k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   122k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   122k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   122k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|   200k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|   200k|    }
  144|  26.9k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  13.3k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 4.53k, False: 8.77k]
  ------------------
  148|  4.53k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 1.89k, False: 2.64k]
  ------------------
  149|  1.89k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  2.64k|    else
  151|  2.64k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  8.77k|  } else {
  153|  8.77k|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 6.30k, False: 2.47k]
  ------------------
  154|  6.30k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|  2.47k|    else
  156|  2.47k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|  8.77k|  }
  158|       |
  159|  40.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 26.9k, False: 13.3k]
  ------------------
  160|  26.9k|    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|  26.9k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 21.8k, False: 5.07k]
  ------------------
  165|  21.8k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 4.24k, False: 17.5k]
  ------------------
  166|  4.24k|        tbl = compptr->dc_tbl_no;
  167|  4.24k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  4.24k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|  4.24k|#define TRUE    1
  ------------------
  169|  4.24k|      }
  170|  21.8k|    } else {
  171|  5.07k|      tbl = compptr->ac_tbl_no;
  172|  5.07k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  5.07k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|  5.07k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  5.07k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  5.07k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  26.9k|    entropy->saved.last_dc_val[ci] = 0;
  179|  26.9k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  13.3k|  entropy->bitstate.bits_left = 0;
  183|  13.3k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  13.3k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  13.3k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  13.3k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  13.3k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  13.3k|}
jdphuff.c:decode_mcu_DC_first:
  291|  2.61M|{
  292|  2.61M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  2.61M|  int Al = cinfo->Al;
  294|  2.61M|  register int s, r;
  295|  2.61M|  int blkn, ci;
  296|  2.61M|  JBLOCKROW block;
  297|  2.61M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  2.61M|  register bit_buf_type get_buffer; \
  |  |  126|  2.61M|  register int bits_left; \
  |  |  127|  2.61M|  bitread_working_state br_state
  ------------------
  298|  2.61M|  savable_state state;
  299|  2.61M|  d_derived_tbl *tbl;
  300|  2.61M|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  2.61M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 624k, False: 1.99M]
  ------------------
  304|   624k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 7.96k, False: 616k]
  ------------------
  305|  7.96k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 7.96k]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|   624k|  }
  308|       |
  309|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  310|       |   * This way, we return uniform gray for the remainder of the segment.
  311|       |   */
  312|  2.61M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 115k, False: 2.50M]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|   115k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   115k|  br_state.cinfo = cinfop; \
  |  |  131|   115k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   115k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   115k|  get_buffer = permstate.get_buffer; \
  |  |  134|   115k|  bits_left = permstate.bits_left;
  ------------------
  316|   115k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|   249k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 133k, False: 115k]
  ------------------
  321|   133k|      block = MCU_data[blkn];
  322|   133k|      ci = cinfo->MCU_membership[blkn];
  323|   133k|      compptr = cinfo->cur_comp_info[ci];
  324|   133k|      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|   133k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|   133k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   133k|  register int nb, look; \
  |  |  202|   133k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   133k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 10.2k, False: 123k]
  |  |  ------------------
  |  |  203|  10.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 10.2k]
  |  |  ------------------
  |  |  204|  10.2k|      { failaction; } \
  |  |  205|  10.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  10.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 3.42k, False: 6.81k]
  |  |  ------------------
  |  |  207|  3.42k|      nb = 1;  goto slowlabel; \
  |  |  208|  3.42k|    } \
  |  |  209|  10.2k|  } \
  |  |  210|   133k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   130k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   130k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   130k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   130k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 128k, False: 2.08k]
  |  |  ------------------
  |  |  212|   128k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   128k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   128k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   128k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   128k|  } else { \
  |  |  215|  5.50k|slowlabel: \
  |  |  216|  5.50k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 5.50k]
  |  |  ------------------
  |  |  217|  5.50k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  5.50k|      { failaction; } \
  |  |  219|  5.50k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  5.50k|  } \
  |  |  221|   130k|}
  ------------------
  330|   133k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 119k, False: 13.9k]
  ------------------
  331|   119k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   119k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   119k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 29.9k, False: 89.9k]
  |  |  ------------------
  |  |  162|  29.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 29.9k]
  |  |  ------------------
  |  |  163|  29.9k|      { action; } \
  |  |  164|  29.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  29.9k|  } \
  |  |  166|   119k|}
  ------------------
  332|   119k|        r = GET_BITS(s);
  ------------------
  |  |  169|   119k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|   119k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|   119k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  86.9k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 86.9k, False: 32.9k]
  |  |  ------------------
  ------------------
  334|   119k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|   133k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 15.5k, False: 118k]
  ------------------
  338|  15.5k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 15.5k]
  ------------------
  339|   133k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 118k, False: 15.5k]
  |  Branch (339:41): [True: 0, False: 118k]
  ------------------
  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|   133k|      s += state.last_dc_val[ci];
  342|   133k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|   133k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|   133k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|   133k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|   115k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   115k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   115k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   115k|  permstate.get_buffer = get_buffer; \
  |  |  140|   115k|  permstate.bits_left = bits_left
  ------------------
  349|   115k|    entropy->saved = state;
  350|   115k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  2.61M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 624k, False: 1.99M]
  ------------------
  354|   624k|    entropy->restarts_to_go--;
  355|       |
  356|  2.61M|  return TRUE;
  ------------------
  |  |  210|  2.61M|#define TRUE    1
  ------------------
  357|  2.61M|}
jdphuff.c:process_restart:
  233|   251k|{
  234|   251k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  235|   251k|  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|   251k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  240|   251k|  entropy->bitstate.bits_left = 0;
  241|       |
  242|       |  /* Advance past the RSTn marker */
  243|   251k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (243:7): [True: 0, False: 251k]
  ------------------
  244|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  245|       |
  246|       |  /* Re-initialize DC predictions to 0 */
  247|   503k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (247:16): [True: 252k, False: 251k]
  ------------------
  248|   252k|    entropy->saved.last_dc_val[ci] = 0;
  249|       |  /* Re-init EOB run count, too */
  250|   251k|  entropy->saved.EOBRUN = 0;
  251|       |
  252|       |  /* Reset restart counter */
  253|   251k|  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|   251k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (260:7): [True: 1.46k, False: 250k]
  ------------------
  261|  1.46k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  1.46k|#define FALSE   0               /* values of boolean */
  ------------------
  262|       |
  263|   251k|  return TRUE;
  ------------------
  |  |  210|   251k|#define TRUE    1
  ------------------
  264|   251k|}
jdphuff.c:decode_mcu_AC_first:
  367|  5.07M|{
  368|  5.07M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|  5.07M|  int Se = cinfo->Se;
  370|  5.07M|  int Al = cinfo->Al;
  371|  5.07M|  register int s, k, r;
  372|  5.07M|  unsigned int EOBRUN;
  373|  5.07M|  JBLOCKROW block;
  374|  5.07M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  5.07M|  register bit_buf_type get_buffer; \
  |  |  126|  5.07M|  register int bits_left; \
  |  |  127|  5.07M|  bitread_working_state br_state
  ------------------
  375|  5.07M|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|  5.07M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 839k, False: 4.23M]
  ------------------
  379|   839k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 62.8k, False: 776k]
  ------------------
  380|  62.8k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 62.8k]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|   839k|  }
  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|  5.07M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 365k, False: 4.71M]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|   365k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|   365k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 187k, False: 178k]
  ------------------
  397|   187k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|   178k|    else {
  399|   178k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   178k|  br_state.cinfo = cinfop; \
  |  |  131|   178k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   178k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   178k|  get_buffer = permstate.get_buffer; \
  |  |  134|   178k|  bits_left = permstate.bits_left;
  ------------------
  400|   178k|      block = MCU_data[0];
  401|   178k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|   590k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 533k, False: 56.1k]
  ------------------
  404|   533k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|   533k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   533k|  register int nb, look; \
  |  |  202|   533k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   533k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 45.5k, False: 488k]
  |  |  ------------------
  |  |  203|  45.5k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 45.5k]
  |  |  ------------------
  |  |  204|  45.5k|      { failaction; } \
  |  |  205|  45.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  45.5k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  45.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 8.66k, False: 36.9k]
  |  |  ------------------
  |  |  207|  8.66k|      nb = 1;  goto slowlabel; \
  |  |  208|  8.66k|    } \
  |  |  209|  45.5k|  } \
  |  |  210|   533k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   525k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   525k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   525k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   525k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 520k, False: 4.75k]
  |  |  ------------------
  |  |  212|   520k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   520k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   520k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   520k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   520k|  } else { \
  |  |  215|  13.4k|slowlabel: \
  |  |  216|  13.4k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 13.4k]
  |  |  ------------------
  |  |  217|  13.4k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  13.4k|      { failaction; } \
  |  |  219|  13.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  13.4k|  } \
  |  |  221|   525k|}
  ------------------
  405|   533k|        r = s >> 4;
  406|   533k|        s &= 15;
  407|   533k|        if (s) {
  ------------------
  |  Branch (407:13): [True: 411k, False: 122k]
  ------------------
  408|   411k|          k += r;
  409|   411k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   411k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   411k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.62k, False: 407k]
  |  |  ------------------
  |  |  162|  3.62k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.62k]
  |  |  ------------------
  |  |  163|  3.62k|      { action; } \
  |  |  164|  3.62k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.62k|  } \
  |  |  166|   411k|}
  ------------------
  410|   411k|          r = GET_BITS(s);
  ------------------
  |  |  169|   411k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|   411k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|   411k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|   229k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 229k, False: 181k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|   411k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|   411k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|   411k|        } else {
  415|   122k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 724, False: 122k]
  ------------------
  416|    724|            k += 15;            /* skip 15 zeroes in band */
  417|   122k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|   122k|            EOBRUN = 1 << r;
  419|   122k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 47.1k, False: 74.8k]
  ------------------
  420|  47.1k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  47.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  47.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 245, False: 46.9k]
  |  |  ------------------
  |  |  162|    245|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 245]
  |  |  ------------------
  |  |  163|    245|      { action; } \
  |  |  164|    245|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    245|  } \
  |  |  166|  47.1k|}
  ------------------
  421|  47.1k|              r = GET_BITS(r);
  ------------------
  |  |  169|  47.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  47.1k|              EOBRUN += r;
  423|  47.1k|            }
  424|   122k|            EOBRUN--;           /* this band is processed at this moment */
  425|   122k|            break;              /* force end-of-band */
  426|   122k|          }
  427|   122k|        }
  428|   533k|      }
  429|       |
  430|   178k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   178k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   178k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   178k|  permstate.get_buffer = get_buffer; \
  |  |  140|   178k|  permstate.bits_left = bits_left
  ------------------
  431|   178k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|   365k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|   365k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|  5.07M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 839k, False: 4.23M]
  ------------------
  439|   839k|    entropy->restarts_to_go--;
  440|       |
  441|  5.07M|  return TRUE;
  ------------------
  |  |  210|  5.07M|#define TRUE    1
  ------------------
  442|  5.07M|}
jdphuff.c:decode_mcu_DC_refine:
  453|  3.30M|{
  454|  3.30M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|  3.30M|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|  3.30M|  int blkn;
  457|  3.30M|  JBLOCKROW block;
  458|  3.30M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  3.30M|  register bit_buf_type get_buffer; \
  |  |  126|  3.30M|  register int bits_left; \
  |  |  127|  3.30M|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|  3.30M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 525k, False: 2.78M]
  ------------------
  462|   525k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 87.9k, False: 437k]
  ------------------
  463|  87.9k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 87.9k]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|   525k|  }
  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|  3.30M|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  3.30M|  br_state.cinfo = cinfop; \
  |  |  131|  3.30M|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  3.30M|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  3.30M|  get_buffer = permstate.get_buffer; \
  |  |  134|  3.30M|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|  17.0M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 13.7M, False: 3.30M]
  ------------------
  477|  13.7M|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|  13.7M|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|  13.7M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  13.7M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 328k, False: 13.3M]
  |  |  ------------------
  |  |  162|   328k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 328k]
  |  |  ------------------
  |  |  163|   328k|      { action; } \
  |  |  164|   328k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|   328k|  } \
  |  |  166|  13.7M|}
  ------------------
  481|  13.7M|    if (GET_BITS(1))
  ------------------
  |  |  169|  13.7M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 19.1k, False: 13.7M]
  |  |  ------------------
  ------------------
  482|  19.1k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|  13.7M|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|  3.30M|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  3.30M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  3.30M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  3.30M|  permstate.get_buffer = get_buffer; \
  |  |  140|  3.30M|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|  3.30M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 525k, False: 2.78M]
  ------------------
  491|   525k|    entropy->restarts_to_go--;
  492|       |
  493|  3.30M|  return TRUE;
  ------------------
  |  |  210|  3.30M|#define TRUE    1
  ------------------
  494|  3.30M|}
jdphuff.c:decode_mcu_AC_refine:
  503|  6.96M|{
  504|  6.96M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|  6.96M|  int Se = cinfo->Se;
  506|  6.96M|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|  6.96M|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|  6.96M|#define NEG_1  ((unsigned)-1)
  ------------------
  508|  6.96M|  register int s, k, r;
  509|  6.96M|  unsigned int EOBRUN;
  510|  6.96M|  JBLOCKROW block;
  511|  6.96M|  JCOEFPTR thiscoef;
  512|  6.96M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  6.96M|  register bit_buf_type get_buffer; \
  |  |  126|  6.96M|  register int bits_left; \
  |  |  127|  6.96M|  bitread_working_state br_state
  ------------------
  513|  6.96M|  d_derived_tbl *tbl;
  514|  6.96M|  int num_newnz;
  515|  6.96M|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|  6.96M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 630k, False: 6.33M]
  ------------------
  519|   630k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 92.7k, False: 537k]
  ------------------
  520|  92.7k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 92.7k]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|   630k|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|  6.96M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 211k, False: 6.75M]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|   211k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   211k|  br_state.cinfo = cinfop; \
  |  |  131|   211k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   211k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   211k|  get_buffer = permstate.get_buffer; \
  |  |  134|   211k|  bits_left = permstate.bits_left;
  ------------------
  530|   211k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|   211k|    block = MCU_data[0];
  534|   211k|    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|   211k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|   211k|    k = cinfo->Ss;
  546|       |
  547|   211k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 44.5k, False: 166k]
  ------------------
  548|   229k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 224k, False: 5.23k]
  ------------------
  549|   224k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|   224k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   224k|  register int nb, look; \
  |  |  202|   224k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   224k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 21.3k, False: 202k]
  |  |  ------------------
  |  |  203|  21.3k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 21.3k]
  |  |  ------------------
  |  |  204|  21.3k|      { failaction; } \
  |  |  205|  21.3k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  21.3k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  21.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 6.07k, False: 15.2k]
  |  |  ------------------
  |  |  207|  6.07k|      nb = 1;  goto slowlabel; \
  |  |  208|  6.07k|    } \
  |  |  209|  21.3k|  } \
  |  |  210|   224k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   218k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   218k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   218k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   218k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 215k, False: 2.69k]
  |  |  ------------------
  |  |  212|   215k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   215k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   215k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   215k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   215k|  } else { \
  |  |  215|  8.77k|slowlabel: \
  |  |  216|  8.77k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 8.77k]
  |  |  ------------------
  |  |  217|  8.77k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  8.77k|      { failaction; } \
  |  |  219|  8.77k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  8.77k|  } \
  |  |  221|   218k|}
  ------------------
  550|   224k|        r = s >> 4;
  551|   224k|        s &= 15;
  552|   224k|        if (s) {
  ------------------
  |  Branch (552:13): [True: 184k, False: 39.8k]
  ------------------
  553|   184k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 14.4k, False: 169k]
  ------------------
  554|  14.4k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  14.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  14.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  555|   184k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   184k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   184k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 774, False: 183k]
  |  |  ------------------
  |  |  162|    774|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 774]
  |  |  ------------------
  |  |  163|    774|      { action; } \
  |  |  164|    774|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    774|  } \
  |  |  166|   184k|}
  ------------------
  556|   184k|          if (GET_BITS(1))
  ------------------
  |  |  169|   184k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 71.2k, False: 113k]
  |  |  ------------------
  ------------------
  557|  71.2k|            s = p1;             /* newly nonzero coef is positive */
  558|   113k|          else
  559|   113k|            s = m1;             /* newly nonzero coef is negative */
  560|   184k|        } else {
  561|  39.8k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 39.3k, False: 526]
  ------------------
  562|  39.3k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  39.3k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 10.2k, False: 29.0k]
  ------------------
  564|  10.2k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  10.2k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  10.2k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 269, False: 9.99k]
  |  |  ------------------
  |  |  162|    269|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 269]
  |  |  ------------------
  |  |  163|    269|      { action; } \
  |  |  164|    269|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    269|  } \
  |  |  166|  10.2k|}
  ------------------
  565|  10.2k|              r = GET_BITS(r);
  ------------------
  |  |  169|  10.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  10.2k|              EOBRUN += r;
  567|  10.2k|            }
  568|  39.3k|            break;              /* rest of block is handled by EOB logic */
  569|  39.3k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  39.8k|        }
  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|   690k|        do {
  577|   690k|          thiscoef = *block + jpeg_natural_order[k];
  578|   690k|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 319k, False: 370k]
  ------------------
  579|   319k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   319k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   319k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.33k, False: 316k]
  |  |  ------------------
  |  |  162|  3.33k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.33k]
  |  |  ------------------
  |  |  163|  3.33k|      { action; } \
  |  |  164|  3.33k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.33k|  } \
  |  |  166|   319k|}
  ------------------
  580|   319k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|   319k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 144k, False: 174k]
  |  |  ------------------
  ------------------
  581|   144k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 24.0k, False: 120k]
  ------------------
  582|  24.0k|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 11.6k, False: 12.4k]
  ------------------
  583|  11.6k|                  *thiscoef += (JCOEF)p1;
  584|  12.4k|                else
  585|  12.4k|                  *thiscoef += (JCOEF)m1;
  586|  24.0k|              }
  587|   144k|            }
  588|   370k|          } else {
  589|   370k|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 181k, False: 189k]
  ------------------
  590|   181k|              break;            /* reached target zero coefficient */
  591|   370k|          }
  592|   508k|          k++;
  593|   508k|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 505k, False: 3.55k]
  ------------------
  594|   184k|        if (s) {
  ------------------
  |  Branch (594:13): [True: 184k, False: 526]
  ------------------
  595|   184k|          int pos = jpeg_natural_order[k];
  596|       |          /* Output newly nonzero coefficient */
  597|   184k|          (*block)[pos] = (JCOEF)s;
  598|       |          /* Remember its position in case we have to suspend */
  599|   184k|          newnz_pos[num_newnz++] = pos;
  600|   184k|        }
  601|   184k|      }
  602|  44.5k|    }
  603|       |
  604|   211k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 206k, False: 5.23k]
  ------------------
  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|  7.30M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 7.10M, False: 206k]
  ------------------
  611|  7.10M|        thiscoef = *block + jpeg_natural_order[k];
  612|  7.10M|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 307k, False: 6.79M]
  ------------------
  613|   307k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   307k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   307k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.63k, False: 302k]
  |  |  ------------------
  |  |  162|  4.63k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.63k]
  |  |  ------------------
  |  |  163|  4.63k|      { action; } \
  |  |  164|  4.63k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.63k|  } \
  |  |  166|   307k|}
  ------------------
  614|   307k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|   307k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 145k, False: 161k]
  |  |  ------------------
  ------------------
  615|   145k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 30.6k, False: 115k]
  ------------------
  616|  30.6k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 15.0k, False: 15.5k]
  ------------------
  617|  15.0k|                *thiscoef += (JCOEF)p1;
  618|  15.5k|              else
  619|  15.5k|                *thiscoef += (JCOEF)m1;
  620|  30.6k|            }
  621|   145k|          }
  622|   307k|        }
  623|  7.10M|      }
  624|       |      /* Count one block completed in EOB run */
  625|   206k|      EOBRUN--;
  626|   206k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|   211k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   211k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   211k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   211k|  permstate.get_buffer = get_buffer; \
  |  |  140|   211k|  permstate.bits_left = bits_left
  ------------------
  630|   211k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|   211k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|  6.96M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 630k, False: 6.33M]
  ------------------
  635|   630k|    entropy->restarts_to_go--;
  636|       |
  637|  6.96M|  return TRUE;
  ------------------
  |  |  210|  6.96M|#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|  6.96M|}

jinit_d_post_controller:
  267|  16.3k|{
  268|  16.3k|  my_post_ptr post;
  269|       |
  270|  16.3k|#ifdef D_LOSSLESS_SUPPORTED
  271|  16.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 571, False: 15.7k]
  ------------------
  272|    571|#if BITS_IN_JSAMPLE == 8
  273|    571|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.14k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 571]
  |  Branch (273:52): [True: 0, False: 571]
  ------------------
  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|    571|  } else
  280|  15.7k|#endif
  281|  15.7k|  {
  282|  15.7k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  15.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 15.7k]
  ------------------
  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|  15.7k|  }
  285|       |
  286|  16.3k|  post = (my_post_ptr)
  287|  16.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  16.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  16.3k|                                sizeof(my_post_controller));
  289|  16.3k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  16.3k|  post->pub.start_pass = start_pass_dpost;
  291|  16.3k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  16.3k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  16.3k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 9.70k, False: 6.59k]
  ------------------
  296|  9.70k|#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|  9.70k|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|  9.70k|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 2.56k, False: 7.13k]
  ------------------
  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|  2.56k|#ifdef QUANT_2PASS_SUPPORTED
  306|  2.56k|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|  2.56k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  2.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  2.56k|#define FALSE   0               /* values of boolean */
  ------------------
  308|  2.56k|         cinfo->output_width * cinfo->out_color_components,
  309|  2.56k|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|  2.56k|                               (long)post->strip_height),
  311|  2.56k|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|  7.13k|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|  7.13k|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|  7.13k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  7.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|  7.13k|         cinfo->output_width * cinfo->out_color_components,
  320|  7.13k|         post->strip_height);
  321|  7.13k|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|  9.70k|  }
  326|  16.3k|}
jdpostct-8.c:start_pass_dpost:
   85|  31.9k|{
   86|  31.9k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  31.9k|  switch (pass_mode) {
   89|  28.6k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 28.6k, False: 3.38k]
  ------------------
   90|  28.6k|#if BITS_IN_JSAMPLE != 16
   91|  28.6k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 17.0k, False: 11.5k]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|  17.0k|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  256|  17.0k|#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|  17.0k|      if (post->buffer == NULL) {
  ------------------
  |  Branch (98:11): [True: 0, False: 17.0k]
  ------------------
   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|  17.0k|    } else
  104|  11.5k|#endif
  105|  11.5k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  11.5k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  256|  11.5k|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  261|  11.5k|#define _upsample  upsample
  ------------------
  110|  11.5k|    }
  111|  28.6k|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|  1.70k|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 1.70k, False: 30.2k]
  ------------------
  114|       |    /* First pass of 2-pass quantization */
  115|  1.70k|    if (post->whole_image == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 1.70k]
  ------------------
  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|  1.70k|    post->pub._post_process_data = post_process_prepass;
  ------------------
  |  |  256|  1.70k|#define _post_process_data  post_process_data
  ------------------
  118|  1.70k|    break;
  119|  1.67k|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 1.67k, False: 30.3k]
  ------------------
  120|       |    /* Second pass of 2-pass quantization */
  121|  1.67k|    if (post->whole_image == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 1.67k]
  ------------------
  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|  1.67k|    post->pub._post_process_data = post_process_2pass;
  ------------------
  |  |  256|  1.67k|#define _post_process_data  post_process_data
  ------------------
  124|  1.67k|    break;
  125|      0|#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 31.9k]
  ------------------
  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|  31.9k|  }
  130|  31.9k|  post->starting_row = post->next_row = 0;
  131|  31.9k|}
jdpostct-8.c:post_process_1pass:
  146|  60.1M|{
  147|  60.1M|  my_post_ptr post = (my_post_ptr)cinfo->post;
  148|  60.1M|  JDIMENSION num_rows, max_rows;
  149|       |
  150|       |  /* Fill the buffer, but not more than what we can dump out in one go. */
  151|       |  /* Note we rely on the upsampler to detect bottom of image. */
  152|  60.1M|  max_rows = out_rows_avail - *out_row_ctr;
  153|  60.1M|  if (max_rows > post->strip_height)
  ------------------
  |  Branch (153:7): [True: 0, False: 60.1M]
  ------------------
  154|      0|    max_rows = post->strip_height;
  155|  60.1M|  num_rows = 0;
  156|  60.1M|  (*cinfo->upsample->_upsample) (cinfo, input_buf, in_row_group_ctr,
  ------------------
  |  |  261|  60.1M|#define _upsample  upsample
  ------------------
  157|  60.1M|                                 in_row_groups_avail, post->buffer, &num_rows,
  158|  60.1M|                                 max_rows);
  159|       |  /* Quantize and emit data. */
  160|  60.1M|  (*cinfo->cquantize->_color_quantize) (cinfo, post->buffer,
  ------------------
  |  |  265|  60.1M|#define _color_quantize  color_quantize
  ------------------
  161|  60.1M|                                        output_buf + *out_row_ctr,
  162|  60.1M|                                        (int)num_rows);
  163|  60.1M|  *out_row_ctr += num_rows;
  164|  60.1M|}
jdpostct-8.c:post_process_prepass:
  180|  3.87M|{
  181|  3.87M|  my_post_ptr post = (my_post_ptr)cinfo->post;
  182|  3.87M|  JDIMENSION old_next_row, num_rows;
  183|       |
  184|       |  /* Reposition virtual buffer if at start of strip. */
  185|  3.87M|  if (post->next_row == 0) {
  ------------------
  |  Branch (185:7): [True: 3.87M, False: 0]
  ------------------
  186|  3.87M|    post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  187|  3.87M|        ((j_common_ptr)cinfo, post->whole_image,
  188|  3.87M|         post->starting_row, post->strip_height, TRUE);
  ------------------
  |  |  210|  3.87M|#define TRUE    1
  ------------------
  189|  3.87M|  }
  190|       |
  191|       |  /* Upsample some data (up to a strip height's worth). */
  192|  3.87M|  old_next_row = post->next_row;
  193|  3.87M|  (*cinfo->upsample->_upsample) (cinfo, input_buf, in_row_group_ctr,
  ------------------
  |  |  261|  3.87M|#define _upsample  upsample
  ------------------
  194|  3.87M|                                 in_row_groups_avail, post->buffer,
  195|  3.87M|                                 &post->next_row, post->strip_height);
  196|       |
  197|       |  /* Allow quantizer to scan new data.  No data is emitted, */
  198|       |  /* but we advance out_row_ctr so outer loop can tell when we're done. */
  199|  3.87M|  if (post->next_row > old_next_row) {
  ------------------
  |  Branch (199:7): [True: 3.87M, False: 0]
  ------------------
  200|  3.87M|    num_rows = post->next_row - old_next_row;
  201|  3.87M|    (*cinfo->cquantize->_color_quantize) (cinfo, post->buffer + old_next_row,
  ------------------
  |  |  265|  3.87M|#define _color_quantize  color_quantize
  ------------------
  202|  3.87M|                                          (_JSAMPARRAY)NULL, (int)num_rows);
  203|  3.87M|    *out_row_ctr += num_rows;
  204|  3.87M|  }
  205|       |
  206|       |  /* Advance if we filled the strip. */
  207|  3.87M|  if (post->next_row >= post->strip_height) {
  ------------------
  |  Branch (207:7): [True: 3.87M, False: 949]
  ------------------
  208|  3.87M|    post->starting_row += post->strip_height;
  209|  3.87M|    post->next_row = 0;
  210|  3.87M|  }
  211|  3.87M|}
jdpostct-8.c:post_process_2pass:
  223|  9.87M|{
  224|  9.87M|  my_post_ptr post = (my_post_ptr)cinfo->post;
  225|  9.87M|  JDIMENSION num_rows, max_rows;
  226|       |
  227|       |  /* Reposition virtual buffer if at start of strip. */
  228|  9.87M|  if (post->next_row == 0) {
  ------------------
  |  Branch (228:7): [True: 3.87M, False: 6.00M]
  ------------------
  229|  3.87M|    post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  230|  3.87M|        ((j_common_ptr)cinfo, post->whole_image,
  231|  3.87M|         post->starting_row, post->strip_height, FALSE);
  ------------------
  |  |  207|  3.87M|#define FALSE   0               /* values of boolean */
  ------------------
  232|  3.87M|  }
  233|       |
  234|       |  /* Determine number of rows to emit. */
  235|  9.87M|  num_rows = post->strip_height - post->next_row; /* available in strip */
  236|  9.87M|  max_rows = out_rows_avail - *out_row_ctr; /* available in output area */
  237|  9.87M|  if (num_rows > max_rows)
  ------------------
  |  Branch (237:7): [True: 6.00M, False: 3.87M]
  ------------------
  238|  6.00M|    num_rows = max_rows;
  239|       |  /* We have to check bottom of image here, can't depend on upsampler. */
  240|  9.87M|  max_rows = cinfo->output_height - post->starting_row;
  241|  9.87M|  if (num_rows > max_rows)
  ------------------
  |  Branch (241:7): [True: 0, False: 9.87M]
  ------------------
  242|      0|    num_rows = max_rows;
  243|       |
  244|       |  /* Quantize and emit data. */
  245|  9.87M|  (*cinfo->cquantize->_color_quantize) (cinfo, post->buffer + post->next_row,
  ------------------
  |  |  265|  9.87M|#define _color_quantize  color_quantize
  ------------------
  246|  9.87M|                                        output_buf + *out_row_ctr,
  247|  9.87M|                                        (int)num_rows);
  248|  9.87M|  *out_row_ctr += num_rows;
  249|       |
  250|       |  /* Advance if we filled the strip. */
  251|  9.87M|  post->next_row += num_rows;
  252|  9.87M|  if (post->next_row >= post->strip_height) {
  ------------------
  |  Branch (252:7): [True: 3.87M, False: 6.00M]
  ------------------
  253|  3.87M|    post->starting_row += post->strip_height;
  254|  3.87M|    post->next_row = 0;
  255|  3.87M|  }
  256|  9.87M|}
j12init_d_post_controller:
  267|  1.37k|{
  268|  1.37k|  my_post_ptr post;
  269|       |
  270|  1.37k|#ifdef D_LOSSLESS_SUPPORTED
  271|  1.37k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 413, False: 962]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    413|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    826|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 413]
  ------------------
  276|    413|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    413|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 413]
  ------------------
  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|    413|  } else
  280|    962|#endif
  281|    962|  {
  282|    962|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    962|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 962]
  ------------------
  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|    962|  }
  285|       |
  286|  1.37k|  post = (my_post_ptr)
  287|  1.37k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.37k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  1.37k|                                sizeof(my_post_controller));
  289|  1.37k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  1.37k|  post->pub.start_pass = start_pass_dpost;
  291|  1.37k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  1.37k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  1.37k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 447, False: 928]
  ------------------
  296|    447|#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|    447|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|    447|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 102, False: 345]
  ------------------
  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|    102|#ifdef QUANT_2PASS_SUPPORTED
  306|    102|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|    102|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|    102|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|    102|#define FALSE   0               /* values of boolean */
  ------------------
  308|    102|         cinfo->output_width * cinfo->out_color_components,
  309|    102|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|    102|                               (long)post->strip_height),
  311|    102|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|    345|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|    345|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|    345|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    345|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|    345|         cinfo->output_width * cinfo->out_color_components,
  320|    345|         post->strip_height);
  321|    345|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|    447|  }
  326|  1.37k|}
jdpostct-12.c:start_pass_dpost:
   85|    100|{
   86|    100|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|    100|  switch (pass_mode) {
   89|    100|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 100, False: 0]
  ------------------
   90|    100|#if BITS_IN_JSAMPLE != 16
   91|    100|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 100]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|      0|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  142|      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|    100|#endif
  105|    100|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|    100|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  142|    100|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  147|    100|#define _upsample  upsample_12
  ------------------
  110|    100|    }
  111|    100|    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: 100]
  ------------------
  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;
  ------------------
  |  |  142|      0|#define _post_process_data  post_process_data_12
  ------------------
  118|      0|    break;
  119|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 0, False: 100]
  ------------------
  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;
  ------------------
  |  |  142|      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: 100]
  ------------------
  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|    100|  }
  130|    100|  post->starting_row = post->next_row = 0;
  131|    100|}
j16init_d_post_controller:
  267|    397|{
  268|    397|  my_post_ptr post;
  269|       |
  270|    397|#ifdef D_LOSSLESS_SUPPORTED
  271|    397|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 397, False: 0]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    397|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    794|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (275:9): [True: 0, False: 397]
  ------------------
  276|    397|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    397|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (276:9): [True: 0, False: 397]
  ------------------
  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|    397|  } else
  280|      0|#endif
  281|      0|  {
  282|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (282:9): [True: 0, False: 0]
  ------------------
  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|      0|  }
  285|       |
  286|    397|  post = (my_post_ptr)
  287|    397|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    397|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    397|                                sizeof(my_post_controller));
  289|    397|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    397|  post->pub.start_pass = start_pass_dpost;
  291|    397|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    397|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    397|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 397]
  ------------------
  296|       |#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|       |    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|       |    if (need_full_buffer) {
  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|       |#ifdef QUANT_2PASS_SUPPORTED
  306|       |      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|       |        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  308|       |         cinfo->output_width * cinfo->out_color_components,
  309|       |         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|       |                               (long)post->strip_height),
  311|       |         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|       |    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|       |      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|       |        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  319|       |         cinfo->output_width * cinfo->out_color_components,
  320|       |         post->strip_height);
  321|       |    }
  322|       |#else
  323|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  324|      0|#endif
  325|      0|  }
  326|    397|}
jdpostct-16.c:start_pass_dpost:
   85|      6|{
   86|      6|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|      6|  switch (pass_mode) {
   89|      6|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 6, False: 0]
  ------------------
   90|       |#if BITS_IN_JSAMPLE != 16
   91|       |    if (cinfo->quantize_colors) {
   92|       |      /* Single-pass processing with color quantization. */
   93|       |      post->pub._post_process_data = post_process_1pass;
   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|       |      if (post->buffer == NULL) {
   99|       |        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|       |          ((j_common_ptr)cinfo, post->whole_image,
  101|       |           (JDIMENSION)0, post->strip_height, TRUE);
  102|       |      }
  103|       |    } else
  104|       |#endif
  105|      6|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|      6|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   55|      6|#define _post_process_data  post_process_data_16
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   57|      6|#define _upsample  upsample_16
  ------------------
  110|      6|    }
  111|      6|    break;
  112|       |#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|       |  case JBUF_SAVE_AND_PASS:
  114|       |    /* First pass of 2-pass quantization */
  115|       |    if (post->whole_image == NULL)
  116|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  117|       |    post->pub._post_process_data = post_process_prepass;
  118|       |    break;
  119|       |  case JBUF_CRANK_DEST:
  120|       |    /* Second pass of 2-pass quantization */
  121|       |    if (post->whole_image == NULL)
  122|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  123|       |    post->pub._post_process_data = post_process_2pass;
  124|       |    break;
  125|       |#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 6]
  ------------------
  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|      6|  }
  130|      6|  post->starting_row = post->next_row = 0;
  131|      6|}

jinit_upsampler:
  418|  16.3k|{
  419|  16.3k|  my_upsample_ptr upsample;
  420|  16.3k|  int ci;
  421|  16.3k|  jpeg_component_info *compptr;
  422|  16.3k|  boolean need_buffer, do_fancy;
  423|  16.3k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  424|       |
  425|  16.3k|#ifdef D_LOSSLESS_SUPPORTED
  426|  16.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (426:7): [True: 578, False: 15.7k]
  ------------------
  427|    578|#if BITS_IN_JSAMPLE == 8
  428|    578|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.15k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (428:9): [True: 0, False: 578]
  |  Branch (428:52): [True: 0, False: 578]
  ------------------
  429|       |#else
  430|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  431|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  432|       |#endif
  433|      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)))
  ------------------
  434|    578|  } else
  435|  15.7k|#endif
  436|  15.7k|  {
  437|  15.7k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  15.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 15.7k]
  ------------------
  438|      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)))
  ------------------
  439|  15.7k|  }
  440|       |
  441|  16.3k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (441:7): [True: 16.3k, False: 0]
  ------------------
  442|  16.3k|    upsample = (my_upsample_ptr)
  443|  16.3k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  16.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  444|  16.3k|                                  sizeof(my_upsampler));
  445|  16.3k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  446|  16.3k|    upsample->pub.start_pass = start_pass_upsample;
  447|  16.3k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  261|  16.3k|#define _upsample  upsample
  ------------------
  448|  16.3k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  16.3k|#define FALSE   0               /* values of boolean */
  ------------------
  449|  16.3k|  } else
  450|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  451|       |
  452|  16.3k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (452:7): [True: 0, False: 16.3k]
  ------------------
  453|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|       |
  455|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  456|       |   * so don't ask for it.
  457|       |   */
  458|  16.3k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  16.3k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (458:14): [True: 16.3k, False: 0]
  |  Branch (458:44): [True: 15.7k, False: 578]
  ------------------
  459|       |
  460|       |  /* Verify we can handle the sampling factors, select per-component methods,
  461|       |   * and create storage as needed.
  462|       |   */
  463|  53.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (463:44): [True: 37.1k, False: 16.3k]
  ------------------
  464|  37.1k|       ci++, compptr++) {
  465|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  466|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  467|       |     */
  468|  37.1k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  37.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  469|  37.1k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  37.1k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  37.1k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  37.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  471|  37.1k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  37.1k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  472|  37.1k|    h_out_group = cinfo->max_h_samp_factor;
  473|  37.1k|    v_out_group = cinfo->max_v_samp_factor;
  474|  37.1k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  475|  37.1k|    need_buffer = TRUE;
  ------------------
  |  |  210|  37.1k|#define TRUE    1
  ------------------
  476|  37.1k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (476:9): [True: 0, False: 37.1k]
  ------------------
  477|       |      /* Don't bother to upsample an uninteresting component. */
  478|      0|      upsample->methods[ci] = noop_upsample;
  479|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  480|  37.1k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (480:16): [True: 21.6k, False: 15.4k]
  |  Branch (480:45): [True: 12.1k, False: 9.51k]
  ------------------
  481|       |      /* Fullsize components can be processed without any work. */
  482|  12.1k|      upsample->methods[ci] = fullsize_upsample;
  483|  12.1k|      need_buffer = FALSE;
  ------------------
  |  |  207|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  484|  25.0k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (484:16): [True: 12.7k, False: 12.2k]
  |  Branch (484:49): [True: 5.48k, False: 7.31k]
  ------------------
  485|       |      /* Special cases for 2h1v upsampling */
  486|  5.48k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (486:11): [True: 5.19k, False: 289]
  |  Branch (486:23): [True: 4.41k, False: 781]
  ------------------
  487|  4.41k|#ifdef WITH_SIMD
  488|  4.41k|        if (jsimd_can_h2v1_fancy_upsample())
  ------------------
  |  Branch (488:13): [True: 4.41k, False: 0]
  ------------------
  489|  4.41k|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  490|      0|        else
  491|      0|#endif
  492|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  493|  4.41k|      } else {
  494|  1.07k|#ifdef WITH_SIMD
  495|  1.07k|        if (jsimd_can_h2v1_upsample())
  ------------------
  |  Branch (495:13): [True: 1.07k, False: 0]
  ------------------
  496|  1.07k|          upsample->methods[ci] = jsimd_h2v1_upsample;
  497|      0|        else
  498|      0|#endif
  499|      0|          upsample->methods[ci] = h2v1_upsample;
  500|  1.07k|      }
  501|  19.5k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (501:16): [True: 9.51k, False: 10.0k]
  ------------------
  502|  9.51k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (502:16): [True: 3.98k, False: 5.53k]
  |  Branch (502:49): [True: 3.78k, False: 197]
  ------------------
  503|       |      /* Non-fancy upsampling is handled by the generic method */
  504|       |#if defined(WITH_SIMD) && (defined(__arm__) || defined(__aarch64__) || \
  505|       |                           defined(_M_ARM) || defined(_M_ARM64) || \
  506|       |                           defined(_M_ARM64EC))
  507|       |      if (jsimd_can_h1v2_fancy_upsample())
  508|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  509|       |      else
  510|       |#endif
  511|  3.78k|        upsample->methods[ci] = h1v2_fancy_upsample;
  512|  3.78k|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  3.78k|#define TRUE    1
  ------------------
  513|  15.7k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (513:16): [True: 7.31k, False: 8.42k]
  ------------------
  514|  7.31k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (514:16): [True: 2.80k, False: 4.51k]
  ------------------
  515|       |      /* Special cases for 2h2v upsampling */
  516|  2.80k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (516:11): [True: 2.59k, False: 209]
  |  Branch (516:23): [True: 2.42k, False: 168]
  ------------------
  517|  2.42k|#ifdef WITH_SIMD
  518|  2.42k|        if (jsimd_can_h2v2_fancy_upsample())
  ------------------
  |  Branch (518:13): [True: 2.42k, False: 0]
  ------------------
  519|  2.42k|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  520|      0|        else
  521|      0|#endif
  522|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  523|  2.42k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  2.42k|#define TRUE    1
  ------------------
  524|  2.42k|      } else {
  525|    377|#ifdef WITH_SIMD
  526|    377|        if (jsimd_can_h2v2_upsample())
  ------------------
  |  Branch (526:13): [True: 377, False: 0]
  ------------------
  527|    377|          upsample->methods[ci] = jsimd_h2v2_upsample;
  528|      0|        else
  529|      0|#endif
  530|      0|          upsample->methods[ci] = h2v2_upsample;
  531|    377|      }
  532|  12.9k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (532:16): [True: 12.9k, False: 8]
  ------------------
  533|  12.9k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (533:16): [True: 12.9k, False: 6]
  ------------------
  534|       |      /* Generic integral-factors upsampling method */
  535|       |#if defined(WITH_SIMD) && defined(__mips__)
  536|       |      if (jsimd_can_int_upsample())
  537|       |        upsample->methods[ci] = jsimd_int_upsample;
  538|       |      else
  539|       |#endif
  540|  12.9k|        upsample->methods[ci] = int_upsample;
  541|  12.9k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  542|  12.9k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  543|  12.9k|    } else
  544|     14|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  545|  37.1k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (545:9): [True: 24.9k, False: 12.1k]
  |  Branch (545:24): [True: 24.9k, False: 0]
  ------------------
  546|  24.9k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  547|  24.9k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  24.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  548|  24.9k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  549|  24.9k|                               (long)cinfo->max_h_samp_factor),
  550|  24.9k|         (JDIMENSION)cinfo->max_v_samp_factor);
  551|  24.9k|    }
  552|  37.1k|  }
  553|  16.3k|}
jdsample-8.c:start_pass_upsample:
   43|  30.3k|{
   44|  30.3k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   45|       |
   46|       |  /* Mark the conversion buffer empty */
   47|  30.3k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   48|       |  /* Initialize total-height counter for detecting bottom of image */
   49|  30.3k|  upsample->rows_to_go = cinfo->output_height;
   50|  30.3k|}
jdsample-8.c:sep_upsample:
   66|   106M|{
   67|   106M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   68|   106M|  int ci;
   69|   106M|  jpeg_component_info *compptr;
   70|   106M|  JDIMENSION num_rows;
   71|       |
   72|       |  /* Fill the conversion buffer, if it's empty */
   73|   106M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (73:7): [True: 48.5M, False: 57.5M]
  ------------------
   74|   157M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (74:46): [True: 108M, False: 48.5M]
  ------------------
   75|   108M|         ci++, compptr++) {
   76|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   77|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   78|       |       */
   79|   108M|      (*upsample->methods[ci]) (cinfo, compptr,
   80|   108M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   81|   108M|        upsample->color_buf + ci);
   82|   108M|    }
   83|  48.5M|    upsample->next_row_out = 0;
   84|  48.5M|  }
   85|       |
   86|       |  /* Color-convert and emit rows */
   87|       |
   88|       |  /* How many we have in the buffer: */
   89|   106M|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
   90|       |  /* Not more than the distance to the end of the image.  Need this test
   91|       |   * in case the image height is not a multiple of max_v_samp_factor:
   92|       |   */
   93|   106M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (93:7): [True: 13.1k, False: 106M]
  ------------------
   94|  13.1k|    num_rows = upsample->rows_to_go;
   95|       |  /* And not more than what the client can accept: */
   96|   106M|  out_rows_avail -= *out_row_ctr;
   97|   106M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (97:7): [True: 57.5M, False: 48.5M]
  ------------------
   98|  57.5M|    num_rows = out_rows_avail;
   99|       |
  100|   106M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  263|   106M|#define _color_convert  color_convert
  ------------------
  101|   106M|                                      (JDIMENSION)upsample->next_row_out,
  102|   106M|                                      output_buf + *out_row_ctr,
  103|   106M|                                      (int)num_rows);
  104|       |
  105|       |  /* Adjust counts */
  106|   106M|  *out_row_ctr += num_rows;
  107|   106M|  upsample->rows_to_go -= num_rows;
  108|   106M|  upsample->next_row_out += num_rows;
  109|       |  /* When the buffer is emptied, declare this input row group consumed */
  110|   106M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (110:7): [True: 48.5M, False: 57.5M]
  ------------------
  111|  48.5M|    (*in_row_group_ctr)++;
  112|   106M|}
jdsample-8.c:fullsize_upsample:
  131|  36.0M|{
  132|  36.0M|  *output_data_ptr = input_data;
  133|  36.0M|}
jdsample-8.c:h1v2_fancy_upsample:
  318|  10.6M|{
  319|  10.6M|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  226|  10.6M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  320|  10.6M|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  225|  10.6M|#define _JSAMPROW  JSAMPROW
  ------------------
  321|  10.6M|#if BITS_IN_JSAMPLE == 8
  322|  10.6M|  int thiscolsum, bias;
  323|       |#else
  324|       |  JLONG thiscolsum, bias;
  325|       |#endif
  326|  10.6M|  JDIMENSION colctr;
  327|  10.6M|  int inrow, outrow, v;
  328|       |
  329|  10.6M|  inrow = outrow = 0;
  330|  27.2M|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (330:10): [True: 16.6M, False: 10.6M]
  ------------------
  331|  49.9M|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (331:17): [True: 33.3M, False: 16.6M]
  ------------------
  332|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  333|  33.3M|      inptr0 = input_data[inrow];
  334|  33.3M|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (334:11): [True: 16.6M, False: 16.6M]
  ------------------
  335|  16.6M|        inptr1 = input_data[inrow - 1];
  336|  16.6M|        bias = 1;
  337|  16.6M|      } else {                  /* next nearest is row below */
  338|  16.6M|        inptr1 = input_data[inrow + 1];
  339|  16.6M|        bias = 2;
  340|  16.6M|      }
  341|  33.3M|      outptr = output_data[outrow++];
  342|       |
  343|   659M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (343:24): [True: 625M, False: 33.3M]
  ------------------
  344|   625M|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  345|   625M|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  346|   625M|      }
  347|  33.3M|    }
  348|  16.6M|    inrow++;
  349|  16.6M|  }
  350|  10.6M|}
jdsample-8.c:int_upsample:
  163|  37.4M|{
  164|  37.4M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  165|  37.4M|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  226|  37.4M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  166|  37.4M|  register _JSAMPROW inptr, outptr;
  167|  37.4M|  register _JSAMPLE invalue;
  168|  37.4M|  register int h;
  169|  37.4M|  _JSAMPROW outend;
  ------------------
  |  |  225|  37.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  170|  37.4M|  int h_expand, v_expand;
  171|  37.4M|  int inrow, outrow;
  172|       |
  173|  37.4M|  h_expand = upsample->h_expand[compptr->component_index];
  174|  37.4M|  v_expand = upsample->v_expand[compptr->component_index];
  175|       |
  176|  37.4M|  inrow = outrow = 0;
  177|  77.9M|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (177:10): [True: 40.4M, False: 37.4M]
  ------------------
  178|       |    /* Generate one output row with proper horizontal expansion */
  179|  40.4M|    inptr = input_data[inrow];
  180|  40.4M|    outptr = output_data[outrow];
  181|  40.4M|    outend = outptr + cinfo->output_width;
  182|   564M|    while (outptr < outend) {
  ------------------
  |  Branch (182:12): [True: 524M, False: 40.4M]
  ------------------
  183|   524M|      invalue = *inptr++;
  184|  1.40G|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (184:26): [True: 885M, False: 524M]
  ------------------
  185|   885M|        *outptr++ = invalue;
  186|   885M|      }
  187|   524M|    }
  188|       |    /* Generate any additional output rows by duplicating the first one */
  189|  40.4M|    if (v_expand > 1) {
  ------------------
  |  Branch (189:9): [True: 32.8M, False: 7.60M]
  ------------------
  190|  32.8M|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  293|  32.8M|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  191|  32.8M|                         v_expand - 1, cinfo->output_width);
  192|  32.8M|    }
  193|  40.4M|    inrow++;
  194|  40.4M|    outrow += v_expand;
  195|  40.4M|  }
  196|  37.4M|}
j12init_upsampler:
  418|  1.38k|{
  419|  1.38k|  my_upsample_ptr upsample;
  420|  1.38k|  int ci;
  421|  1.38k|  jpeg_component_info *compptr;
  422|  1.38k|  boolean need_buffer, do_fancy;
  423|  1.38k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  424|       |
  425|  1.38k|#ifdef D_LOSSLESS_SUPPORTED
  426|  1.38k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (426:7): [True: 421, False: 968]
  ------------------
  427|       |#if BITS_IN_JSAMPLE == 8
  428|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  429|       |#else
  430|    421|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    842|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (430:9): [True: 0, False: 421]
  ------------------
  431|    421|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    421|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (431:9): [True: 0, False: 421]
  ------------------
  432|      0|#endif
  433|      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)))
  ------------------
  434|    421|  } else
  435|    968|#endif
  436|    968|  {
  437|    968|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    968|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (437:9): [True: 0, False: 968]
  ------------------
  438|      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)))
  ------------------
  439|    968|  }
  440|       |
  441|  1.38k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (441:7): [True: 1.38k, False: 0]
  ------------------
  442|  1.38k|    upsample = (my_upsample_ptr)
  443|  1.38k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.38k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  444|  1.38k|                                  sizeof(my_upsampler));
  445|  1.38k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  446|  1.38k|    upsample->pub.start_pass = start_pass_upsample;
  447|  1.38k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  147|  1.38k|#define _upsample  upsample_12
  ------------------
  448|  1.38k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  1.38k|#define FALSE   0               /* values of boolean */
  ------------------
  449|  1.38k|  } else
  450|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  451|       |
  452|  1.38k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (452:7): [True: 0, False: 1.38k]
  ------------------
  453|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|       |
  455|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  456|       |   * so don't ask for it.
  457|       |   */
  458|  1.38k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  1.38k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (458:14): [True: 1.38k, False: 0]
  |  Branch (458:44): [True: 968, False: 421]
  ------------------
  459|       |
  460|       |  /* Verify we can handle the sampling factors, select per-component methods,
  461|       |   * and create storage as needed.
  462|       |   */
  463|  5.05k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (463:44): [True: 3.67k, False: 1.38k]
  ------------------
  464|  3.67k|       ci++, compptr++) {
  465|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  466|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  467|       |     */
  468|  3.67k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  3.67k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  469|  3.67k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  3.67k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  3.67k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  3.67k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  471|  3.67k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  3.67k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  472|  3.67k|    h_out_group = cinfo->max_h_samp_factor;
  473|  3.67k|    v_out_group = cinfo->max_v_samp_factor;
  474|  3.67k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  475|  3.67k|    need_buffer = TRUE;
  ------------------
  |  |  210|  3.67k|#define TRUE    1
  ------------------
  476|  3.67k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (476:9): [True: 0, False: 3.67k]
  ------------------
  477|       |      /* Don't bother to upsample an uninteresting component. */
  478|      0|      upsample->methods[ci] = noop_upsample;
  479|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  480|  3.67k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (480:16): [True: 1.89k, False: 1.77k]
  |  Branch (480:45): [True: 1.02k, False: 869]
  ------------------
  481|       |      /* Fullsize components can be processed without any work. */
  482|  1.02k|      upsample->methods[ci] = fullsize_upsample;
  483|  1.02k|      need_buffer = FALSE;
  ------------------
  |  |  207|  1.02k|#define FALSE   0               /* values of boolean */
  ------------------
  484|  2.64k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (484:16): [True: 1.02k, False: 1.62k]
  |  Branch (484:49): [True: 450, False: 570]
  ------------------
  485|       |      /* Special cases for 2h1v upsampling */
  486|    450|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (486:11): [True: 205, False: 245]
  |  Branch (486:23): [True: 128, False: 77]
  ------------------
  487|       |#ifdef WITH_SIMD
  488|       |        if (jsimd_can_h2v1_fancy_upsample())
  489|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  490|       |        else
  491|       |#endif
  492|    128|          upsample->methods[ci] = h2v1_fancy_upsample;
  493|    322|      } else {
  494|       |#ifdef WITH_SIMD
  495|       |        if (jsimd_can_h2v1_upsample())
  496|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  497|       |        else
  498|       |#endif
  499|    322|          upsample->methods[ci] = h2v1_upsample;
  500|    322|      }
  501|  2.19k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (501:16): [True: 869, False: 1.32k]
  ------------------
  502|    869|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (502:16): [True: 356, False: 513]
  |  Branch (502:49): [True: 206, False: 150]
  ------------------
  503|       |      /* Non-fancy upsampling is handled by the generic method */
  504|       |#if defined(WITH_SIMD) && (defined(__arm__) || defined(__aarch64__) || \
  505|       |                           defined(_M_ARM) || defined(_M_ARM64) || \
  506|       |                           defined(_M_ARM64EC))
  507|       |      if (jsimd_can_h1v2_fancy_upsample())
  508|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  509|       |      else
  510|       |#endif
  511|    206|        upsample->methods[ci] = h1v2_fancy_upsample;
  512|    206|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|    206|#define TRUE    1
  ------------------
  513|  1.98k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (513:16): [True: 570, False: 1.41k]
  ------------------
  514|    570|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (514:16): [True: 228, False: 342]
  ------------------
  515|       |      /* Special cases for 2h2v upsampling */
  516|    228|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (516:11): [True: 109, False: 119]
  |  Branch (516:23): [True: 64, False: 45]
  ------------------
  517|       |#ifdef WITH_SIMD
  518|       |        if (jsimd_can_h2v2_fancy_upsample())
  519|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  520|       |        else
  521|       |#endif
  522|     64|          upsample->methods[ci] = h2v2_fancy_upsample;
  523|     64|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|     64|#define TRUE    1
  ------------------
  524|    164|      } else {
  525|       |#ifdef WITH_SIMD
  526|       |        if (jsimd_can_h2v2_upsample())
  527|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  528|       |        else
  529|       |#endif
  530|    164|          upsample->methods[ci] = h2v2_upsample;
  531|    164|      }
  532|  1.76k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (532:16): [True: 1.75k, False: 8]
  ------------------
  533|  1.75k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (533:16): [True: 1.74k, False: 6]
  ------------------
  534|       |      /* Generic integral-factors upsampling method */
  535|       |#if defined(WITH_SIMD) && defined(__mips__)
  536|       |      if (jsimd_can_int_upsample())
  537|       |        upsample->methods[ci] = jsimd_int_upsample;
  538|       |      else
  539|       |#endif
  540|  1.74k|        upsample->methods[ci] = int_upsample;
  541|  1.74k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  542|  1.74k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  543|  1.74k|    } else
  544|     14|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  545|  3.67k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (545:9): [True: 2.63k, False: 1.03k]
  |  Branch (545:24): [True: 2.63k, False: 0]
  ------------------
  546|  2.63k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  547|  2.63k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.63k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  548|  2.63k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  549|  2.63k|                               (long)cinfo->max_h_samp_factor),
  550|  2.63k|         (JDIMENSION)cinfo->max_v_samp_factor);
  551|  2.63k|    }
  552|  3.67k|  }
  553|  1.38k|}
jdsample-12.c:start_pass_upsample:
   43|    100|{
   44|    100|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   45|       |
   46|       |  /* Mark the conversion buffer empty */
   47|    100|  upsample->next_row_out = cinfo->max_v_samp_factor;
   48|       |  /* Initialize total-height counter for detecting bottom of image */
   49|    100|  upsample->rows_to_go = cinfo->output_height;
   50|    100|}
j16init_upsampler:
  418|    411|{
  419|    411|  my_upsample_ptr upsample;
  420|    411|  int ci;
  421|    411|  jpeg_component_info *compptr;
  422|    411|  boolean need_buffer, do_fancy;
  423|    411|  int h_in_group, v_in_group, h_out_group, v_out_group;
  424|       |
  425|    411|#ifdef D_LOSSLESS_SUPPORTED
  426|    411|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (426:7): [True: 411, False: 0]
  ------------------
  427|       |#if BITS_IN_JSAMPLE == 8
  428|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  429|       |#else
  430|    411|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    822|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (430:9): [True: 0, False: 411]
  ------------------
  431|    411|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    411|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (431:9): [True: 0, False: 411]
  ------------------
  432|      0|#endif
  433|      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)))
  ------------------
  434|    411|  } else
  435|      0|#endif
  436|      0|  {
  437|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (437:9): [True: 0, False: 0]
  ------------------
  438|      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)))
  ------------------
  439|      0|  }
  440|       |
  441|    411|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (441:7): [True: 411, False: 0]
  ------------------
  442|    411|    upsample = (my_upsample_ptr)
  443|    411|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    411|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  444|    411|                                  sizeof(my_upsampler));
  445|    411|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  446|    411|    upsample->pub.start_pass = start_pass_upsample;
  447|    411|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |   57|    411|#define _upsample  upsample_16
  ------------------
  448|    411|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    411|#define FALSE   0               /* values of boolean */
  ------------------
  449|    411|  } else
  450|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  451|       |
  452|    411|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (452:7): [True: 0, False: 411]
  ------------------
  453|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|       |
  455|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  456|       |   * so don't ask for it.
  457|       |   */
  458|    411|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    411|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (458:14): [True: 411, False: 0]
  |  Branch (458:44): [True: 0, False: 411]
  ------------------
  459|       |
  460|       |  /* Verify we can handle the sampling factors, select per-component methods,
  461|       |   * and create storage as needed.
  462|       |   */
  463|  1.88k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (463:44): [True: 1.47k, False: 411]
  ------------------
  464|  1.47k|       ci++, compptr++) {
  465|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  466|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  467|       |     */
  468|  1.47k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.47k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  469|  1.47k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.47k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  1.47k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.47k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  471|  1.47k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.47k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  472|  1.47k|    h_out_group = cinfo->max_h_samp_factor;
  473|  1.47k|    v_out_group = cinfo->max_v_samp_factor;
  474|  1.47k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  475|  1.47k|    need_buffer = TRUE;
  ------------------
  |  |  210|  1.47k|#define TRUE    1
  ------------------
  476|  1.47k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (476:9): [True: 0, False: 1.47k]
  ------------------
  477|       |      /* Don't bother to upsample an uninteresting component. */
  478|      0|      upsample->methods[ci] = noop_upsample;
  479|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  480|  1.47k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (480:16): [True: 659, False: 811]
  |  Branch (480:45): [True: 313, False: 346]
  ------------------
  481|       |      /* Fullsize components can be processed without any work. */
  482|    313|      upsample->methods[ci] = fullsize_upsample;
  483|    313|      need_buffer = FALSE;
  ------------------
  |  |  207|    313|#define FALSE   0               /* values of boolean */
  ------------------
  484|  1.15k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (484:16): [True: 489, False: 668]
  |  Branch (484:49): [True: 196, False: 293]
  ------------------
  485|       |      /* Special cases for 2h1v upsampling */
  486|    196|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (486:11): [True: 0, False: 196]
  |  Branch (486:23): [True: 0, False: 0]
  ------------------
  487|       |#ifdef WITH_SIMD
  488|       |        if (jsimd_can_h2v1_fancy_upsample())
  489|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  490|       |        else
  491|       |#endif
  492|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  493|    196|      } else {
  494|       |#ifdef WITH_SIMD
  495|       |        if (jsimd_can_h2v1_upsample())
  496|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  497|       |        else
  498|       |#endif
  499|    196|          upsample->methods[ci] = h2v1_upsample;
  500|    196|      }
  501|    961|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (501:16): [True: 346, False: 615]
  ------------------
  502|    346|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (502:16): [True: 133, False: 213]
  |  Branch (502:49): [True: 0, False: 133]
  ------------------
  503|       |      /* Non-fancy upsampling is handled by the generic method */
  504|       |#if defined(WITH_SIMD) && (defined(__arm__) || defined(__aarch64__) || \
  505|       |                           defined(_M_ARM) || defined(_M_ARM64) || \
  506|       |                           defined(_M_ARM64EC))
  507|       |      if (jsimd_can_h1v2_fancy_upsample())
  508|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  509|       |      else
  510|       |#endif
  511|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  512|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  513|    961|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (513:16): [True: 293, False: 668]
  ------------------
  514|    293|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (514:16): [True: 134, False: 159]
  ------------------
  515|       |      /* Special cases for 2h2v upsampling */
  516|    134|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (516:11): [True: 0, False: 134]
  |  Branch (516:23): [True: 0, False: 0]
  ------------------
  517|       |#ifdef WITH_SIMD
  518|       |        if (jsimd_can_h2v2_fancy_upsample())
  519|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  520|       |        else
  521|       |#endif
  522|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  523|      0|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  524|    134|      } else {
  525|       |#ifdef WITH_SIMD
  526|       |        if (jsimd_can_h2v2_upsample())
  527|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  528|       |        else
  529|       |#endif
  530|    134|          upsample->methods[ci] = h2v2_upsample;
  531|    134|      }
  532|    827|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (532:16): [True: 820, False: 7]
  ------------------
  533|    820|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (533:16): [True: 813, False: 7]
  ------------------
  534|       |      /* Generic integral-factors upsampling method */
  535|       |#if defined(WITH_SIMD) && defined(__mips__)
  536|       |      if (jsimd_can_int_upsample())
  537|       |        upsample->methods[ci] = jsimd_int_upsample;
  538|       |      else
  539|       |#endif
  540|    813|        upsample->methods[ci] = int_upsample;
  541|    813|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  542|    813|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  543|    813|    } else
  544|     14|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  545|  1.47k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (545:9): [True: 1.14k, False: 327]
  |  Branch (545:24): [True: 1.14k, False: 0]
  ------------------
  546|  1.14k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  547|  1.14k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.14k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  548|  1.14k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  549|  1.14k|                               (long)cinfo->max_h_samp_factor),
  550|  1.14k|         (JDIMENSION)cinfo->max_v_samp_factor);
  551|  1.14k|    }
  552|  1.47k|  }
  553|    411|}
jdsample-16.c:start_pass_upsample:
   43|      6|{
   44|      6|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   45|       |
   46|       |  /* Mark the conversion buffer empty */
   47|      6|  upsample->next_row_out = cinfo->max_v_samp_factor;
   48|       |  /* Initialize total-height counter for detecting bottom of image */
   49|      6|  upsample->rows_to_go = cinfo->output_height;
   50|      6|}

jpeg_std_error:
  229|  6.97k|{
  230|  6.97k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  6.97k|  err->error_exit = error_exit;
  233|  6.97k|  err->emit_message = emit_message;
  234|  6.97k|  err->output_message = output_message;
  235|  6.97k|  err->format_message = format_message;
  236|  6.97k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  6.97k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  6.97k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  6.97k|  return err;
  243|  6.97k|}
jerror.c:reset_error_mgr:
  210|  19.6k|{
  211|  19.6k|  cinfo->err->num_warnings = 0;
  212|       |  /* trace_level is not reset since it is an application-supplied parameter */
  213|  19.6k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  214|  19.6k|}

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

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

jinit_1pass_quantizer:
  823|  7.13k|{
  824|  7.13k|  my_cquantize_ptr cquantize;
  825|       |
  826|  7.13k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  7.13k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (826:7): [True: 0, False: 7.13k]
  ------------------
  827|      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)))
  ------------------
  828|       |
  829|       |  /* Color quantization is not supported with lossless JPEG images */
  830|  7.13k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (830:7): [True: 0, False: 7.13k]
  ------------------
  831|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  832|       |
  833|  7.13k|  cquantize = (my_cquantize_ptr)
  834|  7.13k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  7.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  835|  7.13k|                                sizeof(my_cquantizer));
  836|  7.13k|  cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
  837|  7.13k|  cquantize->pub.start_pass = start_pass_1_quant;
  838|  7.13k|  cquantize->pub.finish_pass = finish_pass_1_quant;
  839|  7.13k|  cquantize->pub.new_color_map = new_color_map_1_quant;
  840|  7.13k|  cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */
  841|  7.13k|  cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */
  842|       |
  843|       |  /* Make sure my internal arrays won't overflow */
  844|  7.13k|  if (cinfo->out_color_components > MAX_Q_COMPS)
  ------------------
  |  |  142|  7.13k|#define MAX_Q_COMPS  4          /* max components I can handle */
  ------------------
  |  Branch (844:7): [True: 0, False: 7.13k]
  ------------------
  845|      0|    ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  846|       |  /* Make sure colormap indexes can be represented by _JSAMPLEs */
  847|  7.13k|  if (cinfo->desired_number_of_colors > (_MAXJSAMPLE + 1))
  ------------------
  |  |  222|  7.13k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  7.13k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (847:7): [True: 0, False: 7.13k]
  ------------------
  848|      0|    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, _MAXJSAMPLE + 1);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  849|       |
  850|       |  /* Create the colormap and color index table. */
  851|  7.13k|  create_colormap(cinfo);
  852|  7.13k|  create_colorindex(cinfo);
  853|       |
  854|       |  /* Allocate Floyd-Steinberg workspace now if requested.
  855|       |   * We do this now since it may affect the memory manager's space
  856|       |   * calculations.  If the user changes to FS dither mode in a later pass, we
  857|       |   * will allocate the space then, and will possibly overrun the
  858|       |   * max_memory_to_use setting.
  859|       |   */
  860|  7.13k|  if (cinfo->dither_mode == JDITHER_FS)
  ------------------
  |  Branch (860:7): [True: 2.38k, False: 4.75k]
  ------------------
  861|  2.38k|    alloc_fs_workspace(cinfo);
  862|  7.13k|}
jquant1-8.c:start_pass_1_quant:
  743|  13.3k|{
  744|  13.3k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  745|  13.3k|  size_t arraysize;
  746|  13.3k|  int i;
  747|       |
  748|       |  /* Install my colormap. */
  749|  13.3k|  cinfo->colormap = (JSAMPARRAY)cquantize->sv_colormap;
  750|  13.3k|  cinfo->actual_number_of_colors = cquantize->sv_actual;
  751|       |
  752|       |  /* Initialize for desired dithering mode. */
  753|  13.3k|  switch (cinfo->dither_mode) {
  754|  4.55k|  case JDITHER_NONE:
  ------------------
  |  Branch (754:3): [True: 4.55k, False: 8.76k]
  ------------------
  755|  4.55k|    if (cinfo->out_color_components == 3)
  ------------------
  |  Branch (755:9): [True: 2.94k, False: 1.61k]
  ------------------
  756|  2.94k|      cquantize->pub._color_quantize = color_quantize3;
  ------------------
  |  |  265|  2.94k|#define _color_quantize  color_quantize
  ------------------
  757|  1.61k|    else
  758|  1.61k|      cquantize->pub._color_quantize = color_quantize;
  ------------------
  |  |  265|  1.61k|#define _color_quantize  color_quantize
  ------------------
  759|  4.55k|    break;
  760|  4.34k|  case JDITHER_ORDERED:
  ------------------
  |  Branch (760:3): [True: 4.34k, False: 8.98k]
  ------------------
  761|  4.34k|    if (cinfo->out_color_components == 3)
  ------------------
  |  Branch (761:9): [True: 2.79k, False: 1.54k]
  ------------------
  762|  2.79k|      cquantize->pub._color_quantize = quantize3_ord_dither;
  ------------------
  |  |  265|  2.79k|#define _color_quantize  color_quantize
  ------------------
  763|  1.54k|    else
  764|  1.54k|      cquantize->pub._color_quantize = quantize_ord_dither;
  ------------------
  |  |  265|  1.54k|#define _color_quantize  color_quantize
  ------------------
  765|  4.34k|    cquantize->row_index = 0;   /* initialize state for ordered dither */
  766|       |    /* If user changed to ordered dither from another mode,
  767|       |     * we must recreate the color index table with padding.
  768|       |     * This will cost extra space, but probably isn't very likely.
  769|       |     */
  770|  4.34k|    if (!cquantize->is_padded)
  ------------------
  |  Branch (770:9): [True: 0, False: 4.34k]
  ------------------
  771|      0|      create_colorindex(cinfo);
  772|       |    /* Create ordered-dither tables if we didn't already. */
  773|  4.34k|    if (cquantize->odither[0] == NULL)
  ------------------
  |  Branch (773:9): [True: 1.65k, False: 2.68k]
  ------------------
  774|  1.65k|      create_odither_tables(cinfo);
  775|  4.34k|    break;
  776|  4.42k|  case JDITHER_FS:
  ------------------
  |  Branch (776:3): [True: 4.42k, False: 8.89k]
  ------------------
  777|  4.42k|    cquantize->pub._color_quantize = quantize_fs_dither;
  ------------------
  |  |  265|  4.42k|#define _color_quantize  color_quantize
  ------------------
  778|  4.42k|    cquantize->on_odd_row = FALSE; /* initialize state for F-S dither */
  ------------------
  |  |  207|  4.42k|#define FALSE   0               /* values of boolean */
  ------------------
  779|       |    /* Allocate Floyd-Steinberg workspace if didn't already. */
  780|  4.42k|    if (cquantize->fserrors[0] == NULL)
  ------------------
  |  Branch (780:9): [True: 0, False: 4.42k]
  ------------------
  781|      0|      alloc_fs_workspace(cinfo);
  782|       |    /* Initialize the propagated errors to zero. */
  783|  4.42k|    arraysize = (size_t)((cinfo->output_width + 2) * sizeof(FSERROR));
  784|  14.4k|    for (i = 0; i < cinfo->out_color_components; i++)
  ------------------
  |  Branch (784:17): [True: 10.0k, False: 4.42k]
  ------------------
  785|  10.0k|      jzero_far((void *)cquantize->fserrors[i], arraysize);
  786|  4.42k|    break;
  787|      0|  default:
  ------------------
  |  Branch (787:3): [True: 0, False: 13.3k]
  ------------------
  788|      0|    ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  789|      0|    break;
  790|  13.3k|  }
  791|  13.3k|}
jquant1-8.c:color_quantize3:
  495|  11.4M|{
  496|  11.4M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  497|  11.4M|  register int pixcode;
  498|  11.4M|  register _JSAMPROW ptrin, ptrout;
  499|  11.4M|  _JSAMPROW colorindex0 = cquantize->colorindex[0];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  500|  11.4M|  _JSAMPROW colorindex1 = cquantize->colorindex[1];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  501|  11.4M|  _JSAMPROW colorindex2 = cquantize->colorindex[2];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  502|  11.4M|  int row;
  503|  11.4M|  JDIMENSION col;
  504|  11.4M|  JDIMENSION width = cinfo->output_width;
  505|       |
  506|  22.8M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (506:17): [True: 11.4M, False: 11.4M]
  ------------------
  507|  11.4M|    ptrin = input_buf[row];
  508|  11.4M|    ptrout = output_buf[row];
  509|   307M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (509:23): [True: 296M, False: 11.4M]
  ------------------
  510|   296M|      pixcode  = colorindex0[*ptrin++];
  511|   296M|      pixcode += colorindex1[*ptrin++];
  512|   296M|      pixcode += colorindex2[*ptrin++];
  513|   296M|      *ptrout++ = (_JSAMPLE)pixcode;
  514|   296M|    }
  515|  11.4M|  }
  516|  11.4M|}
jquant1-8.c:color_quantize:
  467|  4.27M|{
  468|  4.27M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  469|  4.27M|  _JSAMPARRAY colorindex = cquantize->colorindex;
  ------------------
  |  |  226|  4.27M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  470|  4.27M|  register int pixcode, ci;
  471|  4.27M|  register _JSAMPROW ptrin, ptrout;
  472|  4.27M|  int row;
  473|  4.27M|  JDIMENSION col;
  474|  4.27M|  JDIMENSION width = cinfo->output_width;
  475|  4.27M|  register int nc = cinfo->out_color_components;
  476|       |
  477|  8.55M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (477:17): [True: 4.27M, False: 4.27M]
  ------------------
  478|  4.27M|    ptrin = input_buf[row];
  479|  4.27M|    ptrout = output_buf[row];
  480|   192M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (480:23): [True: 188M, False: 4.27M]
  ------------------
  481|   188M|      pixcode = 0;
  482|   376M|      for (ci = 0; ci < nc; ci++) {
  ------------------
  |  Branch (482:20): [True: 188M, False: 188M]
  ------------------
  483|   188M|        pixcode += colorindex[ci][*ptrin++];
  484|   188M|      }
  485|   188M|      *ptrout++ = (_JSAMPLE)pixcode;
  486|   188M|    }
  487|  4.27M|  }
  488|  4.27M|}
jquant1-8.c:quantize3_ord_dither:
  573|  11.4M|{
  574|  11.4M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  575|  11.4M|  register int pixcode;
  576|  11.4M|  register _JSAMPROW input_ptr;
  577|  11.4M|  register _JSAMPROW output_ptr;
  578|  11.4M|  _JSAMPROW colorindex0 = cquantize->colorindex[0];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  579|  11.4M|  _JSAMPROW colorindex1 = cquantize->colorindex[1];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  580|  11.4M|  _JSAMPROW colorindex2 = cquantize->colorindex[2];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  581|  11.4M|  int *dither0;                 /* points to active row of dither matrix */
  582|  11.4M|  int *dither1;
  583|  11.4M|  int *dither2;
  584|  11.4M|  int row_index, col_index;     /* current indexes into dither matrix */
  585|  11.4M|  int row;
  586|  11.4M|  JDIMENSION col;
  587|  11.4M|  JDIMENSION width = cinfo->output_width;
  588|       |
  589|  22.8M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (589:17): [True: 11.4M, False: 11.4M]
  ------------------
  590|  11.4M|    row_index = cquantize->row_index;
  591|  11.4M|    input_ptr = input_buf[row];
  592|  11.4M|    output_ptr = output_buf[row];
  593|  11.4M|    dither0 = cquantize->odither[0][row_index];
  594|  11.4M|    dither1 = cquantize->odither[1][row_index];
  595|  11.4M|    dither2 = cquantize->odither[2][row_index];
  596|  11.4M|    col_index = 0;
  597|       |
  598|   244M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (598:23): [True: 232M, False: 11.4M]
  ------------------
  599|   232M|      pixcode  = colorindex0[(*input_ptr++) + dither0[col_index]];
  600|   232M|      pixcode += colorindex1[(*input_ptr++) + dither1[col_index]];
  601|   232M|      pixcode += colorindex2[(*input_ptr++) + dither2[col_index]];
  602|   232M|      *output_ptr++ = (_JSAMPLE)pixcode;
  603|   232M|      col_index = (col_index + 1) & ODITHER_MASK;
  ------------------
  |  |   78|   232M|#define ODITHER_MASK  (ODITHER_SIZE - 1) /* mask for wrapping around
  |  |  ------------------
  |  |  |  |   75|   232M|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  604|   232M|    }
  605|  11.4M|    row_index = (row_index + 1) & ODITHER_MASK;
  ------------------
  |  |   78|  11.4M|#define ODITHER_MASK  (ODITHER_SIZE - 1) /* mask for wrapping around
  |  |  ------------------
  |  |  |  |   75|  11.4M|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  606|  11.4M|    cquantize->row_index = row_index;
  607|  11.4M|  }
  608|  11.4M|}
jquant1-8.c:quantize_ord_dither:
  523|  4.24M|{
  524|  4.24M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  525|  4.24M|  register _JSAMPROW input_ptr;
  526|  4.24M|  register _JSAMPROW output_ptr;
  527|  4.24M|  _JSAMPROW colorindex_ci;
  ------------------
  |  |  225|  4.24M|#define _JSAMPROW  JSAMPROW
  ------------------
  528|  4.24M|  int *dither;                  /* points to active row of dither matrix */
  529|  4.24M|  int row_index, col_index;     /* current indexes into dither matrix */
  530|  4.24M|  int nc = cinfo->out_color_components;
  531|  4.24M|  int ci;
  532|  4.24M|  int row;
  533|  4.24M|  JDIMENSION col;
  534|  4.24M|  JDIMENSION width = cinfo->output_width;
  535|       |
  536|  8.48M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (536:17): [True: 4.24M, False: 4.24M]
  ------------------
  537|       |    /* Initialize output values to 0 so can process components separately */
  538|  4.24M|    jzero_far((void *)output_buf[row], (size_t)(width * sizeof(_JSAMPLE)));
  539|  4.24M|    row_index = cquantize->row_index;
  540|  8.48M|    for (ci = 0; ci < nc; ci++) {
  ------------------
  |  Branch (540:18): [True: 4.24M, False: 4.24M]
  ------------------
  541|  4.24M|      input_ptr = input_buf[row] + ci;
  542|  4.24M|      output_ptr = output_buf[row];
  543|  4.24M|      colorindex_ci = cquantize->colorindex[ci];
  544|  4.24M|      dither = cquantize->odither[ci][row_index];
  545|  4.24M|      col_index = 0;
  546|       |
  547|   182M|      for (col = width; col > 0; col--) {
  ------------------
  |  Branch (547:25): [True: 178M, False: 4.24M]
  ------------------
  548|       |        /* Form pixel value + dither, range-limit to 0.._MAXJSAMPLE,
  549|       |         * select output value, accumulate into output code for this pixel.
  550|       |         * Range-limiting need not be done explicitly, as we have extended
  551|       |         * the colorindex table to produce the right answers for out-of-range
  552|       |         * inputs.  The maximum dither is +- _MAXJSAMPLE; this sets the
  553|       |         * required amount of padding.
  554|       |         */
  555|   178M|        *output_ptr +=
  556|   178M|          colorindex_ci[*input_ptr + dither[col_index]];
  557|   178M|        input_ptr += nc;
  558|   178M|        output_ptr++;
  559|   178M|        col_index = (col_index + 1) & ODITHER_MASK;
  ------------------
  |  |   78|   178M|#define ODITHER_MASK  (ODITHER_SIZE - 1) /* mask for wrapping around
  |  |  ------------------
  |  |  |  |   75|   178M|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  560|   178M|      }
  561|  4.24M|    }
  562|       |    /* Advance row index for next row */
  563|  4.24M|    row_index = (row_index + 1) & ODITHER_MASK;
  ------------------
  |  |   78|  4.24M|#define ODITHER_MASK  (ODITHER_SIZE - 1) /* mask for wrapping around
  |  |  ------------------
  |  |  |  |   75|  4.24M|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  564|  4.24M|    cquantize->row_index = row_index;
  565|  4.24M|  }
  566|  4.24M|}
jquant1-8.c:create_odither_tables:
  438|  1.65k|{
  439|  1.65k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  440|  1.65k|  ODITHER_MATRIX_PTR odither;
  441|  1.65k|  int i, j, nci;
  442|       |
  443|  5.02k|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (443:15): [True: 3.36k, False: 1.65k]
  ------------------
  444|  3.36k|    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
  445|  3.36k|    odither = NULL;             /* search for matching prior component */
  446|  4.22k|    for (j = 0; j < i; j++) {
  ------------------
  |  Branch (446:17): [True: 1.71k, False: 2.51k]
  ------------------
  447|  1.71k|      if (nci == cquantize->Ncolors[j]) {
  ------------------
  |  Branch (447:11): [True: 858, False: 858]
  ------------------
  448|    858|        odither = cquantize->odither[j];
  449|    858|        break;
  450|    858|      }
  451|  1.71k|    }
  452|  3.36k|    if (odither == NULL)        /* need a new table? */
  ------------------
  |  Branch (452:9): [True: 2.51k, False: 858]
  ------------------
  453|  2.51k|      odither = make_odither_array(cinfo, nci);
  454|  3.36k|    cquantize->odither[i] = odither;
  455|  3.36k|  }
  456|  1.65k|}
jquant1-8.c:make_odither_array:
  402|  2.51k|{
  403|  2.51k|  ODITHER_MATRIX_PTR odither;
  404|  2.51k|  int j, k;
  405|  2.51k|  JLONG num, den;
  406|       |
  407|  2.51k|  odither = (ODITHER_MATRIX_PTR)
  408|  2.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.51k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  409|  2.51k|                                sizeof(ODITHER_MATRIX));
  410|       |  /* The inter-value distance for this color is _MAXJSAMPLE/(ncolors-1).
  411|       |   * Hence the dither value for the matrix cell with fill order f
  412|       |   * (f=0..N-1) should be (N-1-2*f)/(2*N) * _MAXJSAMPLE/(ncolors-1).
  413|       |   * On 16-bit-int machine, be careful to avoid overflow.
  414|       |   */
  415|  2.51k|  den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1));
  ------------------
  |  |   77|  2.51k|#define ODITHER_CELLS  (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
  |  |  ------------------
  |  |  |  |   75|  2.51k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  |  |               #define ODITHER_CELLS  (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
  |  |  ------------------
  |  |  |  |   75|  2.51k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  416|  42.6k|  for (j = 0; j < ODITHER_SIZE; j++) {
  ------------------
  |  |   75|  42.6k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  ------------------
  |  Branch (416:15): [True: 40.1k, False: 2.51k]
  ------------------
  417|   682k|    for (k = 0; k < ODITHER_SIZE; k++) {
  ------------------
  |  |   75|   682k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  ------------------
  |  Branch (417:17): [True: 642k, False: 40.1k]
  ------------------
  418|   642k|      num = ((JLONG)(ODITHER_CELLS - 1 -
  ------------------
  |  |   77|   642k|#define ODITHER_CELLS  (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
  |  |  ------------------
  |  |  |  |   75|   642k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  |  |               #define ODITHER_CELLS  (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
  |  |  ------------------
  |  |  |  |   75|   642k|#define ODITHER_SIZE  16        /* dimension of dither matrix */
  |  |  ------------------
  ------------------
  419|   642k|                     2 * ((int)base_dither_matrix[j][k]))) * _MAXJSAMPLE;
  ------------------
  |  |  222|   642k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   642k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  420|       |      /* Ensure round towards zero despite C's lack of consistency
  421|       |       * about rounding negative values in integer division...
  422|       |       */
  423|   642k|      odither[j][k] = (int)(num < 0 ? -((-num) / den) : num / den);
  ------------------
  |  Branch (423:29): [True: 321k, False: 321k]
  ------------------
  424|   642k|    }
  425|  40.1k|  }
  426|  2.51k|  return odither;
  427|  2.51k|}
jquant1-8.c:quantize_fs_dither:
  615|  15.6M|{
  616|  15.6M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  617|  15.6M|  register LOCFSERROR cur;      /* current error or pixel value */
  618|  15.6M|  LOCFSERROR belowerr;          /* error for pixel below cur */
  619|  15.6M|  LOCFSERROR bpreverr;          /* error for below/prev col */
  620|  15.6M|  LOCFSERROR bnexterr;          /* error for below/next col */
  621|  15.6M|  LOCFSERROR delta;
  622|  15.6M|  register FSERRPTR errorptr;   /* => fserrors[] at column before current */
  623|  15.6M|  register _JSAMPROW input_ptr;
  624|  15.6M|  register _JSAMPROW output_ptr;
  625|  15.6M|  _JSAMPROW colorindex_ci;
  ------------------
  |  |  225|  15.6M|#define _JSAMPROW  JSAMPROW
  ------------------
  626|  15.6M|  _JSAMPROW colormap_ci;
  ------------------
  |  |  225|  15.6M|#define _JSAMPROW  JSAMPROW
  ------------------
  627|  15.6M|  int pixcode;
  628|  15.6M|  int nc = cinfo->out_color_components;
  629|  15.6M|  int dir;                      /* 1 for left-to-right, -1 for right-to-left */
  630|  15.6M|  int dirnc;                    /* dir * nc */
  631|  15.6M|  int ci;
  632|  15.6M|  int row;
  633|  15.6M|  JDIMENSION col;
  634|  15.6M|  JDIMENSION width = cinfo->output_width;
  635|  15.6M|  _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  ------------------
  |  |  220|  15.6M|#define _JSAMPLE  JSAMPLE
  ------------------
  636|  15.6M|  SHIFT_TEMPS
  637|       |
  638|  31.3M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (638:17): [True: 15.6M, False: 15.6M]
  ------------------
  639|       |    /* Initialize output values to 0 so can process components separately */
  640|  15.6M|    jzero_far((void *)output_buf[row], (size_t)(width * sizeof(_JSAMPLE)));
  641|  54.2M|    for (ci = 0; ci < nc; ci++) {
  ------------------
  |  Branch (641:18): [True: 38.5M, False: 15.6M]
  ------------------
  642|  38.5M|      input_ptr = input_buf[row] + ci;
  643|  38.5M|      output_ptr = output_buf[row];
  644|  38.5M|      if (cquantize->on_odd_row) {
  ------------------
  |  Branch (644:11): [True: 19.2M, False: 19.2M]
  ------------------
  645|       |        /* work right to left in this row */
  646|  19.2M|        input_ptr += (width - 1) * nc; /* so point to rightmost pixel */
  647|  19.2M|        output_ptr += width - 1;
  648|  19.2M|        dir = -1;
  649|  19.2M|        dirnc = -nc;
  650|  19.2M|        errorptr = cquantize->fserrors[ci] + (width + 1); /* => entry after last column */
  651|  19.2M|      } else {
  652|       |        /* work left to right in this row */
  653|  19.2M|        dir = 1;
  654|  19.2M|        dirnc = nc;
  655|  19.2M|        errorptr = cquantize->fserrors[ci]; /* => entry before first column */
  656|  19.2M|      }
  657|  38.5M|      colorindex_ci = cquantize->colorindex[ci];
  658|  38.5M|      colormap_ci = cquantize->sv_colormap[ci];
  659|       |      /* Preset error values: no error propagated to first pixel from left */
  660|  38.5M|      cur = 0;
  661|       |      /* and no error propagated to row below yet */
  662|  38.5M|      belowerr = bpreverr = 0;
  663|       |
  664|   929M|      for (col = width; col > 0; col--) {
  ------------------
  |  Branch (664:25): [True: 891M, False: 38.5M]
  ------------------
  665|       |        /* cur holds the error propagated from the previous pixel on the
  666|       |         * current line.  Add the error propagated from the previous line
  667|       |         * to form the complete error correction term for this pixel, and
  668|       |         * round the error term (which is expressed * 16) to an integer.
  669|       |         * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
  670|       |         * for either sign of the error value.
  671|       |         * Note: errorptr points to *previous* column's array entry.
  672|       |         */
  673|   891M|        cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4);
  ------------------
  |  |  474|   891M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  674|       |        /* Form pixel value + error, and range-limit to 0.._MAXJSAMPLE.
  675|       |         * The maximum error is +- _MAXJSAMPLE; this sets the required size
  676|       |         * of the range_limit array.
  677|       |         */
  678|   891M|        cur += *input_ptr;
  679|   891M|        cur = range_limit[cur];
  680|       |        /* Select output value, accumulate into output code for this pixel */
  681|   891M|        pixcode = colorindex_ci[cur];
  682|   891M|        *output_ptr += (_JSAMPLE)pixcode;
  683|       |        /* Compute actual representation error at this pixel */
  684|       |        /* Note: we can do this even though we don't have the final */
  685|       |        /* pixel code, because the colormap is orthogonal. */
  686|   891M|        cur -= colormap_ci[pixcode];
  687|       |        /* Compute error fractions to be propagated to adjacent pixels.
  688|       |         * Add these into the running sums, and simultaneously shift the
  689|       |         * next-line error sums left by 1 column.
  690|       |         */
  691|   891M|        bnexterr = cur;
  692|   891M|        delta = cur * 2;
  693|   891M|        cur += delta;           /* form error * 3 */
  694|   891M|        errorptr[0] = (FSERROR)(bpreverr + cur);
  695|   891M|        cur += delta;           /* form error * 5 */
  696|   891M|        bpreverr = belowerr + cur;
  697|   891M|        belowerr = bnexterr;
  698|   891M|        cur += delta;           /* form error * 7 */
  699|       |        /* At this point cur contains the 7/16 error value to be propagated
  700|       |         * to the next pixel on the current line, and all the errors for the
  701|       |         * next line have been shifted over. We are therefore ready to move on.
  702|       |         */
  703|   891M|        input_ptr += dirnc;     /* advance input ptr to next column */
  704|   891M|        output_ptr += dir;      /* advance output ptr to next column */
  705|   891M|        errorptr += dir;        /* advance errorptr to current column */
  706|   891M|      }
  707|       |      /* Post-loop cleanup: we must unload the final error value into the
  708|       |       * final fserrors[] entry.  Note we need not unload belowerr because
  709|       |       * it is for the dummy column before or after the actual array.
  710|       |       */
  711|  38.5M|      errorptr[0] = (FSERROR)bpreverr; /* unload prev err into array */
  712|  38.5M|    }
  713|  15.6M|    cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE);
  ------------------
  |  |  207|  7.84M|#define FALSE   0               /* values of boolean */
  ------------------
                  cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE);
  ------------------
  |  |  210|  7.84M|#define TRUE    1
  ------------------
  |  Branch (713:30): [True: 7.84M, False: 7.84M]
  ------------------
  714|  15.6M|  }
  715|  15.6M|}
jquant1-8.c:finish_pass_1_quant:
  800|  13.3k|{
  801|       |  /* no work in 1-pass case */
  802|  13.3k|}
jquant1-8.c:create_colormap:
  279|  7.13k|{
  280|  7.13k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  281|  7.13k|  _JSAMPARRAY colormap;         /* Created colormap */
  ------------------
  |  |  226|  7.13k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  282|  7.13k|  int total_colors;             /* Number of distinct output colors */
  283|  7.13k|  int i, j, k, nci, blksize, blkdist, ptr, val;
  284|       |
  285|       |  /* Select number of colors for each component */
  286|  7.13k|  total_colors = select_ncolors(cinfo, cquantize->Ncolors);
  287|       |
  288|       |  /* Report selected color counts */
  289|  7.13k|  if (cinfo->out_color_components == 3)
  ------------------
  |  Branch (289:7): [True: 3.89k, False: 3.24k]
  ------------------
  290|  7.13k|    TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors,
  ------------------
  |  |  314|  3.89k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  3.89k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.89k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  7.13k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  7.13k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  7.13k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  291|  3.24k|             cquantize->Ncolors[0], cquantize->Ncolors[1],
  292|  3.24k|             cquantize->Ncolors[2]);
  293|  3.24k|  else
  294|  3.24k|    TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
  ------------------
  |  |  300|  3.24k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  3.24k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  3.24k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  295|       |
  296|       |  /* Allocate and fill in the colormap. */
  297|       |  /* The colors are ordered in the map in standard row-major order, */
  298|       |  /* i.e. rightmost (highest-indexed) color changes most rapidly. */
  299|       |
  300|  7.13k|  colormap = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  301|  7.13k|    ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  7.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  302|  7.13k|     (JDIMENSION)total_colors, (JDIMENSION)cinfo->out_color_components);
  303|       |
  304|       |  /* blksize is number of adjacent repeated entries for a component */
  305|       |  /* blkdist is distance between groups of identical entries for a component */
  306|  7.13k|  blkdist = total_colors;
  307|       |
  308|  22.0k|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (308:15): [True: 14.9k, False: 7.13k]
  ------------------
  309|       |    /* fill in colormap entries for i'th color component */
  310|  14.9k|    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
  311|  14.9k|    blksize = blkdist / nci;
  312|   918k|    for (j = 0; j < nci; j++) {
  ------------------
  |  Branch (312:17): [True: 903k, False: 14.9k]
  ------------------
  313|       |      /* Compute j'th output value (out of nci) for component */
  314|   903k|      val = output_value(cinfo, i, j, nci - 1);
  315|       |      /* Fill in all colormap entries that have this value of this component */
  316|  2.90M|      for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) {
  ------------------
  |  Branch (316:31): [True: 2.00M, False: 903k]
  ------------------
  317|       |        /* fill in blksize entries beginning at ptr */
  318|  5.77M|        for (k = 0; k < blksize; k++)
  ------------------
  |  Branch (318:21): [True: 3.77M, False: 2.00M]
  ------------------
  319|  3.77M|          colormap[i][ptr + k] = (_JSAMPLE)val;
  320|  2.00M|      }
  321|   903k|    }
  322|  14.9k|    blkdist = blksize;          /* blksize of this color is blkdist of next */
  323|  14.9k|  }
  324|       |
  325|       |  /* Save the colormap in private storage,
  326|       |   * where it will survive color quantization mode changes.
  327|       |   */
  328|  7.13k|  cquantize->sv_colormap = colormap;
  329|  7.13k|  cquantize->sv_actual = total_colors;
  330|  7.13k|}
jquant1-8.c:select_ncolors:
  192|  7.13k|{
  193|  7.13k|  int nc = cinfo->out_color_components; /* number of color components */
  194|  7.13k|  int max_colors = cinfo->desired_number_of_colors;
  195|  7.13k|  int total_colors, iroot, i, j;
  196|  7.13k|  boolean changed;
  197|  7.13k|  long temp;
  198|  7.13k|  int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  300|  7.13k|#define RGB_GREEN       1       /* Offset of Green */
  ------------------
                int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  299|  7.13k|#define RGB_RED         0       /* Offset of Red in an RGB scanline element */
  ------------------
                int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  301|  7.13k|#define RGB_BLUE        2       /* Offset of Blue */
  ------------------
  199|  7.13k|  RGB_order[0] = rgb_green[cinfo->out_color_space];
  200|  7.13k|  RGB_order[1] = rgb_red[cinfo->out_color_space];
  201|  7.13k|  RGB_order[2] = rgb_blue[cinfo->out_color_space];
  202|       |
  203|       |  /* We can allocate at least the nc'th root of max_colors per component. */
  204|       |  /* Compute floor(nc'th root of max_colors). */
  205|  7.13k|  iroot = 1;
  206|   853k|  do {
  207|   853k|    iroot++;
  208|   853k|    temp = iroot;               /* set temp = iroot ** nc */
  209|   900k|    for (i = 1; i < nc; i++)
  ------------------
  |  Branch (209:17): [True: 46.7k, False: 853k]
  ------------------
  210|  46.7k|      temp *= iroot;
  211|   853k|  } while (temp <= (long)max_colors); /* repeat till iroot exceeds root */
  ------------------
  |  Branch (211:12): [True: 846k, False: 7.13k]
  ------------------
  212|  7.13k|  iroot--;                      /* now iroot = floor(root) */
  213|       |
  214|       |  /* Must have at least 2 color values per component */
  215|  7.13k|  if (iroot < 2)
  ------------------
  |  Branch (215:7): [True: 0, False: 7.13k]
  ------------------
  216|      0|    ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int)temp);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  217|       |
  218|       |  /* Initialize to iroot color values for each component */
  219|  7.13k|  total_colors = 1;
  220|  22.0k|  for (i = 0; i < nc; i++) {
  ------------------
  |  Branch (220:15): [True: 14.9k, False: 7.13k]
  ------------------
  221|  14.9k|    Ncolors[i] = iroot;
  222|  14.9k|    total_colors *= iroot;
  223|  14.9k|  }
  224|       |  /* We may be able to increment the count for one or more components without
  225|       |   * exceeding max_colors, though we know not all can be incremented.
  226|       |   * Sometimes, the first component can be incremented more than once!
  227|       |   * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.)
  228|       |   * In RGB colorspace, try to increment G first, then R, then B.
  229|       |   */
  230|  11.0k|  do {
  231|  11.0k|    changed = FALSE;
  ------------------
  |  |  207|  11.0k|#define FALSE   0               /* values of boolean */
  ------------------
  232|  14.9k|    for (i = 0; i < nc; i++) {
  ------------------
  |  Branch (232:17): [True: 14.9k, False: 0]
  ------------------
  233|  14.9k|      j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i);
  ------------------
  |  Branch (233:12): [True: 3.87k, False: 11.0k]
  ------------------
  234|       |      /* calculate new total_colors if Ncolors[j] is incremented */
  235|  14.9k|      temp = total_colors / Ncolors[j];
  236|  14.9k|      temp *= Ncolors[j] + 1;   /* done in long arith to avoid oflo */
  237|  14.9k|      if (temp > (long)max_colors)
  ------------------
  |  Branch (237:11): [True: 11.0k, False: 3.89k]
  ------------------
  238|  11.0k|        break;                  /* won't fit, done with this pass */
  239|  3.89k|      Ncolors[j]++;             /* OK, apply the increment */
  240|  3.89k|      total_colors = (int)temp;
  241|  3.89k|      changed = TRUE;
  ------------------
  |  |  210|  3.89k|#define TRUE    1
  ------------------
  242|  3.89k|    }
  243|  11.0k|  } while (changed);
  ------------------
  |  Branch (243:12): [True: 3.89k, False: 7.13k]
  ------------------
  244|       |
  245|  7.13k|  return total_colors;
  246|  7.13k|}
jquant1-8.c:output_value:
  253|   903k|{
  254|       |  /* We always provide values 0 and _MAXJSAMPLE for each component;
  255|       |   * any additional values are equally spaced between these limits.
  256|       |   * (Forcing the upper and lower values to the limits ensures that
  257|       |   * dithering can't produce a color outside the selected gamut.)
  258|       |   */
  259|   903k|  return (int)(((JLONG)j * _MAXJSAMPLE + maxj / 2) / maxj);
  ------------------
  |  |  222|   903k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   903k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  260|   903k|}
jquant1-8.c:create_colorindex:
  339|  7.13k|{
  340|  7.13k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  341|  7.13k|  _JSAMPROW indexptr;
  ------------------
  |  |  225|  7.13k|#define _JSAMPROW  JSAMPROW
  ------------------
  342|  7.13k|  int i, j, k, nci, blksize, val, pad;
  343|       |
  344|       |  /* For ordered dither, we pad the color index tables by _MAXJSAMPLE in
  345|       |   * each direction (input index values can be -_MAXJSAMPLE .. 2*_MAXJSAMPLE).
  346|       |   * This is not necessary in the other dithering modes.  However, we
  347|       |   * flag whether it was done in case user changes dithering mode.
  348|       |   */
  349|  7.13k|  if (cinfo->dither_mode == JDITHER_ORDERED) {
  ------------------
  |  Branch (349:7): [True: 2.35k, False: 4.78k]
  ------------------
  350|  2.35k|    pad = _MAXJSAMPLE * 2;
  ------------------
  |  |  222|  2.35k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.35k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  351|  2.35k|    cquantize->is_padded = TRUE;
  ------------------
  |  |  210|  2.35k|#define TRUE    1
  ------------------
  352|  4.78k|  } else {
  353|  4.78k|    pad = 0;
  354|  4.78k|    cquantize->is_padded = FALSE;
  ------------------
  |  |  207|  4.78k|#define FALSE   0               /* values of boolean */
  ------------------
  355|  4.78k|  }
  356|       |
  357|  7.13k|  cquantize->colorindex = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  358|  7.13k|    ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  7.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  359|  7.13k|     (JDIMENSION)(_MAXJSAMPLE + 1 + pad),
  ------------------
  |  |  222|  7.13k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  7.13k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  360|  7.13k|     (JDIMENSION)cinfo->out_color_components);
  361|       |
  362|       |  /* blksize is number of adjacent repeated entries for a component */
  363|  7.13k|  blksize = cquantize->sv_actual;
  364|       |
  365|  22.0k|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (365:15): [True: 14.9k, False: 7.13k]
  ------------------
  366|       |    /* fill in colorindex entries for i'th color component */
  367|  14.9k|    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
  368|  14.9k|    blksize = blksize / nci;
  369|       |
  370|       |    /* adjust colorindex pointers to provide padding at negative indexes. */
  371|  14.9k|    if (pad)
  ------------------
  |  Branch (371:9): [True: 4.93k, False: 10.0k]
  ------------------
  372|  4.93k|      cquantize->colorindex[i] += _MAXJSAMPLE;
  ------------------
  |  |  222|  4.93k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  4.93k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  373|       |
  374|       |    /* in loop, val = index of current output value, */
  375|       |    /* and k = largest j that maps to current val */
  376|  14.9k|    indexptr = cquantize->colorindex[i];
  377|  14.9k|    val = 0;
  378|  14.9k|    k = largest_input_value(cinfo, i, 0, nci - 1);
  379|  3.83M|    for (j = 0; j <= _MAXJSAMPLE; j++) {
  ------------------
  |  |  222|  3.83M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  3.83M|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (379:17): [True: 3.82M, False: 14.9k]
  ------------------
  380|  4.70M|      while (j > k)             /* advance val if past boundary */
  ------------------
  |  Branch (380:14): [True: 885k, False: 3.82M]
  ------------------
  381|   885k|        k = largest_input_value(cinfo, i, ++val, nci - 1);
  382|       |      /* premultiply so that no multiplication needed in main processing */
  383|  3.82M|      indexptr[j] = (_JSAMPLE)(val * blksize);
  384|  3.82M|    }
  385|       |    /* Pad at both ends if necessary */
  386|  14.9k|    if (pad)
  ------------------
  |  Branch (386:9): [True: 4.93k, False: 10.0k]
  ------------------
  387|  1.26M|      for (j = 1; j <= _MAXJSAMPLE; j++) {
  ------------------
  |  |  222|  1.26M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.26M|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (387:19): [True: 1.25M, False: 4.93k]
  ------------------
  388|  1.25M|        indexptr[-j] = indexptr[0];
  389|  1.25M|        indexptr[_MAXJSAMPLE + j] = indexptr[_MAXJSAMPLE];
  ------------------
  |  |  222|  1.25M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.25M|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
                      indexptr[_MAXJSAMPLE + j] = indexptr[_MAXJSAMPLE];
  ------------------
  |  |  222|  1.25M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.25M|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  390|  1.25M|      }
  391|  14.9k|  }
  392|  7.13k|}
jquant1-8.c:largest_input_value:
  267|   900k|{
  268|       |  /* Breakpoints are halfway between values returned by output_value */
  269|   900k|  return (int)(((JLONG)(2 * j + 1) * _MAXJSAMPLE + maxj) / (2 * maxj));
  ------------------
  |  |  222|   900k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   900k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  270|   900k|}
jquant1-8.c:alloc_fs_workspace:
  724|  2.38k|{
  725|  2.38k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  726|  2.38k|  size_t arraysize;
  727|  2.38k|  int i;
  728|       |
  729|  2.38k|  arraysize = (size_t)((cinfo->output_width + 2) * sizeof(FSERROR));
  730|  7.37k|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (730:15): [True: 4.98k, False: 2.38k]
  ------------------
  731|  4.98k|    cquantize->fserrors[i] = (FSERRPTR)
  732|  4.98k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, arraysize);
  ------------------
  |  |  889|  4.98k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  733|  4.98k|  }
  734|  2.38k|}
j12init_1pass_quantizer:
  823|    345|{
  824|    345|  my_cquantize_ptr cquantize;
  825|       |
  826|    345|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    345|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (826:7): [True: 0, False: 345]
  ------------------
  827|      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)))
  ------------------
  828|       |
  829|       |  /* Color quantization is not supported with lossless JPEG images */
  830|    345|  if (cinfo->master->lossless)
  ------------------
  |  Branch (830:7): [True: 0, False: 345]
  ------------------
  831|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  832|       |
  833|    345|  cquantize = (my_cquantize_ptr)
  834|    345|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    345|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  835|    345|                                sizeof(my_cquantizer));
  836|    345|  cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
  837|    345|  cquantize->pub.start_pass = start_pass_1_quant;
  838|    345|  cquantize->pub.finish_pass = finish_pass_1_quant;
  839|    345|  cquantize->pub.new_color_map = new_color_map_1_quant;
  840|    345|  cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */
  841|    345|  cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */
  842|       |
  843|       |  /* Make sure my internal arrays won't overflow */
  844|    345|  if (cinfo->out_color_components > MAX_Q_COMPS)
  ------------------
  |  |  142|    345|#define MAX_Q_COMPS  4          /* max components I can handle */
  ------------------
  |  Branch (844:7): [True: 0, False: 345]
  ------------------
  845|      0|    ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  846|       |  /* Make sure colormap indexes can be represented by _JSAMPLEs */
  847|    345|  if (cinfo->desired_number_of_colors > (_MAXJSAMPLE + 1))
  ------------------
  |  |  108|    345|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    345|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (847:7): [True: 0, False: 345]
  ------------------
  848|      0|    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, _MAXJSAMPLE + 1);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  849|       |
  850|       |  /* Create the colormap and color index table. */
  851|    345|  create_colormap(cinfo);
  852|    345|  create_colorindex(cinfo);
  853|       |
  854|       |  /* Allocate Floyd-Steinberg workspace now if requested.
  855|       |   * We do this now since it may affect the memory manager's space
  856|       |   * calculations.  If the user changes to FS dither mode in a later pass, we
  857|       |   * will allocate the space then, and will possibly overrun the
  858|       |   * max_memory_to_use setting.
  859|       |   */
  860|    345|  if (cinfo->dither_mode == JDITHER_FS)
  ------------------
  |  Branch (860:7): [True: 115, False: 230]
  ------------------
  861|    115|    alloc_fs_workspace(cinfo);
  862|    345|}
jquant1-12.c:create_colormap:
  279|    345|{
  280|    345|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  281|    345|  _JSAMPARRAY colormap;         /* Created colormap */
  ------------------
  |  |  112|    345|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  282|    345|  int total_colors;             /* Number of distinct output colors */
  283|    345|  int i, j, k, nci, blksize, blkdist, ptr, val;
  284|       |
  285|       |  /* Select number of colors for each component */
  286|    345|  total_colors = select_ncolors(cinfo, cquantize->Ncolors);
  287|       |
  288|       |  /* Report selected color counts */
  289|    345|  if (cinfo->out_color_components == 3)
  ------------------
  |  Branch (289:7): [True: 153, False: 192]
  ------------------
  290|    345|    TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors,
  ------------------
  |  |  314|    153|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    153|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 153]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    345|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    345|           (cinfo)->err->msg_code = (code); \
  |  |  317|    345|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  291|    192|             cquantize->Ncolors[0], cquantize->Ncolors[1],
  292|    192|             cquantize->Ncolors[2]);
  293|    192|  else
  294|    192|    TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
  ------------------
  |  |  300|    192|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    192|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    192|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  295|       |
  296|       |  /* Allocate and fill in the colormap. */
  297|       |  /* The colors are ordered in the map in standard row-major order, */
  298|       |  /* i.e. rightmost (highest-indexed) color changes most rapidly. */
  299|       |
  300|    345|  colormap = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  301|    345|    ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    345|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  302|    345|     (JDIMENSION)total_colors, (JDIMENSION)cinfo->out_color_components);
  303|       |
  304|       |  /* blksize is number of adjacent repeated entries for a component */
  305|       |  /* blkdist is distance between groups of identical entries for a component */
  306|    345|  blkdist = total_colors;
  307|       |
  308|    996|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (308:15): [True: 651, False: 345]
  ------------------
  309|       |    /* fill in colormap entries for i'th color component */
  310|    651|    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
  311|    651|    blksize = blkdist / nci;
  312|  52.7k|    for (j = 0; j < nci; j++) {
  ------------------
  |  Branch (312:17): [True: 52.0k, False: 651]
  ------------------
  313|       |      /* Compute j'th output value (out of nci) for component */
  314|  52.0k|      val = output_value(cinfo, i, j, nci - 1);
  315|       |      /* Fill in all colormap entries that have this value of this component */
  316|   147k|      for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) {
  ------------------
  |  Branch (316:31): [True: 95.1k, False: 52.0k]
  ------------------
  317|       |        /* fill in blksize entries beginning at ptr */
  318|   259k|        for (k = 0; k < blksize; k++)
  ------------------
  |  Branch (318:21): [True: 164k, False: 95.1k]
  ------------------
  319|   164k|          colormap[i][ptr + k] = (_JSAMPLE)val;
  320|  95.1k|      }
  321|  52.0k|    }
  322|    651|    blkdist = blksize;          /* blksize of this color is blkdist of next */
  323|    651|  }
  324|       |
  325|       |  /* Save the colormap in private storage,
  326|       |   * where it will survive color quantization mode changes.
  327|       |   */
  328|    345|  cquantize->sv_colormap = colormap;
  329|    345|  cquantize->sv_actual = total_colors;
  330|    345|}
jquant1-12.c:select_ncolors:
  192|    345|{
  193|    345|  int nc = cinfo->out_color_components; /* number of color components */
  194|    345|  int max_colors = cinfo->desired_number_of_colors;
  195|    345|  int total_colors, iroot, i, j;
  196|    345|  boolean changed;
  197|    345|  long temp;
  198|    345|  int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  300|    345|#define RGB_GREEN       1       /* Offset of Green */
  ------------------
                int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  299|    345|#define RGB_RED         0       /* Offset of Red in an RGB scanline element */
  ------------------
                int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
  ------------------
  |  |  301|    345|#define RGB_BLUE        2       /* Offset of Blue */
  ------------------
  199|    345|  RGB_order[0] = rgb_green[cinfo->out_color_space];
  200|    345|  RGB_order[1] = rgb_red[cinfo->out_color_space];
  201|    345|  RGB_order[2] = rgb_blue[cinfo->out_color_space];
  202|       |
  203|       |  /* We can allocate at least the nc'th root of max_colors per component. */
  204|       |  /* Compute floor(nc'th root of max_colors). */
  205|    345|  iroot = 1;
  206|  50.0k|  do {
  207|  50.0k|    iroot++;
  208|  50.0k|    temp = iroot;               /* set temp = iroot ** nc */
  209|  51.9k|    for (i = 1; i < nc; i++)
  ------------------
  |  Branch (209:17): [True: 1.83k, False: 50.0k]
  ------------------
  210|  1.83k|      temp *= iroot;
  211|  50.0k|  } while (temp <= (long)max_colors); /* repeat till iroot exceeds root */
  ------------------
  |  Branch (211:12): [True: 49.7k, False: 345]
  ------------------
  212|    345|  iroot--;                      /* now iroot = floor(root) */
  213|       |
  214|       |  /* Must have at least 2 color values per component */
  215|    345|  if (iroot < 2)
  ------------------
  |  Branch (215:7): [True: 0, False: 345]
  ------------------
  216|      0|    ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int)temp);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  217|       |
  218|       |  /* Initialize to iroot color values for each component */
  219|    345|  total_colors = 1;
  220|    996|  for (i = 0; i < nc; i++) {
  ------------------
  |  Branch (220:15): [True: 651, False: 345]
  ------------------
  221|    651|    Ncolors[i] = iroot;
  222|    651|    total_colors *= iroot;
  223|    651|  }
  224|       |  /* We may be able to increment the count for one or more components without
  225|       |   * exceeding max_colors, though we know not all can be incremented.
  226|       |   * Sometimes, the first component can be incremented more than once!
  227|       |   * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.)
  228|       |   * In RGB colorspace, try to increment G first, then R, then B.
  229|       |   */
  230|    498|  do {
  231|    498|    changed = FALSE;
  ------------------
  |  |  207|    498|#define FALSE   0               /* values of boolean */
  ------------------
  232|    651|    for (i = 0; i < nc; i++) {
  ------------------
  |  Branch (232:17): [True: 651, False: 0]
  ------------------
  233|    651|      j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i);
  ------------------
  |  Branch (233:12): [True: 153, False: 498]
  ------------------
  234|       |      /* calculate new total_colors if Ncolors[j] is incremented */
  235|    651|      temp = total_colors / Ncolors[j];
  236|    651|      temp *= Ncolors[j] + 1;   /* done in long arith to avoid oflo */
  237|    651|      if (temp > (long)max_colors)
  ------------------
  |  Branch (237:11): [True: 498, False: 153]
  ------------------
  238|    498|        break;                  /* won't fit, done with this pass */
  239|    153|      Ncolors[j]++;             /* OK, apply the increment */
  240|    153|      total_colors = (int)temp;
  241|    153|      changed = TRUE;
  ------------------
  |  |  210|    153|#define TRUE    1
  ------------------
  242|    153|    }
  243|    498|  } while (changed);
  ------------------
  |  Branch (243:12): [True: 153, False: 345]
  ------------------
  244|       |
  245|    345|  return total_colors;
  246|    345|}
jquant1-12.c:output_value:
  253|  52.0k|{
  254|       |  /* We always provide values 0 and _MAXJSAMPLE for each component;
  255|       |   * any additional values are equally spaced between these limits.
  256|       |   * (Forcing the upper and lower values to the limits ensures that
  257|       |   * dithering can't produce a color outside the selected gamut.)
  258|       |   */
  259|  52.0k|  return (int)(((JLONG)j * _MAXJSAMPLE + maxj / 2) / maxj);
  ------------------
  |  |  108|  52.0k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  52.0k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  260|  52.0k|}
jquant1-12.c:create_colorindex:
  339|    345|{
  340|    345|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  341|    345|  _JSAMPROW indexptr;
  ------------------
  |  |  111|    345|#define _JSAMPROW  J12SAMPROW
  ------------------
  342|    345|  int i, j, k, nci, blksize, val, pad;
  343|       |
  344|       |  /* For ordered dither, we pad the color index tables by _MAXJSAMPLE in
  345|       |   * each direction (input index values can be -_MAXJSAMPLE .. 2*_MAXJSAMPLE).
  346|       |   * This is not necessary in the other dithering modes.  However, we
  347|       |   * flag whether it was done in case user changes dithering mode.
  348|       |   */
  349|    345|  if (cinfo->dither_mode == JDITHER_ORDERED) {
  ------------------
  |  Branch (349:7): [True: 115, False: 230]
  ------------------
  350|    115|    pad = _MAXJSAMPLE * 2;
  ------------------
  |  |  108|    115|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    115|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  351|    115|    cquantize->is_padded = TRUE;
  ------------------
  |  |  210|    115|#define TRUE    1
  ------------------
  352|    230|  } else {
  353|    230|    pad = 0;
  354|    230|    cquantize->is_padded = FALSE;
  ------------------
  |  |  207|    230|#define FALSE   0               /* values of boolean */
  ------------------
  355|    230|  }
  356|       |
  357|    345|  cquantize->colorindex = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  358|    345|    ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    345|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  359|    345|     (JDIMENSION)(_MAXJSAMPLE + 1 + pad),
  ------------------
  |  |  108|    345|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    345|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  360|    345|     (JDIMENSION)cinfo->out_color_components);
  361|       |
  362|       |  /* blksize is number of adjacent repeated entries for a component */
  363|    345|  blksize = cquantize->sv_actual;
  364|       |
  365|    996|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (365:15): [True: 651, False: 345]
  ------------------
  366|       |    /* fill in colorindex entries for i'th color component */
  367|    651|    nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
  368|    651|    blksize = blksize / nci;
  369|       |
  370|       |    /* adjust colorindex pointers to provide padding at negative indexes. */
  371|    651|    if (pad)
  ------------------
  |  Branch (371:9): [True: 217, False: 434]
  ------------------
  372|    217|      cquantize->colorindex[i] += _MAXJSAMPLE;
  ------------------
  |  |  108|    217|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|    217|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  373|       |
  374|       |    /* in loop, val = index of current output value, */
  375|       |    /* and k = largest j that maps to current val */
  376|    651|    indexptr = cquantize->colorindex[i];
  377|    651|    val = 0;
  378|    651|    k = largest_input_value(cinfo, i, 0, nci - 1);
  379|  2.66M|    for (j = 0; j <= _MAXJSAMPLE; j++) {
  ------------------
  |  |  108|  2.66M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  2.66M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (379:17): [True: 2.66M, False: 651]
  ------------------
  380|  2.71M|      while (j > k)             /* advance val if past boundary */
  ------------------
  |  Branch (380:14): [True: 51.4k, False: 2.66M]
  ------------------
  381|  51.4k|        k = largest_input_value(cinfo, i, ++val, nci - 1);
  382|       |      /* premultiply so that no multiplication needed in main processing */
  383|  2.66M|      indexptr[j] = (_JSAMPLE)(val * blksize);
  384|  2.66M|    }
  385|       |    /* Pad at both ends if necessary */
  386|    651|    if (pad)
  ------------------
  |  Branch (386:9): [True: 217, False: 434]
  ------------------
  387|   888k|      for (j = 1; j <= _MAXJSAMPLE; j++) {
  ------------------
  |  |  108|   888k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|   888k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (387:19): [True: 888k, False: 217]
  ------------------
  388|   888k|        indexptr[-j] = indexptr[0];
  389|   888k|        indexptr[_MAXJSAMPLE + j] = indexptr[_MAXJSAMPLE];
  ------------------
  |  |  108|   888k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|   888k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
                      indexptr[_MAXJSAMPLE + j] = indexptr[_MAXJSAMPLE];
  ------------------
  |  |  108|   888k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|   888k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  390|   888k|      }
  391|    651|  }
  392|    345|}
jquant1-12.c:largest_input_value:
  267|  52.0k|{
  268|       |  /* Breakpoints are halfway between values returned by output_value */
  269|  52.0k|  return (int)(((JLONG)(2 * j + 1) * _MAXJSAMPLE + maxj) / (2 * maxj));
  ------------------
  |  |  108|  52.0k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  52.0k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  270|  52.0k|}
jquant1-12.c:alloc_fs_workspace:
  724|    115|{
  725|    115|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  726|    115|  size_t arraysize;
  727|    115|  int i;
  728|       |
  729|    115|  arraysize = (size_t)((cinfo->output_width + 2) * sizeof(FSERROR));
  730|    332|  for (i = 0; i < cinfo->out_color_components; i++) {
  ------------------
  |  Branch (730:15): [True: 217, False: 115]
  ------------------
  731|    217|    cquantize->fserrors[i] = (FSERRPTR)
  732|    217|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, arraysize);
  ------------------
  |  |  889|    217|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  733|    217|  }
  734|    115|}

jinit_2pass_quantizer:
 1223|  2.56k|{
 1224|  2.56k|  my_cquantize_ptr cquantize;
 1225|  2.56k|  int i;
 1226|       |
 1227|  2.56k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1227:7): [True: 0, False: 2.56k]
  ------------------
 1228|      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)))
  ------------------
 1229|       |
 1230|  2.56k|  cquantize = (my_cquantize_ptr)
 1231|  2.56k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1232|  2.56k|                                sizeof(my_cquantizer));
 1233|  2.56k|  cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
 1234|  2.56k|  cquantize->pub.start_pass = start_pass_2_quant;
 1235|  2.56k|  cquantize->pub.new_color_map = new_color_map_2_quant;
 1236|  2.56k|  cquantize->fserrors = NULL;   /* flag optional arrays not allocated */
 1237|  2.56k|  cquantize->error_limiter = NULL;
 1238|       |
 1239|       |  /* Make sure jdmaster didn't give me a case I can't handle */
 1240|  2.56k|  if (cinfo->out_color_components != 3 ||
  ------------------
  |  Branch (1240:7): [True: 0, False: 2.56k]
  ------------------
 1241|  2.56k|      cinfo->out_color_space == JCS_RGB565 || cinfo->master->lossless)
  ------------------
  |  Branch (1241:7): [True: 0, False: 2.56k]
  |  Branch (1241:47): [True: 0, False: 2.56k]
  ------------------
 1242|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1243|       |
 1244|       |  /* Allocate the histogram/inverse colormap storage */
 1245|  2.56k|  cquantize->histogram = (hist3d)(*cinfo->mem->alloc_small)
 1246|  2.56k|    ((j_common_ptr)cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
  ------------------
  |  |  889|  2.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                  ((j_common_ptr)cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
  ------------------
  |  |  120|  2.56k|#define HIST_C0_ELEMS  (1 << HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  2.56k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
 1247|  84.7k|  for (i = 0; i < HIST_C0_ELEMS; i++) {
  ------------------
  |  |  120|  84.7k|#define HIST_C0_ELEMS  (1 << HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  84.7k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  |  Branch (1247:15): [True: 82.1k, False: 2.56k]
  ------------------
 1248|  82.1k|    cquantize->histogram[i] = (hist2d)(*cinfo->mem->alloc_large)
 1249|  82.1k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  82.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1250|  82.1k|       HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  121|  82.1k|#define HIST_C1_ELEMS  (1 << HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  82.1k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                     HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  122|  82.1k|#define HIST_C2_ELEMS  (1 << HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  82.1k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
 1251|  82.1k|  }
 1252|  2.56k|  cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
  ------------------
  |  |  210|  2.56k|#define TRUE    1
  ------------------
 1253|       |
 1254|       |  /* Allocate storage for the completed colormap, if required.
 1255|       |   * We do this now since it may affect the memory manager's space
 1256|       |   * calculations.
 1257|       |   */
 1258|  2.56k|  if (cinfo->enable_2pass_quant) {
  ------------------
  |  Branch (1258:7): [True: 2.56k, False: 0]
  ------------------
 1259|       |    /* Make sure color count is acceptable */
 1260|  2.56k|    int desired = cinfo->desired_number_of_colors;
 1261|       |    /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
 1262|  2.56k|    if (desired < 8)
  ------------------
  |  Branch (1262:9): [True: 0, False: 2.56k]
  ------------------
 1263|      0|      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1264|       |    /* Make sure colormap indexes can be represented by _JSAMPLEs */
 1265|  2.56k|    if (desired > MAXNUMCOLORS)
  ------------------
  |  |  110|  2.56k|#define MAXNUMCOLORS  (_MAXJSAMPLE + 1) /* maximum size of colormap */
  |  |  ------------------
  |  |  |  |  222|  2.56k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  2.56k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1265:9): [True: 0, False: 2.56k]
  ------------------
 1266|      0|      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1267|  2.56k|    cquantize->sv_colormap = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
 1268|  2.56k|      ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)desired, (JDIMENSION)3);
  ------------------
  |  |  889|  2.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1269|  2.56k|    cquantize->desired = desired;
 1270|  2.56k|  } else
 1271|      0|    cquantize->sv_colormap = NULL;
 1272|       |
 1273|       |  /* Only F-S dithering or no dithering is supported. */
 1274|       |  /* If user asks for ordered dither, give them F-S. */
 1275|  2.56k|  if (cinfo->dither_mode != JDITHER_NONE)
  ------------------
  |  Branch (1275:7): [True: 1.28k, False: 1.28k]
  ------------------
 1276|  1.28k|    cinfo->dither_mode = JDITHER_FS;
 1277|       |
 1278|       |  /* Allocate Floyd-Steinberg workspace if necessary.
 1279|       |   * This isn't really needed until pass 2, but again it may affect the memory
 1280|       |   * manager's space calculations.  Although we will cope with a later change
 1281|       |   * in dither_mode, we do not promise to honor max_memory_to_use if
 1282|       |   * dither_mode changes.
 1283|       |   */
 1284|  2.56k|  if (cinfo->dither_mode == JDITHER_FS) {
  ------------------
  |  Branch (1284:7): [True: 1.28k, False: 1.28k]
  ------------------
 1285|  1.28k|    cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
 1286|  1.28k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.28k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1287|  1.28k|       (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR))));
 1288|       |    /* Might as well create the error-limiting table too. */
 1289|  1.28k|    init_error_limit(cinfo);
 1290|  1.28k|  }
 1291|  2.56k|}
jquant2-8.c:start_pass_2_quant:
 1146|  7.09k|{
 1147|  7.09k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
 1148|  7.09k|  hist3d histogram = cquantize->histogram;
 1149|  7.09k|  int i;
 1150|       |
 1151|       |  /* Only F-S dithering or no dithering is supported. */
 1152|       |  /* If user asks for ordered dither, give them F-S. */
 1153|  7.09k|  if (cinfo->dither_mode != JDITHER_NONE)
  ------------------
  |  Branch (1153:7): [True: 3.53k, False: 3.55k]
  ------------------
 1154|  3.53k|    cinfo->dither_mode = JDITHER_FS;
 1155|       |
 1156|  7.09k|  if (is_pre_scan) {
  ------------------
  |  Branch (1156:7): [True: 1.70k, False: 5.38k]
  ------------------
 1157|       |    /* Set up method pointers */
 1158|  1.70k|    cquantize->pub._color_quantize = prescan_quantize;
  ------------------
  |  |  265|  1.70k|#define _color_quantize  color_quantize
  ------------------
 1159|  1.70k|    cquantize->pub.finish_pass = finish_pass1;
 1160|  1.70k|    cquantize->needs_zeroed = TRUE; /* Always zero histogram */
  ------------------
  |  |  210|  1.70k|#define TRUE    1
  ------------------
 1161|  5.38k|  } else {
 1162|       |    /* Set up method pointers */
 1163|  5.38k|    if (cinfo->dither_mode == JDITHER_FS)
  ------------------
  |  Branch (1163:9): [True: 2.68k, False: 2.70k]
  ------------------
 1164|  2.68k|      cquantize->pub._color_quantize = pass2_fs_dither;
  ------------------
  |  |  265|  2.68k|#define _color_quantize  color_quantize
  ------------------
 1165|  2.70k|    else
 1166|  2.70k|      cquantize->pub._color_quantize = pass2_no_dither;
  ------------------
  |  |  265|  2.70k|#define _color_quantize  color_quantize
  ------------------
 1167|  5.38k|    cquantize->pub.finish_pass = finish_pass2;
 1168|       |
 1169|       |    /* Make sure color count is acceptable */
 1170|  5.38k|    i = cinfo->actual_number_of_colors;
 1171|  5.38k|    if (i < 1)
  ------------------
  |  Branch (1171:9): [True: 0, False: 5.38k]
  ------------------
 1172|      0|      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1173|  5.38k|    if (i > MAXNUMCOLORS)
  ------------------
  |  |  110|  5.38k|#define MAXNUMCOLORS  (_MAXJSAMPLE + 1) /* maximum size of colormap */
  |  |  ------------------
  |  |  |  |  222|  5.38k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  5.38k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1173:9): [True: 0, False: 5.38k]
  ------------------
 1174|      0|      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1175|       |
 1176|  5.38k|    if (cinfo->dither_mode == JDITHER_FS) {
  ------------------
  |  Branch (1176:9): [True: 2.68k, False: 2.70k]
  ------------------
 1177|  2.68k|      size_t arraysize =
 1178|  2.68k|        (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR)));
 1179|       |      /* Allocate Floyd-Steinberg workspace if we didn't already. */
 1180|  2.68k|      if (cquantize->fserrors == NULL)
  ------------------
  |  Branch (1180:11): [True: 0, False: 2.68k]
  ------------------
 1181|      0|        cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
 1182|      0|          ((j_common_ptr)cinfo, JPOOL_IMAGE, arraysize);
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1183|       |      /* Initialize the propagated errors to zero. */
 1184|  2.68k|      jzero_far((void *)cquantize->fserrors, arraysize);
 1185|       |      /* Make the error-limit table if we didn't already. */
 1186|  2.68k|      if (cquantize->error_limiter == NULL)
  ------------------
  |  Branch (1186:11): [True: 0, False: 2.68k]
  ------------------
 1187|      0|        init_error_limit(cinfo);
 1188|  2.68k|      cquantize->on_odd_row = FALSE;
  ------------------
  |  |  207|  2.68k|#define FALSE   0               /* values of boolean */
  ------------------
 1189|  2.68k|    }
 1190|       |
 1191|  5.38k|  }
 1192|       |  /* Zero the histogram or inverse color map, if necessary */
 1193|  7.09k|  if (cquantize->needs_zeroed) {
  ------------------
  |  Branch (1193:7): [True: 3.38k, False: 3.70k]
  ------------------
 1194|   111k|    for (i = 0; i < HIST_C0_ELEMS; i++) {
  ------------------
  |  |  120|   111k|#define HIST_C0_ELEMS  (1 << HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   111k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  |  Branch (1194:17): [True: 108k, False: 3.38k]
  ------------------
 1195|   108k|      jzero_far((void *)histogram[i],
 1196|   108k|                HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  121|   108k|#define HIST_C1_ELEMS  (1 << HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   108k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                              HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  122|   108k|#define HIST_C2_ELEMS  (1 << HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   108k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
 1197|   108k|    }
 1198|  3.38k|    cquantize->needs_zeroed = FALSE;
  ------------------
  |  |  207|  3.38k|#define FALSE   0               /* values of boolean */
  ------------------
 1199|  3.38k|  }
 1200|  7.09k|}
jquant2-8.c:prescan_quantize:
  206|  3.87M|{
  207|  3.87M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  208|  3.87M|  register _JSAMPROW ptr;
  209|  3.87M|  register histptr histp;
  210|  3.87M|  register hist3d histogram = cquantize->histogram;
  211|  3.87M|  int row;
  212|  3.87M|  JDIMENSION col;
  213|  3.87M|  JDIMENSION width = cinfo->output_width;
  214|       |
  215|  13.7M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (215:17): [True: 9.87M, False: 3.87M]
  ------------------
  216|  9.87M|    ptr = input_buf[row];
  217|   295M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (217:23): [True: 285M, False: 9.87M]
  ------------------
  218|       |      /* get pixel value and index into the histogram */
  219|   285M|      histp = &histogram[ptr[0] >> C0_SHIFT]
  ------------------
  |  |  125|   285M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   285M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   285M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  220|   285M|                        [ptr[1] >> C1_SHIFT]
  ------------------
  |  |  126|   285M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   285M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   285M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  221|   285M|                        [ptr[2] >> C2_SHIFT];
  ------------------
  |  |  127|   285M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   285M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   285M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  222|       |      /* increment, check for overflow and undo increment if so. */
  223|   285M|      if (++(*histp) <= 0)
  ------------------
  |  Branch (223:11): [True: 212M, False: 73.6M]
  ------------------
  224|   212M|        (*histp)--;
  225|   285M|      ptr += 3;
  226|   285M|    }
  227|  9.87M|  }
  228|  3.87M|}
jquant2-8.c:finish_pass1:
 1122|  1.67k|{
 1123|  1.67k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
 1124|       |
 1125|       |  /* Select the representative colors and fill in cinfo->colormap */
 1126|  1.67k|  cinfo->colormap = (JSAMPARRAY)cquantize->sv_colormap;
 1127|  1.67k|  select_colors(cinfo, cquantize->desired);
 1128|       |  /* Force next pass to zero the color index table */
 1129|  1.67k|  cquantize->needs_zeroed = TRUE;
  ------------------
  |  |  210|  1.67k|#define TRUE    1
  ------------------
 1130|  1.67k|}
jquant2-8.c:select_colors:
  524|  1.67k|{
  525|  1.67k|  boxptr boxlist;
  526|  1.67k|  int numboxes;
  527|  1.67k|  int i;
  528|       |
  529|       |  /* Allocate workspace for box list */
  530|  1.67k|  boxlist = (boxptr)(*cinfo->mem->alloc_small)
  531|  1.67k|    ((j_common_ptr)cinfo, JPOOL_IMAGE, desired_colors * sizeof(box));
  ------------------
  |  |  889|  1.67k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  532|       |  /* Initialize one box containing whole space */
  533|  1.67k|  numboxes = 1;
  534|  1.67k|  boxlist[0].c0min = 0;
  535|  1.67k|  boxlist[0].c0max = _MAXJSAMPLE >> C0_SHIFT;
  ------------------
  |  |  222|  1.67k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.67k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
                boxlist[0].c0max = _MAXJSAMPLE >> C0_SHIFT;
  ------------------
  |  |  125|  1.67k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|  1.67k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  1.67k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  536|  1.67k|  boxlist[0].c1min = 0;
  537|  1.67k|  boxlist[0].c1max = _MAXJSAMPLE >> C1_SHIFT;
  ------------------
  |  |  222|  1.67k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.67k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
                boxlist[0].c1max = _MAXJSAMPLE >> C1_SHIFT;
  ------------------
  |  |  126|  1.67k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|  1.67k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  1.67k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  538|  1.67k|  boxlist[0].c2min = 0;
  539|  1.67k|  boxlist[0].c2max = _MAXJSAMPLE >> C2_SHIFT;
  ------------------
  |  |  222|  1.67k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.67k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
                boxlist[0].c2max = _MAXJSAMPLE >> C2_SHIFT;
  ------------------
  |  |  127|  1.67k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|  1.67k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  1.67k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  540|       |  /* Shrink it to actually-used volume and set its statistics */
  541|  1.67k|  update_box(cinfo, &boxlist[0]);
  542|       |  /* Perform median-cut to produce final box list */
  543|  1.67k|  numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
  544|       |  /* Compute the representative color for each box, fill colormap */
  545|   129k|  for (i = 0; i < numboxes; i++)
  ------------------
  |  Branch (545:15): [True: 128k, False: 1.67k]
  ------------------
  546|   128k|    compute_color(cinfo, &boxlist[i], i);
  547|  1.67k|  cinfo->actual_number_of_colors = numboxes;
  548|  1.67k|  TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
  ------------------
  |  |  300|  1.67k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.67k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.67k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  549|  1.67k|}
jquant2-8.c:update_box:
  296|   254k|{
  297|   254k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  298|   254k|  hist3d histogram = cquantize->histogram;
  299|   254k|  histptr histp;
  300|   254k|  int c0, c1, c2;
  301|   254k|  int c0min, c0max, c1min, c1max, c2min, c2max;
  302|   254k|  JLONG dist0, dist1, dist2;
  303|   254k|  long ccount;
  304|       |
  305|   254k|  c0min = boxp->c0min;  c0max = boxp->c0max;
  306|   254k|  c1min = boxp->c1min;  c1max = boxp->c1max;
  307|   254k|  c2min = boxp->c2min;  c2max = boxp->c2max;
  308|       |
  309|   254k|  if (c0max > c0min)
  ------------------
  |  Branch (309:7): [True: 171k, False: 82.9k]
  ------------------
  310|   315k|    for (c0 = c0min; c0 <= c0max; c0++)
  ------------------
  |  Branch (310:22): [True: 315k, False: 0]
  ------------------
  311|  2.11M|      for (c1 = c1min; c1 <= c1max; c1++) {
  ------------------
  |  Branch (311:24): [True: 1.97M, False: 144k]
  ------------------
  312|  1.97M|        histp = &histogram[c0][c1][c2min];
  313|  35.4M|        for (c2 = c2min; c2 <= c2max; c2++)
  ------------------
  |  Branch (313:26): [True: 33.6M, False: 1.79M]
  ------------------
  314|  33.6M|          if (*histp++ != 0) {
  ------------------
  |  Branch (314:15): [True: 171k, False: 33.5M]
  ------------------
  315|   171k|            boxp->c0min = c0min = c0;
  316|   171k|            goto have_c0min;
  317|   171k|          }
  318|  1.97M|      }
  319|   254k|have_c0min:
  320|   254k|  if (c0max > c0min)
  ------------------
  |  Branch (320:7): [True: 143k, False: 110k]
  ------------------
  321|   293k|    for (c0 = c0max; c0 >= c0min; c0--)
  ------------------
  |  Branch (321:22): [True: 293k, False: 0]
  ------------------
  322|  2.18M|      for (c1 = c1min; c1 <= c1max; c1++) {
  ------------------
  |  Branch (322:24): [True: 2.03M, False: 149k]
  ------------------
  323|  2.03M|        histp = &histogram[c0][c1][c2min];
  324|  37.5M|        for (c2 = c2min; c2 <= c2max; c2++)
  ------------------
  |  Branch (324:26): [True: 35.6M, False: 1.89M]
  ------------------
  325|  35.6M|          if (*histp++ != 0) {
  ------------------
  |  Branch (325:15): [True: 143k, False: 35.4M]
  ------------------
  326|   143k|            boxp->c0max = c0max = c0;
  327|   143k|            goto have_c0max;
  328|   143k|          }
  329|  2.03M|      }
  330|   254k|have_c0max:
  331|   254k|  if (c1max > c1min)
  ------------------
  |  Branch (331:7): [True: 188k, False: 66.3k]
  ------------------
  332|   314k|    for (c1 = c1min; c1 <= c1max; c1++)
  ------------------
  |  Branch (332:22): [True: 314k, False: 0]
  ------------------
  333|  1.12M|      for (c0 = c0min; c0 <= c0max; c0++) {
  ------------------
  |  Branch (333:24): [True: 998k, False: 126k]
  ------------------
  334|   998k|        histp = &histogram[c0][c1][c2min];
  335|  15.0M|        for (c2 = c2min; c2 <= c2max; c2++)
  ------------------
  |  Branch (335:26): [True: 14.2M, False: 810k]
  ------------------
  336|  14.2M|          if (*histp++ != 0) {
  ------------------
  |  Branch (336:15): [True: 188k, False: 14.0M]
  ------------------
  337|   188k|            boxp->c1min = c1min = c1;
  338|   188k|            goto have_c1min;
  339|   188k|          }
  340|   998k|      }
  341|   254k|have_c1min:
  342|   254k|  if (c1max > c1min)
  ------------------
  |  Branch (342:7): [True: 159k, False: 94.4k]
  ------------------
  343|   295k|    for (c1 = c1max; c1 >= c1min; c1--)
  ------------------
  |  Branch (343:22): [True: 295k, False: 0]
  ------------------
  344|  1.15M|      for (c0 = c0min; c0 <= c0max; c0++) {
  ------------------
  |  Branch (344:24): [True: 1.02M, False: 136k]
  ------------------
  345|  1.02M|        histp = &histogram[c0][c1][c2min];
  346|  16.5M|        for (c2 = c2min; c2 <= c2max; c2++)
  ------------------
  |  Branch (346:26): [True: 15.7M, False: 863k]
  ------------------
  347|  15.7M|          if (*histp++ != 0) {
  ------------------
  |  Branch (347:15): [True: 159k, False: 15.5M]
  ------------------
  348|   159k|            boxp->c1max = c1max = c1;
  349|   159k|            goto have_c1max;
  350|   159k|          }
  351|  1.02M|      }
  352|   254k|have_c1max:
  353|   254k|  if (c2max > c2min)
  ------------------
  |  Branch (353:7): [True: 171k, False: 82.5k]
  ------------------
  354|   312k|    for (c2 = c2min; c2 <= c2max; c2++)
  ------------------
  |  Branch (354:22): [True: 312k, False: 0]
  ------------------
  355|  1.20M|      for (c0 = c0min; c0 <= c0max; c0++) {
  ------------------
  |  Branch (355:24): [True: 1.06M, False: 141k]
  ------------------
  356|  1.06M|        histp = &histogram[c0][c1min][c2];
  357|  14.1M|        for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
  ------------------
  |  |  122|  13.0M|#define HIST_C2_ELEMS  (1 << HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  13.0M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  |  Branch (357:26): [True: 13.2M, False: 889k]
  ------------------
  358|  13.2M|          if (*histp != 0) {
  ------------------
  |  Branch (358:15): [True: 171k, False: 13.0M]
  ------------------
  359|   171k|            boxp->c2min = c2min = c2;
  360|   171k|            goto have_c2min;
  361|   171k|          }
  362|  1.06M|      }
  363|   254k|have_c2min:
  364|   254k|  if (c2max > c2min)
  ------------------
  |  Branch (364:7): [True: 143k, False: 110k]
  ------------------
  365|   290k|    for (c2 = c2max; c2 >= c2min; c2--)
  ------------------
  |  Branch (365:22): [True: 290k, False: 0]
  ------------------
  366|  1.19M|      for (c0 = c0min; c0 <= c0max; c0++) {
  ------------------
  |  Branch (366:24): [True: 1.04M, False: 146k]
  ------------------
  367|  1.04M|        histp = &histogram[c0][c1min][c2];
  368|  14.8M|        for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
  ------------------
  |  |  122|  13.7M|#define HIST_C2_ELEMS  (1 << HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  13.7M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  |  Branch (368:26): [True: 13.9M, False: 900k]
  ------------------
  369|  13.9M|          if (*histp != 0) {
  ------------------
  |  Branch (369:15): [True: 143k, False: 13.7M]
  ------------------
  370|   143k|            boxp->c2max = c2max = c2;
  371|   143k|            goto have_c2max;
  372|   143k|          }
  373|  1.04M|      }
  374|   254k|have_c2max:
  375|       |
  376|       |  /* Update box volume.
  377|       |   * We use 2-norm rather than real volume here; this biases the method
  378|       |   * against making long narrow boxes, and it has the side benefit that
  379|       |   * a box is splittable iff norm > 0.
  380|       |   * Since the differences are expressed in histogram-cell units,
  381|       |   * we have to shift back to _JSAMPLE units to get consistent distances;
  382|       |   * after which, we scale according to the selected distance scale factors.
  383|       |   */
  384|   254k|  dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
  ------------------
  |  |  125|   254k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   254k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   254k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
                dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
  ------------------
  |  |   82|   254k|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  385|   254k|  dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
  ------------------
  |  |  126|   254k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   254k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   254k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
  ------------------
  |  |   83|   254k|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  386|   254k|  dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
  ------------------
  |  |  127|   254k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   254k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   254k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
                dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
  ------------------
  |  |   84|   254k|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  387|   254k|  boxp->volume = dist0 * dist0 + dist1 * dist1 + dist2 * dist2;
  388|       |
  389|       |  /* Now scan remaining volume of box and compute population */
  390|   254k|  ccount = 0;
  391|  1.12M|  for (c0 = c0min; c0 <= c0max; c0++)
  ------------------
  |  Branch (391:20): [True: 871k, False: 254k]
  ------------------
  392|  9.53M|    for (c1 = c1min; c1 <= c1max; c1++) {
  ------------------
  |  Branch (392:22): [True: 8.66M, False: 871k]
  ------------------
  393|  8.66M|      histp = &histogram[c0][c1][c2min];
  394|   148M|      for (c2 = c2min; c2 <= c2max; c2++, histp++)
  ------------------
  |  Branch (394:24): [True: 140M, False: 8.66M]
  ------------------
  395|   140M|        if (*histp != 0) {
  ------------------
  |  Branch (395:13): [True: 4.55M, False: 135M]
  ------------------
  396|  4.55M|          ccount++;
  397|  4.55M|        }
  398|  8.66M|    }
  399|   254k|  boxp->colorcount = ccount;
  400|   254k|}
jquant2-8.c:median_cut:
  407|  1.67k|{
  408|  1.67k|  int n, lb;
  409|  1.67k|  int c0, c1, c2, cmax;
  410|  1.67k|  register boxptr b1, b2;
  411|       |
  412|   128k|  while (numboxes < desired_colors) {
  ------------------
  |  Branch (412:10): [True: 127k, False: 251]
  ------------------
  413|       |    /* Select box to split.
  414|       |     * Current algorithm: by population for first half, then by volume.
  415|       |     */
  416|   127k|    if (numboxes * 2 <= desired_colors) {
  ------------------
  |  Branch (416:9): [True: 89.7k, False: 38.0k]
  ------------------
  417|  89.7k|      b1 = find_biggest_color_pop(boxlist, numboxes);
  418|  89.7k|    } else {
  419|  38.0k|      b1 = find_biggest_volume(boxlist, numboxes);
  420|  38.0k|    }
  421|   127k|    if (b1 == NULL)             /* no splittable boxes left! */
  ------------------
  |  Branch (421:9): [True: 1.42k, False: 126k]
  ------------------
  422|  1.42k|      break;
  423|   126k|    b2 = &boxlist[numboxes];    /* where new box will go */
  424|       |    /* Copy the color bounds to the new box. */
  425|   126k|    b2->c0max = b1->c0max;  b2->c1max = b1->c1max;  b2->c2max = b1->c2max;
  426|   126k|    b2->c0min = b1->c0min;  b2->c1min = b1->c1min;  b2->c2min = b1->c2min;
  427|       |    /* Choose which axis to split the box on.
  428|       |     * Current algorithm: longest scaled axis.
  429|       |     * See notes in update_box about scaling distances.
  430|       |     */
  431|   126k|    c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
  ------------------
  |  |  125|   126k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   126k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   126k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
                  c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
  ------------------
  |  |   82|   126k|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  432|   126k|    c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
  ------------------
  |  |  126|   126k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   126k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   126k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                  c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
  ------------------
  |  |   83|   126k|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  433|   126k|    c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
  ------------------
  |  |  127|   126k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   126k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   126k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
                  c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
  ------------------
  |  |   84|   126k|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  434|       |    /* We want to break any ties in favor of green, then red, blue last.
  435|       |     * This code does the right thing for R,G,B or B,G,R color orders only.
  436|       |     */
  437|   126k|    if (rgb_red[cinfo->out_color_space] == 0) {
  ------------------
  |  Branch (437:9): [True: 61.4k, False: 64.9k]
  ------------------
  438|  61.4k|      cmax = c1;  n = 1;
  439|  61.4k|      if (c0 > cmax) { cmax = c0;  n = 0; }
  ------------------
  |  Branch (439:11): [True: 20.4k, False: 41.0k]
  ------------------
  440|  61.4k|      if (c2 > cmax) { n = 2; }
  ------------------
  |  Branch (440:11): [True: 19.9k, False: 41.4k]
  ------------------
  441|  64.9k|    } else {
  442|  64.9k|      cmax = c1;  n = 1;
  443|  64.9k|      if (c2 > cmax) { cmax = c2;  n = 2; }
  ------------------
  |  Branch (443:11): [True: 22.5k, False: 42.3k]
  ------------------
  444|  64.9k|      if (c0 > cmax) { n = 0; }
  ------------------
  |  Branch (444:11): [True: 21.0k, False: 43.8k]
  ------------------
  445|  64.9k|    }
  446|       |    /* Choose split point along selected axis, and update box bounds.
  447|       |     * Current algorithm: split at halfway point.
  448|       |     * (Since the box has been shrunk to minimum volume,
  449|       |     * any split will produce two nonempty subboxes.)
  450|       |     * Note that lb value is max for lower box, so must be < old max.
  451|       |     */
  452|   126k|    switch (n) {
  ------------------
  |  Branch (452:13): [True: 126k, False: 0]
  ------------------
  453|  36.8k|    case 0:
  ------------------
  |  Branch (453:5): [True: 36.8k, False: 89.5k]
  ------------------
  454|  36.8k|      lb = (b1->c0max + b1->c0min) / 2;
  455|  36.8k|      b1->c0max = lb;
  456|  36.8k|      b2->c0min = lb + 1;
  457|  36.8k|      break;
  458|  52.2k|    case 1:
  ------------------
  |  Branch (458:5): [True: 52.2k, False: 74.1k]
  ------------------
  459|  52.2k|      lb = (b1->c1max + b1->c1min) / 2;
  460|  52.2k|      b1->c1max = lb;
  461|  52.2k|      b2->c1min = lb + 1;
  462|  52.2k|      break;
  463|  37.2k|    case 2:
  ------------------
  |  Branch (463:5): [True: 37.2k, False: 89.0k]
  ------------------
  464|  37.2k|      lb = (b1->c2max + b1->c2min) / 2;
  465|  37.2k|      b1->c2max = lb;
  466|  37.2k|      b2->c2min = lb + 1;
  467|  37.2k|      break;
  468|   126k|    }
  469|       |    /* Update stats for boxes */
  470|   126k|    update_box(cinfo, b1);
  471|   126k|    update_box(cinfo, b2);
  472|   126k|    numboxes++;
  473|   126k|  }
  474|  1.67k|  return numboxes;
  475|  1.67k|}
jquant2-8.c:find_biggest_color_pop:
  256|  89.7k|{
  257|  89.7k|  register boxptr boxp;
  258|  89.7k|  register int i;
  259|  89.7k|  register long maxc = 0;
  260|  89.7k|  boxptr which = NULL;
  261|       |
  262|  4.50M|  for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
  ------------------
  |  Branch (262:31): [True: 4.41M, False: 89.7k]
  ------------------
  263|  4.41M|    if (boxp->colorcount > maxc && boxp->volume > 0) {
  ------------------
  |  Branch (263:9): [True: 588k, False: 3.82M]
  |  Branch (263:36): [True: 210k, False: 378k]
  ------------------
  264|   210k|      which = boxp;
  265|   210k|      maxc = boxp->colorcount;
  266|   210k|    }
  267|  4.41M|  }
  268|  89.7k|  return which;
  269|  89.7k|}
jquant2-8.c:find_biggest_volume:
  276|  38.0k|{
  277|  38.0k|  register boxptr boxp;
  278|  38.0k|  register int i;
  279|  38.0k|  register JLONG maxv = 0;
  280|  38.0k|  boxptr which = NULL;
  281|       |
  282|  7.23M|  for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
  ------------------
  |  Branch (282:31): [True: 7.19M, False: 38.0k]
  ------------------
  283|  7.19M|    if (boxp->volume > maxv) {
  ------------------
  |  Branch (283:9): [True: 146k, False: 7.04M]
  ------------------
  284|   146k|      which = boxp;
  285|   146k|      maxv = boxp->volume;
  286|   146k|    }
  287|  7.19M|  }
  288|  38.0k|  return which;
  289|  38.0k|}
jquant2-8.c:compute_color:
  481|   128k|{
  482|       |  /* Current algorithm: mean weighted by pixels (not colors) */
  483|       |  /* Note it is important to get the rounding correct! */
  484|   128k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  485|   128k|  hist3d histogram = cquantize->histogram;
  486|   128k|  histptr histp;
  487|   128k|  int c0, c1, c2;
  488|   128k|  int c0min, c0max, c1min, c1max, c2min, c2max;
  489|   128k|  long count;
  490|   128k|  long total = 0;
  491|   128k|  long c0total = 0;
  492|   128k|  long c1total = 0;
  493|   128k|  long c2total = 0;
  494|       |
  495|   128k|  c0min = boxp->c0min;  c0max = boxp->c0max;
  496|   128k|  c1min = boxp->c1min;  c1max = boxp->c1max;
  497|   128k|  c2min = boxp->c2min;  c2max = boxp->c2max;
  498|       |
  499|   303k|  for (c0 = c0min; c0 <= c0max; c0++)
  ------------------
  |  Branch (499:20): [True: 175k, False: 128k]
  ------------------
  500|   542k|    for (c1 = c1min; c1 <= c1max; c1++) {
  ------------------
  |  Branch (500:22): [True: 367k, False: 175k]
  ------------------
  501|   367k|      histp = &histogram[c0][c1][c2min];
  502|  1.55M|      for (c2 = c2min; c2 <= c2max; c2++) {
  ------------------
  |  Branch (502:24): [True: 1.18M, False: 367k]
  ------------------
  503|  1.18M|        if ((count = *histp++) != 0) {
  ------------------
  |  Branch (503:13): [True: 495k, False: 691k]
  ------------------
  504|   495k|          total += count;
  505|   495k|          c0total += ((c0 << C0_SHIFT) + ((1 << C0_SHIFT) >> 1)) * count;
  ------------------
  |  |  125|   495k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   495k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
                        c0total += ((c0 << C0_SHIFT) + ((1 << C0_SHIFT) >> 1)) * count;
  ------------------
  |  |  125|   495k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   495k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  506|   495k|          c1total += ((c1 << C1_SHIFT) + ((1 << C1_SHIFT) >> 1)) * count;
  ------------------
  |  |  126|   495k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   495k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                        c1total += ((c1 << C1_SHIFT) + ((1 << C1_SHIFT) >> 1)) * count;
  ------------------
  |  |  126|   495k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   495k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  507|   495k|          c2total += ((c2 << C2_SHIFT) + ((1 << C2_SHIFT) >> 1)) * count;
  ------------------
  |  |  127|   495k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   495k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
                        c2total += ((c2 << C2_SHIFT) + ((1 << C2_SHIFT) >> 1)) * count;
  ------------------
  |  |  127|   495k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   495k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   495k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  508|   495k|        }
  509|  1.18M|      }
  510|   367k|    }
  511|       |
  512|   128k|  ((_JSAMPARRAY)cinfo->colormap)[0][icolor] =
  513|   128k|    (_JSAMPLE)((c0total + (total >> 1)) / total);
  514|   128k|  ((_JSAMPARRAY)cinfo->colormap)[1][icolor] =
  515|   128k|    (_JSAMPLE)((c1total + (total >> 1)) / total);
  516|   128k|  ((_JSAMPARRAY)cinfo->colormap)[2][icolor] =
  517|   128k|    (_JSAMPLE)((c2total + (total >> 1)) / total);
  518|   128k|}
jquant2-8.c:pass2_fs_dither:
  935|  11.4M|{
  936|  11.4M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  937|  11.4M|  hist3d histogram = cquantize->histogram;
  938|  11.4M|  register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */
  939|  11.4M|  LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
  940|  11.4M|  LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
  941|  11.4M|  register FSERRPTR errorptr;   /* => fserrors[] at column before current */
  942|  11.4M|  _JSAMPROW inptr;              /* => current input pixel */
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  943|  11.4M|  _JSAMPROW outptr;             /* => current output pixel */
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  944|  11.4M|  histptr cachep;
  945|  11.4M|  int dir;                      /* +1 or -1 depending on direction */
  946|  11.4M|  int dir3;                     /* 3*dir, for advancing inptr & errorptr */
  947|  11.4M|  int row;
  948|  11.4M|  JDIMENSION col;
  949|  11.4M|  JDIMENSION width = cinfo->output_width;
  950|  11.4M|  _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  ------------------
  |  |  220|  11.4M|#define _JSAMPLE  JSAMPLE
  ------------------
  951|  11.4M|  int *error_limit = cquantize->error_limiter;
  952|  11.4M|  _JSAMPROW colormap0 = ((_JSAMPARRAY)cinfo->colormap)[0];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  953|  11.4M|  _JSAMPROW colormap1 = ((_JSAMPARRAY)cinfo->colormap)[1];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  954|  11.4M|  _JSAMPROW colormap2 = ((_JSAMPARRAY)cinfo->colormap)[2];
  ------------------
  |  |  225|  11.4M|#define _JSAMPROW  JSAMPROW
  ------------------
  955|  11.4M|  SHIFT_TEMPS
  956|       |
  957|  22.8M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (957:17): [True: 11.4M, False: 11.4M]
  ------------------
  958|  11.4M|    inptr = input_buf[row];
  959|  11.4M|    outptr = output_buf[row];
  960|  11.4M|    if (cquantize->on_odd_row) {
  ------------------
  |  Branch (960:9): [True: 5.71M, False: 5.72M]
  ------------------
  961|       |      /* work right to left in this row */
  962|  5.71M|      inptr += (width - 1) * 3; /* so point to rightmost pixel */
  963|  5.71M|      outptr += width - 1;
  964|  5.71M|      dir = -1;
  965|  5.71M|      dir3 = -3;
  966|  5.71M|      errorptr = cquantize->fserrors + (width + 1) * 3; /* => entry after last column */
  967|  5.71M|      cquantize->on_odd_row = FALSE; /* flip for next time */
  ------------------
  |  |  207|  5.71M|#define FALSE   0               /* values of boolean */
  ------------------
  968|  5.72M|    } else {
  969|       |      /* work left to right in this row */
  970|  5.72M|      dir = 1;
  971|  5.72M|      dir3 = 3;
  972|  5.72M|      errorptr = cquantize->fserrors; /* => entry before first real column */
  973|  5.72M|      cquantize->on_odd_row = TRUE; /* flip for next time */
  ------------------
  |  |  210|  5.72M|#define TRUE    1
  ------------------
  974|  5.72M|    }
  975|       |    /* Preset error values: no error propagated to first pixel from left */
  976|  11.4M|    cur0 = cur1 = cur2 = 0;
  977|       |    /* and no error propagated to row below yet */
  978|  11.4M|    belowerr0 = belowerr1 = belowerr2 = 0;
  979|  11.4M|    bpreverr0 = bpreverr1 = bpreverr2 = 0;
  980|       |
  981|   266M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (981:23): [True: 255M, False: 11.4M]
  ------------------
  982|       |      /* curN holds the error propagated from the previous pixel on the
  983|       |       * current line.  Add the error propagated from the previous line
  984|       |       * to form the complete error correction term for this pixel, and
  985|       |       * round the error term (which is expressed * 16) to an integer.
  986|       |       * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
  987|       |       * for either sign of the error value.
  988|       |       * Note: errorptr points to *previous* column's array entry.
  989|       |       */
  990|   255M|      cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3 + 0] + 8, 4);
  ------------------
  |  |  474|   255M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  991|   255M|      cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3 + 1] + 8, 4);
  ------------------
  |  |  474|   255M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  992|   255M|      cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3 + 2] + 8, 4);
  ------------------
  |  |  474|   255M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  993|       |      /* Limit the error using transfer function set by init_error_limit.
  994|       |       * See comments with init_error_limit for rationale.
  995|       |       */
  996|   255M|      cur0 = error_limit[cur0];
  997|   255M|      cur1 = error_limit[cur1];
  998|   255M|      cur2 = error_limit[cur2];
  999|       |      /* Form pixel value + error, and range-limit to 0.._MAXJSAMPLE.
 1000|       |       * The maximum error is +- _MAXJSAMPLE (or less with error limiting);
 1001|       |       * this sets the required size of the range_limit array.
 1002|       |       */
 1003|   255M|      cur0 += inptr[0];
 1004|   255M|      cur1 += inptr[1];
 1005|   255M|      cur2 += inptr[2];
 1006|   255M|      cur0 = range_limit[cur0];
 1007|   255M|      cur1 = range_limit[cur1];
 1008|   255M|      cur2 = range_limit[cur2];
 1009|       |      /* Index into the cache with adjusted pixel value */
 1010|   255M|      cachep =
 1011|   255M|        &histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
  ------------------
  |  |  125|   255M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   255M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   255M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
                      &histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
  ------------------
  |  |  126|   255M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   255M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   255M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                      &histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
  ------------------
  |  |  127|   255M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   255M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   255M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
 1012|       |      /* If we have not seen this color before, find nearest colormap */
 1013|       |      /* entry and update the cache */
 1014|   255M|      if (*cachep == 0)
  ------------------
  |  Branch (1014:11): [True: 45.1k, False: 255M]
  ------------------
 1015|  45.1k|        fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT,
  ------------------
  |  |  125|  45.1k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|  45.1k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  45.1k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
                      fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT,
  ------------------
  |  |  126|  45.1k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|  45.1k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  45.1k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
 1016|  45.1k|                          cur2 >> C2_SHIFT);
  ------------------
  |  |  127|  45.1k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|  45.1k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  45.1k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
 1017|       |      /* Now emit the colormap index for this cell */
 1018|   255M|      {
 1019|   255M|        register int pixcode = *cachep - 1;
 1020|   255M|        *outptr = (_JSAMPLE)pixcode;
 1021|       |        /* Compute representation error for this pixel */
 1022|   255M|        cur0 -= colormap0[pixcode];
 1023|   255M|        cur1 -= colormap1[pixcode];
 1024|   255M|        cur2 -= colormap2[pixcode];
 1025|   255M|      }
 1026|       |      /* Compute error fractions to be propagated to adjacent pixels.
 1027|       |       * Add these into the running sums, and simultaneously shift the
 1028|       |       * next-line error sums left by 1 column.
 1029|       |       */
 1030|   255M|      {
 1031|   255M|        register LOCFSERROR bnexterr;
 1032|       |
 1033|   255M|        bnexterr = cur0;        /* Process component 0 */
 1034|   255M|        errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3);
 1035|   255M|        bpreverr0 = belowerr0 + cur0 * 5;
 1036|   255M|        belowerr0 = bnexterr;
 1037|   255M|        cur0 *= 7;
 1038|   255M|        bnexterr = cur1;        /* Process component 1 */
 1039|   255M|        errorptr[1] = (FSERROR)(bpreverr1 + cur1 * 3);
 1040|   255M|        bpreverr1 = belowerr1 + cur1 * 5;
 1041|   255M|        belowerr1 = bnexterr;
 1042|   255M|        cur1 *= 7;
 1043|   255M|        bnexterr = cur2;        /* Process component 2 */
 1044|   255M|        errorptr[2] = (FSERROR)(bpreverr2 + cur2 * 3);
 1045|   255M|        bpreverr2 = belowerr2 + cur2 * 5;
 1046|   255M|        belowerr2 = bnexterr;
 1047|   255M|        cur2 *= 7;
 1048|   255M|      }
 1049|       |      /* At this point curN contains the 7/16 error value to be propagated
 1050|       |       * to the next pixel on the current line, and all the errors for the
 1051|       |       * next line have been shifted over.  We are therefore ready to move on.
 1052|       |       */
 1053|   255M|      inptr += dir3;            /* Advance pixel pointers to next column */
 1054|   255M|      outptr += dir;
 1055|   255M|      errorptr += dir3;         /* advance errorptr to current column */
 1056|   255M|    }
 1057|       |    /* Post-loop cleanup: we must unload the final error values into the
 1058|       |     * final fserrors[] entry.  Note we need not unload belowerrN because
 1059|       |     * it is for the dummy column before or after the actual array.
 1060|       |     */
 1061|  11.4M|    errorptr[0] = (FSERROR)bpreverr0; /* unload prev errs into array */
 1062|  11.4M|    errorptr[1] = (FSERROR)bpreverr1;
 1063|  11.4M|    errorptr[2] = (FSERROR)bpreverr2;
 1064|  11.4M|  }
 1065|  11.4M|}
jquant2-8.c:fill_inverse_cmap:
  842|  81.9k|{
  843|  81.9k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  844|  81.9k|  hist3d histogram = cquantize->histogram;
  845|  81.9k|  int minc0, minc1, minc2;      /* lower left corner of update box */
  846|  81.9k|  int ic0, ic1, ic2;
  847|  81.9k|  register _JSAMPLE *cptr;      /* pointer into bestcolor[] array */
  848|  81.9k|  register histptr cachep;      /* pointer into main cache array */
  849|       |  /* This array lists the candidate colormap indexes. */
  850|  81.9k|  _JSAMPLE colorlist[MAXNUMCOLORS];
  ------------------
  |  |  220|  81.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  851|  81.9k|  int numcolors;                /* number of candidate colors */
  852|       |  /* This array holds the actually closest colormap index for each cell. */
  853|  81.9k|  _JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
  ------------------
  |  |  220|  81.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  854|       |
  855|       |  /* Convert cell coordinates to update box ID */
  856|  81.9k|  c0 >>= BOX_C0_LOG;
  ------------------
  |  |  607|  81.9k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  ------------------
  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  857|  81.9k|  c1 >>= BOX_C1_LOG;
  ------------------
  |  |  608|  81.9k|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  ------------------
  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  858|  81.9k|  c2 >>= BOX_C2_LOG;
  ------------------
  |  |  609|  81.9k|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  ------------------
  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  859|       |
  860|       |  /* Compute true coordinates of update box's origin corner.
  861|       |   * Actually we compute the coordinates of the center of the corner
  862|       |   * histogram cell, which are the lower bounds of the volume we care about.
  863|       |   */
  864|  81.9k|  minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
  ------------------
  |  |  615|  81.9k|#define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
  |  |  ------------------
  |  |  |  |  125|  81.9k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
  |  |  ------------------
  |  |  |  |  607|  81.9k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
  ------------------
  |  |  125|  81.9k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  865|  81.9k|  minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
  ------------------
  |  |  616|  81.9k|#define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  126|  81.9k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  608|  81.9k|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
  ------------------
  |  |  126|  81.9k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  866|  81.9k|  minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
  ------------------
  |  |  617|  81.9k|#define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  127|  81.9k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  609|  81.9k|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
  ------------------
  |  |  127|  81.9k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  867|       |
  868|       |  /* Determine which colormap entries are close enough to be candidates
  869|       |   * for the nearest entry to some cell in the update box.
  870|       |   */
  871|  81.9k|  numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);
  872|       |
  873|       |  /* Determine the actually nearest colors. */
  874|  81.9k|  find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
  875|  81.9k|                   bestcolor);
  876|       |
  877|       |  /* Save the best color numbers (plus 1) in the main cache array */
  878|  81.9k|  c0 <<= BOX_C0_LOG;            /* convert ID back to base cell indexes */
  ------------------
  |  |  607|  81.9k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  ------------------
  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  879|  81.9k|  c1 <<= BOX_C1_LOG;
  ------------------
  |  |  608|  81.9k|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  ------------------
  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  880|  81.9k|  c2 <<= BOX_C2_LOG;
  ------------------
  |  |  609|  81.9k|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  ------------------
  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  881|  81.9k|  cptr = bestcolor;
  882|   409k|  for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
  ------------------
  |  |  611|   409k|#define BOX_C0_ELEMS  (1 << BOX_C0_LOG) /* # of hist cells in update box */
  |  |  ------------------
  |  |  |  |  607|   409k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   409k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (882:17): [True: 327k, False: 81.9k]
  ------------------
  883|  2.95M|    for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
  ------------------
  |  |  612|  2.95M|#define BOX_C1_ELEMS  (1 << BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  608|  2.95M|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  2.95M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (883:19): [True: 2.62M, False: 327k]
  ------------------
  884|  2.62M|      cachep = &histogram[c0 + ic0][c1 + ic1][c2];
  885|  13.1M|      for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
  ------------------
  |  |  613|  13.1M|#define BOX_C2_ELEMS  (1 << BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  609|  13.1M|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  13.1M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (885:21): [True: 10.4M, False: 2.62M]
  ------------------
  886|  10.4M|        *cachep++ = (histcell)((*cptr++) + 1);
  887|  10.4M|      }
  888|  2.62M|    }
  889|   327k|  }
  890|  81.9k|}
jquant2-8.c:find_nearby_colors:
  639|  81.9k|{
  640|  81.9k|  int numcolors = cinfo->actual_number_of_colors;
  641|  81.9k|  int maxc0, maxc1, maxc2;
  642|  81.9k|  int centerc0, centerc1, centerc2;
  643|  81.9k|  int i, x, ncolors;
  644|  81.9k|  JLONG minmaxdist, min_dist, max_dist, tdist;
  645|  81.9k|  JLONG mindist[MAXNUMCOLORS];  /* min distance to colormap entry i */
  646|       |
  647|       |  /* Compute true coordinates of update box's upper corner and center.
  648|       |   * Actually we compute the coordinates of the center of the upper-corner
  649|       |   * histogram cell, which are the upper bounds of the volume we care about.
  650|       |   * Note that since ">>" rounds down, the "center" values may be closer to
  651|       |   * min than to max; hence comparisons to them must be "<=", not "<".
  652|       |   */
  653|  81.9k|  maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT));
  ------------------
  |  |  615|  81.9k|#define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
  |  |  ------------------
  |  |  |  |  125|  81.9k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
  |  |  ------------------
  |  |  |  |  607|  81.9k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT));
  ------------------
  |  |  125|  81.9k|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  654|  81.9k|  centerc0 = (minc0 + maxc0) >> 1;
  655|  81.9k|  maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT));
  ------------------
  |  |  616|  81.9k|#define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  126|  81.9k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  608|  81.9k|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT));
  ------------------
  |  |  126|  81.9k|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  656|  81.9k|  centerc1 = (minc1 + maxc1) >> 1;
  657|  81.9k|  maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT));
  ------------------
  |  |  617|  81.9k|#define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  127|  81.9k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  609|  81.9k|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT));
  ------------------
  |  |  127|  81.9k|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|  81.9k|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  658|  81.9k|  centerc2 = (minc2 + maxc2) >> 1;
  659|       |
  660|       |  /* For each color in colormap, find:
  661|       |   *  1. its minimum squared-distance to any point in the update box
  662|       |   *     (zero if color is within update box);
  663|       |   *  2. its maximum squared-distance to any point in the update box.
  664|       |   * Both of these can be found by considering only the corners of the box.
  665|       |   * We save the minimum distance for each color in mindist[];
  666|       |   * only the smallest maximum distance is of interest.
  667|       |   */
  668|  81.9k|  minmaxdist = 0x7FFFFFFFL;
  669|       |
  670|  15.0M|  for (i = 0; i < numcolors; i++) {
  ------------------
  |  Branch (670:15): [True: 14.9M, False: 81.9k]
  ------------------
  671|       |    /* We compute the squared-c0-distance term, then add in the other two. */
  672|  14.9M|    x = ((_JSAMPARRAY)cinfo->colormap)[0][i];
  673|  14.9M|    if (x < minc0) {
  ------------------
  |  Branch (673:9): [True: 5.98M, False: 8.94M]
  ------------------
  674|  5.98M|      tdist = (x - minc0) * C0_SCALE;
  ------------------
  |  |   82|  5.98M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  675|  5.98M|      min_dist = tdist * tdist;
  676|  5.98M|      tdist = (x - maxc0) * C0_SCALE;
  ------------------
  |  |   82|  5.98M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  677|  5.98M|      max_dist = tdist * tdist;
  678|  8.94M|    } else if (x > maxc0) {
  ------------------
  |  Branch (678:16): [True: 6.46M, False: 2.48M]
  ------------------
  679|  6.46M|      tdist = (x - maxc0) * C0_SCALE;
  ------------------
  |  |   82|  6.46M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  680|  6.46M|      min_dist = tdist * tdist;
  681|  6.46M|      tdist = (x - minc0) * C0_SCALE;
  ------------------
  |  |   82|  6.46M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  682|  6.46M|      max_dist = tdist * tdist;
  683|  6.46M|    } else {
  684|       |      /* within cell range so no contribution to min_dist */
  685|  2.48M|      min_dist = 0;
  686|  2.48M|      if (x <= centerc0) {
  ------------------
  |  Branch (686:11): [True: 1.16M, False: 1.31M]
  ------------------
  687|  1.16M|        tdist = (x - maxc0) * C0_SCALE;
  ------------------
  |  |   82|  1.16M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  688|  1.16M|        max_dist = tdist * tdist;
  689|  1.31M|      } else {
  690|  1.31M|        tdist = (x - minc0) * C0_SCALE;
  ------------------
  |  |   82|  1.31M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  691|  1.31M|        max_dist = tdist * tdist;
  692|  1.31M|      }
  693|  2.48M|    }
  694|       |
  695|  14.9M|    x = ((_JSAMPARRAY)cinfo->colormap)[1][i];
  696|  14.9M|    if (x < minc1) {
  ------------------
  |  Branch (696:9): [True: 6.19M, False: 8.73M]
  ------------------
  697|  6.19M|      tdist = (x - minc1) * C1_SCALE;
  ------------------
  |  |   83|  6.19M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  698|  6.19M|      min_dist += tdist * tdist;
  699|  6.19M|      tdist = (x - maxc1) * C1_SCALE;
  ------------------
  |  |   83|  6.19M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  700|  6.19M|      max_dist += tdist * tdist;
  701|  8.73M|    } else if (x > maxc1) {
  ------------------
  |  Branch (701:16): [True: 6.52M, False: 2.20M]
  ------------------
  702|  6.52M|      tdist = (x - maxc1) * C1_SCALE;
  ------------------
  |  |   83|  6.52M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  703|  6.52M|      min_dist += tdist * tdist;
  704|  6.52M|      tdist = (x - minc1) * C1_SCALE;
  ------------------
  |  |   83|  6.52M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  705|  6.52M|      max_dist += tdist * tdist;
  706|  6.52M|    } else {
  707|       |      /* within cell range so no contribution to min_dist */
  708|  2.20M|      if (x <= centerc1) {
  ------------------
  |  Branch (708:11): [True: 1.09M, False: 1.10M]
  ------------------
  709|  1.09M|        tdist = (x - maxc1) * C1_SCALE;
  ------------------
  |  |   83|  1.09M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  710|  1.09M|        max_dist += tdist * tdist;
  711|  1.10M|      } else {
  712|  1.10M|        tdist = (x - minc1) * C1_SCALE;
  ------------------
  |  |   83|  1.10M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  713|  1.10M|        max_dist += tdist * tdist;
  714|  1.10M|      }
  715|  2.20M|    }
  716|       |
  717|  14.9M|    x = ((_JSAMPARRAY)cinfo->colormap)[2][i];
  718|  14.9M|    if (x < minc2) {
  ------------------
  |  Branch (718:9): [True: 5.96M, False: 8.96M]
  ------------------
  719|  5.96M|      tdist = (x - minc2) * C2_SCALE;
  ------------------
  |  |   84|  5.96M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  720|  5.96M|      min_dist += tdist * tdist;
  721|  5.96M|      tdist = (x - maxc2) * C2_SCALE;
  ------------------
  |  |   84|  5.96M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  722|  5.96M|      max_dist += tdist * tdist;
  723|  8.96M|    } else if (x > maxc2) {
  ------------------
  |  Branch (723:16): [True: 6.57M, False: 2.39M]
  ------------------
  724|  6.57M|      tdist = (x - maxc2) * C2_SCALE;
  ------------------
  |  |   84|  6.57M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  725|  6.57M|      min_dist += tdist * tdist;
  726|  6.57M|      tdist = (x - minc2) * C2_SCALE;
  ------------------
  |  |   84|  6.57M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  727|  6.57M|      max_dist += tdist * tdist;
  728|  6.57M|    } else {
  729|       |      /* within cell range so no contribution to min_dist */
  730|  2.39M|      if (x <= centerc2) {
  ------------------
  |  Branch (730:11): [True: 1.07M, False: 1.32M]
  ------------------
  731|  1.07M|        tdist = (x - maxc2) * C2_SCALE;
  ------------------
  |  |   84|  1.07M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  732|  1.07M|        max_dist += tdist * tdist;
  733|  1.32M|      } else {
  734|  1.32M|        tdist = (x - minc2) * C2_SCALE;
  ------------------
  |  |   84|  1.32M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  735|  1.32M|        max_dist += tdist * tdist;
  736|  1.32M|      }
  737|  2.39M|    }
  738|       |
  739|  14.9M|    mindist[i] = min_dist;      /* save away the results */
  740|  14.9M|    if (max_dist < minmaxdist)
  ------------------
  |  Branch (740:9): [True: 465k, False: 14.4M]
  ------------------
  741|   465k|      minmaxdist = max_dist;
  742|  14.9M|  }
  743|       |
  744|       |  /* Now we know that no cell in the update box is more than minmaxdist
  745|       |   * away from some colormap entry.  Therefore, only colors that are
  746|       |   * within minmaxdist of some part of the box need be considered.
  747|       |   */
  748|  81.9k|  ncolors = 0;
  749|  15.0M|  for (i = 0; i < numcolors; i++) {
  ------------------
  |  Branch (749:15): [True: 14.9M, False: 81.9k]
  ------------------
  750|  14.9M|    if (mindist[i] <= minmaxdist)
  ------------------
  |  Branch (750:9): [True: 1.63M, False: 13.2M]
  ------------------
  751|  1.63M|      colorlist[ncolors++] = (_JSAMPLE)i;
  752|  14.9M|  }
  753|  81.9k|  return ncolors;
  754|  81.9k|}
jquant2-8.c:find_best_colors:
  766|  81.9k|{
  767|  81.9k|  int ic0, ic1, ic2;
  768|  81.9k|  int i, icolor;
  769|  81.9k|  register JLONG *bptr;         /* pointer into bestdist[] array */
  770|  81.9k|  _JSAMPLE *cptr;               /* pointer into bestcolor[] array */
  ------------------
  |  |  220|  81.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  771|  81.9k|  JLONG dist0, dist1;           /* initial distance values */
  772|  81.9k|  register JLONG dist2;         /* current distance in inner loop */
  773|  81.9k|  JLONG xx0, xx1;               /* distance increments */
  774|  81.9k|  register JLONG xx2;
  775|  81.9k|  JLONG inc0, inc1, inc2;       /* initial values for increments */
  776|       |  /* This array holds the distance to the nearest-so-far color for each cell */
  777|  81.9k|  JLONG bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
  778|       |
  779|       |  /* Initialize best-distance for each cell of the update box */
  780|  81.9k|  bptr = bestdist;
  781|  10.5M|  for (i = BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS - 1; i >= 0; i--)
  ------------------
  |  |  611|  81.9k|#define BOX_C0_ELEMS  (1 << BOX_C0_LOG) /* # of hist cells in update box */
  |  |  ------------------
  |  |  |  |  607|  81.9k|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  81.9k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                for (i = BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS - 1; i >= 0; i--)
  ------------------
  |  |  612|  81.9k|#define BOX_C1_ELEMS  (1 << BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  608|  81.9k|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  81.9k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                for (i = BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS - 1; i >= 0; i--)
  ------------------
  |  |  613|  81.9k|#define BOX_C2_ELEMS  (1 << BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  609|  81.9k|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  81.9k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (781:60): [True: 10.4M, False: 81.9k]
  ------------------
  782|  10.4M|    *bptr++ = 0x7FFFFFFFL;
  783|       |
  784|       |  /* For each color selected by find_nearby_colors,
  785|       |   * compute its distance to the center of each cell in the box.
  786|       |   * If that's less than best-so-far, update best distance and color number.
  787|       |   */
  788|       |
  789|       |  /* Nominal steps between cell centers ("x" in Thomas article) */
  790|  81.9k|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  791|  81.9k|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  792|  81.9k|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  793|       |
  794|  1.71M|  for (i = 0; i < numcolors; i++) {
  ------------------
  |  Branch (794:15): [True: 1.63M, False: 81.9k]
  ------------------
  795|  1.63M|    icolor = colorlist[i];
  796|       |    /* Compute (square of) distance from minc0/c1/c2 to this color */
  797|  1.63M|    inc0 = (minc0 - ((_JSAMPARRAY)cinfo->colormap)[0][icolor]) * C0_SCALE;
  ------------------
  |  |   82|  1.63M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  ------------------
  798|  1.63M|    dist0 = inc0 * inc0;
  799|  1.63M|    inc1 = (minc1 - ((_JSAMPARRAY)cinfo->colormap)[1][icolor]) * C1_SCALE;
  ------------------
  |  |   83|  1.63M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  ------------------
  800|  1.63M|    dist0 += inc1 * inc1;
  801|  1.63M|    inc2 = (minc2 - ((_JSAMPARRAY)cinfo->colormap)[2][icolor]) * C2_SCALE;
  ------------------
  |  |   84|  1.63M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  ------------------
  802|  1.63M|    dist0 += inc2 * inc2;
  803|       |    /* Form the initial difference increments */
  804|  1.63M|    inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
  ------------------
  |  |  790|  1.63M|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |  125|  1.63M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  1.63M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |   82|  1.63M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
  ------------------
  |  |  790|  1.63M|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |  125|  1.63M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  1.63M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |   82|  1.63M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
  ------------------
  |  |  790|  1.63M|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |  125|  1.63M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  1.63M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |   82|  1.63M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  805|  1.63M|    inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
  ------------------
  |  |  791|  1.63M|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |  126|  1.63M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.63M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |   83|  1.63M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
  ------------------
  |  |  791|  1.63M|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |  126|  1.63M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.63M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |   83|  1.63M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
  ------------------
  |  |  791|  1.63M|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |  126|  1.63M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.63M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |   83|  1.63M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  806|  1.63M|    inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
  ------------------
  |  |  792|  1.63M|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |  127|  1.63M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.63M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |   84|  1.63M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
  ------------------
  |  |  792|  1.63M|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |  127|  1.63M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.63M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |   84|  1.63M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                  inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
  ------------------
  |  |  792|  1.63M|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |  127|  1.63M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.63M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |   84|  1.63M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  807|       |    /* Now loop over all cells in box, updating distance per Thomas method */
  808|  1.63M|    bptr = bestdist;
  809|  1.63M|    cptr = bestcolor;
  810|  1.63M|    xx0 = inc0;
  811|  8.18M|    for (ic0 = BOX_C0_ELEMS - 1; ic0 >= 0; ic0--) {
  ------------------
  |  |  611|  1.63M|#define BOX_C0_ELEMS  (1 << BOX_C0_LOG) /* # of hist cells in update box */
  |  |  ------------------
  |  |  |  |  607|  1.63M|#define BOX_C0_LOG  (HIST_C0_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  1.63M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (811:34): [True: 6.54M, False: 1.63M]
  ------------------
  812|  6.54M|      dist1 = dist0;
  813|  6.54M|      xx1 = inc1;
  814|  58.8M|      for (ic1 = BOX_C1_ELEMS - 1; ic1 >= 0; ic1--) {
  ------------------
  |  |  612|  6.54M|#define BOX_C1_ELEMS  (1 << BOX_C1_LOG)
  |  |  ------------------
  |  |  |  |  608|  6.54M|#define BOX_C1_LOG  (HIST_C1_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  6.54M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (814:36): [True: 52.3M, False: 6.54M]
  ------------------
  815|  52.3M|        dist2 = dist1;
  816|  52.3M|        xx2 = inc2;
  817|   261M|        for (ic2 = BOX_C2_ELEMS - 1; ic2 >= 0; ic2--) {
  ------------------
  |  |  613|  52.3M|#define BOX_C2_ELEMS  (1 << BOX_C2_LOG)
  |  |  ------------------
  |  |  |  |  609|  52.3M|#define BOX_C2_LOG  (HIST_C2_BITS - 3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  52.3M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (817:38): [True: 209M, False: 52.3M]
  ------------------
  818|   209M|          if (dist2 < *bptr) {
  ------------------
  |  Branch (818:15): [True: 31.6M, False: 177M]
  ------------------
  819|  31.6M|            *bptr = dist2;
  820|  31.6M|            *cptr = (_JSAMPLE)icolor;
  821|  31.6M|          }
  822|   209M|          dist2 += xx2;
  823|   209M|          xx2 += 2 * STEP_C2 * STEP_C2;
  ------------------
  |  |  792|   209M|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |  127|   209M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|   209M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   209M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |   84|   209M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                        xx2 += 2 * STEP_C2 * STEP_C2;
  ------------------
  |  |  792|   209M|#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |  127|   209M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|   209M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   209M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  |  |  ------------------
  |  |  |  |   84|   209M|#define C2_SCALE  c_scales[rgb_blue[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  824|   209M|          bptr++;
  825|   209M|          cptr++;
  826|   209M|        }
  827|  52.3M|        dist1 += xx1;
  828|  52.3M|        xx1 += 2 * STEP_C1 * STEP_C1;
  ------------------
  |  |  791|  52.3M|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |  126|  52.3M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  52.3M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  52.3M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |   83|  52.3M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                      xx1 += 2 * STEP_C1 * STEP_C1;
  ------------------
  |  |  791|  52.3M|#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |  126|  52.3M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  52.3M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  52.3M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
  |  |  ------------------
  |  |  |  |   83|  52.3M|#define C1_SCALE  c_scales[rgb_green[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  829|  52.3M|      }
  830|  6.54M|      dist0 += xx0;
  831|  6.54M|      xx0 += 2 * STEP_C0 * STEP_C0;
  ------------------
  |  |  790|  6.54M|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |  125|  6.54M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  6.54M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  6.54M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |   82|  6.54M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
                    xx0 += 2 * STEP_C0 * STEP_C0;
  ------------------
  |  |  790|  6.54M|#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |  125|  6.54M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  6.54M|#define BITS_IN_JSAMPLE  8
  |  |  |  |  ------------------
  |  |  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  6.54M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
  |  |  ------------------
  |  |  |  |   82|  6.54M|#define C0_SCALE  c_scales[rgb_red[cinfo->out_color_space]]
  |  |  ------------------
  ------------------
  832|  6.54M|    }
  833|  1.63M|  }
  834|  81.9k|}
jquant2-8.c:pass2_no_dither:
  901|  11.4M|{
  902|  11.4M|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
  903|  11.4M|  hist3d histogram = cquantize->histogram;
  904|  11.4M|  register _JSAMPROW inptr, outptr;
  905|  11.4M|  register histptr cachep;
  906|  11.4M|  register int c0, c1, c2;
  907|  11.4M|  int row;
  908|  11.4M|  JDIMENSION col;
  909|  11.4M|  JDIMENSION width = cinfo->output_width;
  910|       |
  911|  22.8M|  for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (911:17): [True: 11.4M, False: 11.4M]
  ------------------
  912|  11.4M|    inptr = input_buf[row];
  913|  11.4M|    outptr = output_buf[row];
  914|   271M|    for (col = width; col > 0; col--) {
  ------------------
  |  Branch (914:23): [True: 259M, False: 11.4M]
  ------------------
  915|       |      /* get pixel value and index into the cache */
  916|   259M|      c0 = (*inptr++) >> C0_SHIFT;
  ------------------
  |  |  125|   259M|#define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |   12|   259M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C0_SHIFT  (BITS_IN_JSAMPLE - HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|   259M|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  917|   259M|      c1 = (*inptr++) >> C1_SHIFT;
  ------------------
  |  |  126|   259M|#define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |   12|   259M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C1_SHIFT  (BITS_IN_JSAMPLE - HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|   259M|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
  918|   259M|      c2 = (*inptr++) >> C2_SHIFT;
  ------------------
  |  |  127|   259M|#define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |   12|   259M|#define BITS_IN_JSAMPLE  8
  |  |  ------------------
  |  |               #define C2_SHIFT  (BITS_IN_JSAMPLE - HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|   259M|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
  919|   259M|      cachep = &histogram[c0][c1][c2];
  920|       |      /* If we have not seen this color before, find nearest colormap entry */
  921|       |      /* and update the cache */
  922|   259M|      if (*cachep == 0)
  ------------------
  |  Branch (922:11): [True: 36.7k, False: 259M]
  ------------------
  923|  36.7k|        fill_inverse_cmap(cinfo, c0, c1, c2);
  924|       |      /* Now emit the colormap index for this cell */
  925|   259M|      *outptr++ = (_JSAMPLE)(*cachep - 1);
  926|   259M|    }
  927|  11.4M|  }
  928|  11.4M|}
jquant2-8.c:finish_pass2:
 1135|  5.38k|{
 1136|       |  /* no work */
 1137|  5.38k|}
jquant2-8.c:init_error_limit:
 1088|  1.28k|{
 1089|  1.28k|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
 1090|  1.28k|  int *table;
 1091|  1.28k|  int in, out;
 1092|       |
 1093|  1.28k|  table = (int *)(*cinfo->mem->alloc_small)
 1094|  1.28k|    ((j_common_ptr)cinfo, JPOOL_IMAGE, (_MAXJSAMPLE * 2 + 1) * sizeof(int));
  ------------------
  |  |  889|  1.28k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                  ((j_common_ptr)cinfo, JPOOL_IMAGE, (_MAXJSAMPLE * 2 + 1) * sizeof(int));
  ------------------
  |  |  222|  1.28k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.28k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
 1095|  1.28k|  table += _MAXJSAMPLE;         /* so can index -_MAXJSAMPLE .. +_MAXJSAMPLE */
  ------------------
  |  |  222|  1.28k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.28k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
 1096|  1.28k|  cquantize->error_limiter = table;
 1097|       |
 1098|  1.28k|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
 1099|       |  /* Map errors 1:1 up to +- _MAXJSAMPLE/16 */
 1100|  1.28k|  out = 0;
 1101|  21.7k|  for (in = 0; in < STEPSIZE; in++, out++) {
  ------------------
  |  | 1098|  21.7k|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
  |  |  ------------------
  |  |  |  |  222|  21.7k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  21.7k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1101:16): [True: 20.4k, False: 1.28k]
  ------------------
 1102|  20.4k|    table[in] = out;  table[-in] = -out;
 1103|  20.4k|  }
 1104|       |  /* Map errors 1:2 up to +- 3*_MAXJSAMPLE/16 */
 1105|  42.2k|  for (; in < STEPSIZE * 3; in++, out += (in & 1) ? 0 : 1) {
  ------------------
  |  | 1098|  42.2k|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
  |  |  ------------------
  |  |  |  |  222|  42.2k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  42.2k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1105:10): [True: 40.9k, False: 1.28k]
  |  Branch (1105:42): [True: 20.4k, False: 20.4k]
  ------------------
 1106|  40.9k|    table[in] = out;  table[-in] = -out;
 1107|  40.9k|  }
 1108|       |  /* Clamp the rest to final out value (which is (_MAXJSAMPLE+1)/8) */
 1109|   267k|  for (; in <= _MAXJSAMPLE; in++) {
  ------------------
  |  |  222|   267k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   267k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (1109:10): [True: 266k, False: 1.28k]
  ------------------
 1110|   266k|    table[in] = out;  table[-in] = -out;
 1111|   266k|  }
 1112|  1.28k|#undef STEPSIZE
 1113|  1.28k|}
j12init_2pass_quantizer:
 1223|    102|{
 1224|    102|  my_cquantize_ptr cquantize;
 1225|    102|  int i;
 1226|       |
 1227|    102|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    102|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (1227:7): [True: 0, False: 102]
  ------------------
 1228|      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)))
  ------------------
 1229|       |
 1230|    102|  cquantize = (my_cquantize_ptr)
 1231|    102|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    102|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1232|    102|                                sizeof(my_cquantizer));
 1233|    102|  cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
 1234|    102|  cquantize->pub.start_pass = start_pass_2_quant;
 1235|    102|  cquantize->pub.new_color_map = new_color_map_2_quant;
 1236|    102|  cquantize->fserrors = NULL;   /* flag optional arrays not allocated */
 1237|    102|  cquantize->error_limiter = NULL;
 1238|       |
 1239|       |  /* Make sure jdmaster didn't give me a case I can't handle */
 1240|    102|  if (cinfo->out_color_components != 3 ||
  ------------------
  |  Branch (1240:7): [True: 0, False: 102]
  ------------------
 1241|    102|      cinfo->out_color_space == JCS_RGB565 || cinfo->master->lossless)
  ------------------
  |  Branch (1241:7): [True: 0, False: 102]
  |  Branch (1241:47): [True: 0, False: 102]
  ------------------
 1242|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1243|       |
 1244|       |  /* Allocate the histogram/inverse colormap storage */
 1245|    102|  cquantize->histogram = (hist3d)(*cinfo->mem->alloc_small)
 1246|    102|    ((j_common_ptr)cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
  ------------------
  |  |  889|    102|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                  ((j_common_ptr)cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
  ------------------
  |  |  120|    102|#define HIST_C0_ELEMS  (1 << HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|    102|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
 1247|  3.36k|  for (i = 0; i < HIST_C0_ELEMS; i++) {
  ------------------
  |  |  120|  3.36k|#define HIST_C0_ELEMS  (1 << HIST_C0_BITS)
  |  |  ------------------
  |  |  |  |  115|  3.36k|#define HIST_C0_BITS  5         /* bits of precision in R/B histogram */
  |  |  ------------------
  ------------------
  |  Branch (1247:15): [True: 3.26k, False: 102]
  ------------------
 1248|  3.26k|    cquantize->histogram[i] = (hist2d)(*cinfo->mem->alloc_large)
 1249|  3.26k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.26k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1250|  3.26k|       HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  121|  3.26k|#define HIST_C1_ELEMS  (1 << HIST_C1_BITS)
  |  |  ------------------
  |  |  |  |  116|  3.26k|#define HIST_C1_BITS  6         /* bits of precision in G histogram */
  |  |  ------------------
  ------------------
                     HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
  ------------------
  |  |  122|  3.26k|#define HIST_C2_ELEMS  (1 << HIST_C2_BITS)
  |  |  ------------------
  |  |  |  |  117|  3.26k|#define HIST_C2_BITS  5         /* bits of precision in B/R histogram */
  |  |  ------------------
  ------------------
 1251|  3.26k|  }
 1252|    102|  cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
  ------------------
  |  |  210|    102|#define TRUE    1
  ------------------
 1253|       |
 1254|       |  /* Allocate storage for the completed colormap, if required.
 1255|       |   * We do this now since it may affect the memory manager's space
 1256|       |   * calculations.
 1257|       |   */
 1258|    102|  if (cinfo->enable_2pass_quant) {
  ------------------
  |  Branch (1258:7): [True: 102, False: 0]
  ------------------
 1259|       |    /* Make sure color count is acceptable */
 1260|    102|    int desired = cinfo->desired_number_of_colors;
 1261|       |    /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
 1262|    102|    if (desired < 8)
  ------------------
  |  Branch (1262:9): [True: 0, False: 102]
  ------------------
 1263|      0|      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1264|       |    /* Make sure colormap indexes can be represented by _JSAMPLEs */
 1265|    102|    if (desired > MAXNUMCOLORS)
  ------------------
  |  |  110|    102|#define MAXNUMCOLORS  (_MAXJSAMPLE + 1) /* maximum size of colormap */
  |  |  ------------------
  |  |  |  |  108|    102|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|    102|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1265:9): [True: 0, False: 102]
  ------------------
 1266|      0|      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1267|    102|    cquantize->sv_colormap = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
 1268|    102|      ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)desired, (JDIMENSION)3);
  ------------------
  |  |  889|    102|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1269|    102|    cquantize->desired = desired;
 1270|    102|  } else
 1271|      0|    cquantize->sv_colormap = NULL;
 1272|       |
 1273|       |  /* Only F-S dithering or no dithering is supported. */
 1274|       |  /* If user asks for ordered dither, give them F-S. */
 1275|    102|  if (cinfo->dither_mode != JDITHER_NONE)
  ------------------
  |  Branch (1275:7): [True: 51, False: 51]
  ------------------
 1276|     51|    cinfo->dither_mode = JDITHER_FS;
 1277|       |
 1278|       |  /* Allocate Floyd-Steinberg workspace if necessary.
 1279|       |   * This isn't really needed until pass 2, but again it may affect the memory
 1280|       |   * manager's space calculations.  Although we will cope with a later change
 1281|       |   * in dither_mode, we do not promise to honor max_memory_to_use if
 1282|       |   * dither_mode changes.
 1283|       |   */
 1284|    102|  if (cinfo->dither_mode == JDITHER_FS) {
  ------------------
  |  Branch (1284:7): [True: 51, False: 51]
  ------------------
 1285|     51|    cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
 1286|     51|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     51|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1287|     51|       (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR))));
 1288|       |    /* Might as well create the error-limiting table too. */
 1289|     51|    init_error_limit(cinfo);
 1290|     51|  }
 1291|    102|}
jquant2-12.c:init_error_limit:
 1088|     51|{
 1089|     51|  my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
 1090|     51|  int *table;
 1091|     51|  int in, out;
 1092|       |
 1093|     51|  table = (int *)(*cinfo->mem->alloc_small)
 1094|     51|    ((j_common_ptr)cinfo, JPOOL_IMAGE, (_MAXJSAMPLE * 2 + 1) * sizeof(int));
  ------------------
  |  |  889|     51|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                  ((j_common_ptr)cinfo, JPOOL_IMAGE, (_MAXJSAMPLE * 2 + 1) * sizeof(int));
  ------------------
  |  |  108|     51|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     51|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
 1095|     51|  table += _MAXJSAMPLE;         /* so can index -_MAXJSAMPLE .. +_MAXJSAMPLE */
  ------------------
  |  |  108|     51|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     51|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
 1096|     51|  cquantize->error_limiter = table;
 1097|       |
 1098|     51|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
 1099|       |  /* Map errors 1:1 up to +- _MAXJSAMPLE/16 */
 1100|     51|  out = 0;
 1101|  13.1k|  for (in = 0; in < STEPSIZE; in++, out++) {
  ------------------
  |  | 1098|  13.1k|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
  |  |  ------------------
  |  |  |  |  108|  13.1k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  13.1k|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1101:16): [True: 13.0k, False: 51]
  ------------------
 1102|  13.0k|    table[in] = out;  table[-in] = -out;
 1103|  13.0k|  }
 1104|       |  /* Map errors 1:2 up to +- 3*_MAXJSAMPLE/16 */
 1105|  26.1k|  for (; in < STEPSIZE * 3; in++, out += (in & 1) ? 0 : 1) {
  ------------------
  |  | 1098|  26.1k|#define STEPSIZE  ((_MAXJSAMPLE + 1) / 16)
  |  |  ------------------
  |  |  |  |  108|  26.1k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  26.1k|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1105:10): [True: 26.1k, False: 51]
  |  Branch (1105:42): [True: 13.0k, False: 13.0k]
  ------------------
 1106|  26.1k|    table[in] = out;  table[-in] = -out;
 1107|  26.1k|  }
 1108|       |  /* Clamp the rest to final out value (which is (_MAXJSAMPLE+1)/8) */
 1109|   169k|  for (; in <= _MAXJSAMPLE; in++) {
  ------------------
  |  |  108|   169k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|   169k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (1109:10): [True: 169k, False: 51]
  ------------------
 1110|   169k|    table[in] = out;  table[-in] = -out;
 1111|   169k|  }
 1112|     51|#undef STEPSIZE
 1113|     51|}

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

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

