LLVMFuzzerTestOneInput:
   39|  5.51k|{
   40|  5.51k|  tjhandle handle = NULL;
   41|  5.51k|  unsigned char *dstBufs[NUMXFORMS] = { NULL, NULL, NULL };
   42|  5.51k|  size_t dstSizes[NUMXFORMS] = { 0, 0, 0 }, maxBufSize;
   43|  5.51k|  int width = 0, height = 0, jpegSubsamp, i, t;
   44|  5.51k|  tjtransform transforms[NUMXFORMS];
   45|       |#if defined(__has_feature) && __has_feature(memory_sanitizer)
   46|       |  char env[18] = "JSIMD_FORCENONE=1";
   47|       |
   48|       |  /* The libjpeg-turbo SIMD extensions produce false positives with
   49|       |     MemorySanitizer. */
   50|       |  putenv(env);
   51|       |#endif
   52|       |
   53|  5.51k|  if ((handle = tj3Init(TJINIT_TRANSFORM)) == NULL)
  ------------------
  |  Branch (53:7): [True: 0, False: 5.51k]
  ------------------
   54|      0|    goto bailout;
   55|       |
   56|  5.51k|  if (tj3DecompressHeader(handle, data, size) < 0)
  ------------------
  |  Branch (56:7): [True: 780, False: 4.73k]
  ------------------
   57|    780|    goto bailout;
   58|  4.73k|  width = tj3Get(handle, TJPARAM_JPEGWIDTH);
   59|  4.73k|  height = tj3Get(handle, TJPARAM_JPEGHEIGHT);
   60|  4.73k|  jpegSubsamp = tj3Get(handle, TJPARAM_SUBSAMP);
   61|       |
   62|       |  /* Ignore 0-pixel images and images larger than 1 Megapixel.  Casting width
   63|       |     to (uint64_t) prevents integer overflow if width * height > INT_MAX. */
   64|  4.73k|  if (width < 1 || height < 1 || (uint64_t)width * height > 1048576)
  ------------------
  |  Branch (64:7): [True: 721, False: 4.01k]
  |  Branch (64:20): [True: 0, False: 4.01k]
  |  Branch (64:34): [True: 18, False: 3.99k]
  ------------------
   65|    739|    goto bailout;
   66|       |
   67|  3.99k|  tj3Set(handle, TJPARAM_SCANLIMIT, 500);
   68|       |
   69|  3.99k|  if (jpegSubsamp < 0 || jpegSubsamp >= TJ_NUMSAMP)
  ------------------
  |  |  110|  3.81k|#define TJ_NUMSAMP  7
  ------------------
  |  Branch (69:7): [True: 184, False: 3.81k]
  |  Branch (69:26): [True: 0, False: 3.81k]
  ------------------
   70|    184|    jpegSubsamp = TJSAMP_444;
   71|       |
   72|  15.9k|  for (t = 0; t < NUMXFORMS; t++)
  ------------------
  |  |   35|  15.9k|#define NUMXFORMS  3
  ------------------
  |  Branch (72:15): [True: 11.9k, False: 3.99k]
  ------------------
   73|  11.9k|    memset(&transforms[t], 0, sizeof(tjtransform));
   74|       |
   75|  3.99k|  transforms[0].op = TJXOP_NONE;
   76|  3.99k|  transforms[0].options = TJXOPT_PROGRESSIVE | TJXOPT_COPYNONE;
  ------------------
  |  |  883|  3.99k|#define TJXOPT_PROGRESSIVE  (1 << 5)
  ------------------
                transforms[0].options = TJXOPT_PROGRESSIVE | TJXOPT_COPYNONE;
  ------------------
  |  |  889|  3.99k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
   77|  3.99k|  dstBufs[0] =
   78|  3.99k|    (unsigned char *)malloc(tj3JPEGBufSize(width, height, jpegSubsamp));
   79|  3.99k|  if (!dstBufs[0])
  ------------------
  |  Branch (79:7): [True: 0, False: 3.99k]
  ------------------
   80|      0|    goto bailout;
   81|       |
   82|  3.99k|  transforms[1].r.w = (width + 1) / 2;
   83|  3.99k|  transforms[1].r.h = (height + 1) / 2;
   84|  3.99k|  transforms[1].op = TJXOP_TRANSPOSE;
   85|  3.99k|  transforms[1].options = TJXOPT_GRAY | TJXOPT_CROP | TJXOPT_COPYNONE;
  ------------------
  |  |  867|  3.99k|#define TJXOPT_GRAY  (1 << 3)
  ------------------
                transforms[1].options = TJXOPT_GRAY | TJXOPT_CROP | TJXOPT_COPYNONE;
  ------------------
  |  |  862|  3.99k|#define TJXOPT_CROP  (1 << 2)
  ------------------
                transforms[1].options = TJXOPT_GRAY | TJXOPT_CROP | TJXOPT_COPYNONE;
  ------------------
  |  |  889|  3.99k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
   86|  3.99k|  dstBufs[1] =
   87|  3.99k|    (unsigned char *)malloc(tj3JPEGBufSize((width + 1) / 2, (height + 1) / 2,
   88|  3.99k|                                           TJSAMP_GRAY));
   89|  3.99k|  if (!dstBufs[1])
  ------------------
  |  Branch (89:7): [True: 0, False: 3.99k]
  ------------------
   90|      0|    goto bailout;
   91|       |
   92|  3.99k|  transforms[2].op = TJXOP_ROT90;
   93|  3.99k|  transforms[2].options = TJXOPT_TRIM | TJXOPT_COPYNONE | TJXOPT_ARITHMETIC;
  ------------------
  |  |  857|  3.99k|#define TJXOPT_TRIM  (1 << 1)
  ------------------
                transforms[2].options = TJXOPT_TRIM | TJXOPT_COPYNONE | TJXOPT_ARITHMETIC;
  ------------------
  |  |  889|  3.99k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
                transforms[2].options = TJXOPT_TRIM | TJXOPT_COPYNONE | TJXOPT_ARITHMETIC;
  ------------------
  |  |  897|  3.99k|#define TJXOPT_ARITHMETIC  (1 << 7)
  ------------------
   94|  3.99k|  dstBufs[2] =
   95|  3.99k|    (unsigned char *)malloc(tj3JPEGBufSize(height, width, jpegSubsamp));
   96|  3.99k|  if (!dstBufs[2])
  ------------------
  |  Branch (96:7): [True: 0, False: 3.99k]
  ------------------
   97|      0|    goto bailout;
   98|       |
   99|  3.99k|  maxBufSize = tj3JPEGBufSize(width, height, jpegSubsamp);
  100|       |
  101|  3.99k|  tj3Set(handle, TJPARAM_NOREALLOC, 1);
  102|  3.99k|  if (tj3Transform(handle, data, size, NUMXFORMS, dstBufs, dstSizes,
  ------------------
  |  |   35|  3.99k|#define NUMXFORMS  3
  ------------------
  |  Branch (102:7): [True: 39, False: 3.95k]
  ------------------
  103|  3.99k|                   transforms) == 0) {
  104|       |    /* Touch all of the output pixels in order to catch uninitialized reads
  105|       |       when using MemorySanitizer. */
  106|    156|    for (t = 0; t < NUMXFORMS; t++) {
  ------------------
  |  |   35|    156|#define NUMXFORMS  3
  ------------------
  |  Branch (106:17): [True: 117, False: 39]
  ------------------
  107|    117|      int sum = 0;
  108|       |
  109|   859k|      for (i = 0; i < dstSizes[t]; i++)
  ------------------
  |  Branch (109:19): [True: 859k, False: 117]
  ------------------
  110|   859k|        sum += dstBufs[t][i];
  111|       |
  112|       |      /* Prevent the code above from being optimized out.  This test should
  113|       |         never be true, but the compiler doesn't know that. */
  114|    117|      if (sum > 255 * maxBufSize)
  ------------------
  |  Branch (114:11): [True: 0, False: 117]
  ------------------
  115|      0|        goto bailout;
  116|    117|    }
  117|     39|  }
  118|       |
  119|  3.99k|  transforms[0].options &= ~TJXOPT_COPYNONE;
  ------------------
  |  |  889|  3.99k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
  120|  3.99k|  transforms[0].options |= TJXOPT_OPTIMIZE;
  ------------------
  |  |  903|  3.99k|#define TJXOPT_OPTIMIZE  (1 << 8)
  ------------------
  121|  3.99k|  free(dstBufs[0]);
  122|  3.99k|  dstBufs[0] = NULL;
  123|  3.99k|  dstSizes[0] = 0;
  124|       |
  125|  3.99k|  tj3Set(handle, TJPARAM_NOREALLOC, 0);
  126|  3.99k|  if (tj3Transform(handle, data, size, 1, dstBufs, dstSizes,
  ------------------
  |  Branch (126:7): [True: 39, False: 3.95k]
  ------------------
  127|  3.99k|                   transforms) == 0) {
  128|     39|    int sum = 0;
  129|       |
  130|   170k|    for (i = 0; i < dstSizes[0]; i++)
  ------------------
  |  Branch (130:17): [True: 170k, False: 39]
  ------------------
  131|   170k|      sum += dstBufs[0][i];
  132|       |
  133|     39|    if (sum > 255 * maxBufSize)
  ------------------
  |  Branch (133:9): [True: 0, False: 39]
  ------------------
  134|      0|      goto bailout;
  135|     39|  }
  136|       |
  137|  5.51k|bailout:
  138|  22.0k|  for (t = 0; t < NUMXFORMS; t++)
  ------------------
  |  |   35|  22.0k|#define NUMXFORMS  3
  ------------------
  |  Branch (138:15): [True: 16.5k, False: 5.51k]
  ------------------
  139|  16.5k|    free(dstBufs[t]);
  140|  5.51k|  tj3Destroy(handle);
  141|  5.51k|  return 0;
  142|  3.99k|}

jpeg_CreateCompress:
   36|  5.51k|{
   37|  5.51k|  int i;
   38|       |
   39|       |  /* Guard against version mismatches between library and caller. */
   40|  5.51k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   41|  5.51k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  5.51k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (41:7): [True: 0, False: 5.51k]
  ------------------
   42|      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)))
  ------------------
   43|  5.51k|  if (structsize != sizeof(struct jpeg_compress_struct))
  ------------------
  |  Branch (43:7): [True: 0, False: 5.51k]
  ------------------
   44|      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)))
  ------------------
   45|  5.51k|             (int)sizeof(struct jpeg_compress_struct), (int)structsize);
   46|       |
   47|       |  /* For debugging purposes, we zero the whole master structure.
   48|       |   * But the application has already set the err pointer, and may have set
   49|       |   * client_data, so we have to save and restore those fields.
   50|       |   * Note: if application hasn't set client_data, tools like Purify may
   51|       |   * complain here.
   52|       |   */
   53|  5.51k|  {
   54|  5.51k|    struct jpeg_error_mgr *err = cinfo->err;
   55|  5.51k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   56|  5.51k|    memset(cinfo, 0, sizeof(struct jpeg_compress_struct));
   57|  5.51k|    cinfo->err = err;
   58|  5.51k|    cinfo->client_data = client_data;
   59|  5.51k|  }
   60|  5.51k|  cinfo->is_decompressor = FALSE;
  ------------------
  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  ------------------
   61|       |
   62|       |  /* Initialize a memory manager instance for this object */
   63|  5.51k|  jinit_memory_mgr((j_common_ptr)cinfo);
   64|       |
   65|       |  /* Zero out pointers to permanent structures. */
   66|  5.51k|  cinfo->progress = NULL;
   67|  5.51k|  cinfo->dest = NULL;
   68|       |
   69|  5.51k|  cinfo->comp_info = NULL;
   70|       |
   71|  27.5k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   57|  27.5k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (71:15): [True: 22.0k, False: 5.51k]
  ------------------
   72|  22.0k|    cinfo->quant_tbl_ptrs[i] = NULL;
   73|       |#if JPEG_LIB_VERSION >= 70
   74|       |    cinfo->q_scale_factor[i] = 100;
   75|       |#endif
   76|  22.0k|  }
   77|       |
   78|  27.5k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  27.5k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (78:15): [True: 22.0k, False: 5.51k]
  ------------------
   79|  22.0k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   80|  22.0k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   81|  22.0k|  }
   82|       |
   83|       |#if JPEG_LIB_VERSION >= 80
   84|       |  /* Must do it here for emit_dqt in case jpeg_write_tables is used */
   85|       |  cinfo->block_size = DCTSIZE;
   86|       |  cinfo->natural_order = jpeg_natural_order;
   87|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   88|       |#endif
   89|       |
   90|  5.51k|  cinfo->script_space = NULL;
   91|       |
   92|  5.51k|  cinfo->input_gamma = 1.0;     /* in case application forgets */
   93|       |
   94|  5.51k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  5.51k|#define BITS_IN_JSAMPLE  8
  ------------------
   95|       |
   96|       |  /* OK, I'm ready */
   97|  5.51k|  cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  5.51k|#define CSTATE_START     100    /* after create_compress */
  ------------------
   98|       |
   99|       |  /* The master struct is used to store extension parameters, so we allocate it
  100|       |   * here.
  101|       |   */
  102|  5.51k|  cinfo->master = (struct jpeg_comp_master *)
  103|  5.51k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  104|  5.51k|                                  sizeof(my_comp_master));
  105|  5.51k|  memset(cinfo->master, 0, sizeof(my_comp_master));
  106|  5.51k|}
jpeg_destroy_compress:
  115|  5.51k|{
  116|  5.51k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  117|  5.51k|}
jpeg_abort_compress:
  127|    274|{
  128|    274|  jpeg_abort((j_common_ptr)cinfo); /* use common routine */
  129|    274|}
jpeg_suppress_tables:
  146|  7.03k|{
  147|  7.03k|  int i;
  148|  7.03k|  JQUANT_TBL *qtbl;
  149|  7.03k|  JHUFF_TBL *htbl;
  150|       |
  151|  35.1k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   57|  35.1k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (151:15): [True: 28.1k, False: 7.03k]
  ------------------
  152|  28.1k|    if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (152:9): [True: 14.1k, False: 14.0k]
  ------------------
  153|  14.1k|      qtbl->sent_table = suppress;
  154|  28.1k|  }
  155|       |
  156|  35.1k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  35.1k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (156:15): [True: 28.1k, False: 7.03k]
  ------------------
  157|  28.1k|    if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (157:9): [True: 14.0k, False: 14.0k]
  ------------------
  158|  14.0k|      htbl->sent_table = suppress;
  159|  28.1k|    if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (159:9): [True: 14.0k, False: 14.0k]
  ------------------
  160|  14.0k|      htbl->sent_table = suppress;
  161|  28.1k|  }
  162|  7.03k|}
jpeg_finish_compress:
  174|  7.03k|{
  175|  7.03k|  JDIMENSION iMCU_row;
  176|       |
  177|  7.03k|  if (cinfo->global_state == CSTATE_SCANNING ||
  ------------------
  |  |   45|  14.0k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (177:7): [True: 0, False: 7.03k]
  ------------------
  178|  7.03k|      cinfo->global_state == CSTATE_RAW_OK) {
  ------------------
  |  |   46|  7.03k|#define CSTATE_RAW_OK    102    /* start_compress done, write_raw_data OK */
  ------------------
  |  Branch (178:7): [True: 0, False: 7.03k]
  ------------------
  179|       |    /* Terminate first pass */
  180|      0|    if (cinfo->next_scanline < cinfo->image_height)
  ------------------
  |  Branch (180:9): [True: 0, False: 0]
  ------------------
  181|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  182|      0|    (*cinfo->master->finish_pass) (cinfo);
  183|  7.03k|  } else if (cinfo->global_state != CSTATE_WRCOEFS)
  ------------------
  |  |   47|  7.03k|#define CSTATE_WRCOEFS   103    /* jpeg_write_coefficients done */
  ------------------
  |  Branch (183:14): [True: 0, False: 7.03k]
  ------------------
  184|      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)))
  ------------------
  185|       |  /* Perform any remaining passes */
  186|  60.2k|  while (!cinfo->master->is_last_pass) {
  ------------------
  |  Branch (186:10): [True: 53.2k, False: 7.03k]
  ------------------
  187|  53.2k|    (*cinfo->master->prepare_for_pass) (cinfo);
  188|  7.80M|    for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
  ------------------
  |  Branch (188:24): [True: 7.75M, False: 53.2k]
  ------------------
  189|  7.75M|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (189:11): [True: 0, False: 7.75M]
  ------------------
  190|      0|        cinfo->progress->pass_counter = (long)iMCU_row;
  191|      0|        cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows;
  192|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  193|      0|      }
  194|       |      /* We bypass the main controller and invoke coef controller directly;
  195|       |       * all work is being done from the coefficient buffer.
  196|       |       */
  197|  7.75M|      if (cinfo->data_precision == 16) {
  ------------------
  |  Branch (197:11): [True: 0, False: 7.75M]
  ------------------
  198|      0|#ifdef C_LOSSLESS_SUPPORTED
  199|      0|        if (!(*cinfo->coef->compress_data_16) (cinfo, (J16SAMPIMAGE)NULL))
  ------------------
  |  Branch (199:13): [True: 0, False: 0]
  ------------------
  200|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  201|       |#else
  202|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  203|       |#endif
  204|  7.75M|      } else if (cinfo->data_precision == 12) {
  ------------------
  |  Branch (204:18): [True: 1.24M, False: 6.50M]
  ------------------
  205|  1.24M|        if (!(*cinfo->coef->compress_data_12) (cinfo, (J12SAMPIMAGE)NULL))
  ------------------
  |  Branch (205:13): [True: 0, False: 1.24M]
  ------------------
  206|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  207|  6.50M|      } else {
  208|  6.50M|        if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
  ------------------
  |  Branch (208:13): [True: 0, False: 6.50M]
  ------------------
  209|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  210|  6.50M|      }
  211|  7.75M|    }
  212|  53.2k|    (*cinfo->master->finish_pass) (cinfo);
  213|  53.2k|  }
  214|       |  /* Write EOI, do final cleanup */
  215|  7.03k|  (*cinfo->marker->write_file_trailer) (cinfo);
  216|  7.03k|  (*cinfo->dest->term_destination) (cinfo);
  217|       |  /* We can use jpeg_abort to release memory and reset global_state */
  218|  7.03k|  jpeg_abort((j_common_ptr)cinfo);
  219|  7.03k|}
jpeg_write_marker:
  232|   292k|{
  233|   292k|  void (*write_marker_byte) (j_compress_ptr info, int val);
  234|       |
  235|   292k|  if (cinfo->next_scanline != 0 ||
  ------------------
  |  Branch (235:7): [True: 0, False: 292k]
  ------------------
  236|   292k|      (cinfo->global_state != CSTATE_SCANNING &&
  ------------------
  |  |   45|   585k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (236:8): [True: 292k, False: 0]
  ------------------
  237|   292k|       cinfo->global_state != CSTATE_RAW_OK &&
  ------------------
  |  |   46|   585k|#define CSTATE_RAW_OK    102    /* start_compress done, write_raw_data OK */
  ------------------
  |  Branch (237:8): [True: 292k, False: 0]
  ------------------
  238|   292k|       cinfo->global_state != CSTATE_WRCOEFS))
  ------------------
  |  |   47|   292k|#define CSTATE_WRCOEFS   103    /* jpeg_write_coefficients done */
  ------------------
  |  Branch (238:8): [True: 0, False: 292k]
  ------------------
  239|      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)))
  ------------------
  240|       |
  241|   292k|  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
  242|   292k|  write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */
  243|  19.3M|  while (datalen--) {
  ------------------
  |  Branch (243:10): [True: 19.0M, False: 292k]
  ------------------
  244|  19.0M|    (*write_marker_byte) (cinfo, *dataptr);
  245|  19.0M|    dataptr++;
  246|  19.0M|  }
  247|   292k|}

jinit_arith_encoder:
  913|  3.55k|{
  914|  3.55k|  arith_entropy_ptr entropy;
  915|  3.55k|  int i;
  916|       |
  917|  3.55k|  entropy = (arith_entropy_ptr)
  918|  3.55k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  3.55k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  919|  3.55k|                                sizeof(arith_entropy_encoder));
  920|  3.55k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
  921|  3.55k|  entropy->pub.start_pass = start_pass;
  922|  3.55k|  entropy->pub.finish_pass = finish_pass;
  923|       |
  924|       |  /* Mark tables unallocated */
  925|  60.4k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   59|  60.4k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (925:15): [True: 56.9k, False: 3.55k]
  ------------------
  926|  56.9k|    entropy->dc_stats[i] = NULL;
  927|  56.9k|    entropy->ac_stats[i] = NULL;
  928|  56.9k|  }
  929|       |
  930|       |  /* Initialize index for fixed probability estimation */
  931|  3.55k|  entropy->fixed_bin[0] = 113;
  932|  3.55k|}
jcarith.c:start_pass:
  829|  18.4k|{
  830|  18.4k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  831|  18.4k|  int ci, tbl;
  832|  18.4k|  jpeg_component_info *compptr;
  833|       |
  834|  18.4k|  if (gather_statistics)
  ------------------
  |  Branch (834:7): [True: 0, False: 18.4k]
  ------------------
  835|       |    /* Make sure to avoid that in the master control logic!
  836|       |     * We are fully adaptive here and need no extra
  837|       |     * statistics gathering pass!
  838|       |     */
  839|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  840|       |
  841|       |  /* We assume jcmaster.c already validated the progressive scan parameters. */
  842|       |
  843|       |  /* Select execution routines */
  844|  18.4k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (844:7): [True: 17.4k, False: 1.00k]
  ------------------
  845|  17.4k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (845:9): [True: 8.72k, False: 8.72k]
  ------------------
  846|  8.72k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (846:11): [True: 2.52k, False: 6.20k]
  ------------------
  847|  2.52k|        entropy->pub.encode_mcu = encode_mcu_DC_first;
  848|  6.20k|      else
  849|  6.20k|        entropy->pub.encode_mcu = encode_mcu_AC_first;
  850|  8.72k|    } else {
  851|  8.72k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (851:11): [True: 2.52k, False: 6.20k]
  ------------------
  852|  2.52k|        entropy->pub.encode_mcu = encode_mcu_DC_refine;
  853|  6.20k|      else
  854|  6.20k|        entropy->pub.encode_mcu = encode_mcu_AC_refine;
  855|  8.72k|    }
  856|  17.4k|  } else
  857|  1.00k|    entropy->pub.encode_mcu = encode_mcu;
  858|       |
  859|       |  /* Allocate & initialize requested statistics areas */
  860|  39.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (860:16): [True: 20.8k, False: 18.4k]
  ------------------
  861|  20.8k|    compptr = cinfo->cur_comp_info[ci];
  862|       |    /* DC needs no table for refinement scan */
  863|  20.8k|    if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (863:9): [True: 1.23k, False: 19.5k]
  |  Branch (863:42): [True: 7.17k, False: 12.4k]
  |  Branch (863:60): [True: 3.58k, False: 3.58k]
  ------------------
  864|  4.81k|      tbl = compptr->dc_tbl_no;
  865|  4.81k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   59|  4.81k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (865:11): [True: 0, False: 4.81k]
  |  Branch (865:22): [True: 0, False: 4.81k]
  ------------------
  866|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  867|  4.81k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (867:11): [True: 4.12k, False: 692]
  ------------------
  868|  4.12k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  869|  4.12k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  873|  4.12k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  4.12k|#define DC_STAT_BINS  64
  ------------------
  870|  4.81k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  4.81k|#define DC_STAT_BINS  64
  ------------------
  871|       |      /* Initialize DC predictions to 0 */
  872|  4.81k|      entropy->last_dc_val[ci] = 0;
  873|  4.81k|      entropy->dc_context[ci] = 0;
  874|  4.81k|    }
  875|       |    /* AC needs no table when not present */
  876|  20.8k|    if (cinfo->progressive_mode == 0 || cinfo->Se) {
  ------------------
  |  Branch (876:9): [True: 1.23k, False: 19.5k]
  |  Branch (876:41): [True: 12.4k, False: 7.17k]
  ------------------
  877|  13.6k|      tbl = compptr->ac_tbl_no;
  878|  13.6k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   59|  13.6k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (878:11): [True: 0, False: 13.6k]
  |  Branch (878:22): [True: 0, False: 13.6k]
  ------------------
  879|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|  13.6k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (880:11): [True: 4.12k, False: 9.50k]
  ------------------
  881|  4.12k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  882|  4.12k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  873|  4.12k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  4.12k|#define AC_STAT_BINS  256
  ------------------
  883|  13.6k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  13.6k|#define AC_STAT_BINS  256
  ------------------
  884|       |#ifdef CALCULATE_SPECTRAL_CONDITIONING
  885|       |      if (cinfo->progressive_mode)
  886|       |        /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
  887|       |        cinfo->arith_ac_K[tbl] = cinfo->Ss +
  888|       |                                 ((8 + cinfo->Se - cinfo->Ss) >> 4);
  889|       |#endif
  890|  13.6k|    }
  891|  20.8k|  }
  892|       |
  893|       |  /* Initialize arithmetic encoding variables */
  894|  18.4k|  entropy->c = 0;
  895|  18.4k|  entropy->a = 0x10000L;
  896|  18.4k|  entropy->sc = 0;
  897|  18.4k|  entropy->zc = 0;
  898|  18.4k|  entropy->ct = 11;
  899|  18.4k|  entropy->buffer = -1;  /* empty */
  900|       |
  901|       |  /* Initialize restart stuff */
  902|  18.4k|  entropy->restarts_to_go = cinfo->restart_interval;
  903|  18.4k|  entropy->next_restart_num = 0;
  904|  18.4k|}
jcarith.c:encode_mcu_DC_first:
  369|  12.9M|{
  370|  12.9M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  371|  12.9M|  JBLOCKROW block;
  372|  12.9M|  unsigned char *st;
  373|  12.9M|  int blkn, ci, tbl;
  374|  12.9M|  int v, v2, m;
  375|  12.9M|  ISHIFT_TEMPS
  376|       |
  377|       |  /* Emit restart marker if needed */
  378|  12.9M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 0, False: 12.9M]
  ------------------
  379|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|      emit_restart(cinfo, entropy->next_restart_num);
  381|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  382|      0|      entropy->next_restart_num++;
  383|      0|      entropy->next_restart_num &= 7;
  384|      0|    }
  385|      0|    entropy->restarts_to_go--;
  386|      0|  }
  387|       |
  388|       |  /* Encode the MCU data blocks */
  389|  33.0M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (389:18): [True: 20.1M, False: 12.9M]
  ------------------
  390|  20.1M|    block = MCU_data[blkn];
  391|  20.1M|    ci = cinfo->MCU_membership[blkn];
  392|  20.1M|    tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
  393|       |
  394|       |    /* Compute the DC value after the required point transform by Al.
  395|       |     * This is simply an arithmetic right shift.
  396|       |     */
  397|  20.1M|    m = IRIGHT_SHIFT((int)((*block)[0]), cinfo->Al);
  ------------------
  |  |  117|  20.1M|#define IRIGHT_SHIFT(x, shft)   ((x) >> (shft))
  ------------------
  398|       |
  399|       |    /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
  400|       |
  401|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  402|  20.1M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  403|       |
  404|       |    /* Figure F.4: Encode_DC_DIFF */
  405|  20.1M|    if ((v = m - entropy->last_dc_val[ci]) == 0) {
  ------------------
  |  Branch (405:9): [True: 13.8M, False: 6.32M]
  ------------------
  406|  13.8M|      arith_encode(cinfo, st, 0);
  407|  13.8M|      entropy->dc_context[ci] = 0;      /* zero diff category */
  408|  13.8M|    } else {
  409|  6.32M|      entropy->last_dc_val[ci] = m;
  410|  6.32M|      arith_encode(cinfo, st, 1);
  411|       |      /* Figure F.6: Encoding nonzero value v */
  412|       |      /* Figure F.7: Encoding the sign of v */
  413|  6.32M|      if (v > 0) {
  ------------------
  |  Branch (413:11): [True: 2.64M, False: 3.67M]
  ------------------
  414|  2.64M|        arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
  415|  2.64M|        st += 2;                        /* Table F.4: SP = S0 + 2 */
  416|  2.64M|        entropy->dc_context[ci] = 4;    /* small positive diff category */
  417|  3.67M|      } else {
  418|  3.67M|        v = -v;
  419|  3.67M|        arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
  420|  3.67M|        st += 3;                        /* Table F.4: SN = S0 + 3 */
  421|  3.67M|        entropy->dc_context[ci] = 8;    /* small negative diff category */
  422|  3.67M|      }
  423|       |      /* Figure F.8: Encoding the magnitude category of v */
  424|  6.32M|      m = 0;
  425|  6.32M|      if (v -= 1) {
  ------------------
  |  Branch (425:11): [True: 4.49M, False: 1.82M]
  ------------------
  426|  4.49M|        arith_encode(cinfo, st, 1);
  427|  4.49M|        m = 1;
  428|  4.49M|        v2 = v;
  429|  4.49M|        st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
  430|  18.9M|        while (v2 >>= 1) {
  ------------------
  |  Branch (430:16): [True: 14.4M, False: 4.49M]
  ------------------
  431|  14.4M|          arith_encode(cinfo, st, 1);
  432|  14.4M|          m <<= 1;
  433|  14.4M|          st += 1;
  434|  14.4M|        }
  435|  4.49M|      }
  436|  6.32M|      arith_encode(cinfo, st, 0);
  437|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  438|  6.32M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (438:11): [True: 0, False: 6.32M]
  ------------------
  439|      0|        entropy->dc_context[ci] = 0;    /* zero diff category */
  440|  6.32M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (440:16): [True: 3.65M, False: 2.67M]
  ------------------
  441|  3.65M|        entropy->dc_context[ci] += 8;   /* large diff category */
  442|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  443|  6.32M|      st += 14;
  444|  20.8M|      while (m >>= 1)
  ------------------
  |  Branch (444:14): [True: 14.4M, False: 6.32M]
  ------------------
  445|  14.4M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (445:33): [True: 8.21M, False: 6.26M]
  ------------------
  446|  6.32M|    }
  447|  20.1M|  }
  448|       |
  449|  12.9M|  return TRUE;
  ------------------
  |  |  209|  12.9M|#define TRUE    1
  ------------------
  450|  12.9M|}
jcarith.c:emit_byte:
  124|  12.6M|{
  125|  12.6M|  struct jpeg_destination_mgr *dest = cinfo->dest;
  126|       |
  127|  12.6M|  *dest->next_output_byte++ = (JOCTET)val;
  128|  12.6M|  if (--dest->free_in_buffer == 0)
  ------------------
  |  Branch (128:7): [True: 403, False: 12.6M]
  ------------------
  129|    403|    if (!(*dest->empty_output_buffer) (cinfo))
  ------------------
  |  Branch (129:9): [True: 0, False: 403]
  ------------------
  130|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  131|  12.6M|}
jcarith.c:arith_encode:
  226|   474M|{
  227|   474M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  228|   474M|  register unsigned char nl, nm;
  229|   474M|  register JLONG qe, temp;
  230|   474M|  register int sv;
  231|       |
  232|       |  /* Fetch values from our compact representation of Table D.2:
  233|       |   * Qe values and probability estimation state machine
  234|       |   */
  235|   474M|  sv = *st;
  236|   474M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  237|   474M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  238|   474M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  239|       |
  240|       |  /* Encode & estimation procedures per sections D.1.4 & D.1.5 */
  241|   474M|  e->a -= qe;
  242|   474M|  if (val != (sv >> 7)) {
  ------------------
  |  Branch (242:7): [True: 39.9M, False: 434M]
  ------------------
  243|       |    /* Encode the less probable symbol */
  244|  39.9M|    if (e->a >= qe) {
  ------------------
  |  Branch (244:9): [True: 26.6M, False: 13.3M]
  ------------------
  245|       |      /* If the interval size (qe) for the less probable symbol (LPS)
  246|       |       * is larger than the interval size for the MPS, then exchange
  247|       |       * the two symbols for coding efficiency, otherwise code the LPS
  248|       |       * as usual: */
  249|  26.6M|      e->c += e->a;
  250|  26.6M|      e->a = qe;
  251|  26.6M|    }
  252|  39.9M|    *st = (sv & 0x80) ^ nl;     /* Estimate_after_LPS */
  253|   434M|  } else {
  254|       |    /* Encode the more probable symbol */
  255|   434M|    if (e->a >= 0x8000L)
  ------------------
  |  Branch (255:9): [True: 388M, False: 46.1M]
  ------------------
  256|   388M|      return;  /* A >= 0x8000 -> ready, no renormalization required */
  257|  46.1M|    if (e->a < qe) {
  ------------------
  |  Branch (257:9): [True: 12.3M, False: 33.7M]
  ------------------
  258|       |      /* If the interval size (qe) for the less probable symbol (LPS)
  259|       |       * is larger than the interval size for the MPS, then exchange
  260|       |       * the two symbols for coding efficiency: */
  261|  12.3M|      e->c += e->a;
  262|  12.3M|      e->a = qe;
  263|  12.3M|    }
  264|  46.1M|    *st = (sv & 0x80) ^ nm;     /* Estimate_after_MPS */
  265|  46.1M|  }
  266|       |
  267|       |  /* Renormalization & data output per section D.1.6 */
  268|   107M|  do {
  269|   107M|    e->a <<= 1;
  270|   107M|    e->c <<= 1;
  271|   107M|    if (--e->ct == 0) {
  ------------------
  |  Branch (271:9): [True: 13.4M, False: 94.2M]
  ------------------
  272|       |      /* Another byte is ready for output */
  273|  13.4M|      temp = e->c >> 19;
  274|  13.4M|      if (temp > 0xFF) {
  ------------------
  |  Branch (274:11): [True: 524k, False: 12.9M]
  ------------------
  275|       |        /* Handle overflow over all stacked 0xFF bytes */
  276|   524k|        if (e->buffer >= 0) {
  ------------------
  |  Branch (276:13): [True: 524k, False: 0]
  ------------------
  277|   524k|          if (e->zc)
  ------------------
  |  Branch (277:15): [True: 23.0k, False: 501k]
  ------------------
  278|  40.6k|            do emit_byte(0x00, cinfo);
  279|  40.6k|            while (--e->zc);
  ------------------
  |  Branch (279:20): [True: 17.6k, False: 23.0k]
  ------------------
  280|   524k|          emit_byte(e->buffer + 1, cinfo);
  281|   524k|          if (e->buffer + 1 == 0xFF)
  ------------------
  |  Branch (281:15): [True: 11.1k, False: 513k]
  ------------------
  282|  11.1k|            emit_byte(0x00, cinfo);
  283|   524k|        }
  284|   524k|        e->zc += e->sc;  /* carry-over converts stacked 0xFF bytes to 0x00 */
  285|   524k|        e->sc = 0;
  286|       |        /* Note: The 3 spacer bits in the C register guarantee
  287|       |         * that the new buffer byte can't be 0xFF here
  288|       |         * (see page 160 in the P&M JPEG book). */
  289|   524k|        e->buffer = temp & 0xFF;  /* new output byte, might overflow later */
  290|  12.9M|      } else if (temp == 0xFF) {
  ------------------
  |  Branch (290:18): [True: 421k, False: 12.5M]
  ------------------
  291|   421k|        ++e->sc;  /* stack 0xFF byte (which might overflow later) */
  292|  12.5M|      } else {
  293|       |        /* Output all stacked 0xFF bytes, they will not overflow any more */
  294|  12.5M|        if (e->buffer == 0)
  ------------------
  |  Branch (294:13): [True: 1.27M, False: 11.2M]
  ------------------
  295|  1.27M|          ++e->zc;
  296|  11.2M|        else if (e->buffer >= 0) {
  ------------------
  |  Branch (296:18): [True: 11.2M, False: 12.6k]
  ------------------
  297|  11.2M|          if (e->zc)
  ------------------
  |  Branch (297:15): [True: 53.4k, False: 11.1M]
  ------------------
  298|   152k|            do emit_byte(0x00, cinfo);
  299|   152k|            while (--e->zc);
  ------------------
  |  Branch (299:20): [True: 99.0k, False: 53.4k]
  ------------------
  300|  11.2M|          emit_byte(e->buffer, cinfo);
  301|  11.2M|        }
  302|  12.5M|        if (e->sc) {
  ------------------
  |  Branch (302:13): [True: 101k, False: 12.4M]
  ------------------
  303|   101k|          if (e->zc)
  ------------------
  |  Branch (303:15): [True: 522, False: 101k]
  ------------------
  304|  1.50k|            do emit_byte(0x00, cinfo);
  305|  1.50k|            while (--e->zc);
  ------------------
  |  Branch (305:20): [True: 979, False: 522]
  ------------------
  306|   178k|          do {
  307|   178k|            emit_byte(0xFF, cinfo);
  308|   178k|            emit_byte(0x00, cinfo);
  309|   178k|          } while (--e->sc);
  ------------------
  |  Branch (309:20): [True: 76.4k, False: 101k]
  ------------------
  310|   101k|        }
  311|  12.5M|        e->buffer = temp & 0xFF;  /* new output byte (can still overflow) */
  312|  12.5M|      }
  313|  13.4M|      e->c &= 0x7FFFFL;
  314|  13.4M|      e->ct += 8;
  315|  13.4M|    }
  316|   107M|  } while (e->a < 0x8000L);
  ------------------
  |  Branch (316:12): [True: 21.6M, False: 86.0M]
  ------------------
  317|  86.0M|}
jcarith.c:encode_mcu_AC_first:
  460|  35.6M|{
  461|  35.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  462|  35.6M|  JBLOCKROW block;
  463|  35.6M|  unsigned char *st;
  464|  35.6M|  int tbl, k, ke;
  465|  35.6M|  int v, v2, m;
  466|       |
  467|       |  /* Emit restart marker if needed */
  468|  35.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (468:7): [True: 0, False: 35.6M]
  ------------------
  469|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (469:9): [True: 0, False: 0]
  ------------------
  470|      0|      emit_restart(cinfo, entropy->next_restart_num);
  471|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  472|      0|      entropy->next_restart_num++;
  473|      0|      entropy->next_restart_num &= 7;
  474|      0|    }
  475|      0|    entropy->restarts_to_go--;
  476|      0|  }
  477|       |
  478|       |  /* Encode the MCU data block */
  479|  35.6M|  block = MCU_data[0];
  480|  35.6M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  481|       |
  482|       |  /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
  483|       |
  484|       |  /* Establish EOB (end-of-block) index */
  485|  1.32G|  for (ke = cinfo->Se; ke > 0; ke--)
  ------------------
  |  Branch (485:24): [True: 1.29G, False: 32.1M]
  ------------------
  486|       |    /* We must apply the point transform by Al.  For AC coefficients this
  487|       |     * is an integer division with rounding towards 0.  To do this portably
  488|       |     * in C, we shift after obtaining the absolute value.
  489|       |     */
  490|  1.29G|    if ((v = (*block)[jpeg_natural_order[ke]]) >= 0) {
  ------------------
  |  Branch (490:9): [True: 1.28G, False: 3.97M]
  ------------------
  491|  1.28G|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (491:11): [True: 1.68M, False: 1.28G]
  ------------------
  492|  1.28G|    } else {
  493|  3.97M|      v = -v;
  494|  3.97M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (494:11): [True: 1.80M, False: 2.16M]
  ------------------
  495|  3.97M|    }
  496|       |
  497|       |  /* Figure F.5: Encode_AC_Coefficients */
  498|  46.1M|  for (k = cinfo->Ss; k <= ke; k++) {
  ------------------
  |  Branch (498:23): [True: 10.4M, False: 35.6M]
  ------------------
  499|  10.4M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  500|  10.4M|    arith_encode(cinfo, st, 0);         /* EOB decision */
  501|  39.9M|    for (;;) {
  502|  39.9M|      if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
  ------------------
  |  Branch (502:11): [True: 33.1M, False: 6.81M]
  ------------------
  503|  33.1M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (503:13): [True: 4.87M, False: 28.3M]
  ------------------
  504|  4.87M|          arith_encode(cinfo, st + 1, 1);
  505|  4.87M|          arith_encode(cinfo, entropy->fixed_bin, 0);
  506|  4.87M|          break;
  507|  4.87M|        }
  508|  33.1M|      } else {
  509|  6.81M|        v = -v;
  510|  6.81M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (510:13): [True: 5.58M, False: 1.23M]
  ------------------
  511|  5.58M|          arith_encode(cinfo, st + 1, 1);
  512|  5.58M|          arith_encode(cinfo, entropy->fixed_bin, 1);
  513|  5.58M|          break;
  514|  5.58M|        }
  515|  6.81M|      }
  516|  29.5M|      arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  517|  29.5M|    }
  518|  10.4M|    st += 2;
  519|       |    /* Figure F.8: Encoding the magnitude category of v */
  520|  10.4M|    m = 0;
  521|  10.4M|    if (v -= 1) {
  ------------------
  |  Branch (521:9): [True: 8.46M, False: 1.99M]
  ------------------
  522|  8.46M|      arith_encode(cinfo, st, 1);
  523|  8.46M|      m = 1;
  524|  8.46M|      v2 = v;
  525|  8.46M|      if (v2 >>= 1) {
  ------------------
  |  Branch (525:11): [True: 7.00M, False: 1.46M]
  ------------------
  526|  7.00M|        arith_encode(cinfo, st, 1);
  527|  7.00M|        m <<= 1;
  528|  7.00M|        st = entropy->ac_stats[tbl] +
  529|  7.00M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (529:15): [True: 1.04M, False: 5.96M]
  ------------------
  530|  25.2M|        while (v2 >>= 1) {
  ------------------
  |  Branch (530:16): [True: 18.2M, False: 7.00M]
  ------------------
  531|  18.2M|          arith_encode(cinfo, st, 1);
  532|  18.2M|          m <<= 1;
  533|  18.2M|          st += 1;
  534|  18.2M|        }
  535|  7.00M|      }
  536|  8.46M|    }
  537|  10.4M|    arith_encode(cinfo, st, 0);
  538|       |    /* Figure F.9: Encoding the magnitude bit pattern of v */
  539|  10.4M|    st += 14;
  540|  35.7M|    while (m >>= 1)
  ------------------
  |  Branch (540:12): [True: 25.2M, False: 10.4M]
  ------------------
  541|  25.2M|      arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (541:31): [True: 23.0M, False: 2.18M]
  ------------------
  542|  10.4M|  }
  543|       |  /* Encode EOB decision only if k <= cinfo->Se */
  544|  35.6M|  if (k <= cinfo->Se) {
  ------------------
  |  Branch (544:7): [True: 35.3M, False: 367k]
  ------------------
  545|  35.3M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  546|  35.3M|    arith_encode(cinfo, st, 1);
  547|  35.3M|  }
  548|       |
  549|  35.6M|  return TRUE;
  ------------------
  |  |  209|  35.6M|#define TRUE    1
  ------------------
  550|  35.6M|}
jcarith.c:encode_mcu_DC_refine:
  559|  12.9M|{
  560|  12.9M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  561|  12.9M|  unsigned char *st;
  562|  12.9M|  int Al, blkn;
  563|       |
  564|       |  /* Emit restart marker if needed */
  565|  12.9M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (565:7): [True: 0, False: 12.9M]
  ------------------
  566|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (566:9): [True: 0, False: 0]
  ------------------
  567|      0|      emit_restart(cinfo, entropy->next_restart_num);
  568|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  569|      0|      entropy->next_restart_num++;
  570|      0|      entropy->next_restart_num &= 7;
  571|      0|    }
  572|      0|    entropy->restarts_to_go--;
  573|      0|  }
  574|       |
  575|  12.9M|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  576|  12.9M|  Al = cinfo->Al;
  577|       |
  578|       |  /* Encode the MCU data blocks */
  579|  33.0M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (579:18): [True: 20.1M, False: 12.9M]
  ------------------
  580|       |    /* We simply emit the Al'th bit of the DC coefficient value. */
  581|  20.1M|    arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1);
  582|  20.1M|  }
  583|       |
  584|  12.9M|  return TRUE;
  ------------------
  |  |  209|  12.9M|#define TRUE    1
  ------------------
  585|  12.9M|}
jcarith.c:encode_mcu_AC_refine:
  594|  35.6M|{
  595|  35.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  596|  35.6M|  JBLOCKROW block;
  597|  35.6M|  unsigned char *st;
  598|  35.6M|  int tbl, k, ke, kex;
  599|  35.6M|  int v;
  600|       |
  601|       |  /* Emit restart marker if needed */
  602|  35.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (602:7): [True: 0, False: 35.6M]
  ------------------
  603|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (603:9): [True: 0, False: 0]
  ------------------
  604|      0|      emit_restart(cinfo, entropy->next_restart_num);
  605|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  606|      0|      entropy->next_restart_num++;
  607|      0|      entropy->next_restart_num &= 7;
  608|      0|    }
  609|      0|    entropy->restarts_to_go--;
  610|      0|  }
  611|       |
  612|       |  /* Encode the MCU data block */
  613|  35.6M|  block = MCU_data[0];
  614|  35.6M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  615|       |
  616|       |  /* Section G.1.3.3: Encoding of AC coefficients */
  617|       |
  618|       |  /* Establish EOB (end-of-block) index */
  619|  2.16G|  for (ke = cinfo->Se; ke > 0; ke--)
  ------------------
  |  Branch (619:24): [True: 2.13G, False: 30.0M]
  ------------------
  620|       |    /* We must apply the point transform by Al.  For AC coefficients this
  621|       |     * is an integer division with rounding towards 0.  To do this portably
  622|       |     * in C, we shift after obtaining the absolute value.
  623|       |     */
  624|  2.13G|    if ((v = (*block)[jpeg_natural_order[ke]]) >= 0) {
  ------------------
  |  Branch (624:9): [True: 2.13G, False: 3.79M]
  ------------------
  625|  2.13G|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (625:11): [True: 2.66M, False: 2.13G]
  ------------------
  626|  2.13G|    } else {
  627|  3.79M|      v = -v;
  628|  3.79M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (628:11): [True: 2.98M, False: 813k]
  ------------------
  629|  3.79M|    }
  630|       |
  631|       |  /* Establish EOBx (previous stage end-of-block) index */
  632|  54.7M|  for (kex = ke; kex > 0; kex--)
  ------------------
  |  Branch (632:18): [True: 23.8M, False: 30.8M]
  ------------------
  633|  23.8M|    if ((v = (*block)[jpeg_natural_order[kex]]) >= 0) {
  ------------------
  |  Branch (633:9): [True: 19.8M, False: 4.01M]
  ------------------
  634|  19.8M|      if (v >>= cinfo->Ah) break;
  ------------------
  |  Branch (634:11): [True: 2.26M, False: 17.5M]
  ------------------
  635|  19.8M|    } else {
  636|  4.01M|      v = -v;
  637|  4.01M|      if (v >>= cinfo->Ah) break;
  ------------------
  |  Branch (637:11): [True: 2.54M, False: 1.47M]
  ------------------
  638|  4.01M|    }
  639|       |
  640|       |  /* Figure G.10: Encode_AC_Coefficients_SA */
  641|  63.5M|  for (k = cinfo->Ss; k <= ke; k++) {
  ------------------
  |  Branch (641:23): [True: 27.8M, False: 35.6M]
  ------------------
  642|  27.8M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  643|  27.8M|    if (k > kex)
  ------------------
  |  Branch (643:9): [True: 2.68M, False: 25.2M]
  ------------------
  644|  2.68M|      arith_encode(cinfo, st, 0);       /* EOB decision */
  645|   116M|    for (;;) {
  646|   116M|      if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
  ------------------
  |  Branch (646:11): [True: 100M, False: 15.9M]
  ------------------
  647|   100M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (647:13): [True: 13.1M, False: 87.4M]
  ------------------
  648|  13.1M|          if (v >> 1)                   /* previously nonzero coef */
  ------------------
  |  Branch (648:15): [True: 10.4M, False: 2.68M]
  ------------------
  649|  10.4M|            arith_encode(cinfo, st + 2, (v & 1));
  650|  2.68M|          else {                        /* newly nonzero coef */
  651|  2.68M|            arith_encode(cinfo, st + 1, 1);
  652|  2.68M|            arith_encode(cinfo, entropy->fixed_bin, 0);
  653|  2.68M|          }
  654|  13.1M|          break;
  655|  13.1M|        }
  656|   100M|      } else {
  657|  15.9M|        v = -v;
  658|  15.9M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (658:13): [True: 14.7M, False: 1.19M]
  ------------------
  659|  14.7M|          if (v >> 1)                   /* previously nonzero coef */
  ------------------
  |  Branch (659:15): [True: 11.7M, False: 3.01M]
  ------------------
  660|  11.7M|            arith_encode(cinfo, st + 2, (v & 1));
  661|  3.01M|          else {                        /* newly nonzero coef */
  662|  3.01M|            arith_encode(cinfo, st + 1, 1);
  663|  3.01M|            arith_encode(cinfo, entropy->fixed_bin, 1);
  664|  3.01M|          }
  665|  14.7M|          break;
  666|  14.7M|        }
  667|  15.9M|      }
  668|  88.6M|      arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  669|  88.6M|    }
  670|  27.8M|  }
  671|       |  /* Encode EOB decision only if k <= cinfo->Se */
  672|  35.6M|  if (k <= cinfo->Se) {
  ------------------
  |  Branch (672:7): [True: 35.6M, False: 42.4k]
  ------------------
  673|  35.6M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  674|  35.6M|    arith_encode(cinfo, st, 1);
  675|  35.6M|  }
  676|       |
  677|  35.6M|  return TRUE;
  ------------------
  |  |  209|  35.6M|#define TRUE    1
  ------------------
  678|  35.6M|}
jcarith.c:encode_mcu:
  687|  3.45M|{
  688|  3.45M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  689|  3.45M|  jpeg_component_info *compptr;
  690|  3.45M|  JBLOCKROW block;
  691|  3.45M|  unsigned char *st;
  692|  3.45M|  int blkn, ci, tbl, k, ke;
  693|  3.45M|  int v, v2, m;
  694|       |
  695|       |  /* Emit restart marker if needed */
  696|  3.45M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (696:7): [True: 0, False: 3.45M]
  ------------------
  697|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (697:9): [True: 0, False: 0]
  ------------------
  698|      0|      emit_restart(cinfo, entropy->next_restart_num);
  699|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  700|      0|      entropy->next_restart_num++;
  701|      0|      entropy->next_restart_num &= 7;
  702|      0|    }
  703|      0|    entropy->restarts_to_go--;
  704|      0|  }
  705|       |
  706|       |  /* Encode the MCU data blocks */
  707|  7.01M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (707:18): [True: 3.56M, False: 3.45M]
  ------------------
  708|  3.56M|    block = MCU_data[blkn];
  709|  3.56M|    ci = cinfo->MCU_membership[blkn];
  710|  3.56M|    compptr = cinfo->cur_comp_info[ci];
  711|       |
  712|       |    /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
  713|       |
  714|  3.56M|    tbl = compptr->dc_tbl_no;
  715|       |
  716|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  717|  3.56M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  718|       |
  719|       |    /* Figure F.4: Encode_DC_DIFF */
  720|  3.56M|    if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) {
  ------------------
  |  Branch (720:9): [True: 2.68M, False: 875k]
  ------------------
  721|  2.68M|      arith_encode(cinfo, st, 0);
  722|  2.68M|      entropy->dc_context[ci] = 0;      /* zero diff category */
  723|  2.68M|    } else {
  724|   875k|      entropy->last_dc_val[ci] = (*block)[0];
  725|   875k|      arith_encode(cinfo, st, 1);
  726|       |      /* Figure F.6: Encoding nonzero value v */
  727|       |      /* Figure F.7: Encoding the sign of v */
  728|   875k|      if (v > 0) {
  ------------------
  |  Branch (728:11): [True: 493k, False: 381k]
  ------------------
  729|   493k|        arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
  730|   493k|        st += 2;                        /* Table F.4: SP = S0 + 2 */
  731|   493k|        entropy->dc_context[ci] = 4;    /* small positive diff category */
  732|   493k|      } else {
  733|   381k|        v = -v;
  734|   381k|        arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
  735|   381k|        st += 3;                        /* Table F.4: SN = S0 + 3 */
  736|   381k|        entropy->dc_context[ci] = 8;    /* small negative diff category */
  737|   381k|      }
  738|       |      /* Figure F.8: Encoding the magnitude category of v */
  739|   875k|      m = 0;
  740|   875k|      if (v -= 1) {
  ------------------
  |  Branch (740:11): [True: 854k, False: 20.7k]
  ------------------
  741|   854k|        arith_encode(cinfo, st, 1);
  742|   854k|        m = 1;
  743|   854k|        v2 = v;
  744|   854k|        st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
  745|  7.24M|        while (v2 >>= 1) {
  ------------------
  |  Branch (745:16): [True: 6.38M, False: 854k]
  ------------------
  746|  6.38M|          arith_encode(cinfo, st, 1);
  747|  6.38M|          m <<= 1;
  748|  6.38M|          st += 1;
  749|  6.38M|        }
  750|   854k|      }
  751|   875k|      arith_encode(cinfo, st, 0);
  752|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  753|   875k|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (753:11): [True: 0, False: 875k]
  ------------------
  754|      0|        entropy->dc_context[ci] = 0;    /* zero diff category */
  755|   875k|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (755:16): [True: 839k, False: 35.6k]
  ------------------
  756|   839k|        entropy->dc_context[ci] += 8;   /* large diff category */
  757|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  758|   875k|      st += 14;
  759|  7.26M|      while (m >>= 1)
  ------------------
  |  Branch (759:14): [True: 6.38M, False: 875k]
  ------------------
  760|  6.38M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (760:33): [True: 2.98M, False: 3.39M]
  ------------------
  761|   875k|    }
  762|       |
  763|       |    /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
  764|       |
  765|  3.56M|    tbl = compptr->ac_tbl_no;
  766|       |
  767|       |    /* Establish EOB (end-of-block) index */
  768|   217M|    for (ke = DCTSIZE2 - 1; ke > 0; ke--)
  ------------------
  |  |   56|  3.56M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (768:29): [True: 214M, False: 2.88M]
  ------------------
  769|   214M|      if ((*block)[jpeg_natural_order[ke]]) break;
  ------------------
  |  Branch (769:11): [True: 674k, False: 213M]
  ------------------
  770|       |
  771|       |    /* Figure F.5: Encode_AC_Coefficients */
  772|  10.3M|    for (k = 1; k <= ke; k++) {
  ------------------
  |  Branch (772:17): [True: 6.83M, False: 3.56M]
  ------------------
  773|  6.83M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  774|  6.83M|      arith_encode(cinfo, st, 0);       /* EOB decision */
  775|  10.8M|      while ((v = (*block)[jpeg_natural_order[k]]) == 0) {
  ------------------
  |  Branch (775:14): [True: 4.01M, False: 6.83M]
  ------------------
  776|  4.01M|        arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  777|  4.01M|      }
  778|  6.83M|      arith_encode(cinfo, st + 1, 1);
  779|       |      /* Figure F.6: Encoding nonzero value v */
  780|       |      /* Figure F.7: Encoding the sign of v */
  781|  6.83M|      if (v > 0) {
  ------------------
  |  Branch (781:11): [True: 3.50M, False: 3.33M]
  ------------------
  782|  3.50M|        arith_encode(cinfo, entropy->fixed_bin, 0);
  783|  3.50M|      } else {
  784|  3.33M|        v = -v;
  785|  3.33M|        arith_encode(cinfo, entropy->fixed_bin, 1);
  786|  3.33M|      }
  787|  6.83M|      st += 2;
  788|       |      /* Figure F.8: Encoding the magnitude category of v */
  789|  6.83M|      m = 0;
  790|  6.83M|      if (v -= 1) {
  ------------------
  |  Branch (790:11): [True: 1.73M, False: 5.10M]
  ------------------
  791|  1.73M|        arith_encode(cinfo, st, 1);
  792|  1.73M|        m = 1;
  793|  1.73M|        v2 = v;
  794|  1.73M|        if (v2 >>= 1) {
  ------------------
  |  Branch (794:13): [True: 1.53M, False: 194k]
  ------------------
  795|  1.53M|          arith_encode(cinfo, st, 1);
  796|  1.53M|          m <<= 1;
  797|  1.53M|          st = entropy->ac_stats[tbl] +
  798|  1.53M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (798:17): [True: 618k, False: 921k]
  ------------------
  799|  3.18M|          while (v2 >>= 1) {
  ------------------
  |  Branch (799:18): [True: 1.65M, False: 1.53M]
  ------------------
  800|  1.65M|            arith_encode(cinfo, st, 1);
  801|  1.65M|            m <<= 1;
  802|  1.65M|            st += 1;
  803|  1.65M|          }
  804|  1.53M|        }
  805|  1.73M|      }
  806|  6.83M|      arith_encode(cinfo, st, 0);
  807|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  808|  6.83M|      st += 14;
  809|  10.0M|      while (m >>= 1)
  ------------------
  |  Branch (809:14): [True: 3.18M, False: 6.83M]
  ------------------
  810|  3.18M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (810:33): [True: 1.06M, False: 2.12M]
  ------------------
  811|  6.83M|    }
  812|       |    /* Encode EOB decision only if k <= DCTSIZE2 - 1 */
  813|  3.56M|    if (k <= DCTSIZE2 - 1) {
  ------------------
  |  |   56|  3.56M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (813:9): [True: 3.47M, False: 85.6k]
  ------------------
  814|  3.47M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  815|  3.47M|      arith_encode(cinfo, st, 1);
  816|  3.47M|    }
  817|  3.56M|  }
  818|       |
  819|  3.45M|  return TRUE;
  ------------------
  |  |  209|  3.45M|#define TRUE    1
  ------------------
  820|  3.45M|}
jcarith.c:finish_pass:
  140|  18.4k|{
  141|  18.4k|  arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  142|  18.4k|  JLONG temp;
  143|       |
  144|       |  /* Section D.1.8: Termination of encoding */
  145|       |
  146|       |  /* Find the e->c in the coding interval with the largest
  147|       |   * number of trailing zero bits */
  148|  18.4k|  if ((temp = (e->a - 1 + e->c) & 0xFFFF0000UL) < e->c)
  ------------------
  |  Branch (148:7): [True: 5.54k, False: 12.9k]
  ------------------
  149|  5.54k|    e->c = temp + 0x8000L;
  150|  12.9k|  else
  151|  12.9k|    e->c = temp;
  152|       |  /* Send remaining bytes to output */
  153|  18.4k|  e->c <<= e->ct;
  154|  18.4k|  if (e->c & 0xF8000000UL) {
  ------------------
  |  Branch (154:7): [True: 527, False: 17.9k]
  ------------------
  155|       |    /* One final overflow has to be handled */
  156|    527|    if (e->buffer >= 0) {
  ------------------
  |  Branch (156:9): [True: 527, False: 0]
  ------------------
  157|    527|      if (e->zc)
  ------------------
  |  Branch (157:11): [True: 54, False: 473]
  ------------------
  158|  9.22k|        do emit_byte(0x00, cinfo);
  159|  9.22k|        while (--e->zc);
  ------------------
  |  Branch (159:16): [True: 9.17k, False: 54]
  ------------------
  160|    527|      emit_byte(e->buffer + 1, cinfo);
  161|    527|      if (e->buffer + 1 == 0xFF)
  ------------------
  |  Branch (161:11): [True: 22, False: 505]
  ------------------
  162|     22|        emit_byte(0x00, cinfo);
  163|    527|    }
  164|    527|    e->zc += e->sc;  /* carry-over converts stacked 0xFF bytes to 0x00 */
  165|    527|    e->sc = 0;
  166|  17.9k|  } else {
  167|  17.9k|    if (e->buffer == 0)
  ------------------
  |  Branch (167:9): [True: 2.63k, False: 15.2k]
  ------------------
  168|  2.63k|      ++e->zc;
  169|  15.2k|    else if (e->buffer >= 0) {
  ------------------
  |  Branch (169:14): [True: 9.51k, False: 5.77k]
  ------------------
  170|  9.51k|      if (e->zc)
  ------------------
  |  Branch (170:11): [True: 233, False: 9.28k]
  ------------------
  171|  2.09k|        do emit_byte(0x00, cinfo);
  172|  2.09k|        while (--e->zc);
  ------------------
  |  Branch (172:16): [True: 1.86k, False: 233]
  ------------------
  173|  9.51k|      emit_byte(e->buffer, cinfo);
  174|  9.51k|    }
  175|  17.9k|    if (e->sc) {
  ------------------
  |  Branch (175:9): [True: 186, False: 17.7k]
  ------------------
  176|    186|      if (e->zc)
  ------------------
  |  Branch (176:11): [True: 26, False: 160]
  ------------------
  177|    121|        do emit_byte(0x00, cinfo);
  178|    121|        while (--e->zc);
  ------------------
  |  Branch (178:16): [True: 95, False: 26]
  ------------------
  179|   165k|      do {
  180|   165k|        emit_byte(0xFF, cinfo);
  181|   165k|        emit_byte(0x00, cinfo);
  182|   165k|      } while (--e->sc);
  ------------------
  |  Branch (182:16): [True: 164k, False: 186]
  ------------------
  183|    186|    }
  184|  17.9k|  }
  185|       |  /* Output final bytes only if they are not 0x00 */
  186|  18.4k|  if (e->c & 0x7FFF800L) {
  ------------------
  |  Branch (186:7): [True: 15.0k, False: 3.38k]
  ------------------
  187|  15.0k|    if (e->zc)  /* output final pending zero bytes */
  ------------------
  |  Branch (187:9): [True: 205, False: 14.8k]
  ------------------
  188|  1.35k|      do emit_byte(0x00, cinfo);
  189|  1.35k|      while (--e->zc);
  ------------------
  |  Branch (189:14): [True: 1.14k, False: 205]
  ------------------
  190|  15.0k|    emit_byte((e->c >> 19) & 0xFF, cinfo);
  191|  15.0k|    if (((e->c >> 19) & 0xFF) == 0xFF)
  ------------------
  |  Branch (191:9): [True: 123, False: 14.9k]
  ------------------
  192|    123|      emit_byte(0x00, cinfo);
  193|  15.0k|    if (e->c & 0x7F800L) {
  ------------------
  |  Branch (193:9): [True: 1.37k, False: 13.6k]
  ------------------
  194|  1.37k|      emit_byte((e->c >> 11) & 0xFF, cinfo);
  195|  1.37k|      if (((e->c >> 11) & 0xFF) == 0xFF)
  ------------------
  |  Branch (195:11): [True: 0, False: 1.37k]
  ------------------
  196|      0|        emit_byte(0x00, cinfo);
  197|  1.37k|    }
  198|  15.0k|  }
  199|  18.4k|}

jpeg_make_c_derived_tbl:
  262|  17.5k|{
  263|  17.5k|  JHUFF_TBL *htbl;
  264|  17.5k|  c_derived_tbl *dtbl;
  265|  17.5k|  int p, i, l, lastp, si, maxsymbol;
  266|  17.5k|  char huffsize[257];
  267|  17.5k|  unsigned int huffcode[257];
  268|  17.5k|  unsigned int code;
  269|       |
  270|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  271|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  272|       |   */
  273|       |
  274|       |  /* Find the input Huffman table */
  275|  17.5k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|  17.5k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (275:7): [True: 0, False: 17.5k]
  |  Branch (275:20): [True: 0, False: 17.5k]
  ------------------
  276|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  277|  17.5k|  htbl =
  278|  17.5k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (278:5): [True: 4.10k, False: 13.3k]
  ------------------
  279|  17.5k|  if (htbl == NULL)
  ------------------
  |  Branch (279:7): [True: 0, False: 17.5k]
  ------------------
  280|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|       |  /* Allocate a workspace if we haven't already done so. */
  283|  17.5k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (283:7): [True: 4.13k, False: 13.3k]
  ------------------
  284|  4.13k|    *pdtbl = (c_derived_tbl *)
  285|  4.13k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  4.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  286|  4.13k|                                  sizeof(c_derived_tbl));
  287|  17.5k|  dtbl = *pdtbl;
  288|       |
  289|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  290|       |
  291|  17.5k|  p = 0;
  292|   297k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (292:15): [True: 280k, False: 17.5k]
  ------------------
  293|   280k|    i = (int)htbl->bits[l];
  294|   280k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (294:9): [True: 0, False: 280k]
  |  Branch (294:18): [True: 0, False: 280k]
  ------------------
  295|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  296|   335k|    while (i--)
  ------------------
  |  Branch (296:12): [True: 55.8k, False: 280k]
  ------------------
  297|  55.8k|      huffsize[p++] = (char)l;
  298|   280k|  }
  299|  17.5k|  huffsize[p] = 0;
  300|  17.5k|  lastp = p;
  301|       |
  302|       |  /* Figure C.2: generate the codes themselves */
  303|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  304|       |
  305|  17.5k|  code = 0;
  306|  17.5k|  si = huffsize[0];
  307|  17.5k|  p = 0;
  308|  53.6k|  while (huffsize[p]) {
  ------------------
  |  Branch (308:10): [True: 36.1k, False: 17.5k]
  ------------------
  309|  91.9k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (309:12): [True: 55.8k, False: 36.1k]
  ------------------
  310|  55.8k|      huffcode[p++] = code;
  311|  55.8k|      code++;
  312|  55.8k|    }
  313|       |    /* code is now 1 more than the last code used for codelength si; but
  314|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  315|       |     */
  316|  36.1k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (316:9): [True: 0, False: 36.1k]
  ------------------
  317|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|  36.1k|    code <<= 1;
  319|  36.1k|    si++;
  320|  36.1k|  }
  321|       |
  322|       |  /* Figure C.3: generate encoding tables */
  323|       |  /* These are code and size indexed by symbol value */
  324|       |
  325|       |  /* Set all codeless symbols to have code length 0;
  326|       |   * this lets us detect duplicate VAL entries here, and later
  327|       |   * allows emit_bits to detect any attempt to emit such symbols.
  328|       |   */
  329|  17.5k|  memset(dtbl->ehufco, 0, sizeof(dtbl->ehufco));
  330|  17.5k|  memset(dtbl->ehufsi, 0, sizeof(dtbl->ehufsi));
  331|       |
  332|       |  /* This is also a convenient place to check for out-of-range and duplicated
  333|       |   * VAL entries.  We allow 0..255 for AC symbols but only 0..15 for DC in
  334|       |   * lossy mode and 0..16 for DC in lossless mode.  (We could constrain them
  335|       |   * further based on data depth and mode, but this seems enough.)
  336|       |   */
  337|  17.5k|  maxsymbol = isDC ? (cinfo->master->lossless ? 16 : 15) : 255;
  ------------------
  |  Branch (337:15): [True: 4.10k, False: 13.3k]
  |  Branch (337:23): [True: 0, False: 4.10k]
  ------------------
  338|       |
  339|  73.3k|  for (p = 0; p < lastp; p++) {
  ------------------
  |  Branch (339:15): [True: 55.8k, False: 17.5k]
  ------------------
  340|  55.8k|    i = htbl->huffval[p];
  341|  55.8k|    if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
  ------------------
  |  Branch (341:9): [True: 0, False: 55.8k]
  |  Branch (341:18): [True: 0, False: 55.8k]
  |  Branch (341:35): [True: 0, False: 55.8k]
  ------------------
  342|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  343|  55.8k|    dtbl->ehufco[i] = huffcode[p];
  344|  55.8k|    dtbl->ehufsi[i] = huffsize[p];
  345|  55.8k|  }
  346|  17.5k|}
jpeg_gen_optimal_table:
  952|  16.2k|{
  953|  16.2k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  954|  16.2k|  UINT8 bits[MAX_CLEN + 1];     /* bits[k] = # of symbols with code length k */
  955|  16.2k|  int bit_pos[MAX_CLEN + 1];    /* # of symbols with smaller code length */
  956|  16.2k|  int codesize[257];            /* codesize[k] = code length of symbol k */
  957|  16.2k|  int nz_index[257];            /* index of nonzero symbol in the original freq
  958|       |                                   array */
  959|  16.2k|  int others[257];              /* next symbol in current branch of tree */
  960|  16.2k|  int c1, c2;
  961|  16.2k|  int p, i, j;
  962|  16.2k|  int num_nz_symbols;
  963|  16.2k|  long v, v2;
  964|       |
  965|       |  /* This algorithm is explained in section K.2 of the JPEG standard */
  966|       |
  967|  16.2k|  memset(bits, 0, sizeof(bits));
  968|  16.2k|  memset(codesize, 0, sizeof(codesize));
  969|  4.18M|  for (i = 0; i < 257; i++)
  ------------------
  |  Branch (969:15): [True: 4.16M, False: 16.2k]
  ------------------
  970|  4.16M|    others[i] = -1;             /* init links to empty */
  971|       |
  972|  16.2k|  freq[256] = 1;                /* make sure 256 has a nonzero count */
  973|       |  /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
  974|       |   * that no real symbol is given code-value of all ones, because 256
  975|       |   * will be placed last in the largest codeword category.
  976|       |   */
  977|       |
  978|       |  /* Group nonzero frequencies together so we can more easily find the
  979|       |   * smallest.
  980|       |   */
  981|  16.2k|  num_nz_symbols = 0;
  982|  4.18M|  for (i = 0; i < 257; i++) {
  ------------------
  |  Branch (982:15): [True: 4.16M, False: 16.2k]
  ------------------
  983|  4.16M|    if (freq[i]) {
  ------------------
  |  Branch (983:9): [True: 68.5k, False: 4.09M]
  ------------------
  984|  68.5k|      nz_index[num_nz_symbols] = i;
  985|  68.5k|      freq[num_nz_symbols] = freq[i];
  986|  68.5k|      num_nz_symbols++;
  987|  68.5k|    }
  988|  4.16M|  }
  989|       |
  990|       |  /* Huffman's basic algorithm to assign optimal code lengths to symbols */
  991|       |
  992|  68.5k|  for (;;) {
  993|       |    /* Find the two smallest nonzero frequencies; set c1, c2 = their symbols */
  994|       |    /* In case of ties, take the larger symbol number.  Since we have grouped
  995|       |     * the nonzero symbols together, checking for zero symbols is not
  996|       |     * necessary.
  997|       |     */
  998|  68.5k|    c1 = -1;
  999|  68.5k|    c2 = -1;
 1000|  68.5k|    v = 1000000000L;
 1001|  68.5k|    v2 = 1000000000L;
 1002|  1.01M|    for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (1002:17): [True: 948k, False: 68.5k]
  ------------------
 1003|   948k|      if (freq[i] <= v2) {
  ------------------
  |  Branch (1003:11): [True: 272k, False: 675k]
  ------------------
 1004|   272k|        if (freq[i] <= v) {
  ------------------
  |  Branch (1004:13): [True: 214k, False: 57.9k]
  ------------------
 1005|   214k|          c2 = c1;
 1006|   214k|          v2 = v;
 1007|   214k|          v = freq[i];
 1008|   214k|          c1 = i;
 1009|   214k|        } else {
 1010|  57.9k|          v2 = freq[i];
 1011|  57.9k|          c2 = i;
 1012|  57.9k|        }
 1013|   272k|      }
 1014|   948k|    }
 1015|       |
 1016|       |    /* Done if we've merged everything into one frequency */
 1017|  68.5k|    if (c2 < 0)
  ------------------
  |  Branch (1017:9): [True: 16.2k, False: 52.3k]
  ------------------
 1018|  16.2k|      break;
 1019|       |
 1020|       |    /* Else merge the two counts/trees */
 1021|  52.3k|    freq[c1] += freq[c2];
 1022|       |    /* Set the frequency to a very high value instead of zero, so we don't have
 1023|       |     * to check for zero values.
 1024|       |     */
 1025|  52.3k|    freq[c2] = 1000000001L;
 1026|       |
 1027|       |    /* Increment the codesize of everything in c1's tree branch */
 1028|  52.3k|    codesize[c1]++;
 1029|   123k|    while (others[c1] >= 0) {
  ------------------
  |  Branch (1029:12): [True: 70.8k, False: 52.3k]
  ------------------
 1030|  70.8k|      c1 = others[c1];
 1031|  70.8k|      codesize[c1]++;
 1032|  70.8k|    }
 1033|       |
 1034|  52.3k|    others[c1] = c2;            /* chain c2 onto c1's tree branch */
 1035|       |
 1036|       |    /* Increment the codesize of everything in c2's tree branch */
 1037|  52.3k|    codesize[c2]++;
 1038|   126k|    while (others[c2] >= 0) {
  ------------------
  |  Branch (1038:12): [True: 73.6k, False: 52.3k]
  ------------------
 1039|  73.6k|      c2 = others[c2];
 1040|  73.6k|      codesize[c2]++;
 1041|  73.6k|    }
 1042|  52.3k|  }
 1043|       |
 1044|       |  /* Now count the number of symbols of each code length */
 1045|  84.7k|  for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (1045:15): [True: 68.5k, False: 16.2k]
  ------------------
 1046|       |    /* The JPEG standard seems to think that this can't happen, */
 1047|       |    /* but I'm paranoid... */
 1048|  68.5k|    if (codesize[i] > MAX_CLEN)
  ------------------
  |  |  953|  68.5k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1048:9): [True: 0, False: 68.5k]
  ------------------
 1049|      0|      ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1050|       |
 1051|  68.5k|    bits[codesize[i]]++;
 1052|  68.5k|  }
 1053|       |
 1054|       |  /* Count the number of symbols with a length smaller than i bits, so we can
 1055|       |   * construct the symbol table more efficiently.  Note that this includes the
 1056|       |   * pseudo-symbol 256, but since it is the last symbol, it will not affect the
 1057|       |   * table.
 1058|       |   */
 1059|  16.2k|  p = 0;
 1060|   535k|  for (i = 1; i <= MAX_CLEN; i++) {
  ------------------
  |  |  953|   535k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1060:15): [True: 518k, False: 16.2k]
  ------------------
 1061|   518k|    bit_pos[i] = p;
 1062|   518k|    p += bits[i];
 1063|   518k|  }
 1064|       |
 1065|       |  /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
 1066|       |   * Huffman procedure assigned any such lengths, we must adjust the coding.
 1067|       |   * Here is what Rec. ITU-T T.81 | ISO/IEC 10918-1 says about how this next
 1068|       |   * bit works: Since symbols are paired for the longest Huffman code, the
 1069|       |   * symbols are removed from this length category two at a time.  The prefix
 1070|       |   * for the pair (which is one bit shorter) is allocated to one of the pair;
 1071|       |   * then, skipping the BITS entry for that prefix length, a code word from the
 1072|       |   * next shortest nonzero BITS entry is converted into a prefix for two code
 1073|       |   * words one bit longer.
 1074|       |   */
 1075|       |
 1076|   275k|  for (i = MAX_CLEN; i > 16; i--) {
  ------------------
  |  |  953|  16.2k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1076:22): [True: 259k, False: 16.2k]
  ------------------
 1077|   259k|    while (bits[i] > 0) {
  ------------------
  |  Branch (1077:12): [True: 139, False: 259k]
  ------------------
 1078|    139|      j = i - 2;                /* find length of new prefix to be used */
 1079|    197|      while (bits[j] == 0)
  ------------------
  |  Branch (1079:14): [True: 58, False: 139]
  ------------------
 1080|     58|        j--;
 1081|       |
 1082|    139|      bits[i] -= 2;             /* remove two symbols */
 1083|    139|      bits[i - 1]++;            /* one goes in this length */
 1084|    139|      bits[j + 1] += 2;         /* two new symbols in this length */
 1085|    139|      bits[j]--;                /* symbol of this length is now a prefix */
 1086|    139|    }
 1087|   259k|  }
 1088|       |
 1089|       |  /* Remove the count for the pseudo-symbol 256 from the largest codelength */
 1090|   240k|  while (bits[i] == 0)          /* find largest codelength still in use */
  ------------------
  |  Branch (1090:10): [True: 224k, False: 16.2k]
  ------------------
 1091|   224k|    i--;
 1092|  16.2k|  bits[i]--;
 1093|       |
 1094|       |  /* Return final symbol counts (only for lengths 0..16) */
 1095|  16.2k|  memcpy(htbl->bits, bits, sizeof(htbl->bits));
 1096|       |
 1097|       |  /* Return a list of the symbols sorted by code length */
 1098|       |  /* It's not real clear to me why we don't need to consider the codelength
 1099|       |   * changes made above, but Rec. ITU-T T.81 | ISO/IEC 10918-1 seems to think
 1100|       |   * this works.
 1101|       |   */
 1102|  68.5k|  for (i = 0; i < num_nz_symbols - 1; i++) {
  ------------------
  |  Branch (1102:15): [True: 52.3k, False: 16.2k]
  ------------------
 1103|  52.3k|    htbl->huffval[bit_pos[codesize[i]]] = (UINT8)nz_index[i];
 1104|  52.3k|    bit_pos[codesize[i]]++;
 1105|  52.3k|  }
 1106|       |
 1107|       |  /* Set sent_table FALSE so updated table will be written to JPEG file. */
 1108|  16.2k|  htbl->sent_table = FALSE;
  ------------------
  |  |  206|  16.2k|#define FALSE   0               /* values of boolean */
  ------------------
 1109|  16.2k|}
jinit_huff_encoder:
 1163|    612|{
 1164|    612|  huff_entropy_ptr entropy;
 1165|    612|  int i;
 1166|       |
 1167|    612|  entropy = (huff_entropy_ptr)
 1168|    612|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|    612|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1169|    612|                                sizeof(huff_entropy_encoder));
 1170|    612|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
 1171|    612|  entropy->pub.start_pass = start_pass_huff;
 1172|       |
 1173|       |  /* Mark tables unallocated */
 1174|  3.06k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  3.06k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (1174:15): [True: 2.44k, False: 612]
  ------------------
 1175|  2.44k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
 1176|  2.44k|#ifdef ENTROPY_OPT_SUPPORTED
 1177|  2.44k|    entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
 1178|  2.44k|#endif
 1179|  2.44k|  }
 1180|    612|}
jchuff.c:start_pass_huff:
  172|    854|{
  173|    854|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  174|    854|  int ci, dctbl, actbl;
  175|    854|  jpeg_component_info *compptr;
  176|       |
  177|    854|  if (gather_statistics) {
  ------------------
  |  Branch (177:7): [True: 256, False: 598]
  ------------------
  178|    256|#ifdef ENTROPY_OPT_SUPPORTED
  179|    256|    entropy->pub.encode_mcu = encode_mcu_gather;
  180|    256|    entropy->pub.finish_pass = finish_pass_gather;
  181|       |#else
  182|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  183|       |#endif
  184|    598|  } else {
  185|    598|    entropy->pub.encode_mcu = encode_mcu_huff;
  186|    598|    entropy->pub.finish_pass = finish_pass_huff;
  187|    598|  }
  188|       |
  189|    854|#ifdef WITH_SIMD
  190|    854|  entropy->simd = jsimd_can_huff_encode_one_block();
  191|    854|#endif
  192|       |
  193|  1.70k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (193:16): [True: 854, False: 854]
  ------------------
  194|    854|    compptr = cinfo->cur_comp_info[ci];
  195|    854|    dctbl = compptr->dc_tbl_no;
  196|    854|    actbl = compptr->ac_tbl_no;
  197|    854|    if (gather_statistics) {
  ------------------
  |  Branch (197:9): [True: 256, False: 598]
  ------------------
  198|    256|#ifdef ENTROPY_OPT_SUPPORTED
  199|       |      /* Check for invalid table indexes */
  200|       |      /* (make_c_derived_tbl does this in the other path) */
  201|    256|      if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|    256|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (201:11): [True: 0, False: 256]
  |  Branch (201:24): [True: 0, False: 256]
  ------------------
  202|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|    256|      if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|    256|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (203:11): [True: 0, False: 256]
  |  Branch (203:24): [True: 0, False: 256]
  ------------------
  204|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  205|       |      /* Allocate and zero the statistics tables */
  206|       |      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
  207|    256|      if (entropy->dc_count_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (207:11): [True: 256, False: 0]
  ------------------
  208|    256|        entropy->dc_count_ptrs[dctbl] = (long *)
  209|    256|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|    256|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  210|    256|                                      257 * sizeof(long));
  211|    256|      memset(entropy->dc_count_ptrs[dctbl], 0, 257 * sizeof(long));
  212|    256|      if (entropy->ac_count_ptrs[actbl] == NULL)
  ------------------
  |  Branch (212:11): [True: 256, False: 0]
  ------------------
  213|    256|        entropy->ac_count_ptrs[actbl] = (long *)
  214|    256|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|    256|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  215|    256|                                      257 * sizeof(long));
  216|    256|      memset(entropy->ac_count_ptrs[actbl], 0, 257 * sizeof(long));
  217|    256|#endif
  218|    598|    } else {
  219|       |      /* Compute derived values for Huffman tables */
  220|       |      /* We may do this more than once for a table, but it's not expensive */
  221|    598|      jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  209|    598|#define TRUE    1
  ------------------
  222|    598|                              &entropy->dc_derived_tbls[dctbl]);
  223|    598|      jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
  ------------------
  |  |  206|    598|#define FALSE   0               /* values of boolean */
  ------------------
  224|    598|                              &entropy->ac_derived_tbls[actbl]);
  225|    598|    }
  226|       |    /* Initialize DC predictions to 0 */
  227|    854|    entropy->saved.last_dc_val[ci] = 0;
  228|    854|  }
  229|       |
  230|       |  /* Initialize bit buffer to empty */
  231|    854|#ifdef WITH_SIMD
  232|    854|  if (entropy->simd) {
  ------------------
  |  Branch (232:7): [True: 854, False: 0]
  ------------------
  233|    854|    entropy->saved.put_buffer.simd = 0;
  234|       |#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
  235|       |    entropy->saved.free_bits = 0;
  236|       |#else
  237|    854|    entropy->saved.free_bits = SIMD_BIT_BUF_SIZE;
  ------------------
  |  |  106|    854|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  238|    854|#endif
  239|    854|  } else
  240|      0|#endif
  241|      0|  {
  242|      0|    entropy->saved.put_buffer.c = 0;
  243|      0|    entropy->saved.free_bits = BIT_BUF_SIZE;
  ------------------
  |  |  100|      0|#define BIT_BUF_SIZE  64
  ------------------
  244|      0|  }
  245|       |
  246|       |  /* Initialize restart stuff */
  247|    854|  entropy->restarts_to_go = cinfo->restart_interval;
  248|    854|  entropy->next_restart_num = 0;
  249|    854|}
jchuff.c:encode_mcu_gather:
  891|   246k|{
  892|   246k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  893|   246k|  int blkn, ci;
  894|   246k|  jpeg_component_info *compptr;
  895|       |
  896|       |  /* Take care of restart intervals if needed */
  897|   246k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (897:7): [True: 0, False: 246k]
  ------------------
  898|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (898:9): [True: 0, False: 0]
  ------------------
  899|       |      /* Re-initialize DC predictions to 0 */
  900|      0|      for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (900:20): [True: 0, False: 0]
  ------------------
  901|      0|        entropy->saved.last_dc_val[ci] = 0;
  902|       |      /* Update restart state */
  903|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  904|      0|    }
  905|      0|    entropy->restarts_to_go--;
  906|      0|  }
  907|       |
  908|   492k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (908:18): [True: 246k, False: 246k]
  ------------------
  909|   246k|    ci = cinfo->MCU_membership[blkn];
  910|   246k|    compptr = cinfo->cur_comp_info[ci];
  911|   246k|    htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
  912|   246k|                    entropy->dc_count_ptrs[compptr->dc_tbl_no],
  913|   246k|                    entropy->ac_count_ptrs[compptr->ac_tbl_no]);
  914|   246k|    entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
  915|   246k|  }
  916|       |
  917|   246k|  return TRUE;
  ------------------
  |  |  209|   246k|#define TRUE    1
  ------------------
  918|   246k|}
jchuff.c:htest_one_block:
  818|   246k|{
  819|   246k|  register int temp;
  820|   246k|  register int nbits;
  821|   246k|  register int k, r;
  822|   246k|  int max_coef_bits = cinfo->data_precision + 2;
  823|       |
  824|       |  /* Encode the DC coefficient difference per section F.1.2.1 */
  825|       |
  826|   246k|  temp = block[0] - last_dc_val;
  827|   246k|  if (temp < 0)
  ------------------
  |  Branch (827:7): [True: 15.5k, False: 230k]
  ------------------
  828|  15.5k|    temp = -temp;
  829|       |
  830|       |  /* Find the number of bits needed for the magnitude of the coefficient */
  831|   246k|  nbits = 0;
  832|   463k|  while (temp) {
  ------------------
  |  Branch (832:10): [True: 217k, False: 246k]
  ------------------
  833|   217k|    nbits++;
  834|   217k|    temp >>= 1;
  835|   217k|  }
  836|       |  /* Check for out-of-range coefficient values.
  837|       |   * Since we're encoding a difference, the range limit is twice as much.
  838|       |   */
  839|   246k|  if (nbits > max_coef_bits + 1)
  ------------------
  |  Branch (839:7): [True: 6, False: 246k]
  ------------------
  840|      6|    ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  841|       |
  842|       |  /* Count the Huffman symbol for the number of bits */
  843|   246k|  dc_counts[nbits]++;
  844|       |
  845|       |  /* Encode the AC coefficients per section F.1.2.2 */
  846|       |
  847|   246k|  r = 0;                        /* r = run length of zeros */
  848|       |
  849|  15.7M|  for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   56|  15.7M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (849:15): [True: 15.5M, False: 246k]
  ------------------
  850|  15.5M|    if ((temp = block[jpeg_natural_order[k]]) == 0) {
  ------------------
  |  Branch (850:9): [True: 13.6M, False: 1.82M]
  ------------------
  851|  13.6M|      r++;
  852|  13.6M|    } else {
  853|       |      /* if run length > 15, must emit special run-length-16 codes (0xF0) */
  854|  1.82M|      while (r > 15) {
  ------------------
  |  Branch (854:14): [True: 2.86k, False: 1.82M]
  ------------------
  855|  2.86k|        ac_counts[0xF0]++;
  856|  2.86k|        r -= 16;
  857|  2.86k|      }
  858|       |
  859|       |      /* Find the number of bits needed for the magnitude of the coefficient */
  860|  1.82M|      if (temp < 0)
  ------------------
  |  Branch (860:11): [True: 1.58M, False: 239k]
  ------------------
  861|  1.58M|        temp = -temp;
  862|       |
  863|       |      /* Find the number of bits needed for the magnitude of the coefficient */
  864|  1.82M|      nbits = 1;                /* there must be at least one 1 bit */
  865|  2.31M|      while ((temp >>= 1))
  ------------------
  |  Branch (865:14): [True: 494k, False: 1.82M]
  ------------------
  866|   494k|        nbits++;
  867|       |      /* Check for out-of-range coefficient values */
  868|  1.82M|      if (nbits > max_coef_bits)
  ------------------
  |  Branch (868:11): [True: 8, False: 1.82M]
  ------------------
  869|      8|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  870|       |
  871|       |      /* Count Huffman symbol for run length / number of bits */
  872|  1.82M|      ac_counts[(r << 4) + nbits]++;
  873|       |
  874|  1.82M|      r = 0;
  875|  1.82M|    }
  876|  15.5M|  }
  877|       |
  878|       |  /* If the last coef(s) were zero, emit an end-of-block code */
  879|   246k|  if (r > 0)
  ------------------
  |  Branch (879:7): [True: 214k, False: 31.7k]
  ------------------
  880|   214k|    ac_counts[0]++;
  881|   246k|}
jchuff.c:finish_pass_gather:
 1118|    242|{
 1119|    242|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
 1120|    242|  int ci, dctbl, actbl;
 1121|    242|  jpeg_component_info *compptr;
 1122|    242|  JHUFF_TBL **htblptr;
 1123|    242|  boolean did_dc[NUM_HUFF_TBLS];
 1124|    242|  boolean did_ac[NUM_HUFF_TBLS];
 1125|       |
 1126|       |  /* It's important not to apply jpeg_gen_optimal_table more than once
 1127|       |   * per table, because it clobbers the input frequency counts!
 1128|       |   */
 1129|    242|  memset(did_dc, 0, sizeof(did_dc));
 1130|    242|  memset(did_ac, 0, sizeof(did_ac));
 1131|       |
 1132|    484|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (1132:16): [True: 242, False: 242]
  ------------------
 1133|    242|    compptr = cinfo->cur_comp_info[ci];
 1134|    242|    dctbl = compptr->dc_tbl_no;
 1135|    242|    actbl = compptr->ac_tbl_no;
 1136|    242|    if (!did_dc[dctbl]) {
  ------------------
  |  Branch (1136:9): [True: 242, False: 0]
  ------------------
 1137|    242|      htblptr = &cinfo->dc_huff_tbl_ptrs[dctbl];
 1138|    242|      if (*htblptr == NULL)
  ------------------
  |  Branch (1138:11): [True: 0, False: 242]
  ------------------
 1139|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1140|    242|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
 1141|    242|      did_dc[dctbl] = TRUE;
  ------------------
  |  |  209|    242|#define TRUE    1
  ------------------
 1142|    242|    }
 1143|    242|    if (!did_ac[actbl]) {
  ------------------
  |  Branch (1143:9): [True: 242, False: 0]
  ------------------
 1144|    242|      htblptr = &cinfo->ac_huff_tbl_ptrs[actbl];
 1145|    242|      if (*htblptr == NULL)
  ------------------
  |  Branch (1145:11): [True: 0, False: 242]
  ------------------
 1146|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1147|    242|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
 1148|    242|      did_ac[actbl] = TRUE;
  ------------------
  |  |  209|    242|#define TRUE    1
  ------------------
 1149|    242|    }
 1150|    242|  }
 1151|    242|}
jchuff.c:encode_mcu_huff:
  702|   569k|{
  703|   569k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  704|   569k|  working_state state;
  705|   569k|  int blkn, ci;
  706|   569k|  jpeg_component_info *compptr;
  707|       |
  708|       |  /* Load up working state */
  709|   569k|  state.next_output_byte = cinfo->dest->next_output_byte;
  710|   569k|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  711|   569k|  state.cur = entropy->saved;
  712|   569k|  state.cinfo = cinfo;
  713|   569k|  state.simd = entropy->simd;
  714|       |
  715|       |  /* Emit restart marker if needed */
  716|   569k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (716:7): [True: 0, False: 569k]
  ------------------
  717|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (717:9): [True: 0, False: 0]
  ------------------
  718|      0|      if (!emit_restart(&state, entropy->next_restart_num))
  ------------------
  |  Branch (718:11): [True: 0, False: 0]
  ------------------
  719|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  720|      0|  }
  721|       |
  722|       |  /* Encode the MCU data blocks */
  723|   569k|#ifdef WITH_SIMD
  724|   569k|  if (entropy->simd) {
  ------------------
  |  Branch (724:7): [True: 569k, False: 0]
  ------------------
  725|  1.13M|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (725:20): [True: 569k, False: 569k]
  ------------------
  726|   569k|      ci = cinfo->MCU_membership[blkn];
  727|   569k|      compptr = cinfo->cur_comp_info[ci];
  728|   569k|      if (!encode_one_block_simd(&state,
  ------------------
  |  Branch (728:11): [True: 0, False: 569k]
  ------------------
  729|   569k|                                 MCU_data[blkn][0], state.cur.last_dc_val[ci],
  730|   569k|                                 entropy->dc_derived_tbls[compptr->dc_tbl_no],
  731|   569k|                                 entropy->ac_derived_tbls[compptr->ac_tbl_no]))
  732|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  733|       |      /* Update last_dc_val */
  734|   569k|      state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
  735|   569k|    }
  736|   569k|  } else
  737|      0|#endif
  738|      0|  {
  739|      0|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (739:20): [True: 0, False: 0]
  ------------------
  740|      0|      ci = cinfo->MCU_membership[blkn];
  741|      0|      compptr = cinfo->cur_comp_info[ci];
  742|      0|      if (!encode_one_block(&state,
  ------------------
  |  Branch (742:11): [True: 0, False: 0]
  ------------------
  743|      0|                            MCU_data[blkn][0], state.cur.last_dc_val[ci],
  744|      0|                            entropy->dc_derived_tbls[compptr->dc_tbl_no],
  745|      0|                            entropy->ac_derived_tbls[compptr->ac_tbl_no]))
  746|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  747|       |      /* Update last_dc_val */
  748|      0|      state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
  749|      0|    }
  750|      0|  }
  751|       |
  752|       |  /* Completed MCU, so update state */
  753|   569k|  cinfo->dest->next_output_byte = state.next_output_byte;
  754|   569k|  cinfo->dest->free_in_buffer = state.free_in_buffer;
  755|   569k|  entropy->saved = state.cur;
  756|       |
  757|       |  /* Update restart-interval state too */
  758|   569k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (758:7): [True: 0, False: 569k]
  ------------------
  759|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (759:9): [True: 0, False: 0]
  ------------------
  760|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  761|      0|      entropy->next_restart_num++;
  762|      0|      entropy->next_restart_num &= 7;
  763|      0|    }
  764|      0|    entropy->restarts_to_go--;
  765|      0|  }
  766|       |
  767|   569k|  return TRUE;
  ------------------
  |  |  209|   569k|#define TRUE    1
  ------------------
  768|   569k|}
jchuff.c:flush_bits:
  509|    598|{
  510|    598|  JOCTET _buffer[BUFSIZE], *buffer, temp;
  511|    598|  simd_bit_buf_type put_buffer;  int put_bits;
  512|    598|  int localbuf = 0;
  513|       |
  514|    598|  if (state->simd) {
  ------------------
  |  Branch (514:7): [True: 598, False: 0]
  ------------------
  515|       |#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
  516|       |    put_bits = state->cur.free_bits;
  517|       |#else
  518|    598|    put_bits = SIMD_BIT_BUF_SIZE - state->cur.free_bits;
  ------------------
  |  |  106|    598|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  519|    598|#endif
  520|    598|    put_buffer = state->cur.put_buffer.simd;
  521|    598|  } else {
  522|      0|    put_bits = BIT_BUF_SIZE - state->cur.free_bits;
  ------------------
  |  |  100|      0|#define BIT_BUF_SIZE  64
  ------------------
  523|      0|    put_buffer = state->cur.put_buffer.c;
  524|      0|  }
  525|       |
  526|    598|  LOAD_BUFFER()
  ------------------
  |  |  477|    598|#define LOAD_BUFFER() { \
  |  |  478|    598|  if (state->free_in_buffer < BUFSIZE) { \
  |  |  ------------------
  |  |  |  |  475|    598|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|    598|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (478:7): [True: 0, False: 598]
  |  |  ------------------
  |  |  479|      0|    localbuf = 1; \
  |  |  480|      0|    buffer = _buffer; \
  |  |  481|      0|  } else \
  |  |  482|    598|    buffer = state->next_output_byte; \
  |  |  483|    598|}
  ------------------
  527|       |
  528|  2.37k|  while (put_bits >= 8) {
  ------------------
  |  Branch (528:10): [True: 1.77k, False: 598]
  ------------------
  529|  1.77k|    put_bits -= 8;
  530|  1.77k|    temp = (JOCTET)(put_buffer >> put_bits);
  531|  1.77k|    EMIT_BYTE(temp)
  ------------------
  |  |  382|  1.77k|#define EMIT_BYTE(b) { \
  |  |  383|  1.77k|  buffer[0] = (JOCTET)(b); \
  |  |  384|  1.77k|  buffer[1] = 0; \
  |  |  385|  1.77k|  buffer -= -2 + ((JOCTET)(b) < 0xFF); \
  |  |  386|  1.77k|}
  ------------------
  532|  1.77k|  }
  533|    598|  if (put_bits) {
  ------------------
  |  Branch (533:7): [True: 505, False: 93]
  ------------------
  534|       |    /* fill partial byte with ones */
  535|    505|    temp = (JOCTET)((put_buffer << (8 - put_bits)) | (0xFF >> put_bits));
  536|    505|    EMIT_BYTE(temp)
  ------------------
  |  |  382|    505|#define EMIT_BYTE(b) { \
  |  |  383|    505|  buffer[0] = (JOCTET)(b); \
  |  |  384|    505|  buffer[1] = 0; \
  |  |  385|    505|  buffer -= -2 + ((JOCTET)(b) < 0xFF); \
  |  |  386|    505|}
  ------------------
  537|    505|  }
  538|       |
  539|    598|  if (state->simd) {                    /* and reset bit buffer to empty */
  ------------------
  |  Branch (539:7): [True: 598, False: 0]
  ------------------
  540|    598|    state->cur.put_buffer.simd = 0;
  541|       |#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
  542|       |    state->cur.free_bits = 0;
  543|       |#else
  544|    598|    state->cur.free_bits = SIMD_BIT_BUF_SIZE;
  ------------------
  |  |  106|    598|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  545|    598|#endif
  546|    598|  } else {
  547|      0|    state->cur.put_buffer.c = 0;
  548|      0|    state->cur.free_bits = BIT_BUF_SIZE;
  ------------------
  |  |  100|      0|#define BIT_BUF_SIZE  64
  ------------------
  549|      0|  }
  550|    598|  STORE_BUFFER()
  ------------------
  |  |  485|    598|#define STORE_BUFFER() { \
  |  |  486|    598|  if (localbuf) { \
  |  |  ------------------
  |  |  |  Branch (486:7): [True: 0, False: 598]
  |  |  ------------------
  |  |  487|      0|    size_t bytes, bytestocopy; \
  |  |  488|      0|    bytes = buffer - _buffer; \
  |  |  489|      0|    buffer = _buffer; \
  |  |  490|      0|    while (bytes > 0) { \
  |  |  ------------------
  |  |  |  Branch (490:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  491|      0|      bytestocopy = MIN(bytes, state->free_in_buffer); \
  |  |  ------------------
  |  |  |  |  448|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (448:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|      0|      memcpy(state->next_output_byte, buffer, bytestocopy); \
  |  |  493|      0|      state->next_output_byte += bytestocopy; \
  |  |  494|      0|      buffer += bytestocopy; \
  |  |  495|      0|      state->free_in_buffer -= bytestocopy; \
  |  |  496|      0|      if (state->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (496:11): [True: 0, False: 0]
  |  |  ------------------
  |  |  497|      0|        if (!dump_buffer(state)) return FALSE; \
  |  |  ------------------
  |  |  |  |  206|      0|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  |  Branch (497:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  498|      0|      bytes -= bytestocopy; \
  |  |  499|      0|    } \
  |  |  500|    598|  } else { \
  |  |  501|    598|    state->free_in_buffer -= (buffer - state->next_output_byte); \
  |  |  502|    598|    state->next_output_byte = buffer; \
  |  |  503|    598|  } \
  |  |  504|    598|}
  ------------------
  551|       |
  552|    598|  return TRUE;
  ------------------
  |  |  209|    598|#define TRUE    1
  ------------------
  553|    598|}
jchuff.c:encode_one_block_simd:
  563|   569k|{
  564|   569k|  JOCTET _buffer[BUFSIZE], *buffer;
  565|   569k|  int localbuf = 0;
  566|       |
  567|   569k|  LOAD_BUFFER()
  ------------------
  |  |  477|   569k|#define LOAD_BUFFER() { \
  |  |  478|   569k|  if (state->free_in_buffer < BUFSIZE) { \
  |  |  ------------------
  |  |  |  |  475|   569k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|   569k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (478:7): [True: 0, False: 569k]
  |  |  ------------------
  |  |  479|      0|    localbuf = 1; \
  |  |  480|      0|    buffer = _buffer; \
  |  |  481|      0|  } else \
  |  |  482|   569k|    buffer = state->next_output_byte; \
  |  |  483|   569k|}
  ------------------
  568|       |
  569|   569k|  buffer = jsimd_huff_encode_one_block(state, buffer, block, last_dc_val,
  570|   569k|                                       dctbl, actbl);
  571|       |
  572|   569k|  STORE_BUFFER()
  ------------------
  |  |  485|   569k|#define STORE_BUFFER() { \
  |  |  486|   569k|  if (localbuf) { \
  |  |  ------------------
  |  |  |  Branch (486:7): [True: 0, False: 569k]
  |  |  ------------------
  |  |  487|      0|    size_t bytes, bytestocopy; \
  |  |  488|      0|    bytes = buffer - _buffer; \
  |  |  489|      0|    buffer = _buffer; \
  |  |  490|      0|    while (bytes > 0) { \
  |  |  ------------------
  |  |  |  Branch (490:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  491|      0|      bytestocopy = MIN(bytes, state->free_in_buffer); \
  |  |  ------------------
  |  |  |  |  448|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (448:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|      0|      memcpy(state->next_output_byte, buffer, bytestocopy); \
  |  |  493|      0|      state->next_output_byte += bytestocopy; \
  |  |  494|      0|      buffer += bytestocopy; \
  |  |  495|      0|      state->free_in_buffer -= bytestocopy; \
  |  |  496|      0|      if (state->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (496:11): [True: 0, False: 0]
  |  |  ------------------
  |  |  497|      0|        if (!dump_buffer(state)) return FALSE; \
  |  |  ------------------
  |  |  |  |  206|      0|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  |  Branch (497:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  498|      0|      bytes -= bytestocopy; \
  |  |  499|      0|    } \
  |  |  500|   569k|  } else { \
  |  |  501|   569k|    state->free_in_buffer -= (buffer - state->next_output_byte); \
  |  |  502|   569k|    state->next_output_byte = buffer; \
  |  |  503|   569k|  } \
  |  |  504|   569k|}
  ------------------
  573|       |
  574|   569k|  return TRUE;
  ------------------
  |  |  209|   569k|#define TRUE    1
  ------------------
  575|   569k|}
jchuff.c:finish_pass_huff:
  777|    598|{
  778|    598|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  779|    598|  working_state state;
  780|       |
  781|       |  /* Load up working state ... flush_bits needs it */
  782|    598|  state.next_output_byte = cinfo->dest->next_output_byte;
  783|    598|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  784|    598|  state.cur = entropy->saved;
  785|    598|  state.cinfo = cinfo;
  786|    598|  state.simd = entropy->simd;
  787|       |
  788|       |  /* Flush out the last data */
  789|    598|  if (!flush_bits(&state))
  ------------------
  |  Branch (789:7): [True: 0, False: 598]
  ------------------
  790|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  791|       |
  792|       |  /* Update state */
  793|    598|  cinfo->dest->next_output_byte = state.next_output_byte;
  794|    598|  cinfo->dest->free_in_buffer = state.free_in_buffer;
  795|    598|  entropy->saved = state.cur;
  796|    598|}

jinit_marker_writer:
  652|  7.03k|{
  653|  7.03k|  my_marker_ptr marker;
  654|       |
  655|       |  /* Create the subobject */
  656|  7.03k|  marker = (my_marker_ptr)
  657|  7.03k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  7.03k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  658|  7.03k|                                sizeof(my_marker_writer));
  659|  7.03k|  cinfo->marker = (struct jpeg_marker_writer *)marker;
  660|       |  /* Initialize method pointers */
  661|  7.03k|  marker->pub.write_file_header = write_file_header;
  662|  7.03k|  marker->pub.write_frame_header = write_frame_header;
  663|  7.03k|  marker->pub.write_scan_header = write_scan_header;
  664|  7.03k|  marker->pub.write_file_trailer = write_file_trailer;
  665|  7.03k|  marker->pub.write_tables_only = write_tables_only;
  666|  7.03k|  marker->pub.write_marker_header = write_marker_header;
  667|  7.03k|  marker->pub.write_marker_byte = write_marker_byte;
  668|       |  /* Initialize private state */
  669|  7.03k|  marker->last_restart_interval = 0;
  670|  7.03k|}
jcmarker.c:write_file_header:
  476|  7.03k|{
  477|  7.03k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  478|       |
  479|  7.03k|  emit_marker(cinfo, M_SOI);    /* first the SOI */
  480|       |
  481|       |  /* SOI is defined to reset restart interval to 0 */
  482|  7.03k|  marker->last_restart_interval = 0;
  483|       |
  484|  7.03k|  if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
  ------------------
  |  Branch (484:7): [True: 6.81k, False: 216]
  ------------------
  485|  6.81k|    emit_jfif_app0(cinfo);
  486|  7.03k|  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
  ------------------
  |  Branch (486:7): [True: 215, False: 6.81k]
  ------------------
  487|    215|    emit_adobe_app14(cinfo);
  488|  7.03k|}
jcmarker.c:emit_marker:
  131|   397k|{
  132|   397k|  emit_byte(cinfo, 0xFF);
  133|   397k|  emit_byte(cinfo, (int)mark);
  134|   397k|}
jcmarker.c:emit_byte:
  117|  21.8M|{
  118|  21.8M|  struct jpeg_destination_mgr *dest = cinfo->dest;
  119|       |
  120|  21.8M|  *(dest->next_output_byte)++ = (JOCTET)val;
  121|  21.8M|  if (--dest->free_in_buffer == 0) {
  ------------------
  |  Branch (121:7): [True: 1.13k, False: 21.8M]
  ------------------
  122|  1.13k|    if (!(*dest->empty_output_buffer) (cinfo))
  ------------------
  |  Branch (122:9): [True: 0, False: 1.13k]
  ------------------
  123|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  124|  1.13k|  }
  125|  21.8M|}
jcmarker.c:emit_jfif_app0:
  357|  6.81k|{
  358|       |  /*
  359|       |   * Length of APP0 block       (2 bytes)
  360|       |   * Block ID                   (4 bytes - ASCII "JFIF")
  361|       |   * Zero byte                  (1 byte to terminate the ID string)
  362|       |   * Version Major, Minor       (2 bytes - major first)
  363|       |   * Units                      (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
  364|       |   * Xdpu                       (2 bytes - dots per unit horizontal)
  365|       |   * Ydpu                       (2 bytes - dots per unit vertical)
  366|       |   * Thumbnail X size           (1 byte)
  367|       |   * Thumbnail Y size           (1 byte)
  368|       |   */
  369|       |
  370|  6.81k|  emit_marker(cinfo, M_APP0);
  371|       |
  372|  6.81k|  emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
  373|       |
  374|  6.81k|  emit_byte(cinfo, 0x4A);       /* Identifier: ASCII "JFIF" */
  375|  6.81k|  emit_byte(cinfo, 0x46);
  376|  6.81k|  emit_byte(cinfo, 0x49);
  377|  6.81k|  emit_byte(cinfo, 0x46);
  378|  6.81k|  emit_byte(cinfo, 0);
  379|  6.81k|  emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
  380|  6.81k|  emit_byte(cinfo, cinfo->JFIF_minor_version);
  381|  6.81k|  emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
  382|  6.81k|  emit_2bytes(cinfo, (int)cinfo->X_density);
  383|  6.81k|  emit_2bytes(cinfo, (int)cinfo->Y_density);
  384|  6.81k|  emit_byte(cinfo, 0);          /* No thumbnail image */
  385|  6.81k|  emit_byte(cinfo, 0);
  386|  6.81k|}
jcmarker.c:emit_2bytes:
  140|   411k|{
  141|   411k|  emit_byte(cinfo, (value >> 8) & 0xFF);
  142|   411k|  emit_byte(cinfo, value & 0xFF);
  143|   411k|}
jcmarker.c:emit_adobe_app14:
  392|    215|{
  393|       |  /*
  394|       |   * Length of APP14 block      (2 bytes)
  395|       |   * Block ID                   (5 bytes - ASCII "Adobe")
  396|       |   * Version Number             (2 bytes - currently 100)
  397|       |   * Flags0                     (2 bytes - currently 0)
  398|       |   * Flags1                     (2 bytes - currently 0)
  399|       |   * Color transform            (1 byte)
  400|       |   *
  401|       |   * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
  402|       |   * now in circulation seem to use Version = 100, so that's what we write.
  403|       |   *
  404|       |   * We write the color transform byte as 1 if the JPEG color space is
  405|       |   * YCbCr, 2 if it's YCCK, 0 otherwise.  Adobe's definition has to do with
  406|       |   * whether the encoder performed a transformation, which is pretty useless.
  407|       |   */
  408|       |
  409|    215|  emit_marker(cinfo, M_APP14);
  410|       |
  411|    215|  emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
  412|       |
  413|    215|  emit_byte(cinfo, 0x41);       /* Identifier: ASCII "Adobe" */
  414|    215|  emit_byte(cinfo, 0x64);
  415|    215|  emit_byte(cinfo, 0x6F);
  416|    215|  emit_byte(cinfo, 0x62);
  417|    215|  emit_byte(cinfo, 0x65);
  418|    215|  emit_2bytes(cinfo, 100);      /* Version */
  419|    215|  emit_2bytes(cinfo, 0);        /* Flags0 */
  420|    215|  emit_2bytes(cinfo, 0);        /* Flags1 */
  421|    215|  switch (cinfo->jpeg_color_space) {
  422|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (422:3): [True: 0, False: 215]
  ------------------
  423|      0|    emit_byte(cinfo, 1);        /* Color transform = 1 */
  424|      0|    break;
  425|      0|  case JCS_YCCK:
  ------------------
  |  Branch (425:3): [True: 0, False: 215]
  ------------------
  426|      0|    emit_byte(cinfo, 2);        /* Color transform = 2 */
  427|      0|    break;
  428|    215|  default:
  ------------------
  |  Branch (428:3): [True: 215, False: 0]
  ------------------
  429|    215|    emit_byte(cinfo, 0);        /* Color transform = 0 */
  430|    215|    break;
  431|    215|  }
  432|    215|}
jcmarker.c:write_frame_header:
  501|  6.85k|{
  502|  6.85k|  int ci, prec = 0;
  503|  6.85k|  boolean is_baseline;
  504|  6.85k|  jpeg_component_info *compptr;
  505|       |
  506|  6.85k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (506:7): [True: 6.85k, False: 0]
  ------------------
  507|       |    /* Emit DQT for each quantization table.
  508|       |     * Note that emit_dqt() suppresses any duplicate tables.
  509|       |     */
  510|  15.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (510:46): [True: 8.92k, False: 6.85k]
  ------------------
  511|  8.92k|         ci++, compptr++) {
  512|  8.92k|      prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  513|  8.92k|    }
  514|       |    /* now prec is nonzero iff there are any 16-bit quant tables. */
  515|  6.85k|  }
  516|       |
  517|       |  /* Check for a non-baseline specification.
  518|       |   * Note we assume that Huffman table numbers won't be changed later.
  519|       |   */
  520|  6.85k|  if (cinfo->arith_code || cinfo->progressive_mode ||
  ------------------
  |  Branch (520:7): [True: 3.52k, False: 3.32k]
  |  Branch (520:28): [True: 2.72k, False: 598]
  ------------------
  521|  6.85k|      cinfo->master->lossless || cinfo->data_precision != 8) {
  ------------------
  |  Branch (521:7): [True: 0, False: 598]
  |  Branch (521:34): [True: 242, False: 356]
  ------------------
  522|  6.49k|    is_baseline = FALSE;
  ------------------
  |  |  206|  6.49k|#define FALSE   0               /* values of boolean */
  ------------------
  523|  6.49k|  } else {
  524|    356|    is_baseline = TRUE;
  ------------------
  |  |  209|    356|#define TRUE    1
  ------------------
  525|    712|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (525:46): [True: 356, False: 356]
  ------------------
  526|    356|         ci++, compptr++) {
  527|    356|      if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
  ------------------
  |  Branch (527:11): [True: 0, False: 356]
  |  Branch (527:37): [True: 0, False: 356]
  ------------------
  528|      0|        is_baseline = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  529|    356|    }
  530|    356|    if (prec && is_baseline) {
  ------------------
  |  Branch (530:9): [True: 1, False: 355]
  |  Branch (530:17): [True: 1, False: 0]
  ------------------
  531|      1|      is_baseline = FALSE;
  ------------------
  |  |  206|      1|#define FALSE   0               /* values of boolean */
  ------------------
  532|       |      /* If it's baseline except for quantizer size, warn the user */
  533|      1|      TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
  ------------------
  |  |  297|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  298|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  534|      1|    }
  535|    356|  }
  536|       |
  537|       |  /* Emit the proper SOF marker */
  538|  6.85k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (538:7): [True: 3.52k, False: 3.32k]
  ------------------
  539|  3.52k|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (539:9): [True: 2.52k, False: 1.00k]
  ------------------
  540|  2.52k|      emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
  541|  1.00k|    else
  542|  1.00k|      emit_sof(cinfo, M_SOF9);  /* SOF code for sequential arithmetic */
  543|  3.52k|  } else {
  544|  3.32k|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (544:9): [True: 2.72k, False: 598]
  ------------------
  545|  2.72k|      emit_sof(cinfo, M_SOF2);  /* SOF code for progressive Huffman */
  546|    598|    else if (cinfo->master->lossless)
  ------------------
  |  Branch (546:14): [True: 0, False: 598]
  ------------------
  547|      0|      emit_sof(cinfo, M_SOF3);  /* SOF code for lossless Huffman */
  548|    598|    else if (is_baseline)
  ------------------
  |  Branch (548:14): [True: 355, False: 243]
  ------------------
  549|    355|      emit_sof(cinfo, M_SOF0);  /* SOF code for baseline implementation */
  550|    243|    else
  551|    243|      emit_sof(cinfo, M_SOF1);  /* SOF code for non-baseline Huffman file */
  552|  3.32k|  }
  553|  6.85k|}
jcmarker.c:emit_dqt:
  154|  8.92k|{
  155|  8.92k|  JQUANT_TBL *qtbl = cinfo->quant_tbl_ptrs[index];
  156|  8.92k|  int prec;
  157|  8.92k|  int i;
  158|       |
  159|  8.92k|  if (qtbl == NULL)
  ------------------
  |  Branch (159:7): [True: 0, False: 8.92k]
  ------------------
  160|      0|    ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|       |
  162|  8.92k|  prec = 0;
  163|   580k|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   56|   580k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (163:15): [True: 571k, False: 8.92k]
  ------------------
  164|   571k|    if (qtbl->quantval[i] > 255)
  ------------------
  |  Branch (164:9): [True: 2.48k, False: 568k]
  ------------------
  165|  2.48k|      prec = 1;
  166|   571k|  }
  167|       |
  168|  8.92k|  if (!qtbl->sent_table) {
  ------------------
  |  Branch (168:7): [True: 6.93k, False: 1.99k]
  ------------------
  169|  6.93k|    emit_marker(cinfo, M_DQT);
  170|       |
  171|  6.93k|    emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
  ------------------
  |  |   56|     41|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
                  emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
  ------------------
  |  |   56|  6.88k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (171:24): [True: 41, False: 6.88k]
  ------------------
  172|       |
  173|  6.93k|    emit_byte(cinfo, index + (prec << 4));
  174|       |
  175|   450k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   56|   450k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (175:17): [True: 443k, False: 6.93k]
  ------------------
  176|       |      /* The table entries must be emitted in zigzag order. */
  177|   443k|      unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
  178|   443k|      if (prec)
  ------------------
  |  Branch (178:11): [True: 2.62k, False: 440k]
  ------------------
  179|  2.62k|        emit_byte(cinfo, (int)(qval >> 8));
  180|   443k|      emit_byte(cinfo, (int)(qval & 0xFF));
  181|   443k|    }
  182|       |
  183|  6.93k|    qtbl->sent_table = TRUE;
  ------------------
  |  |  209|  6.93k|#define TRUE    1
  ------------------
  184|  6.93k|  }
  185|       |
  186|  8.92k|  return prec;
  187|  8.92k|}
jcmarker.c:emit_sof:
  292|  6.85k|{
  293|  6.85k|  int ci;
  294|  6.85k|  jpeg_component_info *compptr;
  295|       |
  296|  6.85k|  emit_marker(cinfo, code);
  297|       |
  298|  6.85k|  emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
  299|       |
  300|       |  /* Make sure image isn't bigger than SOF field can handle */
  301|  6.85k|  if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   31|  6.85k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   30|  6.85k|#define _jpeg_width  image_width
  ------------------
  |  Branch (301:7): [True: 0, False: 6.85k]
  |  Branch (301:45): [True: 0, False: 6.85k]
  ------------------
  302|      0|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  303|       |
  304|  6.85k|  emit_byte(cinfo, cinfo->data_precision);
  305|  6.85k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
  ------------------
  |  |   31|  6.85k|#define _jpeg_height  image_height
  ------------------
  306|  6.85k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
  ------------------
  |  |   30|  6.85k|#define _jpeg_width  image_width
  ------------------
  307|       |
  308|  6.85k|  emit_byte(cinfo, cinfo->num_components);
  309|       |
  310|  15.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:44): [True: 8.92k, False: 6.85k]
  ------------------
  311|  8.92k|       ci++, compptr++) {
  312|  8.92k|    emit_byte(cinfo, compptr->component_id);
  313|  8.92k|    emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
  314|  8.92k|    emit_byte(cinfo, compptr->quant_tbl_no);
  315|  8.92k|  }
  316|  6.85k|}
jcmarker.c:write_scan_header:
  564|  37.2k|{
  565|  37.2k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  566|  37.2k|  int i;
  567|  37.2k|  jpeg_component_info *compptr;
  568|       |
  569|  37.2k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (569:7): [True: 18.4k, False: 18.7k]
  ------------------
  570|       |    /* Emit arith conditioning info.  We may have some duplication
  571|       |     * if the file has multiple scans, but it's so small it's hardly
  572|       |     * worth worrying about.
  573|       |     */
  574|  18.4k|    emit_dac(cinfo);
  575|  18.7k|  } else {
  576|       |    /* Emit Huffman tables.
  577|       |     * Note that emit_dht() suppresses any duplicate tables.
  578|       |     */
  579|  39.0k|    for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (579:17): [True: 20.2k, False: 18.7k]
  ------------------
  580|  20.2k|      compptr = cinfo->cur_comp_info[i];
  581|       |      /* DC needs no table for refinement scan */
  582|  20.2k|      if ((cinfo->Ss == 0 && cinfo->Ah == 0) || cinfo->master->lossless)
  ------------------
  |  Branch (582:12): [True: 7.47k, False: 12.7k]
  |  Branch (582:30): [True: 4.10k, False: 3.36k]
  |  Branch (582:49): [True: 0, False: 16.1k]
  ------------------
  583|  4.10k|        emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
  ------------------
  |  |  206|  4.10k|#define FALSE   0               /* values of boolean */
  ------------------
  584|       |      /* AC needs no table when not present, and lossless mode uses only DC
  585|       |         tables. */
  586|  20.2k|      if (cinfo->Se && !cinfo->master->lossless)
  ------------------
  |  Branch (586:11): [True: 13.3k, False: 6.87k]
  |  Branch (586:24): [True: 13.3k, False: 0]
  ------------------
  587|  13.3k|        emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
  ------------------
  |  |  209|  13.3k|#define TRUE    1
  ------------------
  588|  20.2k|    }
  589|  18.7k|  }
  590|       |
  591|       |  /* Emit DRI if required --- note that DRI value could change for each scan.
  592|       |   * We avoid wasting space with unnecessary DRIs, however.
  593|       |   */
  594|  37.2k|  if (cinfo->restart_interval != marker->last_restart_interval) {
  ------------------
  |  Branch (594:7): [True: 0, False: 37.2k]
  ------------------
  595|      0|    emit_dri(cinfo);
  596|      0|    marker->last_restart_interval = cinfo->restart_interval;
  597|      0|  }
  598|       |
  599|  37.2k|  emit_sos(cinfo);
  600|  37.2k|}
jcmarker.c:emit_dac:
  233|  18.4k|{
  234|  18.4k|#ifdef C_ARITH_CODING_SUPPORTED
  235|  18.4k|  char dc_in_use[NUM_ARITH_TBLS];
  236|  18.4k|  char ac_in_use[NUM_ARITH_TBLS];
  237|  18.4k|  int length, i;
  238|  18.4k|  jpeg_component_info *compptr;
  239|       |
  240|   313k|  for (i = 0; i < NUM_ARITH_TBLS; i++)
  ------------------
  |  |   59|   313k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (240:15): [True: 295k, False: 18.4k]
  ------------------
  241|   295k|    dc_in_use[i] = ac_in_use[i] = 0;
  242|       |
  243|  39.2k|  for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (243:15): [True: 20.8k, False: 18.4k]
  ------------------
  244|  20.8k|    compptr = cinfo->cur_comp_info[i];
  245|       |    /* DC needs no table for refinement scan */
  246|  20.8k|    if (cinfo->Ss == 0 && cinfo->Ah == 0)
  ------------------
  |  Branch (246:9): [True: 8.40k, False: 12.4k]
  |  Branch (246:27): [True: 4.81k, False: 3.58k]
  ------------------
  247|  4.81k|      dc_in_use[compptr->dc_tbl_no] = 1;
  248|       |    /* AC needs no table when not present */
  249|  20.8k|    if (cinfo->Se)
  ------------------
  |  Branch (249:9): [True: 13.6k, False: 7.17k]
  ------------------
  250|  13.6k|      ac_in_use[compptr->ac_tbl_no] = 1;
  251|  20.8k|  }
  252|       |
  253|  18.4k|  length = 0;
  254|   313k|  for (i = 0; i < NUM_ARITH_TBLS; i++)
  ------------------
  |  |   59|   313k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (254:15): [True: 295k, False: 18.4k]
  ------------------
  255|   295k|    length += dc_in_use[i] + ac_in_use[i];
  256|       |
  257|  18.4k|  if (length) {
  ------------------
  |  Branch (257:7): [True: 15.9k, False: 2.52k]
  ------------------
  258|  15.9k|    emit_marker(cinfo, M_DAC);
  259|       |
  260|  15.9k|    emit_2bytes(cinfo, length * 2 + 2);
  261|       |
  262|   270k|    for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   59|   270k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (262:17): [True: 254k, False: 15.9k]
  ------------------
  263|   254k|      if (dc_in_use[i]) {
  ------------------
  |  Branch (263:11): [True: 4.12k, False: 250k]
  ------------------
  264|  4.12k|        emit_byte(cinfo, i);
  265|  4.12k|        emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i] << 4));
  266|  4.12k|      }
  267|   254k|      if (ac_in_use[i]) {
  ------------------
  |  Branch (267:11): [True: 13.5k, False: 241k]
  ------------------
  268|  13.5k|        emit_byte(cinfo, i + 0x10);
  269|  13.5k|        emit_byte(cinfo, cinfo->arith_ac_K[i]);
  270|  13.5k|      }
  271|   254k|    }
  272|  15.9k|  }
  273|  18.4k|#endif /* C_ARITH_CODING_SUPPORTED */
  274|  18.4k|}
jcmarker.c:emit_dht:
  193|  17.5k|{
  194|  17.5k|  JHUFF_TBL *htbl;
  195|  17.5k|  int length, i;
  196|       |
  197|  17.5k|  if (is_ac) {
  ------------------
  |  Branch (197:7): [True: 13.3k, False: 4.10k]
  ------------------
  198|  13.3k|    htbl = cinfo->ac_huff_tbl_ptrs[index];
  199|  13.3k|    index += 0x10;              /* output index has AC bit set */
  200|  13.3k|  } else {
  201|  4.10k|    htbl = cinfo->dc_huff_tbl_ptrs[index];
  202|  4.10k|  }
  203|       |
  204|  17.5k|  if (htbl == NULL)
  ------------------
  |  Branch (204:7): [True: 0, False: 17.5k]
  ------------------
  205|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  206|       |
  207|  17.5k|  if (!htbl->sent_table) {
  ------------------
  |  Branch (207:7): [True: 16.9k, False: 574]
  ------------------
  208|  16.9k|    emit_marker(cinfo, M_DHT);
  209|       |
  210|  16.9k|    length = 0;
  211|   287k|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (211:17): [True: 270k, False: 16.9k]
  ------------------
  212|   270k|      length += htbl->bits[i];
  213|       |
  214|  16.9k|    emit_2bytes(cinfo, length + 2 + 1 + 16);
  215|  16.9k|    emit_byte(cinfo, index);
  216|       |
  217|   287k|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (217:17): [True: 270k, False: 16.9k]
  ------------------
  218|   270k|      emit_byte(cinfo, htbl->bits[i]);
  219|       |
  220|  71.3k|    for (i = 0; i < length; i++)
  ------------------
  |  Branch (220:17): [True: 54.3k, False: 16.9k]
  ------------------
  221|  54.3k|      emit_byte(cinfo, htbl->huffval[i]);
  222|       |
  223|  16.9k|    htbl->sent_table = TRUE;
  ------------------
  |  |  209|  16.9k|#define TRUE    1
  ------------------
  224|  16.9k|  }
  225|  17.5k|}
jcmarker.c:emit_sos:
  322|  37.2k|{
  323|  37.2k|  int i, td, ta;
  324|  37.2k|  jpeg_component_info *compptr;
  325|       |
  326|  37.2k|  emit_marker(cinfo, M_SOS);
  327|       |
  328|  37.2k|  emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
  329|       |
  330|  37.2k|  emit_byte(cinfo, cinfo->comps_in_scan);
  331|       |
  332|  78.2k|  for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (332:15): [True: 41.0k, False: 37.2k]
  ------------------
  333|  41.0k|    compptr = cinfo->cur_comp_info[i];
  334|  41.0k|    emit_byte(cinfo, compptr->component_id);
  335|       |
  336|       |    /* We emit 0 for unused field(s); this is recommended by the P&M text
  337|       |     * but does not seem to be specified in the standard.
  338|       |     */
  339|       |
  340|       |    /* DC needs no table for refinement scan */
  341|  41.0k|    td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0;
  ------------------
  |  Branch (341:10): [True: 15.8k, False: 25.1k]
  |  Branch (341:28): [True: 8.92k, False: 6.95k]
  ------------------
  342|       |    /* AC needs no table when not present */
  343|  41.0k|    ta = cinfo->Se ? compptr->ac_tbl_no : 0;
  ------------------
  |  Branch (343:10): [True: 27.0k, False: 14.0k]
  ------------------
  344|       |
  345|  41.0k|    emit_byte(cinfo, (td << 4) + ta);
  346|  41.0k|  }
  347|       |
  348|  37.2k|  emit_byte(cinfo, cinfo->Ss);
  349|  37.2k|  emit_byte(cinfo, cinfo->Se);
  350|  37.2k|  emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
  351|  37.2k|}
jcmarker.c:write_file_trailer:
  609|  6.75k|{
  610|  6.75k|  emit_marker(cinfo, M_EOI);
  611|  6.75k|}
jcmarker.c:write_marker_header:
  446|   292k|{
  447|   292k|  if (datalen > (unsigned int)65533)            /* safety check */
  ------------------
  |  Branch (447:7): [True: 0, False: 292k]
  ------------------
  448|      0|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  449|       |
  450|   292k|  emit_marker(cinfo, (JPEG_MARKER)marker);
  451|       |
  452|   292k|  emit_2bytes(cinfo, (int)(datalen + 2));       /* total length */
  453|   292k|}
jcmarker.c:write_marker_byte:
  458|  19.0M|{
  459|  19.0M|  emit_byte(cinfo, val);
  460|  19.0M|}

jinit_c_master_control:
  606|  7.03k|{
  607|  7.03k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  608|       |
  609|  7.03k|  master->pub.prepare_for_pass = prepare_for_pass;
  610|  7.03k|  master->pub.pass_startup = pass_startup;
  611|  7.03k|  master->pub.finish_pass = finish_pass_master;
  612|  7.03k|  master->pub.is_last_pass = FALSE;
  ------------------
  |  |  206|  7.03k|#define FALSE   0               /* values of boolean */
  ------------------
  613|       |
  614|  7.03k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (614:7): [True: 5.41k, False: 1.61k]
  ------------------
  615|  5.41k|#ifdef NEED_SCAN_SCRIPT
  616|  5.41k|    validate_script(cinfo);
  617|       |#else
  618|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  619|       |#endif
  620|  5.41k|  } else {
  621|  1.61k|    cinfo->progressive_mode = FALSE;
  ------------------
  |  |  206|  1.61k|#define FALSE   0               /* values of boolean */
  ------------------
  622|  1.61k|    cinfo->num_scans = 1;
  623|  1.61k|  }
  624|       |
  625|       |  /* Disable smoothing and subsampling in lossless mode, since those are lossy
  626|       |   * algorithms.  Set the JPEG colorspace to the input colorspace.  Disable raw
  627|       |   * (downsampled) data input, because it isn't particularly useful without
  628|       |   * subsampling and has not been tested in lossless mode.
  629|       |   */
  630|  7.03k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 0, False: 7.03k]
  ------------------
  631|      0|    int ci;
  632|      0|    jpeg_component_info *compptr;
  633|       |
  634|      0|    cinfo->raw_data_in = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  635|      0|    cinfo->smoothing_factor = 0;
  636|      0|    jpeg_default_colorspace(cinfo);
  637|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (637:46): [True: 0, False: 0]
  ------------------
  638|      0|         ci++, compptr++)
  639|      0|      compptr->h_samp_factor = compptr->v_samp_factor = 1;
  640|      0|  }
  641|       |
  642|       |  /* Validate parameters, determine derived values */
  643|  7.03k|  initial_setup(cinfo, transcode_only);
  644|       |
  645|  7.03k|  if (cinfo->master->lossless ||        /*  TEMPORARY HACK ??? */
  ------------------
  |  Branch (645:7): [True: 0, False: 7.03k]
  ------------------
  646|  7.03k|      (cinfo->progressive_mode && !cinfo->arith_code))
  ------------------
  |  Branch (646:8): [True: 5.41k, False: 1.61k]
  |  Branch (646:35): [True: 2.86k, False: 2.55k]
  ------------------
  647|  2.86k|    cinfo->optimize_coding = TRUE; /* assume default tables no good for
  ------------------
  |  |  209|  2.86k|#define TRUE    1
  ------------------
  648|       |                                      progressive mode or lossless mode */
  649|  7.03k|  if (cinfo->data_precision == 12 && !cinfo->arith_code)
  ------------------
  |  Branch (649:7): [True: 1.43k, False: 5.60k]
  |  Branch (649:38): [True: 900, False: 532]
  ------------------
  650|    900|    cinfo->optimize_coding = TRUE; /* assume default tables no good for 12-bit
  ------------------
  |  |  209|    900|#define TRUE    1
  ------------------
  651|       |                                      data precision */
  652|       |
  653|       |  /* Initialize my private state */
  654|  7.03k|  if (transcode_only) {
  ------------------
  |  Branch (654:7): [True: 7.03k, False: 0]
  ------------------
  655|       |    /* no main pass in transcoding */
  656|  7.03k|    if (cinfo->optimize_coding)
  ------------------
  |  Branch (656:9): [True: 3.11k, False: 3.91k]
  ------------------
  657|  3.11k|      master->pass_type = huff_opt_pass;
  658|  3.91k|    else
  659|  3.91k|      master->pass_type = output_pass;
  660|  7.03k|  } else {
  661|       |    /* for normal compression, first pass is always this type: */
  662|      0|    master->pass_type = main_pass;
  663|      0|  }
  664|  7.03k|  master->scan_number = 0;
  665|  7.03k|  master->pass_number = 0;
  666|  7.03k|  if (cinfo->optimize_coding)
  ------------------
  |  Branch (666:7): [True: 3.11k, False: 3.91k]
  ------------------
  667|  3.11k|    master->total_passes = cinfo->num_scans * 2;
  668|  3.91k|  else
  669|  3.91k|    master->total_passes = cinfo->num_scans;
  670|       |
  671|  7.03k|  master->jpeg_version = PACKAGE_NAME " version " VERSION " (build " BUILD ")";
  ------------------
  |  |   14|  7.03k|#define PACKAGE_NAME  "libjpeg-turbo"
  ------------------
  672|  7.03k|}
jcmaster.c:prepare_for_pass:
  463|  53.2k|{
  464|  53.2k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  465|       |
  466|  53.2k|  switch (master->pass_type) {
  467|      0|  case main_pass:
  ------------------
  |  Branch (467:3): [True: 0, False: 53.2k]
  ------------------
  468|       |    /* Initial pass: will collect input data, and do either Huffman
  469|       |     * optimization or data output for the first scan.
  470|       |     */
  471|      0|    select_scan_parameters(cinfo);
  472|      0|    per_scan_setup(cinfo);
  473|      0|    if (!cinfo->raw_data_in) {
  ------------------
  |  Branch (473:9): [True: 0, False: 0]
  ------------------
  474|      0|      (*cinfo->cconvert->start_pass) (cinfo);
  475|      0|      (*cinfo->downsample->start_pass) (cinfo);
  476|      0|      (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
  477|      0|    }
  478|      0|    (*cinfo->fdct->start_pass) (cinfo);
  479|      0|    (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
  480|      0|    (*cinfo->coef->start_pass) (cinfo,
  481|      0|                                (master->total_passes > 1 ?
  ------------------
  |  Branch (481:34): [True: 0, False: 0]
  ------------------
  482|      0|                                 JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  483|      0|    (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  484|      0|    if (cinfo->optimize_coding) {
  ------------------
  |  Branch (484:9): [True: 0, False: 0]
  ------------------
  485|       |      /* No immediate data output; postpone writing frame/scan headers */
  486|      0|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  487|      0|    } else {
  488|       |      /* Will write frame/scan headers at first jpeg_write_scanlines call */
  489|      0|      master->pub.call_pass_startup = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  490|      0|    }
  491|      0|    break;
  492|      0|#ifdef ENTROPY_OPT_SUPPORTED
  493|  18.6k|  case huff_opt_pass:
  ------------------
  |  Branch (493:3): [True: 18.6k, False: 34.6k]
  ------------------
  494|       |    /* Do Huffman optimization for a scan after the first one. */
  495|  18.6k|    select_scan_parameters(cinfo);
  496|  18.6k|    per_scan_setup(cinfo);
  497|  18.6k|    if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code ||
  ------------------
  |  Branch (497:9): [True: 12.8k, False: 5.74k]
  |  Branch (497:27): [True: 3.11k, False: 2.63k]
  |  Branch (497:45): [True: 0, False: 2.63k]
  ------------------
  498|  18.6k|        cinfo->master->lossless) {
  ------------------
  |  Branch (498:9): [True: 0, False: 2.63k]
  ------------------
  499|  16.0k|      (*cinfo->entropy->start_pass) (cinfo, TRUE);
  ------------------
  |  |  209|  16.0k|#define TRUE    1
  ------------------
  500|  16.0k|      (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  501|  16.0k|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  206|  16.0k|#define FALSE   0               /* values of boolean */
  ------------------
  502|  16.0k|      break;
  503|  16.0k|    }
  504|       |    /* Special case: Huffman DC refinement scans need no Huffman table
  505|       |     * and therefore we can skip the optimization pass for them.
  506|       |     */
  507|  2.64k|    master->pass_type = output_pass;
  508|  2.64k|    master->pass_number++;
  509|  2.64k|#endif
  510|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   38|  2.64k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  511|  37.2k|  case output_pass:
  ------------------
  |  Branch (511:3): [True: 34.6k, False: 18.6k]
  ------------------
  512|       |    /* Do a data-output pass. */
  513|       |    /* We need not repeat per-scan setup if prior optimization pass did it. */
  514|  37.2k|    if (!cinfo->optimize_coding) {
  ------------------
  |  Branch (514:9): [True: 18.8k, False: 18.4k]
  ------------------
  515|  18.8k|      select_scan_parameters(cinfo);
  516|  18.8k|      per_scan_setup(cinfo);
  517|  18.8k|    }
  518|  37.2k|    (*cinfo->entropy->start_pass) (cinfo, FALSE);
  ------------------
  |  |  206|  37.2k|#define FALSE   0               /* values of boolean */
  ------------------
  519|  37.2k|    (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  520|       |    /* We emit frame/scan headers now */
  521|  37.2k|    if (master->scan_number == 0)
  ------------------
  |  Branch (521:9): [True: 6.85k, False: 30.3k]
  ------------------
  522|  6.85k|      (*cinfo->marker->write_frame_header) (cinfo);
  523|  37.2k|    (*cinfo->marker->write_scan_header) (cinfo);
  524|  37.2k|    master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  206|  37.2k|#define FALSE   0               /* values of boolean */
  ------------------
  525|  37.2k|    break;
  526|      0|  default:
  ------------------
  |  Branch (526:3): [True: 0, False: 53.2k]
  ------------------
  527|      0|    ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  528|  53.2k|  }
  529|       |
  530|  53.2k|  master->pub.is_last_pass = (master->pass_number == master->total_passes - 1);
  531|       |
  532|       |  /* Set up progress monitor's pass info if present */
  533|  53.2k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (533:7): [True: 0, False: 53.2k]
  ------------------
  534|      0|    cinfo->progress->completed_passes = master->pass_number;
  535|      0|    cinfo->progress->total_passes = master->total_passes;
  536|      0|  }
  537|  53.2k|}
jcmaster.c:select_scan_parameters:
  328|  37.4k|{
  329|  37.4k|  int ci;
  330|       |
  331|  37.4k|#ifdef NEED_SCAN_SCRIPT
  332|  37.4k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (332:7): [True: 35.8k, False: 1.61k]
  ------------------
  333|       |    /* Prepare for current scan --- the script is already validated */
  334|  35.8k|    my_master_ptr master = (my_master_ptr)cinfo->master;
  335|  35.8k|    const jpeg_scan_info *scanptr = cinfo->scan_info + master->scan_number;
  336|       |
  337|  35.8k|    cinfo->comps_in_scan = scanptr->comps_in_scan;
  338|  75.5k|    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
  ------------------
  |  Branch (338:18): [True: 39.6k, False: 35.8k]
  ------------------
  339|  39.6k|      cinfo->cur_comp_info[ci] =
  340|  39.6k|        &cinfo->comp_info[scanptr->component_index[ci]];
  341|  39.6k|    }
  342|  35.8k|    cinfo->Ss = scanptr->Ss;
  343|  35.8k|    cinfo->Se = scanptr->Se;
  344|  35.8k|    cinfo->Ah = scanptr->Ah;
  345|  35.8k|    cinfo->Al = scanptr->Al;
  346|  35.8k|  } else
  347|  1.61k|#endif
  348|  1.61k|  {
  349|       |    /* Prepare for single sequential-JPEG scan containing all components */
  350|  1.61k|    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  1.61k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (350:9): [True: 0, False: 1.61k]
  ------------------
  351|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  352|  1.61k|               MAX_COMPS_IN_SCAN);
  353|  1.61k|    cinfo->comps_in_scan = cinfo->num_components;
  354|  3.45k|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (354:18): [True: 1.84k, False: 1.61k]
  ------------------
  355|  1.84k|      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
  356|  1.84k|    }
  357|  1.61k|    if (!cinfo->master->lossless) {
  ------------------
  |  Branch (357:9): [True: 1.61k, False: 0]
  ------------------
  358|  1.61k|      cinfo->Ss = 0;
  359|  1.61k|      cinfo->Se = DCTSIZE2 - 1;
  ------------------
  |  |   56|  1.61k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  360|  1.61k|      cinfo->Ah = 0;
  361|  1.61k|      cinfo->Al = 0;
  362|  1.61k|    }
  363|  1.61k|  }
  364|  37.4k|}
jcmaster.c:per_scan_setup:
  371|  37.4k|{
  372|  37.4k|  int ci, mcublks, tmp;
  373|  37.4k|  jpeg_component_info *compptr;
  374|  37.4k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   55|  37.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (374:19): [True: 0, False: 37.4k]
  ------------------
  375|       |
  376|  37.4k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (376:7): [True: 35.5k, False: 1.89k]
  ------------------
  377|       |
  378|       |    /* Noninterleaved (single-component) scan */
  379|  35.5k|    compptr = cinfo->cur_comp_info[0];
  380|       |
  381|       |    /* Overall image size in MCUs */
  382|  35.5k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  383|  35.5k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  384|       |
  385|       |    /* For noninterleaved scan, always one block per MCU */
  386|  35.5k|    compptr->MCU_width = 1;
  387|  35.5k|    compptr->MCU_height = 1;
  388|  35.5k|    compptr->MCU_blocks = 1;
  389|  35.5k|    compptr->MCU_sample_width = data_unit;
  390|  35.5k|    compptr->last_col_width = 1;
  391|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  392|       |     * as the number of block rows present in the last iMCU row.
  393|       |     */
  394|  35.5k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  395|  35.5k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (395:9): [True: 33.9k, False: 1.67k]
  ------------------
  396|  35.5k|    compptr->last_row_height = tmp;
  397|       |
  398|       |    /* Prepare array describing MCU composition */
  399|  35.5k|    cinfo->blocks_in_MCU = 1;
  400|  35.5k|    cinfo->MCU_membership[0] = 0;
  401|       |
  402|  35.5k|  } else {
  403|       |
  404|       |    /* Interleaved (multi-component) scan */
  405|  1.89k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  1.89k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (405:9): [True: 0, False: 1.89k]
  |  Branch (405:38): [True: 0, False: 1.89k]
  ------------------
  406|      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)))
  ------------------
  407|  1.89k|               MAX_COMPS_IN_SCAN);
  408|       |
  409|       |    /* Overall image size in MCUs */
  410|  1.89k|    cinfo->MCUs_per_row = (JDIMENSION)
  411|  1.89k|      jdiv_round_up((long)cinfo->_jpeg_width,
  ------------------
  |  |   30|  1.89k|#define _jpeg_width  image_width
  ------------------
  412|  1.89k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  413|  1.89k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  414|  1.89k|      jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  1.89k|#define _jpeg_height  image_height
  ------------------
  415|  1.89k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  416|       |
  417|  1.89k|    cinfo->blocks_in_MCU = 0;
  418|       |
  419|  7.74k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (419:18): [True: 5.85k, False: 1.89k]
  ------------------
  420|  5.85k|      compptr = cinfo->cur_comp_info[ci];
  421|       |      /* Sampling factors give # of blocks of component in each MCU */
  422|  5.85k|      compptr->MCU_width = compptr->h_samp_factor;
  423|  5.85k|      compptr->MCU_height = compptr->v_samp_factor;
  424|  5.85k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  425|  5.85k|      compptr->MCU_sample_width = compptr->MCU_width * data_unit;
  426|       |      /* Figure number of non-dummy blocks in last MCU column & row */
  427|  5.85k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  428|  5.85k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (428:11): [True: 5.08k, False: 767]
  ------------------
  429|  5.85k|      compptr->last_col_width = tmp;
  430|  5.85k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  431|  5.85k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (431:11): [True: 4.70k, False: 1.15k]
  ------------------
  432|  5.85k|      compptr->last_row_height = tmp;
  433|       |      /* Prepare array describing MCU composition */
  434|  5.85k|      mcublks = compptr->MCU_blocks;
  435|  5.85k|      if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   69|  5.85k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  |  Branch (435:11): [True: 38, False: 5.81k]
  ------------------
  436|     38|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|     38|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     38|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  437|  16.6k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (437:14): [True: 10.8k, False: 5.85k]
  ------------------
  438|  10.8k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  439|  10.8k|      }
  440|  5.85k|    }
  441|       |
  442|  1.89k|  }
  443|       |
  444|       |  /* Convert restart specified in rows to actual MCU count. */
  445|       |  /* Note that count must fit in 16 bits, so we provide limiting. */
  446|  37.4k|  if (cinfo->restart_in_rows > 0) {
  ------------------
  |  Branch (446:7): [True: 0, False: 37.4k]
  ------------------
  447|      0|    long nominal = (long)cinfo->restart_in_rows * (long)cinfo->MCUs_per_row;
  448|      0|    cinfo->restart_interval = (unsigned int)MIN(nominal, 65535L);
  ------------------
  |  |  448|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (448:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  449|      0|  }
  450|  37.4k|}
jcmaster.c:finish_pass_master:
  566|  52.9k|{
  567|  52.9k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  568|       |
  569|       |  /* The entropy coder always needs an end-of-pass call,
  570|       |   * either to analyze statistics or to flush its output buffer.
  571|       |   */
  572|  52.9k|  (*cinfo->entropy->finish_pass) (cinfo);
  573|       |
  574|       |  /* Update state for next pass */
  575|  52.9k|  switch (master->pass_type) {
  ------------------
  |  Branch (575:11): [True: 0, False: 52.9k]
  ------------------
  576|      0|  case main_pass:
  ------------------
  |  Branch (576:3): [True: 0, False: 52.9k]
  ------------------
  577|       |    /* next pass is either output of scan 0 (after optimization)
  578|       |     * or output of scan 1 (if no optimization).
  579|       |     */
  580|      0|    master->pass_type = output_pass;
  581|      0|    if (!cinfo->optimize_coding)
  ------------------
  |  Branch (581:9): [True: 0, False: 0]
  ------------------
  582|      0|      master->scan_number++;
  583|      0|    break;
  584|  15.7k|  case huff_opt_pass:
  ------------------
  |  Branch (584:3): [True: 15.7k, False: 37.2k]
  ------------------
  585|       |    /* next pass is always output of current scan */
  586|  15.7k|    master->pass_type = output_pass;
  587|  15.7k|    break;
  588|  37.2k|  case output_pass:
  ------------------
  |  Branch (588:3): [True: 37.2k, False: 15.7k]
  ------------------
  589|       |    /* next pass is either optimization or output of next scan */
  590|  37.2k|    if (cinfo->optimize_coding)
  ------------------
  |  Branch (590:9): [True: 18.4k, False: 18.8k]
  ------------------
  591|  18.4k|      master->pass_type = huff_opt_pass;
  592|  37.2k|    master->scan_number++;
  593|  37.2k|    break;
  594|  52.9k|  }
  595|       |
  596|  52.9k|  master->pass_number++;
  597|  52.9k|}
jcmaster.c:validate_script:
  164|  5.41k|{
  165|  5.41k|  const jpeg_scan_info *scanptr;
  166|  5.41k|  int scanno, ncomps, ci, coefi, thisi;
  167|  5.41k|  int Ss, Se, Ah, Al;
  168|  5.41k|  boolean component_sent[MAX_COMPONENTS];
  169|  5.41k|#ifdef C_PROGRESSIVE_SUPPORTED
  170|  5.41k|  int *last_bitpos_ptr;
  171|  5.41k|  int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
  172|       |  /* -1 until that coefficient has been seen; then last Al for it */
  173|  5.41k|#endif
  174|       |
  175|  5.41k|  if (cinfo->num_scans <= 0)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.41k]
  ------------------
  176|      0|    ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  177|       |
  178|       |#ifndef C_MULTISCAN_FILES_SUPPORTED
  179|       |  if (cinfo->num_scans > 1)
  180|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  181|       |#endif
  182|       |
  183|  5.41k|  scanptr = cinfo->scan_info;
  184|  5.41k|  if (scanptr->Ss != 0 && scanptr->Se == 0) {
  ------------------
  |  Branch (184:7): [True: 0, False: 5.41k]
  |  Branch (184:27): [True: 0, False: 0]
  ------------------
  185|      0|#ifdef C_LOSSLESS_SUPPORTED
  186|      0|    cinfo->master->lossless = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  187|      0|    cinfo->progressive_mode = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  188|      0|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (188:18): [True: 0, False: 0]
  ------------------
  189|      0|      component_sent[ci] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  190|       |#else
  191|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  192|       |#endif
  193|      0|  }
  194|       |  /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
  195|       |   * for progressive JPEG, no scan can have this.
  196|       |   */
  197|  5.41k|  else if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2 - 1) {
  ------------------
  |  |   56|  5.41k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (197:12): [True: 0, False: 5.41k]
  |  Branch (197:32): [True: 5.41k, False: 0]
  ------------------
  198|  5.41k|#ifdef C_PROGRESSIVE_SUPPORTED
  199|  5.41k|    cinfo->progressive_mode = TRUE;
  ------------------
  |  |  209|  5.41k|#define TRUE    1
  ------------------
  200|  5.41k|    cinfo->master->lossless = FALSE;
  ------------------
  |  |  206|  5.41k|#define FALSE   0               /* values of boolean */
  ------------------
  201|  5.41k|    last_bitpos_ptr = &last_bitpos[0][0];
  202|  12.8k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (202:18): [True: 7.39k, False: 5.41k]
  ------------------
  203|   480k|      for (coefi = 0; coefi < DCTSIZE2; coefi++)
  ------------------
  |  |   56|   480k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (203:23): [True: 473k, False: 7.39k]
  ------------------
  204|   473k|        *last_bitpos_ptr++ = -1;
  205|       |#else
  206|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  207|       |#endif
  208|  5.41k|  } else {
  209|      0|    cinfo->progressive_mode = cinfo->master->lossless = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  210|      0|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (210:18): [True: 0, False: 0]
  ------------------
  211|      0|      component_sent[ci] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  212|      0|  }
  213|       |
  214|  42.9k|  for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
  ------------------
  |  Branch (214:20): [True: 37.5k, False: 5.41k]
  ------------------
  215|       |    /* Validate component indexes */
  216|  37.5k|    ncomps = scanptr->comps_in_scan;
  217|  37.5k|    if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  37.5k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (217:9): [True: 0, False: 37.5k]
  |  Branch (217:24): [True: 0, False: 37.5k]
  ------------------
  218|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  219|  79.0k|    for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (219:18): [True: 41.5k, False: 37.5k]
  ------------------
  220|  41.5k|      thisi = scanptr->component_index[ci];
  221|  41.5k|      if (thisi < 0 || thisi >= cinfo->num_components)
  ------------------
  |  Branch (221:11): [True: 0, False: 41.5k]
  |  Branch (221:24): [True: 0, False: 41.5k]
  ------------------
  222|      0|        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  223|       |      /* Components must appear in SOF order within each scan */
  224|  41.5k|      if (ci > 0 && thisi <= scanptr->component_index[ci - 1])
  ------------------
  |  Branch (224:11): [True: 3.95k, False: 37.5k]
  |  Branch (224:21): [True: 0, False: 3.95k]
  ------------------
  225|      0|        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  226|  41.5k|    }
  227|       |    /* Validate progression parameters */
  228|  37.5k|    Ss = scanptr->Ss;
  229|  37.5k|    Se = scanptr->Se;
  230|  37.5k|    Ah = scanptr->Ah;
  231|  37.5k|    Al = scanptr->Al;
  232|  37.5k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (232:9): [True: 37.5k, False: 0]
  ------------------
  233|  37.5k|#ifdef C_PROGRESSIVE_SUPPORTED
  234|       |      /* Rec. ITU-T T.81 | ISO/IEC 10918-1 simply gives the ranges 0..13 for Ah
  235|       |       * and Al, but that seems wrong: the upper bound ought to depend on data
  236|       |       * precision.  Perhaps they really meant 0..N+1 for N-bit precision.
  237|       |       * Here we allow 0..10 for 8-bit data; Al larger than 10 results in
  238|       |       * out-of-range reconstructed DC values during the first DC scan,
  239|       |       * which might cause problems for some decoders.
  240|       |       */
  241|  37.5k|      int max_Ah_Al = cinfo->data_precision == 12 ? 13 : 10;
  ------------------
  |  Branch (241:23): [True: 5.77k, False: 31.7k]
  ------------------
  242|       |
  243|  37.5k|      if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
  ------------------
  |  |   56|  75.1k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
                    if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
  ------------------
  |  |   56|  75.1k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (243:11): [True: 0, False: 37.5k]
  |  Branch (243:21): [True: 0, False: 37.5k]
  |  Branch (243:39): [True: 0, False: 37.5k]
  |  Branch (243:50): [True: 0, False: 37.5k]
  ------------------
  244|  37.5k|          Ah < 0 || Ah > max_Ah_Al || Al < 0 || Al > max_Ah_Al)
  ------------------
  |  Branch (244:11): [True: 0, False: 37.5k]
  |  Branch (244:21): [True: 0, False: 37.5k]
  |  Branch (244:39): [True: 0, False: 37.5k]
  |  Branch (244:49): [True: 0, False: 37.5k]
  ------------------
  245|      0|        ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  246|  37.5k|      if (Ss == 0) {
  ------------------
  |  Branch (246:11): [True: 10.8k, False: 26.7k]
  ------------------
  247|  10.8k|        if (Se != 0)            /* DC and AC together not OK */
  ------------------
  |  Branch (247:13): [True: 0, False: 10.8k]
  ------------------
  248|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  249|  26.7k|      } else {
  250|  26.7k|        if (ncomps != 1)        /* AC scans must be for only one component */
  ------------------
  |  Branch (250:13): [True: 0, False: 26.7k]
  ------------------
  251|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  252|  26.7k|      }
  253|  79.0k|      for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (253:20): [True: 41.5k, False: 37.5k]
  ------------------
  254|  41.5k|        last_bitpos_ptr = &last_bitpos[scanptr->component_index[ci]][0];
  255|  41.5k|        if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (255:13): [True: 26.7k, False: 14.7k]
  |  Branch (255:24): [True: 0, False: 26.7k]
  ------------------
  256|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  257|  1.36M|        for (coefi = Ss; coefi <= Se; coefi++) {
  ------------------
  |  Branch (257:26): [True: 1.32M, False: 41.5k]
  ------------------
  258|  1.32M|          if (last_bitpos_ptr[coefi] < 0) {
  ------------------
  |  Branch (258:15): [True: 473k, False: 849k]
  ------------------
  259|       |            /* first scan of this coefficient */
  260|   473k|            if (Ah != 0)
  ------------------
  |  Branch (260:17): [True: 0, False: 473k]
  ------------------
  261|      0|              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  262|   849k|          } else {
  263|       |            /* not first scan */
  264|   849k|            if (Ah != last_bitpos_ptr[coefi] || Al != Ah - 1)
  ------------------
  |  Branch (264:17): [True: 0, False: 849k]
  |  Branch (264:49): [True: 0, False: 849k]
  ------------------
  265|      0|              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  266|   849k|          }
  267|  1.32M|          last_bitpos_ptr[coefi] = Al;
  268|  1.32M|        }
  269|  41.5k|      }
  270|  37.5k|#endif
  271|  37.5k|    } else {
  272|      0|#ifdef C_LOSSLESS_SUPPORTED
  273|      0|      if (cinfo->master->lossless) {
  ------------------
  |  Branch (273:11): [True: 0, False: 0]
  ------------------
  274|       |        /* The JPEG spec simply gives the range 0..15 for Al (Pt), but that
  275|       |         * seems wrong: the upper bound ought to depend on data precision.
  276|       |         * Perhaps they really meant 0..N-1 for N-bit precision, which is what
  277|       |         * we allow here.  Values greater than or equal to the data precision
  278|       |         * will result in a blank image.
  279|       |         */
  280|      0|        if (Ss < 1 || Ss > 7 ||         /* predictor selection value */
  ------------------
  |  Branch (280:13): [True: 0, False: 0]
  |  Branch (280:23): [True: 0, False: 0]
  ------------------
  281|      0|            Se != 0 || Ah != 0 ||
  ------------------
  |  Branch (281:13): [True: 0, False: 0]
  |  Branch (281:24): [True: 0, False: 0]
  ------------------
  282|      0|            Al < 0 || Al >= cinfo->data_precision) /* point transform */
  ------------------
  |  Branch (282:13): [True: 0, False: 0]
  |  Branch (282:23): [True: 0, False: 0]
  ------------------
  283|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|      0|      } else
  285|      0|#endif
  286|      0|      {
  287|       |        /* For sequential JPEG, all progression parameters must be these: */
  288|      0|        if (Ss != 0 || Se != DCTSIZE2 - 1 || Ah != 0 || Al != 0)
  ------------------
  |  |   56|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (288:13): [True: 0, False: 0]
  |  Branch (288:24): [True: 0, False: 0]
  |  Branch (288:46): [True: 0, False: 0]
  |  Branch (288:57): [True: 0, False: 0]
  ------------------
  289|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  290|      0|      }
  291|       |      /* Make sure components are not sent twice */
  292|      0|      for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (292:20): [True: 0, False: 0]
  ------------------
  293|      0|        thisi = scanptr->component_index[ci];
  294|      0|        if (component_sent[thisi])
  ------------------
  |  Branch (294:13): [True: 0, False: 0]
  ------------------
  295|      0|          ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  296|      0|        component_sent[thisi] = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  297|      0|      }
  298|      0|    }
  299|  37.5k|  }
  300|       |
  301|       |  /* Now verify that everything got sent. */
  302|  5.41k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (302:7): [True: 5.41k, False: 0]
  ------------------
  303|  5.41k|#ifdef C_PROGRESSIVE_SUPPORTED
  304|       |    /* For progressive mode, we only check that at least some DC data
  305|       |     * got sent for each component; the spec does not require that all bits
  306|       |     * of all coefficients be transmitted.  Would it be wiser to enforce
  307|       |     * transmission of all coefficient bits??
  308|       |     */
  309|  12.8k|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (309:18): [True: 7.39k, False: 5.41k]
  ------------------
  310|  7.39k|      if (last_bitpos[ci][0] < 0)
  ------------------
  |  Branch (310:11): [True: 0, False: 7.39k]
  ------------------
  311|      0|        ERREXIT(cinfo, JERR_MISSING_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  312|  7.39k|    }
  313|  5.41k|#endif
  314|  5.41k|  } else {
  315|      0|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (315:18): [True: 0, False: 0]
  ------------------
  316|      0|      if (!component_sent[ci])
  ------------------
  |  Branch (316:11): [True: 0, False: 0]
  ------------------
  317|      0|        ERREXIT(cinfo, JERR_MISSING_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|      0|    }
  319|      0|  }
  320|  5.41k|}
jcmaster.c:initial_setup:
   56|  7.03k|{
   57|  7.03k|  int ci;
   58|  7.03k|  jpeg_component_info *compptr;
   59|  7.03k|  long samplesperrow;
   60|  7.03k|  JDIMENSION jd_samplesperrow;
   61|  7.03k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   55|  7.03k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (61:19): [True: 0, False: 7.03k]
  ------------------
   62|       |
   63|       |#if JPEG_LIB_VERSION >= 70
   64|       |#if JPEG_LIB_VERSION >= 80
   65|       |  if (!transcode_only)
   66|       |#endif
   67|       |    jpeg_calc_jpeg_dimensions(cinfo);
   68|       |#endif
   69|       |
   70|       |  /* Sanity check on image dimensions */
   71|  7.03k|  if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   31|  7.03k|#define _jpeg_height  image_height
  ------------------
                if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   30|  7.03k|#define _jpeg_width  image_width
  ------------------
  |  Branch (71:7): [True: 0, False: 7.03k]
  |  Branch (71:35): [True: 0, False: 7.03k]
  ------------------
   72|  7.03k|      cinfo->num_components <= 0 || cinfo->input_components <= 0)
  ------------------
  |  Branch (72:7): [True: 0, False: 7.03k]
  |  Branch (72:37): [True: 0, False: 7.03k]
  ------------------
   73|      0|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   74|       |
   75|       |  /* Make sure image isn't bigger than I can handle */
   76|  7.03k|  if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |   31|  7.03k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  157|  14.0k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (76:7): [True: 0, False: 7.03k]
  ------------------
   77|  7.03k|      (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |   30|  7.03k|#define _jpeg_width  image_width
  ------------------
                    (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  157|  7.03k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (77:7): [True: 0, False: 7.03k]
  ------------------
   78|      0|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   79|       |
   80|       |  /* Width of an input scanline must be representable as JDIMENSION. */
   81|  7.03k|  samplesperrow = (long)cinfo->image_width * (long)cinfo->input_components;
   82|  7.03k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
   83|  7.03k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (83:7): [True: 0, False: 7.03k]
  ------------------
   84|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   85|       |
   86|  7.03k|#ifdef C_LOSSLESS_SUPPORTED
   87|  7.03k|  if (cinfo->data_precision != 8 && cinfo->data_precision != 12 &&
  ------------------
  |  Branch (87:7): [True: 1.43k, False: 5.60k]
  |  Branch (87:37): [True: 0, False: 1.43k]
  ------------------
   88|  7.03k|      cinfo->data_precision != 16)
  ------------------
  |  Branch (88:7): [True: 0, False: 0]
  ------------------
   89|       |#else
   90|       |  if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
   91|       |#endif
   92|      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)))
  ------------------
   93|       |
   94|       |  /* Check that number of components won't exceed internal array sizes */
   95|  7.03k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   29|  7.03k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (95:7): [True: 0, False: 7.03k]
  ------------------
   96|      0|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   97|  7.03k|             MAX_COMPONENTS);
   98|       |
   99|       |  /* Compute maximum sampling factors; check factor validity */
  100|  7.03k|  cinfo->max_h_samp_factor = 1;
  101|  7.03k|  cinfo->max_v_samp_factor = 1;
  102|  16.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (102:44): [True: 9.23k, False: 7.03k]
  ------------------
  103|  9.23k|       ci++, compptr++) {
  104|  9.23k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (104:9): [True: 0, False: 9.23k]
  ------------------
  105|  9.23k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   61|  18.4k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (105:9): [True: 0, False: 9.23k]
  ------------------
  106|  9.23k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (106:9): [True: 0, False: 9.23k]
  ------------------
  107|  9.23k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   61|  9.23k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (107:9): [True: 0, False: 9.23k]
  ------------------
  108|      0|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  9.23k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  446|  9.23k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 1.59k, False: 7.64k]
  |  |  ------------------
  ------------------
  110|  9.23k|                                   compptr->h_samp_factor);
  111|  9.23k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  446|  9.23k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 1.13k, False: 8.10k]
  |  |  ------------------
  ------------------
  112|  9.23k|                                   compptr->v_samp_factor);
  113|  9.23k|  }
  114|       |
  115|       |  /* Compute dimensions of components */
  116|  16.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (116:44): [True: 9.23k, False: 7.03k]
  ------------------
  117|  9.23k|       ci++, compptr++) {
  118|       |    /* Fill in the correct component_index value; don't rely on application */
  119|  9.23k|    compptr->component_index = ci;
  120|       |    /* For compression, we never do DCT scaling. */
  121|       |#if JPEG_LIB_VERSION >= 70
  122|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  123|       |#else
  124|  9.23k|    compptr->DCT_scaled_size = data_unit;
  125|  9.23k|#endif
  126|       |    /* Size in data units */
  127|  9.23k|    compptr->width_in_blocks = (JDIMENSION)
  128|  9.23k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  9.23k|#define _jpeg_width  image_width
  ------------------
  129|  9.23k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  130|  9.23k|    compptr->height_in_blocks = (JDIMENSION)
  131|  9.23k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  9.23k|#define _jpeg_height  image_height
  ------------------
  132|  9.23k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  133|       |    /* Size in samples */
  134|  9.23k|    compptr->downsampled_width = (JDIMENSION)
  135|  9.23k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  9.23k|#define _jpeg_width  image_width
  ------------------
  136|  9.23k|                    (long)cinfo->max_h_samp_factor);
  137|  9.23k|    compptr->downsampled_height = (JDIMENSION)
  138|  9.23k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  9.23k|#define _jpeg_height  image_height
  ------------------
  139|  9.23k|                    (long)cinfo->max_v_samp_factor);
  140|       |    /* Mark component needed (this flag isn't actually used for compression) */
  141|  9.23k|    compptr->component_needed = TRUE;
  ------------------
  |  |  209|  9.23k|#define TRUE    1
  ------------------
  142|  9.23k|  }
  143|       |
  144|       |  /* Compute number of fully interleaved MCU rows (number of times that
  145|       |   * main controller will call coefficient or difference controller).
  146|       |   */
  147|  7.03k|  cinfo->total_iMCU_rows = (JDIMENSION)
  148|  7.03k|    jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  7.03k|#define _jpeg_height  image_height
  ------------------
  149|  7.03k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  150|  7.03k|}

jpeg_abort:
   33|  19.9k|{
   34|  19.9k|  int pool;
   35|       |
   36|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   37|  19.9k|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (37:7): [True: 0, False: 19.9k]
  ------------------
   38|      0|    return;
   39|       |
   40|       |  /* Releasing pools in reverse order might help avoid fragmentation
   41|       |   * with some (brain-damaged) malloc libraries.
   42|       |   */
   43|  39.8k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  874|  19.9k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  872|  39.8k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (43:35): [True: 19.9k, False: 19.9k]
  ------------------
   44|  19.9k|    (*cinfo->mem->free_pool) (cinfo, pool);
   45|  19.9k|  }
   46|       |
   47|       |  /* Reset overall state for possible reuse of object */
   48|  19.9k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (48:7): [True: 12.9k, False: 7.03k]
  ------------------
   49|  12.9k|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  12.9k|#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|  12.9k|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   54|  12.9k|  } else {
   55|  7.03k|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  7.03k|#define CSTATE_START     100    /* after create_compress */
  ------------------
   56|  7.03k|  }
   57|  19.9k|}
jpeg_destroy:
   73|  11.0k|{
   74|       |  /* We need only tell the memory manager to release everything. */
   75|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
   76|  11.0k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (76:7): [True: 11.0k, False: 0]
  ------------------
   77|  11.0k|    (*cinfo->mem->self_destruct) (cinfo);
   78|  11.0k|  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
   79|  11.0k|  cinfo->global_state = 0;      /* mark it destroyed */
   80|  11.0k|}
jpeg_alloc_quant_table:
   90|  10.0k|{
   91|  10.0k|  JQUANT_TBL *tbl;
   92|       |
   93|  10.0k|  tbl = (JQUANT_TBL *)
   94|  10.0k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  872|  10.0k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   95|  10.0k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  10.0k|#define FALSE   0               /* values of boolean */
  ------------------
   96|  10.0k|  return tbl;
   97|  10.0k|}
jpeg_alloc_huff_table:
  102|  18.9k|{
  103|  18.9k|  JHUFF_TBL *tbl;
  104|       |
  105|  18.9k|  tbl = (JHUFF_TBL *)
  106|  18.9k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  872|  18.9k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  107|  18.9k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  18.9k|#define FALSE   0               /* values of boolean */
  ------------------
  108|  18.9k|  return tbl;
  109|  18.9k|}

jpeg_add_quant_table:
   38|  15.0k|{
   39|  15.0k|  JQUANT_TBL **qtblptr;
   40|  15.0k|  int i;
   41|  15.0k|  long temp;
   42|       |
   43|       |  /* Safety check to ensure start_compress not called yet. */
   44|  15.0k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  15.0k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (44:7): [True: 0, False: 15.0k]
  ------------------
   45|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   46|       |
   47|  15.0k|  if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
  ------------------
  |  |   57|  15.0k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (47:7): [True: 0, False: 15.0k]
  |  Branch (47:24): [True: 0, False: 15.0k]
  ------------------
   48|      0|    ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   49|       |
   50|  15.0k|  qtblptr = &cinfo->quant_tbl_ptrs[which_tbl];
   51|       |
   52|  15.0k|  if (*qtblptr == NULL)
  ------------------
  |  Branch (52:7): [True: 5.94k, False: 9.09k]
  ------------------
   53|  5.94k|    *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo);
   54|       |
   55|   977k|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   56|   977k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (55:15): [True: 962k, False: 15.0k]
  ------------------
   56|   962k|    temp = ((long)basic_table[i] * scale_factor + 50L) / 100L;
   57|       |    /* limit the values to the valid range */
   58|   962k|    if (temp <= 0L) temp = 1L;
  ------------------
  |  Branch (58:9): [True: 0, False: 962k]
  ------------------
   59|   962k|    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
  ------------------
  |  Branch (59:9): [True: 0, False: 962k]
  ------------------
   60|   962k|    if (force_baseline && temp > 255L)
  ------------------
  |  Branch (60:9): [True: 962k, False: 0]
  |  Branch (60:27): [True: 0, False: 962k]
  ------------------
   61|      0|      temp = 255L;              /* limit to baseline range if requested */
   62|   962k|    (*qtblptr)->quantval[i] = (UINT16)temp;
   63|   962k|  }
   64|       |
   65|       |  /* Initialize sent_table FALSE so table will be written to JPEG file. */
   66|  15.0k|  (*qtblptr)->sent_table = FALSE;
  ------------------
  |  |  206|  15.0k|#define FALSE   0               /* values of boolean */
  ------------------
   67|  15.0k|}
jpeg_set_linear_quality:
  122|  7.52k|{
  123|       |  /* Set up two quantization tables using the specified scaling */
  124|  7.52k|  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  125|  7.52k|                       scale_factor, force_baseline);
  126|  7.52k|  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  127|  7.52k|                       scale_factor, force_baseline);
  128|  7.52k|}
jpeg_quality_scaling:
  137|  7.52k|{
  138|       |  /* Safety limit on quality factor.  Convert 0 to 1 to avoid zero divide. */
  139|  7.52k|  if (quality <= 0) quality = 1;
  ------------------
  |  Branch (139:7): [True: 0, False: 7.52k]
  ------------------
  140|  7.52k|  if (quality > 100) quality = 100;
  ------------------
  |  Branch (140:7): [True: 0, False: 7.52k]
  ------------------
  141|       |
  142|       |  /* The basic table is used as-is (scaling 100) for a quality of 50.
  143|       |   * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
  144|       |   * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
  145|       |   * to make all the table entries 1 (hence, minimum quantization loss).
  146|       |   * Qualities 1..50 are converted to scaling percentage 5000/Q.
  147|       |   */
  148|  7.52k|  if (quality < 50)
  ------------------
  |  Branch (148:7): [True: 0, False: 7.52k]
  ------------------
  149|      0|    quality = 5000 / quality;
  150|  7.52k|  else
  151|  7.52k|    quality = 200 - quality * 2;
  152|       |
  153|  7.52k|  return quality;
  154|  7.52k|}
jpeg_set_quality:
  164|  7.52k|{
  165|       |  /* Convert user 0-100 rating to percentage scaling */
  166|  7.52k|  quality = jpeg_quality_scaling(quality);
  167|       |
  168|       |  /* Set up standard quality tables */
  169|  7.52k|  jpeg_set_linear_quality(cinfo, quality, force_baseline);
  170|  7.52k|}
jpeg_set_defaults:
  185|  7.52k|{
  186|  7.52k|  int i;
  187|       |
  188|       |  /* Safety check to ensure start_compress not called yet. */
  189|  7.52k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  7.52k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (189:7): [True: 0, False: 7.52k]
  ------------------
  190|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  191|       |
  192|       |  /* Allocate comp_info array large enough for maximum component count.
  193|       |   * Array is made permanent in case application wants to compress
  194|       |   * multiple images at same param settings.
  195|       |   */
  196|  7.52k|  if (cinfo->comp_info == NULL)
  ------------------
  |  Branch (196:7): [True: 2.97k, False: 4.54k]
  ------------------
  197|  2.97k|    cinfo->comp_info = (jpeg_component_info *)
  198|  2.97k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  2.97k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  199|  2.97k|                                  MAX_COMPONENTS * sizeof(jpeg_component_info));
  ------------------
  |  |   29|  2.97k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  200|       |
  201|       |  /* Initialize everything not dependent on the color space */
  202|       |
  203|       |#if JPEG_LIB_VERSION >= 70
  204|       |  cinfo->scale_num = 1;         /* 1:1 scaling */
  205|       |  cinfo->scale_denom = 1;
  206|       |#endif
  207|       |  /* Set up two quantization tables using default quality of 75 */
  208|  7.52k|  jpeg_set_quality(cinfo, 75, TRUE);
  ------------------
  |  |  209|  7.52k|#define TRUE    1
  ------------------
  209|       |  /* Set up two Huffman tables */
  210|  7.52k|  std_huff_tables((j_common_ptr)cinfo);
  211|       |
  212|       |  /* Initialize default arithmetic coding conditioning */
  213|   127k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   59|   127k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (213:15): [True: 120k, False: 7.52k]
  ------------------
  214|   120k|    cinfo->arith_dc_L[i] = 0;
  215|   120k|    cinfo->arith_dc_U[i] = 1;
  216|   120k|    cinfo->arith_ac_K[i] = 5;
  217|   120k|  }
  218|       |
  219|       |  /* Default is no multiple-scan output */
  220|  7.52k|  cinfo->scan_info = NULL;
  221|  7.52k|  cinfo->num_scans = 0;
  222|       |
  223|       |  /* Expect normal source image, not raw downsampled data */
  224|  7.52k|  cinfo->raw_data_in = FALSE;
  ------------------
  |  |  206|  7.52k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|       |  /* Use Huffman coding, not arithmetic coding, by default */
  227|  7.52k|  cinfo->arith_code = FALSE;
  ------------------
  |  |  206|  7.52k|#define FALSE   0               /* values of boolean */
  ------------------
  228|       |
  229|       |  /* By default, don't do extra passes to optimize entropy coding */
  230|  7.52k|  cinfo->optimize_coding = FALSE;
  ------------------
  |  |  206|  7.52k|#define FALSE   0               /* values of boolean */
  ------------------
  231|       |  /* The standard Huffman tables are only valid for 8-bit data precision.
  232|       |   * If the precision is higher, force optimization on so that usable
  233|       |   * tables will be computed.  This test can be removed if default tables
  234|       |   * are supplied that are valid for the desired precision.
  235|       |   */
  236|  7.52k|  if (cinfo->data_precision == 12 && !cinfo->arith_code)
  ------------------
  |  Branch (236:7): [True: 953, False: 6.56k]
  |  Branch (236:38): [True: 953, False: 0]
  ------------------
  237|    953|    cinfo->optimize_coding = TRUE;
  ------------------
  |  |  209|    953|#define TRUE    1
  ------------------
  238|       |
  239|       |  /* By default, use the simpler non-cosited sampling alignment */
  240|  7.52k|  cinfo->CCIR601_sampling = FALSE;
  ------------------
  |  |  206|  7.52k|#define FALSE   0               /* values of boolean */
  ------------------
  241|       |
  242|       |#if JPEG_LIB_VERSION >= 70
  243|       |  /* By default, apply fancy downsampling */
  244|       |  cinfo->do_fancy_downsampling = TRUE;
  245|       |#endif
  246|       |
  247|       |  /* No input smoothing */
  248|  7.52k|  cinfo->smoothing_factor = 0;
  249|       |
  250|       |  /* DCT algorithm preference */
  251|  7.52k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  285|  7.52k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  252|       |
  253|       |  /* No restart markers */
  254|  7.52k|  cinfo->restart_interval = 0;
  255|  7.52k|  cinfo->restart_in_rows = 0;
  256|       |
  257|       |  /* Fill in default JFIF marker parameters.  Note that whether the marker
  258|       |   * will actually be written is determined by jpeg_set_colorspace.
  259|       |   *
  260|       |   * By default, the library emits JFIF version code 1.01.
  261|       |   * An application that wants to emit JFIF 1.02 extension markers should set
  262|       |   * JFIF_minor_version to 2.  We could probably get away with just defaulting
  263|       |   * to 1.02, but there may still be some decoders in use that will complain
  264|       |   * about that; saying 1.01 should minimize compatibility problems.
  265|       |   */
  266|  7.52k|  cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
  267|  7.52k|  cinfo->JFIF_minor_version = 1;
  268|  7.52k|  cinfo->density_unit = 0;      /* Pixel size is unknown by default */
  269|  7.52k|  cinfo->X_density = 1;         /* Pixel aspect ratio is square by default */
  270|  7.52k|  cinfo->Y_density = 1;
  271|       |
  272|       |  /* Choose JPEG colorspace based on input space, set defaults accordingly */
  273|       |
  274|  7.52k|  jpeg_default_colorspace(cinfo);
  275|  7.52k|}
jpeg_default_colorspace:
  284|  7.52k|{
  285|  7.52k|  switch (cinfo->in_color_space) {
  286|  5.80k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (286:3): [True: 5.80k, False: 1.71k]
  ------------------
  287|  5.80k|    jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
  288|  5.80k|    break;
  289|    118|  case JCS_RGB:
  ------------------
  |  Branch (289:3): [True: 118, False: 7.40k]
  ------------------
  290|    118|  case JCS_EXT_RGB:
  ------------------
  |  Branch (290:3): [True: 0, False: 7.52k]
  ------------------
  291|    118|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (291:3): [True: 0, False: 7.52k]
  ------------------
  292|    118|  case JCS_EXT_BGR:
  ------------------
  |  Branch (292:3): [True: 0, False: 7.52k]
  ------------------
  293|    118|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (293:3): [True: 0, False: 7.52k]
  ------------------
  294|    118|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (294:3): [True: 0, False: 7.52k]
  ------------------
  295|    118|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (295:3): [True: 0, False: 7.52k]
  ------------------
  296|    118|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (296:3): [True: 0, False: 7.52k]
  ------------------
  297|    118|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (297:3): [True: 0, False: 7.52k]
  ------------------
  298|    118|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (298:3): [True: 0, False: 7.52k]
  ------------------
  299|    118|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (299:3): [True: 0, False: 7.52k]
  ------------------
  300|    118|    if (cinfo->master->lossless)
  ------------------
  |  Branch (300:9): [True: 0, False: 118]
  ------------------
  301|      0|      jpeg_set_colorspace(cinfo, JCS_RGB);
  302|    118|    else
  303|    118|      jpeg_set_colorspace(cinfo, JCS_YCbCr);
  304|    118|    break;
  305|  1.42k|  case JCS_YCbCr:
  ------------------
  |  Branch (305:3): [True: 1.42k, False: 6.09k]
  ------------------
  306|  1.42k|    jpeg_set_colorspace(cinfo, JCS_YCbCr);
  307|  1.42k|    break;
  308|    164|  case JCS_CMYK:
  ------------------
  |  Branch (308:3): [True: 164, False: 7.35k]
  ------------------
  309|    164|    jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
  310|    164|    break;
  311|      1|  case JCS_YCCK:
  ------------------
  |  Branch (311:3): [True: 1, False: 7.51k]
  ------------------
  312|      1|    jpeg_set_colorspace(cinfo, JCS_YCCK);
  313|      1|    break;
  314|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (314:3): [True: 0, False: 7.52k]
  ------------------
  315|      0|    jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
  316|      0|    break;
  317|      0|  default:
  ------------------
  |  Branch (317:3): [True: 0, False: 7.52k]
  ------------------
  318|      0|    ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|  7.52k|  }
  320|  7.52k|}
jpeg_set_colorspace:
  329|  16.4k|{
  330|  16.4k|  jpeg_component_info *compptr;
  331|  16.4k|  int ci;
  332|       |
  333|  16.4k|#define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \
  334|  16.4k|  (compptr = &cinfo->comp_info[index], \
  335|  16.4k|   compptr->component_id = (id), \
  336|  16.4k|   compptr->h_samp_factor = (hsamp), \
  337|  16.4k|   compptr->v_samp_factor = (vsamp), \
  338|  16.4k|   compptr->quant_tbl_no = (quant), \
  339|  16.4k|   compptr->dc_tbl_no = (dctbl), \
  340|  16.4k|   compptr->ac_tbl_no = (actbl) )
  341|       |
  342|       |  /* Safety check to ensure start_compress not called yet. */
  343|  16.4k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  16.4k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (343:7): [True: 0, False: 16.4k]
  ------------------
  344|      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)))
  ------------------
  345|       |
  346|       |  /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
  347|       |   * tables 1 for chrominance components.
  348|       |   */
  349|       |
  350|  16.4k|  cinfo->jpeg_color_space = colorspace;
  351|       |
  352|  16.4k|  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
  ------------------
  |  |  206|  16.4k|#define FALSE   0               /* values of boolean */
  ------------------
  353|  16.4k|  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
  ------------------
  |  |  206|  16.4k|#define FALSE   0               /* values of boolean */
  ------------------
  354|       |
  355|  16.4k|  switch (colorspace) {
  356|  13.0k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (356:3): [True: 13.0k, False: 3.42k]
  ------------------
  357|  13.0k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  209|  13.0k|#define TRUE    1
  ------------------
  358|  13.0k|    cinfo->num_components = 1;
  359|       |    /* JFIF specifies component ID 1 */
  360|  13.0k|    SET_COMP(0, 1, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|  13.0k|  (compptr = &cinfo->comp_info[index], \
  |  |  335|  13.0k|   compptr->component_id = (id), \
  |  |  336|  13.0k|   compptr->h_samp_factor = (hsamp), \
  |  |  337|  13.0k|   compptr->v_samp_factor = (vsamp), \
  |  |  338|  13.0k|   compptr->quant_tbl_no = (quant), \
  |  |  339|  13.0k|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|  13.0k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  361|  13.0k|    break;
  362|    118|  case JCS_RGB:
  ------------------
  |  Branch (362:3): [True: 118, False: 16.3k]
  ------------------
  363|    118|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
  ------------------
  |  |  209|    118|#define TRUE    1
  ------------------
  364|    118|    cinfo->num_components = 3;
  365|    118|    SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    118|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    118|   compptr->component_id = (id), \
  |  |  336|    118|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    118|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    118|   compptr->quant_tbl_no = (quant), \
  |  |  339|    118|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    118|   compptr->ac_tbl_no = (actbl) )
  ------------------
  366|    118|    SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    118|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    118|   compptr->component_id = (id), \
  |  |  336|    118|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    118|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    118|   compptr->quant_tbl_no = (quant), \
  |  |  339|    118|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    118|   compptr->ac_tbl_no = (actbl) )
  ------------------
  367|    118|    SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    118|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    118|   compptr->component_id = (id), \
  |  |  336|    118|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    118|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    118|   compptr->quant_tbl_no = (quant), \
  |  |  339|    118|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    118|   compptr->ac_tbl_no = (actbl) )
  ------------------
  368|    118|    break;
  369|  2.97k|  case JCS_YCbCr:
  ------------------
  |  Branch (369:3): [True: 2.97k, False: 13.4k]
  ------------------
  370|  2.97k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  209|  2.97k|#define TRUE    1
  ------------------
  371|  2.97k|    cinfo->num_components = 3;
  372|       |    /* JFIF specifies component IDs 1,2,3 */
  373|       |    /* We default to 2x2 subsamples of chrominance */
  374|  2.97k|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  334|  2.97k|  (compptr = &cinfo->comp_info[index], \
  |  |  335|  2.97k|   compptr->component_id = (id), \
  |  |  336|  2.97k|   compptr->h_samp_factor = (hsamp), \
  |  |  337|  2.97k|   compptr->v_samp_factor = (vsamp), \
  |  |  338|  2.97k|   compptr->quant_tbl_no = (quant), \
  |  |  339|  2.97k|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|  2.97k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  375|  2.97k|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  334|  2.97k|  (compptr = &cinfo->comp_info[index], \
  |  |  335|  2.97k|   compptr->component_id = (id), \
  |  |  336|  2.97k|   compptr->h_samp_factor = (hsamp), \
  |  |  337|  2.97k|   compptr->v_samp_factor = (vsamp), \
  |  |  338|  2.97k|   compptr->quant_tbl_no = (quant), \
  |  |  339|  2.97k|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|  2.97k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  376|  2.97k|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  334|  2.97k|  (compptr = &cinfo->comp_info[index], \
  |  |  335|  2.97k|   compptr->component_id = (id), \
  |  |  336|  2.97k|   compptr->h_samp_factor = (hsamp), \
  |  |  337|  2.97k|   compptr->v_samp_factor = (vsamp), \
  |  |  338|  2.97k|   compptr->quant_tbl_no = (quant), \
  |  |  339|  2.97k|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|  2.97k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  377|  2.97k|    break;
  378|    328|  case JCS_CMYK:
  ------------------
  |  Branch (378:3): [True: 328, False: 16.1k]
  ------------------
  379|    328|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
  ------------------
  |  |  209|    328|#define TRUE    1
  ------------------
  380|    328|    cinfo->num_components = 4;
  381|    328|    SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    328|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    328|   compptr->component_id = (id), \
  |  |  336|    328|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    328|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    328|   compptr->quant_tbl_no = (quant), \
  |  |  339|    328|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    328|   compptr->ac_tbl_no = (actbl) )
  ------------------
  382|    328|    SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    328|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    328|   compptr->component_id = (id), \
  |  |  336|    328|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    328|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    328|   compptr->quant_tbl_no = (quant), \
  |  |  339|    328|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    328|   compptr->ac_tbl_no = (actbl) )
  ------------------
  383|    328|    SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    328|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    328|   compptr->component_id = (id), \
  |  |  336|    328|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    328|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    328|   compptr->quant_tbl_no = (quant), \
  |  |  339|    328|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    328|   compptr->ac_tbl_no = (actbl) )
  ------------------
  384|    328|    SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|    328|  (compptr = &cinfo->comp_info[index], \
  |  |  335|    328|   compptr->component_id = (id), \
  |  |  336|    328|   compptr->h_samp_factor = (hsamp), \
  |  |  337|    328|   compptr->v_samp_factor = (vsamp), \
  |  |  338|    328|   compptr->quant_tbl_no = (quant), \
  |  |  339|    328|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|    328|   compptr->ac_tbl_no = (actbl) )
  ------------------
  385|    328|    break;
  386|      2|  case JCS_YCCK:
  ------------------
  |  Branch (386:3): [True: 2, False: 16.4k]
  ------------------
  387|      2|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
  ------------------
  |  |  209|      2|#define TRUE    1
  ------------------
  388|      2|    cinfo->num_components = 4;
  389|      2|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  334|      2|  (compptr = &cinfo->comp_info[index], \
  |  |  335|      2|   compptr->component_id = (id), \
  |  |  336|      2|   compptr->h_samp_factor = (hsamp), \
  |  |  337|      2|   compptr->v_samp_factor = (vsamp), \
  |  |  338|      2|   compptr->quant_tbl_no = (quant), \
  |  |  339|      2|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|      2|   compptr->ac_tbl_no = (actbl) )
  ------------------
  390|      2|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  334|      2|  (compptr = &cinfo->comp_info[index], \
  |  |  335|      2|   compptr->component_id = (id), \
  |  |  336|      2|   compptr->h_samp_factor = (hsamp), \
  |  |  337|      2|   compptr->v_samp_factor = (vsamp), \
  |  |  338|      2|   compptr->quant_tbl_no = (quant), \
  |  |  339|      2|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|      2|   compptr->ac_tbl_no = (actbl) )
  ------------------
  391|      2|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  334|      2|  (compptr = &cinfo->comp_info[index], \
  |  |  335|      2|   compptr->component_id = (id), \
  |  |  336|      2|   compptr->h_samp_factor = (hsamp), \
  |  |  337|      2|   compptr->v_samp_factor = (vsamp), \
  |  |  338|      2|   compptr->quant_tbl_no = (quant), \
  |  |  339|      2|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|      2|   compptr->ac_tbl_no = (actbl) )
  ------------------
  392|      2|    SET_COMP(3, 4, 2, 2, 0, 0, 0);
  ------------------
  |  |  334|      2|  (compptr = &cinfo->comp_info[index], \
  |  |  335|      2|   compptr->component_id = (id), \
  |  |  336|      2|   compptr->h_samp_factor = (hsamp), \
  |  |  337|      2|   compptr->v_samp_factor = (vsamp), \
  |  |  338|      2|   compptr->quant_tbl_no = (quant), \
  |  |  339|      2|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|      2|   compptr->ac_tbl_no = (actbl) )
  ------------------
  393|      2|    break;
  394|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (394:3): [True: 0, False: 16.4k]
  ------------------
  395|      0|    cinfo->num_components = cinfo->input_components;
  396|      0|    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   29|      0|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (396:9): [True: 0, False: 0]
  |  Branch (396:38): [True: 0, False: 0]
  ------------------
  397|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  398|      0|               MAX_COMPONENTS);
  399|      0|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (399:18): [True: 0, False: 0]
  ------------------
  400|      0|      SET_COMP(ci, ci, 1, 1, 0, 0, 0);
  ------------------
  |  |  334|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  335|      0|   compptr->component_id = (id), \
  |  |  336|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  337|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  338|      0|   compptr->quant_tbl_no = (quant), \
  |  |  339|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  340|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  401|      0|    }
  402|      0|    break;
  403|      0|  default:
  ------------------
  |  Branch (403:3): [True: 0, False: 16.4k]
  ------------------
  404|      0|    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  405|  16.4k|  }
  406|  16.4k|}
jpeg_simple_progression:
  473|  5.41k|{
  474|  5.41k|  int ncomps = cinfo->num_components;
  475|  5.41k|  int nscans;
  476|  5.41k|  jpeg_scan_info *scanptr;
  477|       |
  478|       |  /* Safety check to ensure start_compress not called yet. */
  479|  5.41k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  5.41k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (479:7): [True: 0, False: 5.41k]
  ------------------
  480|      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)))
  ------------------
  481|       |
  482|  5.41k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (482:7): [True: 0, False: 5.41k]
  ------------------
  483|      0|    cinfo->master->lossless = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  484|      0|    jpeg_default_colorspace(cinfo);
  485|      0|  }
  486|       |
  487|       |  /* Figure space needed for script.  Calculation must match code below! */
  488|  5.41k|  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (488:7): [True: 801, False: 4.61k]
  |  Branch (488:22): [True: 711, False: 90]
  ------------------
  489|       |    /* Custom script for YCbCr color images. */
  490|    711|    nscans = 10;
  491|  4.70k|  } else {
  492|       |    /* All-purpose script for other color spaces. */
  493|  4.70k|    if (ncomps > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  4.70k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (493:9): [True: 0, False: 4.70k]
  ------------------
  494|      0|      nscans = 6 * ncomps;      /* 2 DC + 4 AC scans per component */
  495|  4.70k|    else
  496|  4.70k|      nscans = 2 + 4 * ncomps;  /* 2 DC scans; 4 AC scans per component */
  497|  4.70k|  }
  498|       |
  499|       |  /* Allocate space for script.
  500|       |   * We need to put it in the permanent pool in case the application performs
  501|       |   * multiple compressions without changing the settings.  To avoid a memory
  502|       |   * leak if jpeg_simple_progression is called repeatedly for the same JPEG
  503|       |   * object, we try to re-use previously allocated space, and we allocate
  504|       |   * enough space to handle YCbCr even if initially asked for grayscale.
  505|       |   */
  506|  5.41k|  if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
  ------------------
  |  Branch (506:7): [True: 2.69k, False: 2.71k]
  |  Branch (506:38): [True: 0, False: 2.71k]
  ------------------
  507|  2.69k|    cinfo->script_space_size = MAX(nscans, 10);
  ------------------
  |  |  446|  2.69k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 150, False: 2.54k]
  |  |  ------------------
  ------------------
  508|  2.69k|    cinfo->script_space = (jpeg_scan_info *)
  509|  2.69k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  2.69k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  510|  2.69k|                        cinfo->script_space_size * sizeof(jpeg_scan_info));
  511|  2.69k|  }
  512|  5.41k|  scanptr = cinfo->script_space;
  513|  5.41k|  cinfo->scan_info = scanptr;
  514|  5.41k|  cinfo->num_scans = nscans;
  515|       |
  516|  5.41k|  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (516:7): [True: 801, False: 4.61k]
  |  Branch (516:22): [True: 711, False: 90]
  ------------------
  517|       |    /* Custom script for YCbCr color images. */
  518|       |    /* Initial DC scan */
  519|    711|    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  520|       |    /* Initial AC scan: get some luma data out in a hurry */
  521|    711|    scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
  522|       |    /* Chroma data is too small to be worth expending many scans on */
  523|    711|    scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
  524|    711|    scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
  525|       |    /* Complete spectral selection for luma AC */
  526|    711|    scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
  527|       |    /* Refine next bit of luma AC */
  528|    711|    scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
  529|       |    /* Finish DC successive approximation */
  530|    711|    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  531|       |    /* Finish AC successive approximation */
  532|    711|    scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
  533|    711|    scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
  534|       |    /* Luma bottom bit comes last since it's usually largest scan */
  535|    711|    scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
  536|  4.70k|  } else {
  537|       |    /* All-purpose script for other color spaces. */
  538|       |    /* Successive approximation first pass */
  539|  4.70k|    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  540|  4.70k|    scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
  541|  4.70k|    scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
  542|       |    /* Successive approximation second pass */
  543|  4.70k|    scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
  544|       |    /* Successive approximation final pass */
  545|  4.70k|    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  546|  4.70k|    scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
  547|  4.70k|  }
  548|  5.41k|}
jcparam.c:fill_dc_scans:
  446|  10.8k|{
  447|  10.8k|  int ci;
  448|       |
  449|  10.8k|  if (ncomps <= MAX_COMPS_IN_SCAN) {
  ------------------
  |  |   60|  10.8k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (449:7): [True: 10.8k, False: 0]
  ------------------
  450|       |    /* Single interleaved DC scan */
  451|  10.8k|    scanptr->comps_in_scan = ncomps;
  452|  25.6k|    for (ci = 0; ci < ncomps; ci++)
  ------------------
  |  Branch (452:18): [True: 14.7k, False: 10.8k]
  ------------------
  453|  14.7k|      scanptr->component_index[ci] = ci;
  454|  10.8k|    scanptr->Ss = scanptr->Se = 0;
  455|  10.8k|    scanptr->Ah = Ah;
  456|  10.8k|    scanptr->Al = Al;
  457|  10.8k|    scanptr++;
  458|  10.8k|  } else {
  459|       |    /* Noninterleaved DC scan for each component */
  460|      0|    scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
  461|      0|  }
  462|  10.8k|  return scanptr;
  463|  10.8k|}
jcparam.c:fill_a_scan:
  414|  5.68k|{
  415|  5.68k|  scanptr->comps_in_scan = 1;
  416|  5.68k|  scanptr->component_index[0] = ci;
  417|  5.68k|  scanptr->Ss = Ss;
  418|  5.68k|  scanptr->Se = Se;
  419|  5.68k|  scanptr->Ah = Ah;
  420|  5.68k|  scanptr->Al = Al;
  421|  5.68k|  scanptr++;
  422|  5.68k|  return scanptr;
  423|  5.68k|}
jcparam.c:fill_scans:
  428|  18.8k|{
  429|  18.8k|  int ci;
  430|       |
  431|  39.8k|  for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (431:16): [True: 21.0k, False: 18.8k]
  ------------------
  432|  21.0k|    scanptr->comps_in_scan = 1;
  433|  21.0k|    scanptr->component_index[0] = ci;
  434|  21.0k|    scanptr->Ss = Ss;
  435|  21.0k|    scanptr->Se = Se;
  436|  21.0k|    scanptr->Ah = Ah;
  437|  21.0k|    scanptr->Al = Al;
  438|  21.0k|    scanptr++;
  439|  21.0k|  }
  440|  18.8k|  return scanptr;
  441|  18.8k|}

jinit_phuff_encoder:
 1107|  2.86k|{
 1108|  2.86k|  phuff_entropy_ptr entropy;
 1109|  2.86k|  int i;
 1110|       |
 1111|  2.86k|  entropy = (phuff_entropy_ptr)
 1112|  2.86k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  2.86k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1113|  2.86k|                                sizeof(phuff_entropy_encoder));
 1114|  2.86k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
 1115|  2.86k|  entropy->pub.start_pass = start_pass_phuff;
 1116|       |
 1117|       |  /* Mark tables unallocated */
 1118|  14.3k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  14.3k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (1118:15): [True: 11.4k, False: 2.86k]
  ------------------
 1119|  11.4k|    entropy->derived_tbls[i] = NULL;
 1120|  11.4k|    entropy->count_ptrs[i] = NULL;
 1121|  11.4k|  }
 1122|  2.86k|  entropy->bit_buffer = NULL;   /* needed only in AC refinement scan */
 1123|  2.86k|}
jcphuff.c:start_pass_phuff:
  213|  33.9k|{
  214|  33.9k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  215|  33.9k|  boolean is_DC_band;
  216|  33.9k|  int ci, tbl;
  217|  33.9k|  jpeg_component_info *compptr;
  218|       |
  219|  33.9k|  entropy->cinfo = cinfo;
  220|  33.9k|  entropy->gather_statistics = gather_statistics;
  221|       |
  222|  33.9k|  is_DC_band = (cinfo->Ss == 0);
  223|       |
  224|       |  /* We assume jcmaster.c already validated the scan parameters. */
  225|       |
  226|       |  /* Select execution routines */
  227|  33.9k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (227:7): [True: 18.5k, False: 15.3k]
  ------------------
  228|  18.5k|    if (is_DC_band)
  ------------------
  |  Branch (228:9): [True: 5.58k, False: 12.9k]
  ------------------
  229|  5.58k|      entropy->pub.encode_mcu = encode_mcu_DC_first;
  230|  12.9k|    else
  231|  12.9k|      entropy->pub.encode_mcu = encode_mcu_AC_first;
  232|  18.5k|#ifdef WITH_SIMD
  233|  18.5k|    if (jsimd_can_encode_mcu_AC_first_prepare())
  ------------------
  |  Branch (233:9): [True: 18.5k, False: 0]
  ------------------
  234|  18.5k|      entropy->AC_first_prepare = jsimd_encode_mcu_AC_first_prepare;
  235|      0|    else
  236|      0|#endif
  237|      0|      entropy->AC_first_prepare = encode_mcu_AC_first_prepare;
  238|  18.5k|  } else {
  239|  15.3k|    if (is_DC_band)
  ------------------
  |  Branch (239:9): [True: 2.63k, False: 12.7k]
  ------------------
  240|  2.63k|      entropy->pub.encode_mcu = encode_mcu_DC_refine;
  241|  12.7k|    else {
  242|  12.7k|      entropy->pub.encode_mcu = encode_mcu_AC_refine;
  243|  12.7k|#ifdef WITH_SIMD
  244|  12.7k|      if (jsimd_can_encode_mcu_AC_refine_prepare())
  ------------------
  |  Branch (244:11): [True: 12.7k, False: 0]
  ------------------
  245|  12.7k|        entropy->AC_refine_prepare = jsimd_encode_mcu_AC_refine_prepare;
  246|      0|      else
  247|      0|#endif
  248|      0|        entropy->AC_refine_prepare = encode_mcu_AC_refine_prepare;
  249|       |      /* AC refinement needs a correction bit buffer */
  250|  12.7k|      if (entropy->bit_buffer == NULL)
  ------------------
  |  Branch (250:11): [True: 2.63k, False: 10.0k]
  ------------------
  251|  2.63k|        entropy->bit_buffer = (char *)
  252|  2.63k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  2.63k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  253|  2.63k|                                      MAX_CORR_BITS * sizeof(char));
  ------------------
  |  |  140|  2.63k|#define MAX_CORR_BITS  1000     /* Max # of correction bits I can buffer */
  ------------------
  254|  12.7k|    }
  255|  15.3k|  }
  256|  33.9k|  if (gather_statistics)
  ------------------
  |  Branch (256:7): [True: 15.7k, False: 18.1k]
  ------------------
  257|  15.7k|    entropy->pub.finish_pass = finish_pass_gather_phuff;
  258|  18.1k|  else
  259|  18.1k|    entropy->pub.finish_pass = finish_pass_phuff;
  260|       |
  261|       |  /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
  262|       |   * for AC coefficients.
  263|       |   */
  264|  70.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (264:16): [True: 36.2k, False: 33.9k]
  ------------------
  265|  36.2k|    compptr = cinfo->cur_comp_info[ci];
  266|       |    /* Initialize DC predictions to 0 */
  267|  36.2k|    entropy->last_dc_val[ci] = 0;
  268|       |    /* Get table index */
  269|  36.2k|    if (is_DC_band) {
  ------------------
  |  Branch (269:9): [True: 10.5k, False: 25.6k]
  ------------------
  270|  10.5k|      if (cinfo->Ah != 0)       /* DC refinement needs no table */
  ------------------
  |  Branch (270:11): [True: 3.36k, False: 7.17k]
  ------------------
  271|  3.36k|        continue;
  272|  7.17k|      tbl = compptr->dc_tbl_no;
  273|  25.6k|    } else {
  274|  25.6k|      entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
  275|  25.6k|    }
  276|  32.8k|    if (gather_statistics) {
  ------------------
  |  Branch (276:9): [True: 16.5k, False: 16.3k]
  ------------------
  277|       |      /* Check for invalid table index */
  278|       |      /* (make_c_derived_tbl does this in the other path) */
  279|  16.5k|      if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|  16.5k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (279:11): [True: 0, False: 16.5k]
  |  Branch (279:22): [True: 0, False: 16.5k]
  ------------------
  280|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |      /* Allocate and zero the statistics tables */
  282|       |      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
  283|  16.5k|      if (entropy->count_ptrs[tbl] == NULL)
  ------------------
  |  Branch (283:11): [True: 3.07k, False: 13.4k]
  ------------------
  284|  3.07k|        entropy->count_ptrs[tbl] = (long *)
  285|  3.07k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  3.07k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  286|  3.07k|                                      257 * sizeof(long));
  287|  16.5k|      memset(entropy->count_ptrs[tbl], 0, 257 * sizeof(long));
  288|  16.5k|    } else {
  289|       |      /* Compute derived values for Huffman table */
  290|       |      /* We may do this more than once for a table, but it's not expensive */
  291|  16.3k|      jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
  292|  16.3k|                              &entropy->derived_tbls[tbl]);
  293|  16.3k|    }
  294|  32.8k|  }
  295|       |
  296|       |  /* Initialize AC stuff */
  297|  33.9k|  entropy->EOBRUN = 0;
  298|  33.9k|  entropy->BE = 0;
  299|       |
  300|       |  /* Initialize bit buffer to empty */
  301|  33.9k|  entropy->put_buffer = 0;
  302|  33.9k|  entropy->put_bits = 0;
  303|       |
  304|       |  /* Initialize restart stuff */
  305|  33.9k|  entropy->restarts_to_go = cinfo->restart_interval;
  306|  33.9k|  entropy->next_restart_num = 0;
  307|  33.9k|}
jcphuff.c:encode_mcu_DC_first:
  493|  17.5M|{
  494|  17.5M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  495|  17.5M|  register int temp, temp2, temp3;
  496|  17.5M|  register int nbits;
  497|  17.5M|  int blkn, ci;
  498|  17.5M|  int Al = cinfo->Al;
  499|  17.5M|  JBLOCKROW block;
  500|  17.5M|  jpeg_component_info *compptr;
  501|  17.5M|  ISHIFT_TEMPS
  502|  17.5M|  int max_coef_bits = cinfo->data_precision + 2;
  503|       |
  504|  17.5M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  505|  17.5M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  506|       |
  507|       |  /* Emit restart marker if needed */
  508|  17.5M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (508:7): [True: 0, False: 17.5M]
  ------------------
  509|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (509:9): [True: 0, False: 0]
  ------------------
  510|      0|      emit_restart(entropy, entropy->next_restart_num);
  511|       |
  512|       |  /* Encode the MCU data blocks */
  513|  39.1M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (513:18): [True: 21.6M, False: 17.5M]
  ------------------
  514|  21.6M|    block = MCU_data[blkn];
  515|  21.6M|    ci = cinfo->MCU_membership[blkn];
  516|  21.6M|    compptr = cinfo->cur_comp_info[ci];
  517|       |
  518|       |    /* Compute the DC value after the required point transform by Al.
  519|       |     * This is simply an arithmetic right shift.
  520|       |     */
  521|  21.6M|    temp2 = IRIGHT_SHIFT((int)((*block)[0]), Al);
  ------------------
  |  |  155|  21.6M|#define IRIGHT_SHIFT(x, shft)   ((x) >> (shft))
  ------------------
  522|       |
  523|       |    /* DC differences are figured on the point-transformed values. */
  524|  21.6M|    temp = temp2 - entropy->last_dc_val[ci];
  525|  21.6M|    entropy->last_dc_val[ci] = temp2;
  526|       |
  527|       |    /* Encode the DC coefficient difference per section G.1.2.1 */
  528|       |
  529|       |    /* This is a well-known technique for obtaining the absolute value without
  530|       |     * a branch.  It is derived from an assembly language technique presented
  531|       |     * in "How to Optimize for the Pentium Processors", Copyright (c) 1996,
  532|       |     * 1997 by Agner Fog.
  533|       |     */
  534|  21.6M|    temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
  535|  21.6M|    temp ^= temp3;
  536|  21.6M|    temp -= temp3;              /* temp is abs value of input */
  537|       |    /* For a negative input, want temp2 = bitwise complement of abs(input) */
  538|  21.6M|    temp2 = temp ^ temp3;
  539|       |
  540|       |    /* Find the number of bits needed for the magnitude of the coefficient */
  541|  21.6M|    nbits = JPEG_NBITS(temp);
  ------------------
  |  |   78|  21.6M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  ------------------
  542|       |    /* Check for out-of-range coefficient values.
  543|       |     * Since we're encoding a difference, the range limit is twice as much.
  544|       |     */
  545|  21.6M|    if (nbits > max_coef_bits + 1)
  ------------------
  |  Branch (545:9): [True: 128, False: 21.6M]
  ------------------
  546|    128|      ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|    128|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    128|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  547|       |
  548|       |    /* Count/emit the Huffman-coded symbol for the number of bits */
  549|  21.6M|    emit_symbol(entropy, compptr->dc_tbl_no, nbits);
  550|       |
  551|       |    /* Emit that number of bits of the value, if positive, */
  552|       |    /* or the complement of its magnitude, if negative. */
  553|  21.6M|    if (nbits)                  /* emit_bits rejects calls with size 0 */
  ------------------
  |  Branch (553:9): [True: 248k, False: 21.3M]
  ------------------
  554|   248k|      emit_bits(entropy, (unsigned int)temp2, nbits);
  555|  21.6M|  }
  556|       |
  557|  17.5M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  558|  17.5M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  559|       |
  560|       |  /* Update restart-interval state too */
  561|  17.5M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (561:7): [True: 0, False: 17.5M]
  ------------------
  562|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (562:9): [True: 0, False: 0]
  ------------------
  563|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  564|      0|      entropy->next_restart_num++;
  565|      0|      entropy->next_restart_num &= 7;
  566|      0|    }
  567|      0|    entropy->restarts_to_go--;
  568|      0|  }
  569|       |
  570|  17.5M|  return TRUE;
  ------------------
  |  |  209|  17.5M|#define TRUE    1
  ------------------
  571|  17.5M|}
jcphuff.c:emit_eobrun:
  434|  24.5M|{
  435|  24.5M|  register int temp, nbits;
  436|       |
  437|  24.5M|  if (entropy->EOBRUN > 0) {    /* if there is any pending EOBRUN */
  ------------------
  |  Branch (437:7): [True: 1.39M, False: 23.1M]
  ------------------
  438|  1.39M|    temp = entropy->EOBRUN;
  439|  1.39M|    nbits = JPEG_NBITS_NONZERO(temp) - 1;
  ------------------
  |  |   79|  1.39M|#define JPEG_NBITS_NONZERO(x)  JPEG_NBITS(x)
  |  |  ------------------
  |  |  |  |   78|  1.39M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  |  |  ------------------
  ------------------
  440|       |    /* safety check: shouldn't happen given limited correction-bit buffer */
  441|  1.39M|    if (nbits > 14)
  ------------------
  |  Branch (441:9): [True: 0, False: 1.39M]
  ------------------
  442|      0|      ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|       |
  444|  1.39M|    emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
  445|  1.39M|    if (nbits)
  ------------------
  |  Branch (445:9): [True: 168k, False: 1.22M]
  ------------------
  446|   168k|      emit_bits(entropy, entropy->EOBRUN, nbits);
  447|       |
  448|  1.39M|    entropy->EOBRUN = 0;
  449|       |
  450|       |    /* Emit any buffered correction bits */
  451|  1.39M|    emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
  452|  1.39M|    entropy->BE = 0;
  453|  1.39M|  }
  454|  24.5M|}
jcphuff.c:emit_buffered_bits:
  416|  25.3M|{
  417|  25.3M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (417:7): [True: 12.6M, False: 12.6M]
  ------------------
  418|  12.6M|    return;                     /* no real work */
  419|       |
  420|  22.9M|  while (nbits > 0) {
  ------------------
  |  Branch (420:10): [True: 10.2M, False: 12.6M]
  ------------------
  421|  10.2M|    emit_bits(entropy, (unsigned int)(*bufstart), 1);
  422|  10.2M|    bufstart++;
  423|  10.2M|    nbits--;
  424|  10.2M|  }
  425|  12.6M|}
jcphuff.c:flush_bits:
  386|  18.1k|{
  387|  18.1k|  emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
  388|  18.1k|  entropy->put_buffer = 0;     /* and reset bit-buffer to empty */
  389|  18.1k|  entropy->put_bits = 0;
  390|  18.1k|}
jcphuff.c:dump_buffer:
  326|    294|{
  327|    294|  struct jpeg_destination_mgr *dest = entropy->cinfo->dest;
  328|       |
  329|    294|  if (!(*dest->empty_output_buffer) (entropy->cinfo))
  ------------------
  |  Branch (329:7): [True: 0, False: 294]
  ------------------
  330|      0|    ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  331|       |  /* After a successful buffer dump, must reset buffer pointers */
  332|    294|  entropy->next_output_byte = dest->next_output_byte;
  333|    294|  entropy->free_in_buffer = dest->free_in_buffer;
  334|    294|}
jcphuff.c:emit_symbol:
  399|  55.9M|{
  400|  55.9M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (400:7): [True: 27.9M, False: 27.9M]
  ------------------
  401|  27.9M|    entropy->count_ptrs[tbl_no][symbol]++;
  402|  27.9M|  else {
  403|  27.9M|    c_derived_tbl *tbl = entropy->derived_tbls[tbl_no];
  404|  27.9M|    emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
  405|  27.9M|  }
  406|  55.9M|}
jcphuff.c:emit_bits:
  348|  81.1M|{
  349|       |  /* This routine is heavily used, so it's worth coding tightly. */
  350|  81.1M|  register size_t put_buffer = (size_t)code;
  351|  81.1M|  register int put_bits = entropy->put_bits;
  352|       |
  353|       |  /* if size is 0, caller used an invalid Huffman table entry */
  354|  81.1M|  if (size == 0)
  ------------------
  |  Branch (354:7): [True: 0, False: 81.1M]
  ------------------
  355|      0|    ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  356|       |
  357|  81.1M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (357:7): [True: 16.2M, False: 64.8M]
  ------------------
  358|  16.2M|    return;                     /* do nothing if we're only getting stats */
  359|       |
  360|  64.8M|  put_buffer &= (((size_t)1) << size) - 1; /* mask off any extra bits in code */
  361|       |
  362|  64.8M|  put_bits += size;             /* new number of bits in buffer */
  363|       |
  364|  64.8M|  put_buffer <<= 24 - put_bits; /* align incoming bits */
  365|       |
  366|  64.8M|  put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
  367|       |
  368|  75.0M|  while (put_bits >= 8) {
  ------------------
  |  Branch (368:10): [True: 10.1M, False: 64.8M]
  ------------------
  369|  10.1M|    int c = (int)((put_buffer >> 16) & 0xFF);
  370|       |
  371|  10.1M|    emit_byte(entropy, c);
  ------------------
  |  |  316|  10.1M|#define emit_byte(entropy, val) { \
  |  |  317|  10.1M|  *(entropy)->next_output_byte++ = (JOCTET)(val); \
  |  |  318|  10.1M|  if (--(entropy)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (318:7): [True: 280, False: 10.1M]
  |  |  ------------------
  |  |  319|  10.1M|    dump_buffer(entropy); \
  |  |  320|  10.1M|}
  ------------------
  372|  10.1M|    if (c == 0xFF) {            /* need to stuff a zero byte? */
  ------------------
  |  Branch (372:9): [True: 523k, False: 9.67M]
  ------------------
  373|   523k|      emit_byte(entropy, 0);
  ------------------
  |  |  316|   523k|#define emit_byte(entropy, val) { \
  |  |  317|   523k|  *(entropy)->next_output_byte++ = (JOCTET)(val); \
  |  |  318|   523k|  if (--(entropy)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (318:7): [True: 14, False: 523k]
  |  |  ------------------
  |  |  319|   523k|    dump_buffer(entropy); \
  |  |  320|   523k|}
  ------------------
  374|   523k|    }
  375|  10.1M|    put_buffer <<= 8;
  376|  10.1M|    put_bits -= 8;
  377|  10.1M|  }
  378|       |
  379|  64.8M|  entropy->put_buffer = put_buffer; /* update variables */
  380|  64.8M|  entropy->put_bits = put_bits;
  381|  64.8M|}
jcphuff.c:encode_mcu_AC_first:
  673|  40.9M|{
  674|  40.9M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  675|  40.9M|  register int temp, temp2;
  676|  40.9M|  register int nbits, r;
  677|  40.9M|  int Sl = cinfo->Se - cinfo->Ss + 1;
  678|  40.9M|  int Al = cinfo->Al;
  679|  40.9M|  UJCOEF values_unaligned[2 * DCTSIZE2 + 15];
  680|  40.9M|  UJCOEF *values;
  681|  40.9M|  const UJCOEF *cvalue;
  682|  40.9M|  size_t zerobits;
  683|  40.9M|  size_t bits[8 / SIZEOF_SIZE_T];
  684|  40.9M|  int max_coef_bits = cinfo->data_precision + 2;
  685|       |
  686|  40.9M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  687|  40.9M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  688|       |
  689|       |  /* Emit restart marker if needed */
  690|  40.9M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (690:7): [True: 0, False: 40.9M]
  ------------------
  691|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (691:9): [True: 0, False: 0]
  ------------------
  692|      0|      emit_restart(entropy, entropy->next_restart_num);
  693|       |
  694|  40.9M|#ifdef WITH_SIMD
  695|  40.9M|  cvalue = values = (UJCOEF *)PAD((JUINTPTR)values_unaligned, 16);
  ------------------
  |  |  158|  40.9M|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  696|       |#else
  697|       |  /* Not using SIMD, so alignment is not needed */
  698|       |  cvalue = values = values_unaligned;
  699|       |#endif
  700|       |
  701|       |  /* Prepare data */
  702|  40.9M|  entropy->AC_first_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
  703|  40.9M|                            Sl, Al, values, bits);
  704|       |
  705|  40.9M|  zerobits = bits[0];
  706|       |#if SIZEOF_SIZE_T == 4
  707|       |  zerobits |= bits[1];
  708|       |#endif
  709|       |
  710|       |  /* Emit any pending EOBRUN */
  711|  40.9M|  if (zerobits && (entropy->EOBRUN > 0))
  ------------------
  |  Branch (711:7): [True: 713k, False: 40.1M]
  |  Branch (711:19): [True: 549k, False: 163k]
  ------------------
  712|   549k|    emit_eobrun(entropy);
  713|       |
  714|       |#if SIZEOF_SIZE_T == 4
  715|       |  zerobits = bits[0];
  716|       |#endif
  717|       |
  718|       |  /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
  719|       |
  720|  40.9M|  ENCODE_COEFS_AC_FIRST((void)0;);
  ------------------
  |  |  639|  40.9M|#define ENCODE_COEFS_AC_FIRST(label) { \
  |  |  640|  49.5M|  while (zerobits) { \
  |  |  ------------------
  |  |  |  Branch (640:10): [True: 8.65M, False: 40.9M]
  |  |  ------------------
  |  |  641|  8.65M|    r = count_zeroes(&zerobits); \
  |  |  642|  8.65M|    cvalue += r; \
  |  |  643|  8.65M|label \
  |  |  644|  8.65M|    temp  = cvalue[0]; \
  |  |  645|  8.65M|    temp2 = cvalue[DCTSIZE2]; \
  |  |  ------------------
  |  |  |  |   56|  8.65M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  |  |  646|  8.65M|    \
  |  |  647|  8.65M|    /* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
  |  |  648|  8.93M|    while (r > 15) { \
  |  |  ------------------
  |  |  |  Branch (648:12): [True: 282k, False: 8.65M]
  |  |  ------------------
  |  |  649|   282k|      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
  |  |  650|   282k|      r -= 16; \
  |  |  651|   282k|    } \
  |  |  652|  8.65M|    \
  |  |  653|  8.65M|    /* Find the number of bits needed for the magnitude of the coefficient */ \
  |  |  654|  8.65M|    nbits = JPEG_NBITS_NONZERO(temp);  /* there must be at least one 1 bit */ \
  |  |  ------------------
  |  |  |  |   79|  8.65M|#define JPEG_NBITS_NONZERO(x)  JPEG_NBITS(x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  8.65M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  655|  8.65M|    /* Check for out-of-range coefficient values */ \
  |  |  656|  8.65M|    if (nbits > max_coef_bits) \
  |  |  ------------------
  |  |  |  Branch (656:9): [True: 94, False: 8.65M]
  |  |  ------------------
  |  |  657|  8.65M|      ERREXIT(cinfo, JERR_BAD_DCT_COEF); \
  |  |  ------------------
  |  |  |  |  240|     94|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  241|     94|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |  658|  8.65M|    \
  |  |  659|  8.65M|    /* Count/emit Huffman symbol for run length / number of bits */ \
  |  |  660|  8.65M|    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); \
  |  |  661|  8.65M|    \
  |  |  662|  8.65M|    /* Emit that number of bits of the value, if positive, */ \
  |  |  663|  8.65M|    /* or the complement of its magnitude, if negative. */ \
  |  |  664|  8.65M|    emit_bits(entropy, (unsigned int)temp2, nbits); \
  |  |  665|  8.65M|    \
  |  |  666|  8.65M|    cvalue++; \
  |  |  667|  8.65M|    zerobits >>= 1; \
  |  |  668|  8.65M|  } \
  |  |  669|  40.9M|}
  ------------------
  721|       |
  722|       |#if SIZEOF_SIZE_T == 4
  723|       |  zerobits = bits[1];
  724|       |  if (zerobits) {
  725|       |    int diff = ((values + DCTSIZE2 / 2) - cvalue);
  726|       |    r = count_zeroes(&zerobits);
  727|       |    r += diff;
  728|       |    cvalue += r;
  729|       |    goto first_iter_ac_first;
  730|       |  }
  731|       |
  732|       |  ENCODE_COEFS_AC_FIRST(first_iter_ac_first:);
  733|       |#endif
  734|       |
  735|  40.9M|  if (cvalue < (values + Sl)) { /* If there are trailing zeroes, */
  ------------------
  |  Branch (735:7): [True: 40.7M, False: 172k]
  ------------------
  736|  40.7M|    entropy->EOBRUN++;          /* count an EOB */
  737|  40.7M|    if (entropy->EOBRUN == 0x7FFF)
  ------------------
  |  Branch (737:9): [True: 0, False: 40.7M]
  ------------------
  738|      0|      emit_eobrun(entropy);     /* force it out to avoid overflow */
  739|  40.7M|  }
  740|       |
  741|  40.9M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  742|  40.9M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  743|       |
  744|       |  /* Update restart-interval state too */
  745|  40.9M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (745:7): [True: 0, False: 40.9M]
  ------------------
  746|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  748|      0|      entropy->next_restart_num++;
  749|      0|      entropy->next_restart_num &= 7;
  750|      0|    }
  751|      0|    entropy->restarts_to_go--;
  752|      0|  }
  753|       |
  754|  40.9M|  return TRUE;
  ------------------
  |  |  209|  40.9M|#define TRUE    1
  ------------------
  755|  40.9M|}
jcphuff.c:count_zeroes:
  183|  52.6M|{
  184|  52.6M|#if defined(HAVE_BUILTIN_CTZL)
  185|  52.6M|  int result;
  186|  52.6M|  result = __builtin_ctzl(*x);
  187|  52.6M|  *x >>= result;
  188|       |#elif defined(HAVE_BITSCANFORWARD64)
  189|       |  unsigned long result;
  190|       |  _BitScanForward64(&result, *x);
  191|       |  *x >>= result;
  192|       |#elif defined(HAVE_BITSCANFORWARD)
  193|       |  unsigned long result;
  194|       |  _BitScanForward(&result, *x);
  195|       |  *x >>= result;
  196|       |#else
  197|       |  int result = 0;
  198|       |  while ((*x & 1) == 0) {
  199|       |    ++result;
  200|       |    *x >>= 1;
  201|       |  }
  202|       |#endif
  203|  52.6M|  return (int)result;
  204|  52.6M|}
jcphuff.c:encode_mcu_DC_refine:
  766|  8.57M|{
  767|  8.57M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  768|  8.57M|  register int temp;
  769|  8.57M|  int blkn;
  770|  8.57M|  int Al = cinfo->Al;
  771|  8.57M|  JBLOCKROW block;
  772|       |
  773|  8.57M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  774|  8.57M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  775|       |
  776|       |  /* Emit restart marker if needed */
  777|  8.57M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (777:7): [True: 0, False: 8.57M]
  ------------------
  778|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (778:9): [True: 0, False: 0]
  ------------------
  779|      0|      emit_restart(entropy, entropy->next_restart_num);
  780|       |
  781|       |  /* Encode the MCU data blocks */
  782|  18.9M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (782:18): [True: 10.4M, False: 8.57M]
  ------------------
  783|  10.4M|    block = MCU_data[blkn];
  784|       |
  785|       |    /* We simply emit the Al'th bit of the DC coefficient value. */
  786|  10.4M|    temp = (*block)[0];
  787|  10.4M|    emit_bits(entropy, (unsigned int)(temp >> Al), 1);
  788|  10.4M|  }
  789|       |
  790|  8.57M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  791|  8.57M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  792|       |
  793|       |  /* Update restart-interval state too */
  794|  8.57M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (794:7): [True: 0, False: 8.57M]
  ------------------
  795|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (795:9): [True: 0, False: 0]
  ------------------
  796|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  797|      0|      entropy->next_restart_num++;
  798|      0|      entropy->next_restart_num &= 7;
  799|      0|    }
  800|      0|    entropy->restarts_to_go--;
  801|      0|  }
  802|       |
  803|  8.57M|  return TRUE;
  ------------------
  |  |  209|  8.57M|#define TRUE    1
  ------------------
  804|  8.57M|}
jcphuff.c:encode_mcu_AC_refine:
  938|  40.4M|{
  939|  40.4M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  940|  40.4M|  register int temp, r, idx;
  941|  40.4M|  char *BR_buffer;
  942|  40.4M|  unsigned int BR;
  943|  40.4M|  int Sl = cinfo->Se - cinfo->Ss + 1;
  944|  40.4M|  int Al = cinfo->Al;
  945|  40.4M|  UJCOEF absvalues_unaligned[DCTSIZE2 + 15];
  946|  40.4M|  UJCOEF *absvalues;
  947|  40.4M|  const UJCOEF *cabsvalue, *EOBPTR;
  948|  40.4M|  size_t zerobits, signbits;
  949|  40.4M|  size_t bits[16 / SIZEOF_SIZE_T];
  950|       |
  951|  40.4M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  952|  40.4M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  953|       |
  954|       |  /* Emit restart marker if needed */
  955|  40.4M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (955:7): [True: 0, False: 40.4M]
  ------------------
  956|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (956:9): [True: 0, False: 0]
  ------------------
  957|      0|      emit_restart(entropy, entropy->next_restart_num);
  958|       |
  959|  40.4M|#ifdef WITH_SIMD
  960|  40.4M|  cabsvalue = absvalues = (UJCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
  ------------------
  |  |  158|  40.4M|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  961|       |#else
  962|       |  /* Not using SIMD, so alignment is not needed */
  963|       |  cabsvalue = absvalues = absvalues_unaligned;
  964|       |#endif
  965|       |
  966|       |  /* Prepare data */
  967|  40.4M|  EOBPTR = absvalues +
  968|  40.4M|    entropy->AC_refine_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
  969|  40.4M|                               Sl, Al, absvalues, bits);
  970|       |
  971|       |  /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
  972|       |
  973|  40.4M|  r = 0;                        /* r = run length of zeros */
  974|  40.4M|  BR = 0;                       /* BR = count of buffered bits added now */
  975|  40.4M|  BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
  976|       |
  977|  40.4M|  zerobits = bits[0];
  978|  40.4M|#if SIZEOF_SIZE_T == 8
  979|  40.4M|  signbits = bits[1];
  980|       |#else
  981|       |  signbits = bits[2];
  982|       |#endif
  983|  40.4M|  ENCODE_COEFS_AC_REFINE((void)0;);
  ------------------
  |  |  881|  40.4M|#define ENCODE_COEFS_AC_REFINE(label) { \
  |  |  882|  84.4M|  while (zerobits) { \
  |  |  ------------------
  |  |  |  Branch (882:10): [True: 43.9M, False: 40.4M]
  |  |  ------------------
  |  |  883|  43.9M|    idx = count_zeroes(&zerobits); \
  |  |  884|  43.9M|    r += idx; \
  |  |  885|  43.9M|    cabsvalue += idx; \
  |  |  886|  43.9M|    signbits >>= idx; \
  |  |  887|  43.9M|label \
  |  |  888|  43.9M|    /* Emit any required ZRLs, but not if they can be folded into EOB */ \
  |  |  889|  44.4M|    while (r > 15 && (cabsvalue <= EOBPTR)) { \
  |  |  ------------------
  |  |  |  Branch (889:12): [True: 2.36M, False: 42.0M]
  |  |  |  Branch (889:22): [True: 464k, False: 1.90M]
  |  |  ------------------
  |  |  890|   464k|      /* emit any pending EOBRUN and the BE correction bits */ \
  |  |  891|   464k|      emit_eobrun(entropy); \
  |  |  892|   464k|      /* Emit ZRL */ \
  |  |  893|   464k|      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
  |  |  894|   464k|      r -= 16; \
  |  |  895|   464k|      /* Emit buffered correction bits that must be associated with ZRL */ \
  |  |  896|   464k|      emit_buffered_bits(entropy, BR_buffer, BR); \
  |  |  897|   464k|      BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
  |  |  898|   464k|      BR = 0; \
  |  |  899|   464k|    } \
  |  |  900|  43.9M|    \
  |  |  901|  43.9M|    temp = *cabsvalue++; \
  |  |  902|  43.9M|    \
  |  |  903|  43.9M|    /* If the coef was previously nonzero, it only needs a correction bit. \
  |  |  904|  43.9M|     * NOTE: a straight translation of the spec's figure G.7 would suggest \
  |  |  905|  43.9M|     * that we also need to test r > 15.  But if r > 15, we can only get here \
  |  |  906|  43.9M|     * if k > EOB, which implies that this coefficient is not 1. \
  |  |  907|  43.9M|     */ \
  |  |  908|  43.9M|    if (temp > 1) { \
  |  |  ------------------
  |  |  |  Branch (908:9): [True: 20.4M, False: 23.5M]
  |  |  ------------------
  |  |  909|  20.4M|      /* The correction bit is the next bit of the absolute value. */ \
  |  |  910|  20.4M|      BR_buffer[BR++] = (char)(temp & 1); \
  |  |  911|  20.4M|      signbits >>= 1; \
  |  |  912|  20.4M|      zerobits >>= 1; \
  |  |  913|  20.4M|      continue; \
  |  |  914|  20.4M|    } \
  |  |  915|  43.9M|    \
  |  |  916|  43.9M|    /* Emit any pending EOBRUN and the BE correction bits */ \
  |  |  917|  43.9M|    emit_eobrun(entropy); \
  |  |  918|  23.5M|    \
  |  |  919|  23.5M|    /* Count/emit Huffman symbol for run length / number of bits */ \
  |  |  920|  23.5M|    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); \
  |  |  921|  23.5M|    \
  |  |  922|  23.5M|    /* Emit output bit for newly-nonzero coef */ \
  |  |  923|  23.5M|    temp = signbits & 1; /* ((*block)[jpeg_natural_order_start[k]] < 0) ? 0 : 1 */ \
  |  |  924|  23.5M|    emit_bits(entropy, (unsigned int)temp, 1); \
  |  |  925|  23.5M|    \
  |  |  926|  23.5M|    /* Emit buffered correction bits that must be associated with this code */ \
  |  |  927|  23.5M|    emit_buffered_bits(entropy, BR_buffer, BR); \
  |  |  928|  23.5M|    BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
  |  |  929|  23.5M|    BR = 0; \
  |  |  930|  23.5M|    r = 0;                      /* reset zero run length */ \
  |  |  931|  23.5M|    signbits >>= 1; \
  |  |  932|  23.5M|    zerobits >>= 1; \
  |  |  933|  23.5M|  } \
  |  |  934|  40.4M|}
  ------------------
  984|       |
  985|       |#if SIZEOF_SIZE_T == 4
  986|       |  zerobits = bits[1];
  987|       |  signbits = bits[3];
  988|       |
  989|       |  if (zerobits) {
  990|       |    int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
  991|       |    idx = count_zeroes(&zerobits);
  992|       |    signbits >>= idx;
  993|       |    idx += diff;
  994|       |    r += idx;
  995|       |    cabsvalue += idx;
  996|       |    goto first_iter_ac_refine;
  997|       |  }
  998|       |
  999|       |  ENCODE_COEFS_AC_REFINE(first_iter_ac_refine:);
 1000|       |#endif
 1001|       |
 1002|  40.4M|  r |= (int)((absvalues + Sl) - cabsvalue);
 1003|       |
 1004|  40.4M|  if (r > 0 || BR > 0) {        /* If there are trailing zeroes, */
  ------------------
  |  Branch (1004:7): [True: 39.9M, False: 520k]
  |  Branch (1004:16): [True: 161k, False: 358k]
  ------------------
 1005|  40.1M|    entropy->EOBRUN++;          /* count an EOB */
 1006|  40.1M|    entropy->BE += BR;          /* concat my correction bits to older ones */
 1007|       |    /* We force out the EOB if we risk either:
 1008|       |     * 1. overflow of the EOB counter;
 1009|       |     * 2. overflow of the correction bit buffer during the next MCU.
 1010|       |     */
 1011|  40.1M|    if (entropy->EOBRUN == 0x7FFF ||
  ------------------
  |  Branch (1011:9): [True: 0, False: 40.1M]
  ------------------
 1012|  40.1M|        entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
  ------------------
  |  |  140|  40.1M|#define MAX_CORR_BITS  1000     /* Max # of correction bits I can buffer */
  ------------------
                      entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
  ------------------
  |  |   56|  40.1M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (1012:9): [True: 3.60k, False: 40.1M]
  ------------------
 1013|  3.60k|      emit_eobrun(entropy);
 1014|  40.1M|  }
 1015|       |
 1016|  40.4M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
 1017|  40.4M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
 1018|       |
 1019|       |  /* Update restart-interval state too */
 1020|  40.4M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (1020:7): [True: 0, False: 40.4M]
  ------------------
 1021|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (1021:9): [True: 0, False: 0]
  ------------------
 1022|      0|      entropy->restarts_to_go = cinfo->restart_interval;
 1023|      0|      entropy->next_restart_num++;
 1024|      0|      entropy->next_restart_num &= 7;
 1025|      0|    }
 1026|      0|    entropy->restarts_to_go--;
 1027|      0|  }
 1028|       |
 1029|  40.4M|  return TRUE;
  ------------------
  |  |  209|  40.4M|#define TRUE    1
  ------------------
 1030|  40.4M|}
jcphuff.c:finish_pass_gather_phuff:
 1060|  15.5k|{
 1061|  15.5k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
 1062|  15.5k|  boolean is_DC_band;
 1063|  15.5k|  int ci, tbl;
 1064|  15.5k|  jpeg_component_info *compptr;
 1065|  15.5k|  JHUFF_TBL **htblptr;
 1066|  15.5k|  boolean did[NUM_HUFF_TBLS];
 1067|       |
 1068|       |  /* Flush out buffered data (all we care about is counting the EOB symbol) */
 1069|  15.5k|  emit_eobrun(entropy);
 1070|       |
 1071|  15.5k|  is_DC_band = (cinfo->Ss == 0);
 1072|       |
 1073|       |  /* It's important not to apply jpeg_gen_optimal_table more than once
 1074|       |   * per table, because it clobbers the input frequency counts!
 1075|       |   */
 1076|  15.5k|  memset(did, 0, sizeof(did));
 1077|       |
 1078|  31.8k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (1078:16): [True: 16.3k, False: 15.5k]
  ------------------
 1079|  16.3k|    compptr = cinfo->cur_comp_info[ci];
 1080|  16.3k|    if (is_DC_band) {
  ------------------
  |  Branch (1080:9): [True: 3.50k, False: 12.7k]
  ------------------
 1081|  3.50k|      if (cinfo->Ah != 0)       /* DC refinement needs no table */
  ------------------
  |  Branch (1081:11): [True: 0, False: 3.50k]
  ------------------
 1082|      0|        continue;
 1083|  3.50k|      tbl = compptr->dc_tbl_no;
 1084|  12.7k|    } else {
 1085|  12.7k|      tbl = compptr->ac_tbl_no;
 1086|  12.7k|    }
 1087|  16.3k|    if (!did[tbl]) {
  ------------------
  |  Branch (1087:9): [True: 15.7k, False: 574]
  ------------------
 1088|  15.7k|      if (is_DC_band)
  ------------------
  |  Branch (1088:11): [True: 2.93k, False: 12.7k]
  ------------------
 1089|  2.93k|        htblptr = &cinfo->dc_huff_tbl_ptrs[tbl];
 1090|  12.7k|      else
 1091|  12.7k|        htblptr = &cinfo->ac_huff_tbl_ptrs[tbl];
 1092|  15.7k|      if (*htblptr == NULL)
  ------------------
  |  Branch (1092:11): [True: 0, False: 15.7k]
  ------------------
 1093|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1094|  15.7k|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
 1095|  15.7k|      did[tbl] = TRUE;
  ------------------
  |  |  209|  15.7k|#define TRUE    1
  ------------------
 1096|  15.7k|    }
 1097|  16.3k|  }
 1098|  15.5k|}
jcphuff.c:finish_pass_phuff:
 1039|  18.1k|{
 1040|  18.1k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
 1041|       |
 1042|  18.1k|  entropy->next_output_byte = cinfo->dest->next_output_byte;
 1043|  18.1k|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
 1044|       |
 1045|       |  /* Flush out any buffered data */
 1046|  18.1k|  emit_eobrun(entropy);
 1047|  18.1k|  flush_bits(entropy);
 1048|       |
 1049|  18.1k|  cinfo->dest->next_output_byte = entropy->next_output_byte;
 1050|  18.1k|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
 1051|  18.1k|}

jpeg_write_coefficients:
   44|  7.03k|{
   45|  7.03k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (45:7): [True: 0, False: 7.03k]
  ------------------
   46|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   47|       |
   48|  7.03k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  7.03k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (48:7): [True: 0, False: 7.03k]
  ------------------
   49|      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)))
  ------------------
   50|       |  /* Mark all tables to be written */
   51|  7.03k|  jpeg_suppress_tables(cinfo, FALSE);
  ------------------
  |  |  206|  7.03k|#define FALSE   0               /* values of boolean */
  ------------------
   52|       |  /* (Re)initialize error mgr and destination modules */
   53|  7.03k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
   54|  7.03k|  (*cinfo->dest->init_destination) (cinfo);
   55|       |  /* Perform master selection of active modules */
   56|  7.03k|  transencode_master_selection(cinfo, coef_arrays);
   57|       |  /* Wait for jpeg_finish_compress() call */
   58|  7.03k|  cinfo->next_scanline = 0;     /* so jpeg_write_marker works */
   59|  7.03k|  cinfo->global_state = CSTATE_WRCOEFS;
  ------------------
  |  |   47|  7.03k|#define CSTATE_WRCOEFS   103    /* jpeg_write_coefficients done */
  ------------------
   60|  7.03k|}
jpeg_copy_critical_parameters:
   72|  7.52k|{
   73|  7.52k|  JQUANT_TBL **qtblptr;
   74|  7.52k|  jpeg_component_info *incomp, *outcomp;
   75|  7.52k|  JQUANT_TBL *c_quant, *slot_quant;
   76|  7.52k|  int tblno, ci, coefi;
   77|       |
   78|  7.52k|  if (srcinfo->master->lossless)
  ------------------
  |  Branch (78:7): [True: 0, False: 7.52k]
  ------------------
   79|      0|    ERREXIT(dstinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   80|       |
   81|       |  /* Safety check to ensure start_compress not called yet. */
   82|  7.52k|  if (dstinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  7.52k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (82:7): [True: 0, False: 7.52k]
  ------------------
   83|      0|    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->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)))
  ------------------
   84|       |  /* Copy fundamental image dimensions */
   85|  7.52k|  dstinfo->image_width = srcinfo->image_width;
   86|  7.52k|  dstinfo->image_height = srcinfo->image_height;
   87|  7.52k|  dstinfo->input_components = srcinfo->num_components;
   88|  7.52k|  dstinfo->in_color_space = srcinfo->jpeg_color_space;
   89|       |#if JPEG_LIB_VERSION >= 70
   90|       |  dstinfo->jpeg_width = srcinfo->output_width;
   91|       |  dstinfo->jpeg_height = srcinfo->output_height;
   92|       |  dstinfo->min_DCT_h_scaled_size = srcinfo->min_DCT_h_scaled_size;
   93|       |  dstinfo->min_DCT_v_scaled_size = srcinfo->min_DCT_v_scaled_size;
   94|       |#endif
   95|       |  /* Initialize all parameters to default values */
   96|  7.52k|  jpeg_set_defaults(dstinfo);
   97|       |  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
   98|       |   * Fix it to get the right header markers for the image colorspace.
   99|       |   */
  100|  7.52k|  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
  101|  7.52k|  dstinfo->data_precision = srcinfo->data_precision;
  102|  7.52k|  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
  103|       |  /* Copy the source's quantization tables. */
  104|  37.6k|  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
  ------------------
  |  |   57|  37.6k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (104:19): [True: 30.0k, False: 7.52k]
  ------------------
  105|  30.0k|    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
  ------------------
  |  Branch (105:9): [True: 7.69k, False: 22.3k]
  ------------------
  106|  7.69k|      qtblptr = &dstinfo->quant_tbl_ptrs[tblno];
  107|  7.69k|      if (*qtblptr == NULL)
  ------------------
  |  Branch (107:11): [True: 19, False: 7.67k]
  ------------------
  108|     19|        *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo);
  109|  7.69k|      memcpy((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval,
  110|  7.69k|             sizeof((*qtblptr)->quantval));
  111|  7.69k|      (*qtblptr)->sent_table = FALSE;
  ------------------
  |  |  206|  7.69k|#define FALSE   0               /* values of boolean */
  ------------------
  112|  7.69k|    }
  113|  30.0k|  }
  114|       |  /* Copy the source's per-component info.
  115|       |   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
  116|       |   */
  117|  7.52k|  dstinfo->num_components = srcinfo->num_components;
  118|  7.52k|  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   29|  7.52k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (118:7): [True: 0, False: 7.52k]
  |  Branch (118:38): [True: 0, False: 7.52k]
  ------------------
  119|      0|    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  120|  7.52k|             MAX_COMPONENTS);
  121|  7.52k|  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
  122|  18.0k|       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
  ------------------
  |  Branch (122:8): [True: 10.5k, False: 7.52k]
  ------------------
  123|  10.5k|    outcomp->component_id = incomp->component_id;
  124|  10.5k|    outcomp->h_samp_factor = incomp->h_samp_factor;
  125|  10.5k|    outcomp->v_samp_factor = incomp->v_samp_factor;
  126|  10.5k|    outcomp->quant_tbl_no = incomp->quant_tbl_no;
  127|       |    /* Make sure saved quantization table for component matches the qtable
  128|       |     * slot.  If not, the input file re-used this qtable slot.
  129|       |     * IJG encoder currently cannot duplicate this.
  130|       |     */
  131|  10.5k|    tblno = outcomp->quant_tbl_no;
  132|  10.5k|    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   57|  21.1k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (132:9): [True: 0, False: 10.5k]
  |  Branch (132:22): [True: 192, False: 10.3k]
  ------------------
  133|  10.5k|        srcinfo->quant_tbl_ptrs[tblno] == NULL)
  ------------------
  |  Branch (133:9): [True: 198, False: 10.1k]
  ------------------
  134|    390|      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
  ------------------
  |  |  243|    390|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    390|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    390|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  135|  10.5k|    slot_quant = srcinfo->quant_tbl_ptrs[tblno];
  136|  10.5k|    c_quant = incomp->quant_table;
  137|  10.5k|    if (c_quant != NULL) {
  ------------------
  |  Branch (137:9): [True: 8.97k, False: 1.60k]
  ------------------
  138|   580k|      for (coefi = 0; coefi < DCTSIZE2; coefi++) {
  ------------------
  |  |   56|   580k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (138:23): [True: 571k, False: 8.97k]
  ------------------
  139|   571k|        if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
  ------------------
  |  Branch (139:13): [True: 35, False: 571k]
  ------------------
  140|     35|          ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
  ------------------
  |  |  243|     35|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     35|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     35|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  141|   571k|      }
  142|  8.97k|    }
  143|       |    /* Note: we do not copy the source's Huffman table assignments;
  144|       |     * instead we rely on jpeg_set_colorspace to have made a suitable choice.
  145|       |     */
  146|  10.5k|  }
  147|       |  /* Also copy JFIF version and resolution information, if available.
  148|       |   * Strictly speaking this isn't "critical" info, but it's nearly
  149|       |   * always appropriate to copy it if available.  In particular,
  150|       |   * if the application chooses to copy JFIF 1.02 extension markers from
  151|       |   * the source file, we need to copy the version to make sure we don't
  152|       |   * emit a file that has 1.02 extensions but a claimed version of 1.01.
  153|       |   * We will *not*, however, copy version info from mislabeled "2.01" files.
  154|       |   */
  155|  7.52k|  if (srcinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (155:7): [True: 130, False: 7.39k]
  ------------------
  156|    130|    if (srcinfo->JFIF_major_version == 1) {
  ------------------
  |  Branch (156:9): [True: 45, False: 85]
  ------------------
  157|     45|      dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
  158|     45|      dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
  159|     45|    }
  160|    130|    dstinfo->density_unit = srcinfo->density_unit;
  161|    130|    dstinfo->X_density = srcinfo->X_density;
  162|    130|    dstinfo->Y_density = srcinfo->Y_density;
  163|    130|  }
  164|  7.52k|}
jctrans.c:transencode_master_selection:
  175|  7.03k|{
  176|       |  /* Although we don't actually use input_components for transcoding,
  177|       |   * jcmaster.c's initial_setup will complain if input_components is 0.
  178|       |   */
  179|  7.03k|  cinfo->input_components = 1;
  180|       |  /* Initialize master control (includes parameter checking/processing) */
  181|  7.03k|  jinit_c_master_control(cinfo, TRUE /* transcode only */);
  ------------------
  |  |  209|  7.03k|#define TRUE    1
  ------------------
  182|       |
  183|       |  /* Entropy encoding: either Huffman or arithmetic coding. */
  184|  7.03k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (184:7): [True: 3.55k, False: 3.47k]
  ------------------
  185|  3.55k|#ifdef C_ARITH_CODING_SUPPORTED
  186|  3.55k|    jinit_arith_encoder(cinfo);
  187|       |#else
  188|       |    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  189|       |#endif
  190|  3.55k|  } else {
  191|  3.47k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (191:9): [True: 2.86k, False: 612]
  ------------------
  192|  2.86k|#ifdef C_PROGRESSIVE_SUPPORTED
  193|  2.86k|      jinit_phuff_encoder(cinfo);
  194|       |#else
  195|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  196|       |#endif
  197|  2.86k|    } else
  198|    612|      jinit_huff_encoder(cinfo);
  199|  3.47k|  }
  200|       |
  201|       |  /* We need a special coefficient buffer controller. */
  202|  7.03k|  transencode_coef_controller(cinfo, coef_arrays);
  203|       |
  204|  7.03k|  jinit_marker_writer(cinfo);
  205|       |
  206|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  207|  7.03k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  208|       |
  209|       |  /* Write the datastream header (SOI, JFIF) immediately.
  210|       |   * Frame and scan headers are postponed till later.
  211|       |   * This lets application insert special markers after the SOI.
  212|       |   */
  213|  7.03k|  (*cinfo->marker->write_file_header) (cinfo);
  214|  7.03k|}
jctrans.c:transencode_coef_controller:
  391|  7.03k|{
  392|  7.03k|  my_coef_ptr coef;
  393|  7.03k|  JBLOCKROW buffer;
  394|  7.03k|  int i;
  395|       |
  396|  7.03k|  coef = (my_coef_ptr)
  397|  7.03k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  7.03k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  398|  7.03k|                                sizeof(my_coef_controller));
  399|  7.03k|  cinfo->coef = (struct jpeg_c_coef_controller *)coef;
  400|  7.03k|  coef->pub.start_pass = start_pass_coef;
  401|  7.03k|  coef->pub.compress_data = compress_output;
  402|  7.03k|  coef->pub.compress_data_12 = compress_output_12;
  403|       |
  404|       |  /* Save pointer to virtual arrays */
  405|  7.03k|  coef->whole_image = coef_arrays;
  406|       |
  407|       |  /* Allocate and pre-zero space for dummy DCT blocks. */
  408|  7.03k|  buffer = (JBLOCKROW)
  409|  7.03k|    (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  7.03k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  410|  7.03k|                                C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   69|  7.03k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  411|  7.03k|  jzero_far((void *)buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   69|  7.03k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  412|  77.3k|  for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   69|  77.3k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  |  Branch (412:15): [True: 70.3k, False: 7.03k]
  ------------------
  413|  70.3k|    coef->dummy_buffer[i] = buffer + i;
  414|  70.3k|  }
  415|  7.03k|}
jctrans.c:start_pass_coef:
  275|  53.2k|{
  276|  53.2k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  277|       |
  278|  53.2k|  if (pass_mode != JBUF_CRANK_DEST)
  ------------------
  |  Branch (278:7): [True: 0, False: 53.2k]
  ------------------
  279|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |
  281|  53.2k|  coef->iMCU_row_num = 0;
  282|  53.2k|  start_iMCU_row(cinfo);
  283|  53.2k|}
jctrans.c:start_iMCU_row:
  248|  7.80M|{
  249|  7.80M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  250|       |
  251|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
  252|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
  253|       |   * But at the bottom of the image, process only what's left.
  254|       |   */
  255|  7.80M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (255:7): [True: 333k, False: 7.47M]
  ------------------
  256|   333k|    coef->MCU_rows_per_iMCU_row = 1;
  257|  7.47M|  } else {
  258|  7.47M|    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (258:9): [True: 7.37M, False: 101k]
  ------------------
  259|  7.37M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
  260|   101k|    else
  261|   101k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
  262|  7.47M|  }
  263|       |
  264|  7.80M|  coef->mcu_ctr = 0;
  265|  7.80M|  coef->MCU_vert_offset = 0;
  266|  7.80M|}
jctrans.c:compress_output:
  298|  7.75M|{
  299|  7.75M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  300|  7.75M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  301|  7.75M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
  302|  7.75M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  303|  7.75M|  int blkn, ci, xindex, yindex, yoffset, blockcnt;
  304|  7.75M|  JDIMENSION start_col;
  305|  7.75M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  306|  7.75M|  JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
  307|  7.75M|  JBLOCKROW buffer_ptr;
  308|  7.75M|  jpeg_component_info *compptr;
  309|       |
  310|       |  /* Align the virtual buffers for the components used in this scan. */
  311|  16.2M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (311:16): [True: 8.48M, False: 7.75M]
  ------------------
  312|  8.48M|    compptr = cinfo->cur_comp_info[ci];
  313|  8.48M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  314|  8.48M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  315|  8.48M|       coef->iMCU_row_num * compptr->v_samp_factor,
  316|  8.48M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  206|  8.48M|#define FALSE   0               /* values of boolean */
  ------------------
  317|  8.48M|  }
  318|       |
  319|       |  /* Loop to process one whole iMCU row */
  320|  16.0M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (320:41): [True: 8.27M, False: 7.75M]
  ------------------
  321|  8.27M|       yoffset++) {
  322|   217M|    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (322:39): [True: 209M, False: 8.27M]
  ------------------
  323|   209M|         MCU_col_num++) {
  324|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  325|   209M|      blkn = 0;                 /* index of current DCT block within MCU */
  326|   429M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (326:20): [True: 220M, False: 209M]
  ------------------
  327|   220M|        compptr = cinfo->cur_comp_info[ci];
  328|   220M|        start_col = MCU_col_num * compptr->MCU_width;
  329|   220M|        blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
  ------------------
  |  Branch (329:20): [True: 211M, False: 9.01M]
  ------------------
  330|   220M|                                                  compptr->last_col_width;
  331|   444M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (331:26): [True: 224M, False: 220M]
  ------------------
  332|   224M|          if (coef->iMCU_row_num < last_iMCU_row ||
  ------------------
  |  Branch (332:15): [True: 213M, False: 10.4M]
  ------------------
  333|   224M|              yindex + yoffset < compptr->last_row_height) {
  ------------------
  |  Branch (333:15): [True: 10.3M, False: 52.5k]
  ------------------
  334|       |            /* Fill in pointers to real blocks in this row */
  335|   224M|            buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  336|   453M|            for (xindex = 0; xindex < blockcnt; xindex++)
  ------------------
  |  Branch (336:30): [True: 228M, False: 224M]
  ------------------
  337|   228M|              MCU_buffer[blkn++] = buffer_ptr++;
  338|   224M|          } else {
  339|       |            /* At bottom of image, need a whole row of dummy blocks */
  340|  52.5k|            xindex = 0;
  341|  52.5k|          }
  342|       |          /* Fill in any dummy blocks needed in this row.
  343|       |           * Dummy blocks are filled in the same way as in jccoefct.c:
  344|       |           * all zeroes in the AC entries, DC entries equal to previous
  345|       |           * block's DC value.  The init routine has already zeroed the
  346|       |           * AC entries, so we need only set the DC entries correctly.
  347|       |           */
  348|   224M|          for (; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (348:18): [True: 417k, False: 224M]
  ------------------
  349|   417k|            MCU_buffer[blkn] = coef->dummy_buffer[blkn];
  350|   417k|            MCU_buffer[blkn][0][0] = MCU_buffer[blkn - 1][0][0];
  351|   417k|            blkn++;
  352|   417k|          }
  353|   224M|        }
  354|   220M|      }
  355|       |      /* Try to write the MCU. */
  356|   209M|      if (!(*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
  ------------------
  |  Branch (356:11): [True: 0, False: 209M]
  ------------------
  357|       |        /* Suspension forced; update state counters and exit */
  358|      0|        coef->MCU_vert_offset = yoffset;
  359|      0|        coef->mcu_ctr = MCU_col_num;
  360|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  361|      0|      }
  362|   209M|    }
  363|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  364|  8.27M|    coef->mcu_ctr = 0;
  365|  8.27M|  }
  366|       |  /* Completed the iMCU row, advance counters for next one */
  367|  7.75M|  coef->iMCU_row_num++;
  368|  7.75M|  start_iMCU_row(cinfo);
  369|  7.75M|  return TRUE;
  ------------------
  |  |  209|  7.75M|#define TRUE    1
  ------------------
  370|  7.75M|}
jctrans.c:compress_output_12:
  375|  1.24M|{
  376|  1.24M|  return compress_output(cinfo, (JSAMPIMAGE)input_buf);
  377|  1.24M|}

jpeg_CreateDecompress:
   37|  5.51k|{
   38|  5.51k|  int i;
   39|       |
   40|       |  /* Guard against version mismatches between library and caller. */
   41|  5.51k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   42|  5.51k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  5.51k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (42:7): [True: 0, False: 5.51k]
  ------------------
   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|  5.51k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (44:7): [True: 0, False: 5.51k]
  ------------------
   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|  5.51k|             (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|  5.51k|  {
   55|  5.51k|    struct jpeg_error_mgr *err = cinfo->err;
   56|  5.51k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   57|  5.51k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   58|  5.51k|    cinfo->err = err;
   59|  5.51k|    cinfo->client_data = client_data;
   60|  5.51k|  }
   61|  5.51k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  209|  5.51k|#define TRUE    1
  ------------------
   62|       |
   63|       |  /* Initialize a memory manager instance for this object */
   64|  5.51k|  jinit_memory_mgr((j_common_ptr)cinfo);
   65|       |
   66|       |  /* Zero out pointers to permanent structures. */
   67|  5.51k|  cinfo->progress = NULL;
   68|  5.51k|  cinfo->src = NULL;
   69|       |
   70|  27.5k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   57|  27.5k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (70:15): [True: 22.0k, False: 5.51k]
  ------------------
   71|  22.0k|    cinfo->quant_tbl_ptrs[i] = NULL;
   72|       |
   73|  27.5k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  27.5k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 22.0k, False: 5.51k]
  ------------------
   74|  22.0k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   75|  22.0k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   76|  22.0k|  }
   77|       |
   78|       |  /* Initialize marker processor so application can override methods
   79|       |   * for COM, APPn markers before calling jpeg_read_header.
   80|       |   */
   81|  5.51k|  cinfo->marker_list = NULL;
   82|  5.51k|  jinit_marker_reader(cinfo);
   83|       |
   84|       |  /* And initialize the overall input controller. */
   85|  5.51k|  jinit_input_controller(cinfo);
   86|       |
   87|  5.51k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  5.51k|#define BITS_IN_JSAMPLE  8
  ------------------
   88|       |
   89|       |  /* OK, I'm ready */
   90|  5.51k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  5.51k|#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|  5.51k|  cinfo->master = (struct jpeg_decomp_master *)
   96|  5.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   97|  5.51k|                                sizeof(my_decomp_master));
   98|  5.51k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
   99|  5.51k|}
jpeg_destroy_decompress:
  108|  5.51k|{
  109|  5.51k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  110|  5.51k|}
jpeg_abort_decompress:
  120|  8.29k|{
  121|  8.29k|  jpeg_abort((j_common_ptr)cinfo); /* use common routine */
  122|  8.29k|}
jpeg_read_header:
  261|  13.5k|{
  262|  13.5k|  int retcode;
  263|       |
  264|  13.5k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  27.0k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (264:7): [True: 0, False: 13.5k]
  ------------------
  265|  13.5k|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|      0|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (265:7): [True: 0, False: 0]
  ------------------
  266|      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)))
  ------------------
  267|       |
  268|  13.5k|  retcode = jpeg_consume_input(cinfo);
  269|       |
  270|  13.5k|  switch (retcode) {
  ------------------
  |  Branch (270:11): [True: 607, False: 12.9k]
  ------------------
  271|  12.1k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1095|  12.1k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (271:3): [True: 12.1k, False: 1.32k]
  ------------------
  272|  12.1k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1050|  12.1k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  273|  12.1k|    break;
  274|    721|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1096|    721|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (274:3): [True: 721, False: 12.7k]
  ------------------
  275|    721|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (275:9): [True: 0, False: 721]
  ------------------
  276|      0|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  277|       |    /* Reset to start state; it would be safer to require the application to
  278|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  279|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  280|       |     */
  281|    721|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  282|    721|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1051|    721|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  283|    721|    break;
  284|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (284:3): [True: 0, False: 13.5k]
  ------------------
  285|       |    /* no work */
  286|      0|    break;
  287|  13.5k|  }
  288|       |
  289|  12.9k|  return retcode;
  290|  13.5k|}
jpeg_consume_input:
  307|  13.5k|{
  308|  13.5k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1049|  13.5k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  309|       |
  310|       |  /* NB: every possible DSTATE value should be listed in this switch */
  311|  13.5k|  switch (cinfo->global_state) {
  312|  13.5k|  case DSTATE_START:
  ------------------
  |  |   48|  13.5k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (312:3): [True: 13.5k, False: 0]
  ------------------
  313|       |    /* Start-of-datastream actions: reset appropriate modules */
  314|  13.5k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  315|       |    /* Initialize application's data source module */
  316|  13.5k|    (*cinfo->src->init_source) (cinfo);
  317|  13.5k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|  13.5k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  318|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   38|  13.5k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  319|  13.5k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|  13.5k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (319:3): [True: 0, False: 13.5k]
  ------------------
  320|  13.5k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  321|  13.5k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1095|  13.5k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (321:9): [True: 12.1k, False: 1.32k]
  ------------------
  322|       |      /* Set up default parameters based on header data */
  323|  12.1k|      default_decompress_parms(cinfo);
  324|       |      /* Set global state: ready for start_decompress */
  325|  12.1k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  12.1k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  326|  12.1k|    }
  327|  13.5k|    break;
  328|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (328:3): [True: 0, False: 13.5k]
  ------------------
  329|       |    /* Can't advance past first SOS until start_decompress is called */
  330|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1095|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  331|      0|    break;
  332|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (332:3): [True: 0, False: 13.5k]
  ------------------
  333|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (333:3): [True: 0, False: 13.5k]
  ------------------
  334|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (334:3): [True: 0, False: 13.5k]
  ------------------
  335|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (335:3): [True: 0, False: 13.5k]
  ------------------
  336|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (336:3): [True: 0, False: 13.5k]
  ------------------
  337|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (337:3): [True: 0, False: 13.5k]
  ------------------
  338|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (338:3): [True: 0, False: 13.5k]
  ------------------
  339|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  340|      0|    break;
  341|      0|  default:
  ------------------
  |  Branch (341:3): [True: 0, False: 13.5k]
  ------------------
  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|  13.5k|  }
  344|  12.9k|  return retcode;
  345|  13.5k|}
jpeg_finish_decompress:
  389|  3.88k|{
  390|  3.88k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  7.76k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (390:8): [True: 0, False: 3.88k]
  ------------------
  391|  3.88k|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   54|  3.88k|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (391:8): [True: 0, False: 3.88k]
  |  Branch (391:49): [True: 0, False: 0]
  ------------------
  392|       |    /* Terminate final pass of non-buffered mode */
  393|      0|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (393:9): [True: 0, False: 0]
  ------------------
  394|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  395|      0|    (*cinfo->master->finish_output_pass) (cinfo);
  396|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  397|  3.88k|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   55|  3.88k|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (397:14): [True: 0, False: 3.88k]
  ------------------
  398|       |    /* Finishing after a buffered-image operation */
  399|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  400|  3.88k|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   58|  3.88k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (400:14): [True: 0, False: 3.88k]
  ------------------
  401|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  402|      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)))
  ------------------
  403|      0|  }
  404|       |  /* Read until EOI */
  405|  3.88k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (405:10): [True: 0, False: 3.88k]
  ------------------
  406|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (406:9): [True: 0, False: 0]
  ------------------
  407|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  408|      0|  }
  409|       |  /* Do final cleanup */
  410|  3.88k|  (*cinfo->src->term_source) (cinfo);
  411|       |  /* We can use jpeg_abort to release memory and reset global_state */
  412|  3.88k|  jpeg_abort((j_common_ptr)cinfo);
  413|  3.88k|  return TRUE;
  ------------------
  |  |  209|  3.88k|#define TRUE    1
  ------------------
  414|  3.88k|}
jdapimin.c:default_decompress_parms:
  131|  12.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|  12.1k|  switch (cinfo->num_components) {
  136|  8.84k|  case 1:
  ------------------
  |  Branch (136:3): [True: 8.84k, False: 3.33k]
  ------------------
  137|  8.84k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  138|  8.84k|    cinfo->out_color_space = JCS_GRAYSCALE;
  139|  8.84k|    break;
  140|       |
  141|  2.96k|  case 3:
  ------------------
  |  Branch (141:3): [True: 2.96k, False: 9.21k]
  ------------------
  142|  2.96k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (142:9): [True: 49, False: 2.91k]
  ------------------
  143|     49|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  144|  2.91k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (144:16): [True: 231, False: 2.68k]
  ------------------
  145|    231|      switch (cinfo->Adobe_transform) {
  146|    212|      case 0:
  ------------------
  |  Branch (146:7): [True: 212, False: 19]
  ------------------
  147|    212|        cinfo->jpeg_color_space = JCS_RGB;
  148|    212|        break;
  149|      8|      case 1:
  ------------------
  |  Branch (149:7): [True: 8, False: 223]
  ------------------
  150|      8|        cinfo->jpeg_color_space = JCS_YCbCr;
  151|      8|        break;
  152|     11|      default:
  ------------------
  |  Branch (152:7): [True: 11, False: 220]
  ------------------
  153|     11|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  287|     11|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|     11|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  154|     11|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  155|     11|        break;
  156|    231|      }
  157|  2.68k|    } else {
  158|       |      /* Saw no special markers, try to guess from the component IDs */
  159|  2.68k|      int cid0 = cinfo->comp_info[0].component_id;
  160|  2.68k|      int cid1 = cinfo->comp_info[1].component_id;
  161|  2.68k|      int cid2 = cinfo->comp_info[2].component_id;
  162|       |
  163|  2.68k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3)
  ------------------
  |  Branch (163:11): [True: 2.22k, False: 465]
  |  Branch (163:24): [True: 2.14k, False: 82]
  |  Branch (163:37): [True: 1.96k, False: 175]
  ------------------
  164|  1.96k|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  165|    722|      else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (165:16): [True: 51, False: 671]
  |  Branch (165:30): [True: 25, False: 26]
  |  Branch (165:44): [True: 7, False: 18]
  ------------------
  166|      7|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  167|    715|      else {
  168|    715|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|    715|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    715|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|    715|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|    715|           (cinfo)->err->msg_code = (code); \
  |  |  312|    715|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  169|    715|        if (cinfo->master->lossless)
  ------------------
  |  Branch (169:13): [True: 9, False: 706]
  ------------------
  170|      9|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  171|    706|        else
  172|    706|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  173|    715|      }
  174|  2.68k|    }
  175|       |    /* Always guess RGB is proper output colorspace. */
  176|  2.96k|    cinfo->out_color_space = JCS_RGB;
  177|  2.96k|    break;
  178|       |
  179|    362|  case 4:
  ------------------
  |  Branch (179:3): [True: 362, False: 11.8k]
  ------------------
  180|    362|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (180:9): [True: 15, False: 347]
  ------------------
  181|     15|      switch (cinfo->Adobe_transform) {
  182|      4|      case 0:
  ------------------
  |  Branch (182:7): [True: 4, False: 11]
  ------------------
  183|      4|        cinfo->jpeg_color_space = JCS_CMYK;
  184|      4|        break;
  185|      7|      case 2:
  ------------------
  |  Branch (185:7): [True: 7, False: 8]
  ------------------
  186|      7|        cinfo->jpeg_color_space = JCS_YCCK;
  187|      7|        break;
  188|      4|      default:
  ------------------
  |  Branch (188:7): [True: 4, False: 11]
  ------------------
  189|      4|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  190|      4|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  191|      4|        break;
  192|     15|      }
  193|    347|    } else {
  194|       |      /* No special markers, assume straight CMYK. */
  195|    347|      cinfo->jpeg_color_space = JCS_CMYK;
  196|    347|    }
  197|    362|    cinfo->out_color_space = JCS_CMYK;
  198|    362|    break;
  199|       |
  200|      5|  default:
  ------------------
  |  Branch (200:3): [True: 5, False: 12.1k]
  ------------------
  201|      5|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  202|      5|    cinfo->out_color_space = JCS_UNKNOWN;
  203|      5|    break;
  204|  12.1k|  }
  205|       |
  206|       |  /* Set defaults for other decompression parameters. */
  207|  12.1k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  208|  12.1k|  cinfo->scale_denom = 1;
  209|  12.1k|  cinfo->output_gamma = 1.0;
  210|  12.1k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  211|  12.1k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  212|  12.1k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  285|  12.1k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  213|  12.1k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  209|  12.1k|#define TRUE    1
  ------------------
  214|  12.1k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  209|  12.1k|#define TRUE    1
  ------------------
  215|  12.1k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  216|       |  /* We set these in case application only sets quantize_colors. */
  217|  12.1k|  cinfo->dither_mode = JDITHER_FS;
  218|  12.1k|#ifdef QUANT_2PASS_SUPPORTED
  219|  12.1k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  209|  12.1k|#define TRUE    1
  ------------------
  220|       |#else
  221|       |  cinfo->two_pass_quantize = FALSE;
  222|       |#endif
  223|  12.1k|  cinfo->desired_number_of_colors = 256;
  224|  12.1k|  cinfo->colormap = NULL;
  225|       |  /* Initialize for no mode change in buffered-image mode. */
  226|  12.1k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  12.1k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  228|  12.1k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
  229|  12.1k|}

jinit_arith_decoder:
  751|  2.19k|{
  752|  2.19k|  arith_entropy_ptr entropy;
  753|  2.19k|  int i;
  754|       |
  755|  2.19k|  entropy = (arith_entropy_ptr)
  756|  2.19k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  2.19k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  2.19k|                                sizeof(arith_entropy_decoder));
  758|  2.19k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  2.19k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|  37.3k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   59|  37.3k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 35.1k, False: 2.19k]
  ------------------
  763|  35.1k|    entropy->dc_stats[i] = NULL;
  764|  35.1k|    entropy->ac_stats[i] = NULL;
  765|  35.1k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  2.19k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  2.19k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 1.41k, False: 777]
  ------------------
  771|       |    /* Create progression status table */
  772|  1.41k|    int *coef_bit_ptr, ci;
  773|  1.41k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  1.41k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  1.41k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  1.41k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   56|  1.41k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  1.41k|                                  sizeof(int));
  777|  1.41k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  3.59k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 2.17k, False: 1.41k]
  ------------------
  779|   141k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   56|   141k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 139k, False: 2.17k]
  ------------------
  780|   139k|        *coef_bit_ptr++ = -1;
  781|  1.41k|  }
  782|  2.19k|}
jdarith.c:start_pass:
  633|  11.9k|{
  634|  11.9k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  11.9k|  int ci, tbl;
  636|  11.9k|  jpeg_component_info *compptr;
  637|       |
  638|  11.9k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 6.41k, False: 5.54k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  6.41k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 3.94k, False: 2.46k]
  ------------------
  641|  3.94k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 9, False: 3.93k]
  ------------------
  642|      9|        goto bad;
  643|  3.94k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  2.46k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   56|  2.46k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 7, False: 2.46k]
  |  Branch (645:36): [True: 54, False: 2.40k]
  ------------------
  646|     61|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  2.40k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 3, False: 2.40k]
  ------------------
  649|      3|        goto bad;
  650|  2.40k|    }
  651|  6.34k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 1.61k, False: 4.73k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  1.61k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 23, False: 1.58k]
  ------------------
  654|     23|        goto bad;
  655|  1.61k|    }
  656|  6.31k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 3, False: 6.31k]
  ------------------
  657|     99|bad:
  658|     99|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     99|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     99|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     99|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     99|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     99|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     99|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|     99|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|     99|    }
  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|  14.2k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 7.86k, False: 6.41k]
  ------------------
  666|  7.86k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  7.86k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  7.86k|      int *prev_coef_bit_ptr =
  669|  7.86k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  7.86k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 2.39k, False: 5.47k]
  |  Branch (670:24): [True: 1.24k, False: 1.15k]
  ------------------
  671|  1.24k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  1.24k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  1.24k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  1.24k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  1.24k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   140k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  448|  7.86k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (448:26): [True: 5.47k, False: 2.39k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  446|   140k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 76.6k, False: 64.0k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 132k, False: 7.86k]
  ------------------
  673|   132k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 99.3k, False: 33.5k]
  ------------------
  674|  99.3k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  33.5k|        else
  676|  33.5k|          prev_coef_bit_ptr[coefi] = 0;
  677|   132k|      }
  678|  58.1k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 50.3k, False: 7.86k]
  ------------------
  679|  50.3k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 15.0k, False: 35.2k]
  ------------------
  680|  50.3k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 29.3k, False: 20.9k]
  ------------------
  681|  29.3k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  29.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  29.3k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  29.3k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  29.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|  50.3k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|  50.3k|      }
  684|  7.86k|    }
  685|       |    /* Select MCU decoding routine */
  686|  6.41k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 4.73k, False: 1.68k]
  ------------------
  687|  4.73k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 3.16k, False: 1.56k]
  ------------------
  688|  3.16k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  1.56k|      else
  690|  1.56k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  4.73k|    } else {
  692|  1.68k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 763, False: 922]
  ------------------
  693|    763|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|    922|      else
  695|    922|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  1.68k|    }
  697|  6.41k|  } else {
  698|       |    /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
  699|       |     * This ought to be an error condition, but we make it a warning.
  700|       |     */
  701|  5.54k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   56|  3.34k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 2.20k, False: 3.34k]
  |  Branch (701:27): [True: 2.46k, False: 880]
  ------------------
  702|  5.54k|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 258, False: 622]
  |  Branch (702:27): [True: 267, False: 355]
  ------------------
  703|  5.19k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  5.19k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  5.19k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  5.54k|    entropy->pub.decode_mcu = decode_mcu;
  706|  5.54k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  27.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 15.5k, False: 11.9k]
  ------------------
  710|  15.5k|    compptr = cinfo->cur_comp_info[ci];
  711|  15.5k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 7.73k, False: 7.86k]
  |  Branch (711:38): [True: 5.47k, False: 2.39k]
  |  Branch (711:56): [True: 3.90k, False: 1.56k]
  ------------------
  712|  11.6k|      tbl = compptr->dc_tbl_no;
  713|  11.6k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   59|  11.6k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 11.6k]
  |  Branch (713:22): [True: 0, False: 11.6k]
  ------------------
  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|  11.6k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 2.04k, False: 9.59k]
  ------------------
  716|  2.04k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  2.04k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  873|  2.04k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  2.04k|#define DC_STAT_BINS  64
  ------------------
  718|  11.6k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  11.6k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  11.6k|      entropy->last_dc_val[ci] = 0;
  721|  11.6k|      entropy->dc_context[ci] = 0;
  722|  11.6k|    }
  723|  15.5k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 7.73k, False: 7.86k]
  |  Branch (723:37): [True: 2.39k, False: 5.47k]
  ------------------
  724|  10.1k|      tbl = compptr->ac_tbl_no;
  725|  10.1k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   59|  10.1k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 10.1k]
  |  Branch (725:22): [True: 0, False: 10.1k]
  ------------------
  726|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  727|  10.1k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 1.87k, False: 8.24k]
  ------------------
  728|  1.87k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  1.87k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  873|  1.87k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  1.87k|#define AC_STAT_BINS  256
  ------------------
  730|  10.1k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  10.1k|#define AC_STAT_BINS  256
  ------------------
  731|  10.1k|    }
  732|  15.5k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  11.9k|  entropy->c = 0;
  736|  11.9k|  entropy->a = 0;
  737|  11.9k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  11.9k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  11.9k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  11.9k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  11.9k|}
jdarith.c:decode_mcu_DC_first:
  251|  14.4M|{
  252|  14.4M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  14.4M|  JBLOCKROW block;
  254|  14.4M|  unsigned char *st;
  255|  14.4M|  int blkn, ci, tbl, sign;
  256|  14.4M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  14.4M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 11.4M, False: 2.96M]
  ------------------
  260|  11.4M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 11.2M, False: 185k]
  ------------------
  261|  11.2M|      process_restart(cinfo);
  262|  11.4M|    entropy->restarts_to_go--;
  263|  11.4M|  }
  264|       |
  265|  14.4M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  67.5k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 67.5k, False: 14.3M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  32.7M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 18.4M, False: 14.3M]
  ------------------
  270|  18.4M|    block = MCU_data[blkn];
  271|  18.4M|    ci = cinfo->MCU_membership[blkn];
  272|  18.4M|    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|  18.4M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  18.4M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 15.0M, False: 3.42M]
  ------------------
  281|  15.0M|      entropy->dc_context[ci] = 0;
  282|  3.42M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  3.42M|      sign = arith_decode(cinfo, st + 1);
  286|  3.42M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  3.42M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 1.95M, False: 1.47M]
  ------------------
  289|  1.95M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  4.51M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 2.55M, False: 1.95M]
  ------------------
  291|  2.55M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 209, False: 2.55M]
  ------------------
  292|    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))
  ------------------
  293|    209|            entropy->ct = -1;                   /* magnitude overflow */
  294|    209|            return TRUE;
  ------------------
  |  |  209|    209|#define TRUE    1
  ------------------
  295|    209|          }
  296|  2.55M|          st += 1;
  297|  2.55M|        }
  298|  1.95M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  3.42M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 16.3k, False: 3.41M]
  ------------------
  301|  16.3k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  3.41M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 1.48M, False: 1.92M]
  ------------------
  303|  1.48M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  1.92M|      else
  305|  1.92M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  3.42M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  3.42M|      st += 14;
  309|  5.98M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 2.55M, False: 3.42M]
  ------------------
  310|  2.55M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 1.90M, False: 645k]
  ------------------
  311|  3.42M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 2.29M, False: 1.13M]
  ------------------
  312|  3.42M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  3.42M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  18.4M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  18.4M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  18.4M|  }
  318|       |
  319|  14.3M|  return TRUE;
  ------------------
  |  |  209|  14.3M|#define TRUE    1
  ------------------
  320|  14.3M|}
jdarith.c:process_restart:
  200|  17.7M|{
  201|  17.7M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|  17.7M|  int ci;
  203|  17.7M|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|  17.7M|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 17.7M]
  ------------------
  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|  35.5M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 17.7M, False: 17.7M]
  ------------------
  211|  17.7M|    compptr = cinfo->cur_comp_info[ci];
  212|  17.7M|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 49.1k, False: 17.7M]
  |  Branch (212:38): [True: 11.4M, False: 6.28M]
  |  Branch (212:56): [True: 11.2M, False: 174k]
  ------------------
  213|  11.3M|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  11.3M|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|  11.3M|      entropy->last_dc_val[ci] = 0;
  216|  11.3M|      entropy->dc_context[ci] = 0;
  217|  11.3M|    }
  218|  17.7M|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 49.1k, False: 17.7M]
  |  Branch (218:37): [True: 6.28M, False: 11.4M]
  ------------------
  219|  6.32M|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  6.32M|#define AC_STAT_BINS  256
  ------------------
  220|  6.32M|    }
  221|  17.7M|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|  17.7M|  entropy->c = 0;
  225|  17.7M|  entropy->a = 0;
  226|  17.7M|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|  17.7M|  entropy->restarts_to_go = cinfo->restart_interval;
  230|  17.7M|}
jdarith.c:arith_decode:
  116|   290M|{
  117|   290M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|   290M|  register unsigned char nl, nm;
  119|   290M|  register JLONG qe, temp;
  120|   290M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   390M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 99.7M, False: 290M]
  ------------------
  124|  99.7M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 47.0M, False: 52.7M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  47.0M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 46.9M, False: 83.2k]
  ------------------
  127|  46.9M|        data = 0;               /* stuff zero data */
  128|  83.2k|      else {
  129|  83.2k|        data = get_byte(cinfo); /* read next input byte */
  130|  83.2k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 12.6k, False: 70.6k]
  ------------------
  131|  13.3k|          do data = get_byte(cinfo);
  132|  13.3k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 740, False: 12.6k]
  ------------------
  133|  12.6k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 1.54k, False: 11.0k]
  ------------------
  134|  1.54k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  11.0k|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|  11.0k|            cinfo->unread_marker = data;
  143|  11.0k|            data = 0;
  144|  11.0k|          }
  145|  12.6k|        }
  146|  83.2k|      }
  147|  47.0M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  47.0M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 35.5M, False: 11.4M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|  35.5M|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 17.7M, False: 17.7M]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|  17.7M|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  47.0M|    }
  154|  99.7M|    e->a <<= 1;
  155|  99.7M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|   290M|  sv = *st;
  161|   290M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|   290M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|   290M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|   290M|  temp = e->a - qe;
  167|   290M|  e->a = temp;
  168|   290M|  temp <<= e->ct;
  169|   290M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 8.72M, False: 281M]
  ------------------
  170|  8.72M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  8.72M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 2.67M, False: 6.05M]
  ------------------
  173|  2.67M|      e->a = qe;
  174|  2.67M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  6.05M|    } else {
  176|  6.05M|      e->a = qe;
  177|  6.05M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  6.05M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  6.05M|    }
  180|   281M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 43.3M, False: 238M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  43.3M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 30.6M, False: 12.7M]
  ------------------
  183|  30.6M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  30.6M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  30.6M|    } else {
  186|  12.7M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  12.7M|    }
  188|  43.3M|  }
  189|       |
  190|   290M|  return sv >> 7;
  191|   290M|}
jdarith.c:get_byte:
   76|  96.6k|{
   77|  96.6k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|  96.6k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 1.30k, False: 95.3k]
  ------------------
   80|  1.30k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 1.30k]
  ------------------
   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|  96.6k|  src->bytes_in_buffer--;
   83|  96.6k|  return *src->next_input_byte++;
   84|  96.6k|}
jdarith.c:decode_mcu_AC_first:
  330|  10.6M|{
  331|  10.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  10.6M|  JBLOCKROW block;
  333|  10.6M|  unsigned char *st;
  334|  10.6M|  int tbl, sign, k;
  335|  10.6M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  10.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 5.30M, False: 5.30M]
  ------------------
  339|  5.30M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 5.04M, False: 259k]
  ------------------
  340|  5.04M|      process_restart(cinfo);
  341|  5.30M|    entropy->restarts_to_go--;
  342|  5.30M|  }
  343|       |
  344|  10.6M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  1.41M|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 1.41M, False: 9.18M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  9.18M|  block = MCU_data[0];
  348|  9.18M|  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|  16.4M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 16.1M, False: 287k]
  ------------------
  354|  16.1M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  16.1M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 8.89M, False: 7.22M]
  ------------------
  356|  9.31M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 2.09M, False: 7.22M]
  ------------------
  357|  2.09M|      st += 3;  k++;
  358|  2.09M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 500, False: 2.09M]
  ------------------
  359|    500|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    500|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    500|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|    500|        entropy->ct = -1;                       /* spectral overflow */
  361|    500|        return TRUE;
  ------------------
  |  |  209|    500|#define TRUE    1
  ------------------
  362|    500|      }
  363|  2.09M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  7.22M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  7.22M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  7.22M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 1.28M, False: 5.94M]
  ------------------
  370|  1.28M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 1.18M, False: 101k]
  ------------------
  371|  1.18M|        m <<= 1;
  372|  1.18M|        st = entropy->ac_stats[tbl] +
  373|  1.18M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 75.7k, False: 1.10M]
  ------------------
  374|  2.28M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 1.10M, False: 1.18M]
  ------------------
  375|  1.10M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 66, False: 1.10M]
  ------------------
  376|     66|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     66|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     66|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|     66|            entropy->ct = -1;                   /* magnitude overflow */
  378|     66|            return TRUE;
  ------------------
  |  |  209|     66|#define TRUE    1
  ------------------
  379|     66|          }
  380|  1.10M|          st += 1;
  381|  1.10M|        }
  382|  1.18M|      }
  383|  1.28M|    }
  384|  7.22M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  7.22M|    st += 14;
  387|  9.50M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 2.28M, False: 7.22M]
  ------------------
  388|  2.28M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 666k, False: 1.61M]
  ------------------
  389|  7.22M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 6.09M, False: 1.12M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  7.22M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  7.22M|  }
  393|       |
  394|  9.18M|  return TRUE;
  ------------------
  |  |  209|  9.18M|#define TRUE    1
  ------------------
  395|  9.18M|}
jdarith.c:decode_mcu_DC_refine:
  404|   824k|{
  405|   824k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|   824k|  unsigned char *st;
  407|   824k|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|   824k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 276k, False: 547k]
  ------------------
  411|   276k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 174k, False: 102k]
  ------------------
  412|   174k|      process_restart(cinfo);
  413|   276k|    entropy->restarts_to_go--;
  414|   276k|  }
  415|       |
  416|   824k|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|   824k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|  2.19M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 1.36M, False: 824k]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|  1.36M|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 637k, False: 730k]
  ------------------
  424|   637k|      MCU_data[blkn][0][0] |= p1;
  425|  1.36M|  }
  426|       |
  427|   824k|  return TRUE;
  ------------------
  |  |  209|   824k|#define TRUE    1
  ------------------
  428|   824k|}
jdarith.c:decode_mcu_AC_refine:
  437|  4.85M|{
  438|  4.85M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  4.85M|  JBLOCKROW block;
  440|  4.85M|  JCOEFPTR thiscoef;
  441|  4.85M|  unsigned char *st;
  442|  4.85M|  int tbl, k, kex;
  443|  4.85M|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  4.85M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 1.38M, False: 3.47M]
  ------------------
  447|  1.38M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 1.23M, False: 145k]
  ------------------
  448|  1.23M|      process_restart(cinfo);
  449|  1.38M|    entropy->restarts_to_go--;
  450|  1.38M|  }
  451|       |
  452|  4.85M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  1.55M|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 1.55M, False: 3.29M]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  3.29M|  block = MCU_data[0];
  456|  3.29M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  3.29M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  3.29M|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  3.29M|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  95.7M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 94.3M, False: 1.34M]
  ------------------
  463|  94.3M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 1.95M, False: 92.4M]
  ------------------
  464|       |
  465|  25.8M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 25.5M, False: 268k]
  ------------------
  466|  25.5M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|  25.5M|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 4.89M, False: 20.6M]
  ------------------
  468|  4.89M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 2.98M, False: 1.90M]
  ------------------
  469|  27.3M|    for (;;) {
  470|  27.3M|      thiscoef = *block + jpeg_natural_order[k];
  471|  27.3M|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 15.2M, False: 12.0M]
  ------------------
  472|  15.2M|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 7.74M, False: 7.50M]
  ------------------
  473|  7.74M|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 4.38M, False: 3.36M]
  ------------------
  474|  4.38M|            *thiscoef += (JCOEF)m1;
  475|  3.36M|          else
  476|  3.36M|            *thiscoef += (JCOEF)p1;
  477|  7.74M|        }
  478|  15.2M|        break;
  479|  15.2M|      }
  480|  12.0M|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 7.25M, False: 4.79M]
  ------------------
  481|  7.25M|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 4.06M, False: 3.19M]
  ------------------
  482|  4.06M|          *thiscoef = (JCOEF)m1;
  483|  3.19M|        else
  484|  3.19M|          *thiscoef = (JCOEF)p1;
  485|  7.25M|        break;
  486|  7.25M|      }
  487|  4.79M|      st += 3;  k++;
  488|  4.79M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 43.5k, False: 4.75M]
  ------------------
  489|  43.5k|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|  43.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  43.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|  43.5k|        entropy->ct = -1;                       /* spectral overflow */
  491|  43.5k|        return TRUE;
  ------------------
  |  |  209|  43.5k|#define TRUE    1
  ------------------
  492|  43.5k|      }
  493|  4.79M|    }
  494|  22.5M|  }
  495|       |
  496|  3.25M|  return TRUE;
  ------------------
  |  |  209|  3.25M|#define TRUE    1
  ------------------
  497|  3.29M|}
jdarith.c:decode_mcu:
  506|  11.0M|{
  507|  11.0M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  11.0M|  jpeg_component_info *compptr;
  509|  11.0M|  JBLOCKROW block;
  510|  11.0M|  unsigned char *st;
  511|  11.0M|  int blkn, ci, tbl, sign, k;
  512|  11.0M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  11.0M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 269k, False: 10.7M]
  ------------------
  516|   269k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 46.2k, False: 223k]
  ------------------
  517|  46.2k|      process_restart(cinfo);
  518|   269k|    entropy->restarts_to_go--;
  519|   269k|  }
  520|       |
  521|  11.0M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|   618k|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 618k, False: 10.4M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  22.5M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 12.0M, False: 10.4M]
  ------------------
  526|  12.0M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 12.0M, False: 0]
  ------------------
  527|  12.0M|    ci = cinfo->MCU_membership[blkn];
  528|  12.0M|    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.0M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  12.0M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  12.0M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 4.86M, False: 7.20M]
  ------------------
  539|  4.86M|      entropy->dc_context[ci] = 0;
  540|  7.20M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  7.20M|      sign = arith_decode(cinfo, st + 1);
  544|  7.20M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  7.20M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 6.29M, False: 918k]
  ------------------
  547|  6.29M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  28.5M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 22.3M, False: 6.28M]
  ------------------
  549|  22.3M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 308, False: 22.3M]
  ------------------
  550|    308|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    308|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    308|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|    308|            entropy->ct = -1;                   /* magnitude overflow */
  552|    308|            return TRUE;
  ------------------
  |  |  209|    308|#define TRUE    1
  ------------------
  553|    308|          }
  554|  22.3M|          st += 1;
  555|  22.3M|        }
  556|  6.29M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  7.20M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 7.52k, False: 7.20M]
  ------------------
  559|  7.52k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  7.20M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 5.76M, False: 1.43M]
  ------------------
  561|  5.76M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  1.43M|      else
  563|  1.43M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  7.20M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  7.20M|      st += 14;
  567|  29.5M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 22.2M, False: 7.20M]
  ------------------
  568|  22.2M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 567k, False: 21.7M]
  ------------------
  569|  7.20M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 6.02M, False: 1.18M]
  ------------------
  570|  7.20M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  7.20M|    }
  572|       |
  573|  12.0M|    if (block)
  ------------------
  |  Branch (573:9): [True: 12.0M, False: 0]
  ------------------
  574|  12.0M|      (*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.0M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  22.4M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   56|  22.4M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 22.4M, False: 1.08k]
  ------------------
  582|  22.4M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  22.4M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 12.0M, False: 10.3M]
  ------------------
  584|  33.7M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 23.3M, False: 10.3M]
  ------------------
  585|  23.3M|        st += 3;  k++;
  586|  23.3M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   56|  23.3M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 194, False: 23.3M]
  ------------------
  587|    194|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    194|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    194|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    194|          entropy->ct = -1;                     /* spectral overflow */
  589|    194|          return TRUE;
  ------------------
  |  |  209|    194|#define TRUE    1
  ------------------
  590|    194|        }
  591|  23.3M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  10.3M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  10.3M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  10.3M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 3.90M, False: 6.49M]
  ------------------
  598|  3.90M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 3.43M, False: 466k]
  ------------------
  599|  3.43M|          m <<= 1;
  600|  3.43M|          st = entropy->ac_stats[tbl] +
  601|  3.43M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 2.18M, False: 1.25M]
  ------------------
  602|  6.60M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 3.17M, False: 3.43M]
  ------------------
  603|  3.17M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 352, False: 3.17M]
  ------------------
  604|    352|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    352|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    352|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    352|              entropy->ct = -1;                 /* magnitude overflow */
  606|    352|              return TRUE;
  ------------------
  |  |  209|    352|#define TRUE    1
  ------------------
  607|    352|            }
  608|  3.17M|            st += 1;
  609|  3.17M|          }
  610|  3.43M|        }
  611|  3.90M|      }
  612|  10.3M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  10.3M|      st += 14;
  615|  16.9M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 6.60M, False: 10.3M]
  ------------------
  616|  6.60M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 3.32M, False: 3.27M]
  ------------------
  617|  10.3M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 4.78M, False: 5.60M]
  ------------------
  618|  10.3M|      if (block)
  ------------------
  |  Branch (618:11): [True: 10.3M, False: 0]
  ------------------
  619|  10.3M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  10.3M|    }
  621|  12.0M|  }
  622|       |
  623|  10.4M|  return TRUE;
  ------------------
  |  |  209|  10.4M|#define TRUE    1
  ------------------
  624|  10.4M|}

jpeg_mem_dest_tj:
  149|  13.0k|{
  150|  13.0k|  boolean reused = FALSE;
  ------------------
  |  |  206|  13.0k|#define FALSE   0               /* values of boolean */
  ------------------
  151|  13.0k|  my_mem_dest_ptr dest;
  152|       |
  153|  13.0k|  if (outbuffer == NULL || outsize == NULL)     /* sanity check */
  ------------------
  |  Branch (153:7): [True: 0, False: 13.0k]
  |  Branch (153:28): [True: 0, False: 13.0k]
  ------------------
  154|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  155|       |
  156|       |  /* The destination object is made permanent so that multiple JPEG images
  157|       |   * can be written to the same buffer without re-executing jpeg_mem_dest.
  158|       |   */
  159|  13.0k|  if (cinfo->dest == NULL) {    /* first time for this JPEG object? */
  ------------------
  |  Branch (159:7): [True: 5.51k, False: 7.52k]
  ------------------
  160|  5.51k|    cinfo->dest = (struct jpeg_destination_mgr *)
  161|  5.51k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  162|  5.51k|                                  sizeof(my_mem_destination_mgr));
  163|  5.51k|    dest = (my_mem_dest_ptr)cinfo->dest;
  164|  5.51k|    dest->newbuffer = NULL;
  165|  5.51k|    dest->buffer = NULL;
  166|  7.52k|  } else if (cinfo->dest->init_destination != init_mem_destination) {
  ------------------
  |  Branch (166:14): [True: 0, False: 7.52k]
  ------------------
  167|       |    /* It is unsafe to reuse the existing destination manager unless it was
  168|       |     * created by this function.
  169|       |     */
  170|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  171|      0|  }
  172|       |
  173|  13.0k|  dest = (my_mem_dest_ptr)cinfo->dest;
  174|  13.0k|  dest->pub.init_destination = init_mem_destination;
  175|  13.0k|  dest->pub.empty_output_buffer = empty_mem_output_buffer;
  176|  13.0k|  dest->pub.term_destination = term_mem_destination;
  177|  13.0k|  if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc)
  ------------------
  |  Branch (177:7): [True: 0, False: 13.0k]
  |  Branch (177:37): [True: 0, False: 0]
  |  Branch (177:59): [True: 0, False: 0]
  ------------------
  178|      0|    reused = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  179|  13.0k|  dest->outbuffer = outbuffer;
  180|  13.0k|  dest->outsize = outsize;
  181|  13.0k|  dest->alloc = alloc;
  182|       |
  183|  13.0k|  if (*outbuffer == NULL || *outsize == 0) {
  ------------------
  |  Branch (183:7): [True: 2.96k, False: 10.0k]
  |  Branch (183:29): [True: 0, False: 10.0k]
  ------------------
  184|  2.96k|    if (alloc) {
  ------------------
  |  Branch (184:9): [True: 2.96k, False: 0]
  ------------------
  185|       |      /* Allocate initial buffer */
  186|  2.96k|      dest->newbuffer = *outbuffer = (unsigned char *)malloc(OUTPUT_BUF_SIZE);
  ------------------
  |  |   30|  2.96k|#define OUTPUT_BUF_SIZE  4096   /* choose an efficiently fwrite'able size */
  ------------------
  187|  2.96k|      if (dest->newbuffer == NULL)
  ------------------
  |  Branch (187:11): [True: 0, False: 2.96k]
  ------------------
  188|      0|        ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  189|  2.96k|      *outsize = OUTPUT_BUF_SIZE;
  ------------------
  |  |   30|  2.96k|#define OUTPUT_BUF_SIZE  4096   /* choose an efficiently fwrite'able size */
  ------------------
  190|  2.96k|    } else
  191|      0|      ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  192|  2.96k|  }
  193|       |
  194|  13.0k|  dest->pub.next_output_byte = dest->buffer = *outbuffer;
  195|  13.0k|  if (!reused)
  ------------------
  |  Branch (195:7): [True: 13.0k, False: 0]
  ------------------
  196|  13.0k|    dest->bufsize = *outsize;
  197|  13.0k|  dest->pub.free_in_buffer = dest->bufsize;
  198|  13.0k|}
jdatadst-tj.c:init_mem_destination:
   56|  7.03k|{
   57|       |  /* no work necessary here */
   58|  7.03k|}
jdatadst-tj.c:empty_mem_output_buffer:
   86|  1.83k|{
   87|  1.83k|  size_t nextsize;
   88|  1.83k|  JOCTET *nextbuffer;
   89|  1.83k|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
   90|       |
   91|  1.83k|  if (!dest->alloc) ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  |  Branch (91:7): [True: 0, False: 1.83k]
  ------------------
   92|       |
   93|       |  /* Try to allocate new buffer with double size */
   94|  1.83k|  nextsize = dest->bufsize * 2;
   95|  1.83k|  nextbuffer = (JOCTET *)malloc(nextsize);
   96|       |
   97|  1.83k|  if (nextbuffer == NULL)
  ------------------
  |  Branch (97:7): [True: 0, False: 1.83k]
  ------------------
   98|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   99|       |
  100|  1.83k|  memcpy(nextbuffer, dest->buffer, dest->bufsize);
  101|       |
  102|  1.83k|  free(dest->newbuffer);
  103|       |
  104|  1.83k|  dest->newbuffer = nextbuffer;
  105|       |
  106|  1.83k|  dest->pub.next_output_byte = nextbuffer + dest->bufsize;
  107|  1.83k|  dest->pub.free_in_buffer = dest->bufsize;
  108|       |
  109|  1.83k|  dest->buffer = nextbuffer;
  110|  1.83k|  dest->bufsize = nextsize;
  111|       |
  112|  1.83k|  return TRUE;
  ------------------
  |  |  209|  1.83k|#define TRUE    1
  ------------------
  113|  1.83k|}
jdatadst-tj.c:term_mem_destination:
  127|  7.03k|{
  128|  7.03k|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
  129|       |
  130|  7.03k|  if (dest->alloc) *dest->outbuffer = dest->buffer;
  ------------------
  |  Branch (130:7): [True: 2.69k, False: 4.33k]
  ------------------
  131|  7.03k|  *dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
  132|  7.03k|}

jpeg_mem_src_tj:
  165|  19.0k|{
  166|  19.0k|  struct jpeg_source_mgr *src;
  167|       |
  168|  19.0k|  if (inbuffer == NULL || insize == 0)  /* Treat empty input as fatal error */
  ------------------
  |  Branch (168:7): [True: 0, False: 19.0k]
  |  Branch (168:27): [True: 0, False: 19.0k]
  ------------------
  169|      0|    ERREXIT(cinfo, JERR_INPUT_EMPTY);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  170|       |
  171|       |  /* The source object is made permanent so that a series of JPEG images
  172|       |   * can be read from the same buffer by calling jpeg_mem_src only before
  173|       |   * the first one.
  174|       |   */
  175|  19.0k|  if (cinfo->src == NULL) {     /* first time for this JPEG object? */
  ------------------
  |  Branch (175:7): [True: 5.51k, False: 13.5k]
  ------------------
  176|  5.51k|    cinfo->src = (struct jpeg_source_mgr *)
  177|  5.51k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  178|  5.51k|                                  sizeof(struct jpeg_source_mgr));
  179|  13.5k|  } else if (cinfo->src->init_source != init_mem_source) {
  ------------------
  |  Branch (179:14): [True: 0, False: 13.5k]
  ------------------
  180|       |    /* It is unsafe to reuse the existing source manager unless it was created
  181|       |     * by this function.
  182|       |     */
  183|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  184|      0|  }
  185|       |
  186|  19.0k|  src = cinfo->src;
  187|  19.0k|  src->init_source = init_mem_source;
  188|  19.0k|  src->fill_input_buffer = fill_mem_input_buffer;
  189|  19.0k|  src->skip_input_data = skip_input_data;
  190|  19.0k|  src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  191|  19.0k|  src->term_source = term_source;
  192|  19.0k|  src->bytes_in_buffer = insize;
  193|  19.0k|  src->next_input_byte = (const JOCTET *)inbuffer;
  194|  19.0k|}
jdatasrc-tj.c:init_mem_source:
   37|  13.5k|{
   38|       |  /* no work necessary here */
   39|  13.5k|}
jdatasrc-tj.c:fill_mem_input_buffer:
   77|  14.9M|{
   78|  14.9M|  static const JOCTET mybuffer[4] = {
   79|  14.9M|    (JOCTET)0xFF, (JOCTET)JPEG_EOI, 0, 0
  ------------------
  |  | 1151|  14.9M|#define JPEG_EOI        0xD9    /* EOI marker code */
  ------------------
   80|  14.9M|  };
   81|       |
   82|       |  /* The whole JPEG data is expected to reside in the supplied memory
   83|       |   * buffer, so any request for more data beyond the given buffer size
   84|       |   * is treated as an error.
   85|       |   */
   86|  14.9M|  WARNMS(cinfo, JWRN_JPEG_EOF);
  ------------------
  |  |  283|  14.9M|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  14.9M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   87|       |
   88|       |  /* Insert a fake EOI marker */
   89|       |
   90|  14.9M|  cinfo->src->next_input_byte = mybuffer;
   91|  14.9M|  cinfo->src->bytes_in_buffer = 2;
   92|       |
   93|  14.9M|  return TRUE;
  ------------------
  |  |  209|  14.9M|#define TRUE    1
  ------------------
   94|  14.9M|}
jdatasrc-tj.c:skip_input_data:
  111|  28.6k|{
  112|  28.6k|  struct jpeg_source_mgr *src = cinfo->src;
  113|       |
  114|       |  /* Just a dumb implementation for now.  Could use fseek() except
  115|       |   * it doesn't work on pipes.  Not clear that being smart is worth
  116|       |   * any trouble anyway --- large skips are infrequent.
  117|       |   */
  118|  28.6k|  if (num_bytes > 0) {
  ------------------
  |  Branch (118:7): [True: 28.6k, False: 0]
  ------------------
  119|  9.73M|    while (num_bytes > (long)src->bytes_in_buffer) {
  ------------------
  |  Branch (119:12): [True: 9.70M, False: 28.6k]
  ------------------
  120|  9.70M|      num_bytes -= (long)src->bytes_in_buffer;
  121|  9.70M|      (void)(*src->fill_input_buffer) (cinfo);
  122|       |      /* note we assume that fill_input_buffer will never return FALSE,
  123|       |       * so suspension need not be handled.
  124|       |       */
  125|  9.70M|    }
  126|  28.6k|    src->next_input_byte += (size_t)num_bytes;
  127|  28.6k|    src->bytes_in_buffer -= (size_t)num_bytes;
  128|  28.6k|  }
  129|  28.6k|}
jdatasrc-tj.c:term_source:
  152|  3.88k|{
  153|       |  /* no work necessary here */
  154|  3.88k|}

j12init_d_coef_controller:
  815|  1.08k|{
  816|  1.08k|  my_coef_ptr coef;
  817|       |
  818|  1.08k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  Branch (818:7): [True: 0, False: 1.08k]
  ------------------
  819|      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)))
  ------------------
  820|       |
  821|  1.08k|  coef = (my_coef_ptr)
  822|  1.08k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  1.08k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  823|  1.08k|                                sizeof(my_coef_controller));
  824|  1.08k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  825|  1.08k|  coef->pub.start_input_pass = start_input_pass;
  826|  1.08k|  coef->pub.start_output_pass = start_output_pass;
  827|  1.08k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  828|  1.08k|  coef->coef_bits_latch = NULL;
  829|  1.08k|#endif
  830|       |
  831|       |  /* Create the coefficient buffer. */
  832|  1.08k|  if (need_full_buffer) {
  ------------------
  |  Branch (832:7): [True: 1.08k, False: 0]
  ------------------
  833|  1.08k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  834|       |    /* Allocate a full-image virtual array for each component, */
  835|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  836|       |    /* Note we ask for a pre-zeroed array. */
  837|  1.08k|    int ci, access_rows;
  838|  1.08k|    jpeg_component_info *compptr;
  839|       |
  840|  2.49k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (840:46): [True: 1.40k, False: 1.08k]
  ------------------
  841|  1.40k|         ci++, compptr++) {
  842|  1.40k|      access_rows = compptr->v_samp_factor;
  843|  1.40k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  844|       |      /* If block smoothing could be used, need a bigger window */
  845|  1.40k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (845:11): [True: 496, False: 913]
  ------------------
  846|    496|        access_rows *= 5;
  847|  1.40k|#endif
  848|  1.40k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  849|  1.40k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  873|  1.40k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|  1.40k|#define TRUE    1
  ------------------
  850|  1.40k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  851|  1.40k|                               (long)compptr->h_samp_factor),
  852|  1.40k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  853|  1.40k|                               (long)compptr->v_samp_factor),
  854|  1.40k|         (JDIMENSION)access_rows);
  855|  1.40k|    }
  856|  1.08k|    coef->pub.consume_data = consume_data;
  857|  1.08k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  148|  1.08k|#define _decompress_data  decompress_data_12
  ------------------
  858|  1.08k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  859|       |#else
  860|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  861|       |#endif
  862|  1.08k|  } else {
  863|       |    /* We only need a single-MCU buffer. */
  864|      0|    JBLOCKROW buffer;
  865|      0|    int i;
  866|       |
  867|      0|    buffer = (JBLOCKROW)
  868|      0|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  869|      0|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   71|      0|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  870|      0|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   71|      0|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (870:17): [True: 0, False: 0]
  ------------------
  871|      0|      coef->MCU_buffer[i] = buffer + i;
  872|      0|    }
  873|      0|    coef->pub.consume_data = dummy_consume_data;
  874|      0|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  148|      0|#define _decompress_data  decompress_data_12
  ------------------
  875|      0|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  876|      0|  }
  877|       |
  878|       |  /* Allocate the workspace buffer */
  879|  1.08k|  coef->workspace = (JCOEF *)
  880|  1.08k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  1.08k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  881|  1.08k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   56|  1.08k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  882|  1.08k|}
jdcoefct.c:start_input_pass:
   47|  23.2k|{
   48|  23.2k|  cinfo->input_iMCU_row = 0;
   49|  23.2k|  start_iMCU_row(cinfo);
   50|  23.2k|}
jdcoefct.c:consume_data:
  194|  4.96M|{
  195|  4.96M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  196|  4.96M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  197|  4.96M|  int blkn, ci, xindex, yindex, yoffset;
  198|  4.96M|  JDIMENSION start_col;
  199|  4.96M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  200|  4.96M|  JBLOCKROW buffer_ptr;
  201|  4.96M|  jpeg_component_info *compptr;
  202|       |
  203|       |  /* Align the virtual buffers for the components used in this scan. */
  204|  11.9M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (204:16): [True: 7.03M, False: 4.96M]
  ------------------
  205|  7.03M|    compptr = cinfo->cur_comp_info[ci];
  206|  7.03M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  207|  7.03M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  208|  7.03M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  209|  7.03M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|  7.03M|#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|  7.03M|  }
  215|       |
  216|       |  /* Loop to process one whole iMCU row */
  217|  10.6M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (217:41): [True: 5.72M, False: 4.96M]
  ------------------
  218|  5.72M|       yoffset++) {
  219|  66.9M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (219:39): [True: 61.2M, False: 5.72M]
  ------------------
  220|  61.2M|         MCU_col_num++) {
  221|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  222|  61.2M|      blkn = 0;                 /* index of current DCT block within MCU */
  223|   131M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (223:20): [True: 70.3M, False: 61.2M]
  ------------------
  224|  70.3M|        compptr = cinfo->cur_comp_info[ci];
  225|  70.3M|        start_col = MCU_col_num * compptr->MCU_width;
  226|   141M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (226:26): [True: 71.0M, False: 70.3M]
  ------------------
  227|  71.0M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  228|   147M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (228:28): [True: 75.9M, False: 71.0M]
  ------------------
  229|  75.9M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  230|  75.9M|          }
  231|  71.0M|        }
  232|  70.3M|      }
  233|  61.2M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (233:11): [True: 42.4M, False: 18.8M]
  ------------------
  234|  42.4M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  235|       |      /* Try to fetch the MCU. */
  236|  61.2M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (236:11): [True: 0, False: 61.2M]
  ------------------
  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;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  241|      0|      }
  242|  61.2M|    }
  243|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  244|  5.72M|    coef->MCU_ctr = 0;
  245|  5.72M|  }
  246|       |  /* Completed the iMCU row, advance counters for next one */
  247|  4.96M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (247:7): [True: 4.94M, False: 23.2k]
  ------------------
  248|  4.94M|    start_iMCU_row(cinfo);
  249|  4.94M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1097|  4.94M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  250|  4.94M|  }
  251|       |  /* Completed the scan */
  252|  23.2k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  253|  23.2k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1098|  23.2k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  254|  4.96M|}
jinit_d_coef_controller:
  815|  5.22k|{
  816|  5.22k|  my_coef_ptr coef;
  817|       |
  818|  5.22k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   34|  5.22k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (818:7): [True: 5, False: 5.21k]
  ------------------
  819|      5|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  820|       |
  821|  5.22k|  coef = (my_coef_ptr)
  822|  5.22k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  5.22k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  823|  5.22k|                                sizeof(my_coef_controller));
  824|  5.22k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  825|  5.22k|  coef->pub.start_input_pass = start_input_pass;
  826|  5.22k|  coef->pub.start_output_pass = start_output_pass;
  827|  5.22k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  828|  5.22k|  coef->coef_bits_latch = NULL;
  829|  5.22k|#endif
  830|       |
  831|       |  /* Create the coefficient buffer. */
  832|  5.22k|  if (need_full_buffer) {
  ------------------
  |  Branch (832:7): [True: 5.21k, False: 5]
  ------------------
  833|  5.21k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  834|       |    /* Allocate a full-image virtual array for each component, */
  835|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  836|       |    /* Note we ask for a pre-zeroed array. */
  837|  5.21k|    int ci, access_rows;
  838|  5.21k|    jpeg_component_info *compptr;
  839|       |
  840|  13.6k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (840:46): [True: 8.39k, False: 5.21k]
  ------------------
  841|  8.39k|         ci++, compptr++) {
  842|  8.39k|      access_rows = compptr->v_samp_factor;
  843|  8.39k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  844|       |      /* If block smoothing could be used, need a bigger window */
  845|  8.39k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (845:11): [True: 3.67k, False: 4.72k]
  ------------------
  846|  3.67k|        access_rows *= 5;
  847|  8.39k|#endif
  848|  8.39k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  849|  8.39k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  873|  8.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|  8.39k|#define TRUE    1
  ------------------
  850|  8.39k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  851|  8.39k|                               (long)compptr->h_samp_factor),
  852|  8.39k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  853|  8.39k|                               (long)compptr->v_samp_factor),
  854|  8.39k|         (JDIMENSION)access_rows);
  855|  8.39k|    }
  856|  5.21k|    coef->pub.consume_data = consume_data;
  857|  5.21k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  263|  5.21k|#define _decompress_data  decompress_data
  ------------------
  858|  5.21k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  859|       |#else
  860|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  861|       |#endif
  862|  5.21k|  } else {
  863|       |    /* We only need a single-MCU buffer. */
  864|      5|    JBLOCKROW buffer;
  865|      5|    int i;
  866|       |
  867|      5|    buffer = (JBLOCKROW)
  868|      5|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  869|      5|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   71|      5|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  870|      5|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   71|      5|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (870:17): [True: 0, False: 5]
  ------------------
  871|      0|      coef->MCU_buffer[i] = buffer + i;
  872|      0|    }
  873|      5|    coef->pub.consume_data = dummy_consume_data;
  874|      5|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  263|      5|#define _decompress_data  decompress_data
  ------------------
  875|      5|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  876|      5|  }
  877|       |
  878|       |  /* Allocate the workspace buffer */
  879|  5.22k|  coef->workspace = (JCOEF *)
  880|  5.22k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  5.22k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  881|  5.22k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   56|  5.22k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  882|  5.22k|}

jdcoefct.c:start_iMCU_row:
   68|  4.96M|{
   69|  4.96M|  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|  4.96M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 1.04M, False: 3.91M]
  ------------------
   76|  1.04M|    coef->MCU_rows_per_iMCU_row = 1;
   77|  3.91M|  } else {
   78|  3.91M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 3.90M, False: 19.0k]
  ------------------
   79|  3.90M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  19.0k|    else
   81|  19.0k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  3.91M|  }
   83|       |
   84|  4.96M|  coef->MCU_ctr = 0;
   85|  4.96M|  coef->MCU_vert_offset = 0;
   86|  4.96M|}

jpeg_make_d_derived_tbl:
  145|  21.1k|{
  146|  21.1k|  JHUFF_TBL *htbl;
  147|  21.1k|  d_derived_tbl *dtbl;
  148|  21.1k|  int p, i, l, si, numsymbols;
  149|  21.1k|  int lookbits, ctr;
  150|  21.1k|  char huffsize[257];
  151|  21.1k|  unsigned int huffcode[257];
  152|  21.1k|  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|  21.1k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|  21.1k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 21.1k]
  |  Branch (159:20): [True: 70, False: 21.1k]
  ------------------
  160|     70|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     70|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     70|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     70|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  21.1k|  htbl =
  162|  21.1k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 10.5k, False: 10.6k]
  ------------------
  163|  21.1k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 33, False: 21.1k]
  ------------------
  164|     33|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     33|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     33|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     33|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  21.1k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 6.67k, False: 14.5k]
  ------------------
  168|  6.67k|    *pdtbl = (d_derived_tbl *)
  169|  6.67k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  6.67k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  6.67k|                                  sizeof(d_derived_tbl));
  171|  21.1k|  dtbl = *pdtbl;
  172|  21.1k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  21.1k|  p = 0;
  177|   358k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 337k, False: 21.1k]
  ------------------
  178|   337k|    i = (int)htbl->bits[l];
  179|   337k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 337k]
  |  Branch (179:18): [True: 0, False: 337k]
  ------------------
  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|  1.63M|    while (i--)
  ------------------
  |  Branch (181:12): [True: 1.29M, False: 337k]
  ------------------
  182|  1.29M|      huffsize[p++] = (char)l;
  183|   337k|  }
  184|  21.1k|  huffsize[p] = 0;
  185|  21.1k|  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|  21.1k|  code = 0;
  191|  21.1k|  si = huffsize[0];
  192|  21.1k|  p = 0;
  193|   237k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 216k, False: 21.1k]
  ------------------
  194|  1.51M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 1.29M, False: 216k]
  ------------------
  195|  1.29M|      huffcode[p++] = code;
  196|  1.29M|      code++;
  197|  1.29M|    }
  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|   216k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 9, False: 216k]
  ------------------
  202|      9|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|   216k|    code <<= 1;
  204|   216k|    si++;
  205|   216k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  21.1k|  p = 0;
  210|   358k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 337k, False: 21.1k]
  ------------------
  211|   337k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 184k, False: 152k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   184k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   184k|      p += htbl->bits[l];
  217|   184k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|   184k|    } else {
  219|   152k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|   152k|    }
  221|   337k|  }
  222|  21.1k|  dtbl->valoffset[17] = 0;
  223|  21.1k|  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|  5.41M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  5.41M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 5.39M, False: 21.1k]
  ------------------
  233|  5.39M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  5.39M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  5.39M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  21.1k|  p = 0;
  236|   189k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|   189k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 168k, False: 21.1k]
  ------------------
  237|   423k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 254k, False: 168k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|   254k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|   254k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  5.23M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|   254k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 4.98M, False: 254k]
  ------------------
  242|  4.98M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  4.98M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  4.98M|        lookbits++;
  244|  4.98M|      }
  245|   254k|    }
  246|   168k|  }
  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|  21.1k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 10.5k, False: 10.6k]
  ------------------
  255|   115k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 104k, False: 10.5k]
  ------------------
  256|   104k|      int sym = htbl->huffval[i];
  257|   104k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 104k]
  |  Branch (257:22): [True: 24, False: 104k]
  |  Branch (257:29): [True: 0, False: 104k]
  ------------------
  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|   104k|    }
  260|  10.5k|  }
  261|  21.1k|}
jpeg_fill_bit_buffer:
  291|   426k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   426k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   426k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   426k|  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|   426k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 188k, False: 237k]
  ------------------
  302|  1.39M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  1.39M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.39M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 1.22M, False: 168k]
  ------------------
  303|  1.22M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  1.22M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 2.23k, False: 1.22M]
  ------------------
  307|  2.23k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 2.23k]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|  2.23k|        next_input_byte = cinfo->src->next_input_byte;
  310|  2.23k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|  2.23k|      }
  312|  1.22M|      bytes_in_buffer--;
  313|  1.22M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  1.22M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 113k, False: 1.11M]
  ------------------
  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|   196k|        do {
  323|   196k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 44, False: 196k]
  ------------------
  324|     44|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 44]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|     44|            next_input_byte = cinfo->src->next_input_byte;
  327|     44|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|     44|          }
  329|   196k|          bytes_in_buffer--;
  330|   196k|          c = *next_input_byte++;
  331|   196k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 83.1k, False: 113k]
  ------------------
  332|       |
  333|   113k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 93.1k, False: 20.3k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  93.1k|          c = 0xFF;
  336|  93.1k|        } else {
  337|       |          /* Oops, it's actually a marker indicating end of compressed data.
  338|       |           * Save the marker code for later use.
  339|       |           * Fine point: it might appear that we should save the marker into
  340|       |           * bitread working state, not straight into permanent state.  But
  341|       |           * once we have hit a marker, we cannot need to suspend within the
  342|       |           * current MCU, because we will read no more bytes from the data
  343|       |           * source.  So it is OK to update permanent state right away.
  344|       |           */
  345|  20.3k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  20.3k|          goto no_more_bytes;
  348|  20.3k|        }
  349|   113k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.20M|      get_buffer = (get_buffer << 8) | c;
  353|  1.20M|      bits_left += 8;
  354|  1.20M|    } /* end while */
  355|   237k|  } else {
  356|   258k|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|   258k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 125k, False: 132k]
  ------------------
  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|   125k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 20.5k, False: 105k]
  ------------------
  368|  20.5k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  20.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  20.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  20.5k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  209|  20.5k|#define TRUE    1
  ------------------
  370|  20.5k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|   125k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|   125k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   125k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|   125k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|   125k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   125k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|   125k|    }
  375|   258k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   426k|  state->next_input_byte = next_input_byte;
  379|   426k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   426k|  state->get_buffer = get_buffer;
  381|   426k|  state->bits_left = bits_left;
  382|       |
  383|   426k|  return TRUE;
  ------------------
  |  |  209|   426k|#define TRUE    1
  ------------------
  384|   426k|}
jpeg_huff_decode:
  439|   206k|{
  440|   206k|  register int l = min_bits;
  441|   206k|  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|   206k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|   206k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   206k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 21.8k, False: 184k]
  |  |  ------------------
  |  |  162|  21.8k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 21.8k]
  |  |  ------------------
  |  |  163|  21.8k|      { action; } \
  |  |  164|  21.8k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  21.8k|  } \
  |  |  166|   206k|}
  ------------------
  447|   206k|  code = GET_BITS(l);
  ------------------
  |  |  169|   206k|  (((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|   606k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 400k, False: 206k]
  ------------------
  453|   400k|    code <<= 1;
  454|   400k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|   400k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   400k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 31.9k, False: 368k]
  |  |  ------------------
  |  |  162|  31.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 31.9k]
  |  |  ------------------
  |  |  163|  31.9k|      { action; } \
  |  |  164|  31.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  31.9k|  } \
  |  |  166|   400k|}
  ------------------
  455|   400k|    code |= GET_BITS(1);
  ------------------
  |  |  169|   400k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|   400k|    l++;
  457|   400k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|   206k|  state->get_buffer = get_buffer;
  461|   206k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|   206k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 10.4k, False: 195k]
  ------------------
  466|  10.4k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  10.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  10.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|  10.4k|    return 0;                   /* fake a zero as the safest result */
  468|  10.4k|  }
  469|       |
  470|   195k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|   206k|}
jinit_huff_decoder:
  815|  2.70k|{
  816|  2.70k|  huff_entropy_ptr entropy;
  817|  2.70k|  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|  2.70k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  2.70k|  entropy = (huff_entropy_ptr)
  826|  2.70k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  2.70k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  2.70k|                                sizeof(huff_entropy_decoder));
  828|  2.70k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  2.70k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  2.70k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  13.5k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  13.5k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 10.8k, False: 2.70k]
  ------------------
  834|  10.8k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  10.8k|  }
  836|  2.70k|}
jdhuff.c:start_pass_huff_decoder:
   80|  7.02k|{
   81|  7.02k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  7.02k|  int ci, blkn, dctbl, actbl;
   83|  7.02k|  d_derived_tbl **pdtbl;
   84|  7.02k|  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|  7.02k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   56|  4.14k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 2.87k, False: 4.14k]
  |  Branch (90:25): [True: 2.82k, False: 1.32k]
  ------------------
   91|  7.02k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 585, False: 735]
  |  Branch (91:25): [True: 239, False: 496]
  ------------------
   92|  6.52k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  6.52k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  6.52k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  15.3k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 8.30k, False: 7.02k]
  ------------------
   95|  8.30k|    compptr = cinfo->cur_comp_info[ci];
   96|  8.30k|    dctbl = compptr->dc_tbl_no;
   97|  8.30k|    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|  8.30k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  8.30k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  209|  8.30k|#define TRUE    1
  ------------------
  102|  8.30k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  8.30k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  206|  8.30k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  8.30k|    entropy->saved.last_dc_val[ci] = 0;
  106|  8.30k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  16.9k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 9.89k, False: 7.02k]
  ------------------
  110|  9.89k|    ci = cinfo->MCU_membership[blkn];
  111|  9.89k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  9.89k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  9.89k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  9.89k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 9.89k, False: 0]
  ------------------
  117|  9.89k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  209|  9.89k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  9.89k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  9.89k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  9.89k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  9.89k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  7.02k|  entropy->bitstate.bits_left = 0;
  127|  7.02k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  7.02k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  7.02k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  7.02k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  7.02k|}
jdhuff.c:decode_mcu:
  771|  12.1M|{
  772|  12.1M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|  12.1M|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|  12.1M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 2.43M, False: 9.66M]
  ------------------
  777|  2.43M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 155k, False: 2.28M]
  ------------------
  778|   155k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 155k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  2.43M|    usefast = 0;
  781|  2.43M|  }
  782|       |
  783|  12.1M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|  12.1M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   56|  12.1M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 6.95M, False: 5.14M]
  ------------------
  784|  12.1M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 4.71M, False: 430k]
  ------------------
  785|  11.6M|    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|  12.1M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 465k, False: 11.6M]
  ------------------
  791|       |
  792|   465k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 418k, False: 47.1k]
  ------------------
  793|   418k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 38.8k, False: 379k]
  ------------------
  794|   418k|    } else {
  795|  85.9k|use_slow:
  796|  85.9k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 85.9k]
  ------------------
  797|  85.9k|    }
  798|       |
  799|   465k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|  12.1M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 2.43M, False: 9.66M]
  ------------------
  803|  2.43M|    entropy->restarts_to_go--;
  804|       |
  805|  12.1M|  return TRUE;
  ------------------
  |  |  209|  12.1M|#define TRUE    1
  ------------------
  806|  12.1M|}
jdhuff.c:process_restart:
  513|   155k|{
  514|   155k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|   155k|  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|   155k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|   155k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|   155k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 155k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|   321k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 165k, False: 155k]
  ------------------
  528|   165k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|   155k|  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|   155k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 6.61k, False: 148k]
  ------------------
  539|  6.61k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  6.61k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|   155k|  return TRUE;
  ------------------
  |  |  209|   155k|#define TRUE    1
  ------------------
  542|   155k|}
jdhuff.c:decode_mcu_fast:
  664|   418k|{
  665|   418k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   418k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   418k|  register bit_buf_type get_buffer; \
  |  |  126|   418k|  register int bits_left; \
  |  |  127|   418k|  bitread_working_state br_state
  ------------------
  667|   418k|  JOCTET *buffer;
  668|   418k|  int blkn;
  669|   418k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   418k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   418k|  br_state.cinfo = cinfop; \
  |  |  131|   418k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   418k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   418k|  get_buffer = permstate.get_buffer; \
  |  |  134|   418k|  bits_left = permstate.bits_left;
  ------------------
  674|   418k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   418k|  state = entropy->saved;
  676|       |
  677|   841k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 423k, False: 418k]
  ------------------
  678|   423k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 423k, False: 0]
  ------------------
  679|   423k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   423k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   423k|    register int s, k, r, l;
  682|       |
  683|   423k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   423k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   423k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 38.0k, False: 385k]
  |  |  |  |  ------------------
  |  |  |  |  416|  38.0k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 6.47k, False: 31.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  6.47k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  6.47k|    buffer++; \
  |  |  |  |  |  |  401|  6.47k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.02k, False: 4.44k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.02k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.02k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.02k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.02k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.02k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.02k|    } \
  |  |  |  |  |  |  408|  6.47k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 9.92k, False: 28.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  9.92k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  9.92k|    buffer++; \
  |  |  |  |  |  |  401|  9.92k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.44k, False: 6.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.44k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.44k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.44k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.44k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.44k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.44k|    } \
  |  |  |  |  |  |  408|  9.92k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 7.69k, False: 30.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  7.69k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  7.69k|    buffer++; \
  |  |  |  |  |  |  401|  7.69k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.75k, False: 3.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.75k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.75k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.75k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.75k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.75k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.75k|    } \
  |  |  |  |  |  |  408|  7.69k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 10.7k, False: 27.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  10.7k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  10.7k|    buffer++; \
  |  |  |  |  |  |  401|  10.7k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.00k, False: 6.72k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.00k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.00k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.00k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.00k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.00k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.00k|    } \
  |  |  |  |  |  |  408|  10.7k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 9.33k, False: 28.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  9.33k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  9.33k|    buffer++; \
  |  |  |  |  |  |  401|  9.33k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.90k, False: 4.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.90k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.90k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.90k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.90k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.90k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.90k|    } \
  |  |  |  |  |  |  408|  9.33k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  38.0k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  38.0k|  register int c0, c1; \
  |  |  |  |  |  |  393|  38.0k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  38.0k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  38.0k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  38.0k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  38.0k|  bits_left += 8; \
  |  |  |  |  |  |  398|  38.0k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 11.3k, False: 26.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  11.3k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  11.3k|    buffer++; \
  |  |  |  |  |  |  401|  11.3k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 5.38k, False: 5.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  5.38k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  5.38k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  5.38k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  5.38k|      buffer -= 2; \
  |  |  |  |  |  |  406|  5.38k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  5.38k|    } \
  |  |  |  |  |  |  408|  11.3k|  } \
  |  |  |  |  |  |  409|  38.0k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  38.0k|  }
  |  |  ------------------
  |  |  225|   423k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   423k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   423k|  s = htbl->lookup[s]; \
  |  |  227|   423k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   423k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   423k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   423k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   423k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   423k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   423k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   423k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   846k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 14.0k, False: 409k]
  |  |  ------------------
  |  |  232|  14.0k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  14.0k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  14.0k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   110k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 95.9k, False: 14.0k]
  |  |  ------------------
  |  |  236|  95.9k|      s <<= 1; \
  |  |  237|  95.9k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  95.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  95.9k|      nb++; \
  |  |  239|  95.9k|    } \
  |  |  240|  14.0k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 11.9k, False: 2.07k]
  |  |  ------------------
  |  |  241|  14.0k|      s = 0; \
  |  |  242|  14.0k|    else \
  |  |  243|  14.0k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  14.0k|  }
  ------------------
  684|   423k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 180k, False: 242k]
  ------------------
  685|   180k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   180k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 21.6k, False: 159k]
  |  |  ------------------
  |  |  416|  21.6k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 919, False: 20.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|    919|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    919|    buffer++; \
  |  |  |  |  401|    919|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 451, False: 468]
  |  |  |  |  ------------------
  |  |  |  |  402|    451|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    451|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    451|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    451|      buffer -= 2; \
  |  |  |  |  406|    451|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    451|    } \
  |  |  |  |  408|    919|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.78k, False: 18.9k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.78k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.78k|    buffer++; \
  |  |  |  |  401|  2.78k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 696, False: 2.08k]
  |  |  |  |  ------------------
  |  |  |  |  402|    696|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    696|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    696|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    696|      buffer -= 2; \
  |  |  |  |  406|    696|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    696|    } \
  |  |  |  |  408|  2.78k|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.28k, False: 20.3k]
  |  |  |  |  ------------------
  |  |  |  |  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: 703, False: 586]
  |  |  |  |  ------------------
  |  |  |  |  402|    703|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    703|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    703|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    703|      buffer -= 2; \
  |  |  |  |  406|    703|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    703|    } \
  |  |  |  |  408|  1.28k|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 2.89k, False: 18.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|  2.89k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  2.89k|    buffer++; \
  |  |  |  |  401|  2.89k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 912, False: 1.98k]
  |  |  |  |  ------------------
  |  |  |  |  402|    912|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    912|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    912|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    912|      buffer -= 2; \
  |  |  |  |  406|    912|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    912|    } \
  |  |  |  |  408|  2.89k|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.90k, False: 19.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.90k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.90k|    buffer++; \
  |  |  |  |  401|  1.90k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.43k, False: 466]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.43k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.43k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.43k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.43k|      buffer -= 2; \
  |  |  |  |  406|  1.43k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.43k|    } \
  |  |  |  |  408|  1.90k|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  21.6k|#define GET_BYTE { \
  |  |  |  |  392|  21.6k|  register int c0, c1; \
  |  |  |  |  393|  21.6k|  c0 = *buffer++; \
  |  |  |  |  394|  21.6k|  c1 = *buffer; \
  |  |  |  |  395|  21.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  21.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  21.6k|  bits_left += 8; \
  |  |  |  |  398|  21.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.44k, False: 18.2k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.44k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.44k|    buffer++; \
  |  |  |  |  401|  3.44k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 1.48k, False: 1.95k]
  |  |  |  |  ------------------
  |  |  |  |  402|  1.48k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  1.48k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  1.48k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  1.48k|      buffer -= 2; \
  |  |  |  |  406|  1.48k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  1.48k|    } \
  |  |  |  |  408|  3.44k|  } \
  |  |  |  |  409|  21.6k|}
  |  |  ------------------
  |  |  417|  21.6k|  }
  ------------------
  686|   180k|      r = GET_BITS(s);
  ------------------
  |  |  169|   180k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|   180k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   180k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   180k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|   180k|    }
  689|       |
  690|   423k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 423k, False: 0]
  ------------------
  691|   423k|      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|   423k|      s += state.last_dc_val[ci];
  696|   423k|      state.last_dc_val[ci] = s;
  697|   423k|      if (block)
  ------------------
  |  Branch (697:11): [True: 423k, False: 0]
  ------------------
  698|   423k|        (*block)[0] = (JCOEF)s;
  699|   423k|    }
  700|       |
  701|   423k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 423k, False: 0]
  |  Branch (701:37): [True: 423k, False: 0]
  ------------------
  702|       |
  703|  16.6M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   56|  16.6M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 16.3M, False: 280k]
  ------------------
  704|  16.3M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  16.3M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  16.3M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 350k, False: 16.0M]
  |  |  |  |  ------------------
  |  |  |  |  416|   350k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 36.9k, False: 313k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  36.9k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  36.9k|    buffer++; \
  |  |  |  |  |  |  401|  36.9k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 21.0k, False: 15.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  21.0k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  21.0k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  21.0k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  21.0k|      buffer -= 2; \
  |  |  |  |  |  |  406|  21.0k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  21.0k|    } \
  |  |  |  |  |  |  408|  36.9k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 40.5k, False: 309k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  40.5k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  40.5k|    buffer++; \
  |  |  |  |  |  |  401|  40.5k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 22.4k, False: 18.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  22.4k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  22.4k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  22.4k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  22.4k|      buffer -= 2; \
  |  |  |  |  |  |  406|  22.4k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  22.4k|    } \
  |  |  |  |  |  |  408|  40.5k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 48.6k, False: 301k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  48.6k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  48.6k|    buffer++; \
  |  |  |  |  |  |  401|  48.6k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 23.0k, False: 25.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  23.0k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  23.0k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  23.0k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  23.0k|      buffer -= 2; \
  |  |  |  |  |  |  406|  23.0k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  23.0k|    } \
  |  |  |  |  |  |  408|  48.6k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 36.5k, False: 313k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  36.5k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  36.5k|    buffer++; \
  |  |  |  |  |  |  401|  36.5k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 25.4k, False: 11.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  25.4k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  25.4k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  25.4k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  25.4k|      buffer -= 2; \
  |  |  |  |  |  |  406|  25.4k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  25.4k|    } \
  |  |  |  |  |  |  408|  36.5k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 44.3k, False: 305k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  44.3k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  44.3k|    buffer++; \
  |  |  |  |  |  |  401|  44.3k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 26.2k, False: 18.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  26.2k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  26.2k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  26.2k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  26.2k|      buffer -= 2; \
  |  |  |  |  |  |  406|  26.2k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  26.2k|    } \
  |  |  |  |  |  |  408|  44.3k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   350k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   350k|  register int c0, c1; \
  |  |  |  |  |  |  393|   350k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   350k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   350k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   350k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   350k|  bits_left += 8; \
  |  |  |  |  |  |  398|   350k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 47.5k, False: 302k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  47.5k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  47.5k|    buffer++; \
  |  |  |  |  |  |  401|  47.5k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 29.0k, False: 18.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  29.0k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  29.0k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  29.0k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  29.0k|      buffer -= 2; \
  |  |  |  |  |  |  406|  29.0k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  29.0k|    } \
  |  |  |  |  |  |  408|  47.5k|  } \
  |  |  |  |  |  |  409|   350k|}
  |  |  |  |  ------------------
  |  |  |  |  417|   350k|  }
  |  |  ------------------
  |  |  225|  16.3M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  16.3M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  16.3M|  s = htbl->lookup[s]; \
  |  |  227|  16.3M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  16.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  16.3M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  16.3M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  16.3M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  16.3M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  16.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  16.3M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  32.7M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 239k, False: 16.1M]
  |  |  ------------------
  |  |  232|   239k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|   239k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|   239k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   982k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 742k, False: 239k]
  |  |  ------------------
  |  |  236|   742k|      s <<= 1; \
  |  |  237|   742k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   742k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   742k|      nb++; \
  |  |  239|   742k|    } \
  |  |  240|   239k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 42.6k, False: 196k]
  |  |  ------------------
  |  |  241|   239k|      s = 0; \
  |  |  242|   239k|    else \
  |  |  243|   239k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|   239k|  }
  ------------------
  705|  16.3M|        r = s >> 4;
  706|  16.3M|        s &= 15;
  707|       |
  708|  16.3M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 16.1M, False: 163k]
  ------------------
  709|  16.1M|          k += r;
  710|  16.1M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  16.1M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 1.16M, False: 15.0M]
  |  |  ------------------
  |  |  416|  1.16M|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 77.1k, False: 1.08M]
  |  |  |  |  ------------------
  |  |  |  |  399|  77.1k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  77.1k|    buffer++; \
  |  |  |  |  401|  77.1k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 42.7k, False: 34.3k]
  |  |  |  |  ------------------
  |  |  |  |  402|  42.7k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  42.7k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  42.7k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  42.7k|      buffer -= 2; \
  |  |  |  |  406|  42.7k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  42.7k|    } \
  |  |  |  |  408|  77.1k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 82.9k, False: 1.08M]
  |  |  |  |  ------------------
  |  |  |  |  399|  82.9k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  82.9k|    buffer++; \
  |  |  |  |  401|  82.9k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 46.2k, False: 36.6k]
  |  |  |  |  ------------------
  |  |  |  |  402|  46.2k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  46.2k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  46.2k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  46.2k|      buffer -= 2; \
  |  |  |  |  406|  46.2k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  46.2k|    } \
  |  |  |  |  408|  82.9k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 81.9k, False: 1.08M]
  |  |  |  |  ------------------
  |  |  |  |  399|  81.9k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  81.9k|    buffer++; \
  |  |  |  |  401|  81.9k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 51.7k, False: 30.1k]
  |  |  |  |  ------------------
  |  |  |  |  402|  51.7k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  51.7k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  51.7k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  51.7k|      buffer -= 2; \
  |  |  |  |  406|  51.7k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  51.7k|    } \
  |  |  |  |  408|  81.9k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 97.0k, False: 1.06M]
  |  |  |  |  ------------------
  |  |  |  |  399|  97.0k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  97.0k|    buffer++; \
  |  |  |  |  401|  97.0k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 54.3k, False: 42.6k]
  |  |  |  |  ------------------
  |  |  |  |  402|  54.3k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  54.3k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  54.3k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  54.3k|      buffer -= 2; \
  |  |  |  |  406|  54.3k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  54.3k|    } \
  |  |  |  |  408|  97.0k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 94.4k, False: 1.07M]
  |  |  |  |  ------------------
  |  |  |  |  399|  94.4k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  94.4k|    buffer++; \
  |  |  |  |  401|  94.4k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 59.2k, False: 35.2k]
  |  |  |  |  ------------------
  |  |  |  |  402|  59.2k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  59.2k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  59.2k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  59.2k|      buffer -= 2; \
  |  |  |  |  406|  59.2k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  59.2k|    } \
  |  |  |  |  408|  94.4k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  1.16M|#define GET_BYTE { \
  |  |  |  |  392|  1.16M|  register int c0, c1; \
  |  |  |  |  393|  1.16M|  c0 = *buffer++; \
  |  |  |  |  394|  1.16M|  c1 = *buffer; \
  |  |  |  |  395|  1.16M|  /* Pre-execute most common case */ \
  |  |  |  |  396|  1.16M|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  1.16M|  bits_left += 8; \
  |  |  |  |  398|  1.16M|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 96.2k, False: 1.07M]
  |  |  |  |  ------------------
  |  |  |  |  399|  96.2k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  96.2k|    buffer++; \
  |  |  |  |  401|  96.2k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 61.2k, False: 34.9k]
  |  |  |  |  ------------------
  |  |  |  |  402|  61.2k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  61.2k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  61.2k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  61.2k|      buffer -= 2; \
  |  |  |  |  406|  61.2k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  61.2k|    } \
  |  |  |  |  408|  96.2k|  } \
  |  |  |  |  409|  1.16M|}
  |  |  ------------------
  |  |  417|  1.16M|  }
  ------------------
  711|  16.1M|          r = GET_BITS(s);
  ------------------
  |  |  169|  16.1M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  16.1M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  16.1M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  16.1M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  16.1M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  16.1M|        } else {
  715|   163k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 142k, False: 20.6k]
  ------------------
  716|  20.6k|          k += 15;
  717|  20.6k|        }
  718|  16.3M|      }
  719|       |
  720|   423k|    } else {
  721|       |
  722|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   56|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (722:19): [True: 0, False: 0]
  ------------------
  723|      0|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|      0|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |  417|      0|  }
  |  |  ------------------
  |  |  225|      0|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|      0|  s = htbl->lookup[s]; \
  |  |  227|      0|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|      0|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|      0|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|      0|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|      0|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  232|      0|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|      0|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|      0|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|      0|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  236|      0|      s <<= 1; \
  |  |  237|      0|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|      0|      nb++; \
  |  |  239|      0|    } \
  |  |  240|      0|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  241|      0|      s = 0; \
  |  |  242|      0|    else \
  |  |  243|      0|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|      0|  }
  ------------------
  724|      0|        r = s >> 4;
  725|      0|        s &= 15;
  726|       |
  727|      0|        if (s) {
  ------------------
  |  Branch (727:13): [True: 0, False: 0]
  ------------------
  728|      0|          k += r;
  729|      0|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |  417|      0|  }
  ------------------
  730|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  731|      0|        } else {
  732|      0|          if (r != 15) break;
  ------------------
  |  Branch (732:15): [True: 0, False: 0]
  ------------------
  733|      0|          k += 15;
  734|      0|        }
  735|      0|      }
  736|      0|    }
  737|   423k|  }
  738|       |
  739|   418k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 38.8k, False: 379k]
  ------------------
  740|  38.8k|    cinfo->unread_marker = 0;
  741|  38.8k|    return FALSE;
  ------------------
  |  |  206|  38.8k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  38.8k|  }
  743|       |
  744|   379k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   379k|  br_state.next_input_byte = buffer;
  746|   379k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   379k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   379k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   379k|  permstate.get_buffer = get_buffer; \
  |  |  140|   379k|  permstate.bits_left = bits_left
  ------------------
  747|   379k|  entropy->saved = state;
  748|   379k|  return TRUE;
  ------------------
  |  |  209|   379k|#define TRUE    1
  ------------------
  749|   418k|}
jdhuff.c:decode_mcu_slow:
  553|  85.9k|{
  554|  85.9k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  85.9k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  85.9k|  register bit_buf_type get_buffer; \
  |  |  126|  85.9k|  register int bits_left; \
  |  |  127|  85.9k|  bitread_working_state br_state
  ------------------
  556|  85.9k|  int blkn;
  557|  85.9k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  85.9k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  85.9k|  br_state.cinfo = cinfop; \
  |  |  131|  85.9k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  85.9k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  85.9k|  get_buffer = permstate.get_buffer; \
  |  |  134|  85.9k|  bits_left = permstate.bits_left;
  ------------------
  562|  85.9k|  state = entropy->saved;
  563|       |
  564|   179k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 93.8k, False: 85.9k]
  ------------------
  565|  93.8k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 93.8k, False: 0]
  ------------------
  566|  93.8k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  93.8k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  93.8k|    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|  93.8k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  93.8k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  93.8k|  register int nb, look; \
  |  |  202|  93.8k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  93.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 16.4k, False: 77.3k]
  |  |  ------------------
  |  |  203|  16.4k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 16.4k]
  |  |  ------------------
  |  |  204|  16.4k|      { failaction; } \
  |  |  205|  16.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  16.4k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  16.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 8.18k, False: 8.29k]
  |  |  ------------------
  |  |  207|  8.18k|      nb = 1;  goto slowlabel; \
  |  |  208|  8.18k|    } \
  |  |  209|  16.4k|  } \
  |  |  210|  93.8k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  85.6k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  85.6k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  85.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  85.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 80.8k, False: 4.81k]
  |  |  ------------------
  |  |  212|  80.8k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  80.8k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  80.8k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  80.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  80.8k|  } else { \
  |  |  215|  12.9k|slowlabel: \
  |  |  216|  12.9k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 12.9k]
  |  |  ------------------
  |  |  217|  12.9k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  12.9k|      { failaction; } \
  |  |  219|  12.9k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  12.9k|  } \
  |  |  221|  85.6k|}
  ------------------
  574|  93.8k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 28.1k, False: 65.6k]
  ------------------
  575|  28.1k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  28.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  28.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 965, False: 27.2k]
  |  |  ------------------
  |  |  162|    965|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 965]
  |  |  ------------------
  |  |  163|    965|      { action; } \
  |  |  164|    965|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    965|  } \
  |  |  166|  28.1k|}
  ------------------
  576|  28.1k|      r = GET_BITS(s);
  ------------------
  |  |  169|  28.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  28.1k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  28.1k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  28.1k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  28.1k|    }
  579|       |
  580|  93.8k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 93.8k, False: 0]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  93.8k|      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|  93.8k|      s += state.last_dc_val[ci];
  592|  93.8k|      state.last_dc_val[ci] = s;
  593|  93.8k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 93.8k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  93.8k|        (*block)[0] = (JCOEF)s;
  596|  93.8k|      }
  597|  93.8k|    }
  598|       |
  599|  93.8k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 93.8k, False: 0]
  |  Branch (599:37): [True: 93.8k, False: 0]
  ------------------
  600|       |
  601|       |      /* Section F.2.2.2: decode the AC coefficients */
  602|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  603|  2.24M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   56|  2.24M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 2.19M, False: 49.3k]
  ------------------
  604|  2.19M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  2.19M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  2.19M|  register int nb, look; \
  |  |  202|  2.19M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.19M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 201k, False: 1.99M]
  |  |  ------------------
  |  |  203|   201k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 201k]
  |  |  ------------------
  |  |  204|   201k|      { failaction; } \
  |  |  205|   201k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   201k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   201k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 106k, False: 94.7k]
  |  |  ------------------
  |  |  207|   106k|      nb = 1;  goto slowlabel; \
  |  |  208|   106k|    } \
  |  |  209|   201k|  } \
  |  |  210|  2.19M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.08M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  2.08M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.08M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.08M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 2.01M, False: 72.8k]
  |  |  ------------------
  |  |  212|  2.01M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.01M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  2.01M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.01M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  2.01M|  } else { \
  |  |  215|   179k|slowlabel: \
  |  |  216|   179k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 179k]
  |  |  ------------------
  |  |  217|   179k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   179k|      { failaction; } \
  |  |  219|   179k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   179k|  } \
  |  |  221|  2.08M|}
  ------------------
  605|       |
  606|  2.19M|        r = s >> 4;
  607|  2.19M|        s &= 15;
  608|       |
  609|  2.19M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 2.13M, False: 62.8k]
  ------------------
  610|  2.13M|          k += r;
  611|  2.13M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  2.13M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.13M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 10.1k, False: 2.12M]
  |  |  ------------------
  |  |  162|  10.1k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 10.1k]
  |  |  ------------------
  |  |  163|  10.1k|      { action; } \
  |  |  164|  10.1k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  10.1k|  } \
  |  |  166|  2.13M|}
  ------------------
  612|  2.13M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.13M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  2.13M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.13M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.13M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  614|       |          /* Output coefficient in natural (dezigzagged) order.
  615|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  616|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  617|       |           */
  618|  2.13M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  2.13M|        } else {
  620|  62.8k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 44.5k, False: 18.3k]
  ------------------
  621|  44.5k|            break;
  622|  18.3k|          k += 15;
  623|  18.3k|        }
  624|  2.19M|      }
  625|       |
  626|  93.8k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   56|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 0]
  ------------------
  631|      0|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  200|      0|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|      0|  register int nb, look; \
  |  |  202|      0|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  203|      0|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  204|      0|      { failaction; } \
  |  |  205|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|      0|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  207|      0|      nb = 1;  goto slowlabel; \
  |  |  208|      0|    } \
  |  |  209|      0|  } \
  |  |  210|      0|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|      0|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|      0|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|      0|  } else { \
  |  |  215|      0|slowlabel: \
  |  |  216|      0|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|      0|      { failaction; } \
  |  |  219|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|      0|  } \
  |  |  221|      0|}
  ------------------
  632|       |
  633|      0|        r = s >> 4;
  634|      0|        s &= 15;
  635|       |
  636|      0|        if (s) {
  ------------------
  |  Branch (636:13): [True: 0, False: 0]
  ------------------
  637|      0|          k += r;
  638|      0|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|      0|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|      0|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  162|      0|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  163|      0|      { action; } \
  |  |  164|      0|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|      0|  } \
  |  |  166|      0|}
  ------------------
  639|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  640|      0|        } else {
  641|      0|          if (r != 15)
  ------------------
  |  Branch (641:15): [True: 0, False: 0]
  ------------------
  642|      0|            break;
  643|      0|          k += 15;
  644|      0|        }
  645|      0|      }
  646|      0|    }
  647|  93.8k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  85.9k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  85.9k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  85.9k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  85.9k|  permstate.get_buffer = get_buffer; \
  |  |  140|  85.9k|  permstate.bits_left = bits_left
  ------------------
  651|  85.9k|  entropy->saved = state;
  652|  85.9k|  return TRUE;
  ------------------
  |  |  209|  85.9k|#define TRUE    1
  ------------------
  653|  85.9k|}

jinit_input_controller:
  400|  5.51k|{
  401|  5.51k|  my_inputctl_ptr inputctl;
  402|       |
  403|       |  /* Create subobject in permanent pool */
  404|  5.51k|  inputctl = (my_inputctl_ptr)
  405|  5.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  406|  5.51k|                                sizeof(my_input_controller));
  407|  5.51k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  408|       |  /* Initialize method pointers */
  409|  5.51k|  inputctl->pub.consume_input = consume_markers;
  410|  5.51k|  inputctl->pub.reset_input_controller = reset_input_controller;
  411|  5.51k|  inputctl->pub.start_input_pass = start_input_pass;
  412|  5.51k|  inputctl->pub.finish_input_pass = finish_input_pass;
  413|       |  /* Initialize state: can't use reset_input_controller since we don't
  414|       |   * want to try to reset other modules yet.
  415|       |   */
  416|  5.51k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  ------------------
  417|  5.51k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  ------------------
  418|  5.51k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|  5.51k|#define TRUE    1
  ------------------
  419|  5.51k|}
jdinput.c:consume_markers:
  327|  36.7k|{
  328|  36.7k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  329|  36.7k|  int val;
  330|       |
  331|  36.7k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (331:7): [True: 0, False: 36.7k]
  ------------------
  332|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1096|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  333|       |
  334|  36.7k|  val = (*cinfo->marker->read_markers) (cinfo);
  335|       |
  336|  36.7k|  switch (val) {
  ------------------
  |  Branch (336:11): [True: 1.54k, False: 35.1k]
  ------------------
  337|  29.7k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1095|  29.7k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (337:3): [True: 29.7k, False: 6.94k]
  ------------------
  338|  29.7k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (338:9): [True: 12.2k, False: 17.5k]
  ------------------
  339|  12.2k|      initial_setup(cinfo);
  340|  12.2k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  206|  12.2k|#define FALSE   0               /* values of boolean */
  ------------------
  341|       |      /* Note: start_input_pass must be called by jdmaster.c
  342|       |       * before any more input can be consumed.  jdapimin.c is
  343|       |       * responsible for enforcing this sequencing.
  344|       |       */
  345|  17.5k|    } else {                    /* 2nd or later SOS marker */
  346|  17.5k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (346:11): [True: 18, False: 17.5k]
  ------------------
  347|     18|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     18|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|  17.5k|      start_input_pass(cinfo);
  349|  17.5k|    }
  350|  29.7k|    break;
  351|  5.39k|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1096|  5.39k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (351:3): [True: 5.39k, False: 31.3k]
  ------------------
  352|  5.39k|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  209|  5.39k|#define TRUE    1
  ------------------
  353|  5.39k|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (353:9): [True: 746, False: 4.64k]
  ------------------
  354|    746|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (354:11): [True: 25, False: 721]
  ------------------
  355|     25|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     25|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  356|  4.64k|    } else {
  357|       |      /* Prevent infinite loop in coef ctlr's decompress_data routine
  358|       |       * if user set output_scan_number larger than number of scans.
  359|       |       */
  360|  4.64k|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (360:11): [True: 0, False: 4.64k]
  ------------------
  361|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  362|  4.64k|    }
  363|  5.39k|    break;
  364|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (364:3): [True: 0, False: 36.7k]
  ------------------
  365|      0|    break;
  366|  36.7k|  }
  367|       |
  368|  34.9k|  return val;
  369|  36.7k|}
jdinput.c:initial_setup:
   49|  12.2k|{
   50|  12.2k|  int ci;
   51|  12.2k|  jpeg_component_info *compptr;
   52|  12.2k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   55|  12.1k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 76, False: 12.1k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  12.2k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  157|  24.4k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 1, False: 12.2k]
  ------------------
   56|  12.2k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  157|  12.2k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 1, False: 12.2k]
  ------------------
   57|      2|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   58|       |
   59|       |  /* For now, precision must match compiled-in value... */
   60|  12.2k|#ifdef D_LOSSLESS_SUPPORTED
   61|  12.2k|  if (cinfo->data_precision != 8 && cinfo->data_precision != 12 &&
  ------------------
  |  Branch (61:7): [True: 2.18k, False: 10.0k]
  |  Branch (61:37): [True: 30, False: 2.15k]
  ------------------
   62|  12.2k|      cinfo->data_precision != 16)
  ------------------
  |  Branch (62:7): [True: 19, False: 11]
  ------------------
   63|       |#else
   64|       |  if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
   65|       |#endif
   66|     19|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     19|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     19|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   67|       |
   68|       |  /* Check that number of components won't exceed internal array sizes */
   69|  12.2k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   29|  12.2k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (69:7): [True: 2, False: 12.2k]
  ------------------
   70|      2|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      2|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   71|  12.2k|             MAX_COMPONENTS);
   72|       |
   73|       |  /* Compute maximum sampling factors; check factor validity */
   74|  12.2k|  cinfo->max_h_samp_factor = 1;
   75|  12.2k|  cinfo->max_v_samp_factor = 1;
   76|  31.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (76:44): [True: 19.2k, False: 12.2k]
  ------------------
   77|  19.2k|       ci++, compptr++) {
   78|  19.2k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (78:9): [True: 2, False: 19.2k]
  ------------------
   79|  19.2k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   61|  38.4k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (79:9): [True: 3, False: 19.2k]
  ------------------
   80|  19.2k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (80:9): [True: 1, False: 19.2k]
  ------------------
   81|  19.2k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   61|  19.2k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (81:9): [True: 3, False: 19.2k]
  ------------------
   82|      9|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   83|  19.2k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  446|  19.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 6.02k, False: 13.2k]
  |  |  ------------------
  ------------------
   84|  19.2k|                                   compptr->h_samp_factor);
   85|  19.2k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  446|  19.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 3.82k, False: 15.4k]
  |  |  ------------------
  ------------------
   86|  19.2k|                                   compptr->v_samp_factor);
   87|  19.2k|  }
   88|       |
   89|       |#if JPEG_LIB_VERSION >= 80
   90|       |  cinfo->block_size = data_unit;
   91|       |  cinfo->natural_order = jpeg_natural_order;
   92|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   93|       |#endif
   94|       |
   95|       |  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE in lossy
   96|       |   * mode.  In the full decompressor, this will be overridden by jdmaster.c;
   97|       |   * but in the transcoder, jdmaster.c is not used, so we must do it here.
   98|       |   */
   99|       |#if JPEG_LIB_VERSION >= 70
  100|       |  cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = data_unit;
  101|       |#else
  102|  12.2k|  cinfo->min_DCT_scaled_size = data_unit;
  103|  12.2k|#endif
  104|       |
  105|       |  /* Compute dimensions of components */
  106|  31.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (106:44): [True: 19.2k, False: 12.2k]
  ------------------
  107|  19.2k|       ci++, compptr++) {
  108|       |#if JPEG_LIB_VERSION >= 70
  109|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  110|       |#else
  111|  19.2k|    compptr->DCT_scaled_size = data_unit;
  112|  19.2k|#endif
  113|       |    /* Size in data units */
  114|  19.2k|    compptr->width_in_blocks = (JDIMENSION)
  115|  19.2k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  116|  19.2k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  117|  19.2k|    compptr->height_in_blocks = (JDIMENSION)
  118|  19.2k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  119|  19.2k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  120|       |    /* Set the first and last MCU columns to decompress from multi-scan images.
  121|       |     * By default, decompress all of the MCU columns.
  122|       |     */
  123|  19.2k|    cinfo->master->first_MCU_col[ci] = 0;
  124|  19.2k|    cinfo->master->last_MCU_col[ci] = compptr->width_in_blocks - 1;
  125|       |    /* downsampled_width and downsampled_height will also be overridden by
  126|       |     * jdmaster.c if we are doing full decompression.  The transcoder library
  127|       |     * doesn't use these values, but the calling application might.
  128|       |     */
  129|       |    /* Size in samples */
  130|  19.2k|    compptr->downsampled_width = (JDIMENSION)
  131|  19.2k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  132|  19.2k|                    (long)cinfo->max_h_samp_factor);
  133|  19.2k|    compptr->downsampled_height = (JDIMENSION)
  134|  19.2k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  135|  19.2k|                    (long)cinfo->max_v_samp_factor);
  136|       |    /* Mark component needed, until color conversion says otherwise */
  137|  19.2k|    compptr->component_needed = TRUE;
  ------------------
  |  |  209|  19.2k|#define TRUE    1
  ------------------
  138|       |    /* Mark no quantization table yet saved for component */
  139|  19.2k|    compptr->quant_table = NULL;
  140|  19.2k|  }
  141|       |
  142|       |  /* Compute number of fully interleaved MCU rows. */
  143|  12.2k|  cinfo->total_iMCU_rows = (JDIMENSION)
  144|  12.2k|    jdiv_round_up((long)cinfo->image_height,
  145|  12.2k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  146|       |
  147|       |  /* Decide whether file contains multiple scans */
  148|  12.2k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (148:7): [True: 2.71k, False: 9.49k]
  |  Branch (148:55): [True: 4.97k, False: 4.52k]
  ------------------
  149|  7.65k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  209|  7.65k|#define TRUE    1
  ------------------
  150|  4.55k|  else
  151|  4.55k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  206|  4.55k|#define FALSE   0               /* values of boolean */
  ------------------
  152|  12.2k|}
jdinput.c:reset_input_controller:
  378|  13.5k|{
  379|  13.5k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  380|       |
  381|  13.5k|  inputctl->pub.consume_input = consume_markers;
  382|  13.5k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  383|  13.5k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  384|  13.5k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|  13.5k|#define TRUE    1
  ------------------
  385|       |  /* Reset other modules */
  386|  13.5k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  387|  13.5k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  388|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  389|  13.5k|  cinfo->coef_bits = NULL;
  390|  13.5k|}
jdinput.c:start_input_pass:
  292|  23.8k|{
  293|  23.8k|  per_scan_setup(cinfo);
  294|  23.8k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (294:7): [True: 23.8k, False: 12]
  ------------------
  295|  23.8k|    latch_quant_tables(cinfo);
  296|  23.8k|  (*cinfo->entropy->start_pass) (cinfo);
  297|  23.8k|  (*cinfo->coef->start_input_pass) (cinfo);
  298|  23.8k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  299|  23.8k|}
jdinput.c:per_scan_setup:
  159|  23.8k|{
  160|  23.8k|  int ci, mcublks, tmp;
  161|  23.8k|  jpeg_component_info *compptr;
  162|  23.8k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   55|  23.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (162:19): [True: 0, False: 23.8k]
  ------------------
  163|       |
  164|  23.8k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (164:7): [True: 19.5k, False: 4.28k]
  ------------------
  165|       |
  166|       |    /* Noninterleaved (single-component) scan */
  167|  19.5k|    compptr = cinfo->cur_comp_info[0];
  168|       |
  169|       |    /* Overall image size in MCUs */
  170|  19.5k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  171|  19.5k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  172|       |
  173|       |    /* For noninterleaved scan, always one data unit per MCU */
  174|  19.5k|    compptr->MCU_width = 1;
  175|  19.5k|    compptr->MCU_height = 1;
  176|  19.5k|    compptr->MCU_blocks = 1;
  177|  19.5k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  19.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  178|  19.5k|    compptr->last_col_width = 1;
  179|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  180|       |     * as the number of data unit rows present in the last iMCU row.
  181|       |     */
  182|  19.5k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  183|  19.5k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (183:9): [True: 14.2k, False: 5.28k]
  ------------------
  184|  19.5k|    compptr->last_row_height = tmp;
  185|       |
  186|       |    /* Prepare array describing MCU composition */
  187|  19.5k|    cinfo->blocks_in_MCU = 1;
  188|  19.5k|    cinfo->MCU_membership[0] = 0;
  189|       |
  190|  19.5k|  } else {
  191|       |
  192|       |    /* Interleaved (multi-component) scan */
  193|  4.28k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  4.28k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (193:9): [True: 0, False: 4.28k]
  |  Branch (193:38): [True: 0, False: 4.28k]
  ------------------
  194|      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)))
  ------------------
  195|  4.28k|               MAX_COMPS_IN_SCAN);
  196|       |
  197|       |    /* Overall image size in MCUs */
  198|  4.28k|    cinfo->MCUs_per_row = (JDIMENSION)
  199|  4.28k|      jdiv_round_up((long)cinfo->image_width,
  200|  4.28k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  201|  4.28k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  202|  4.28k|      jdiv_round_up((long)cinfo->image_height,
  203|  4.28k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  204|       |
  205|  4.28k|    cinfo->blocks_in_MCU = 0;
  206|       |
  207|  16.1k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (207:18): [True: 11.8k, False: 4.28k]
  ------------------
  208|  11.8k|      compptr = cinfo->cur_comp_info[ci];
  209|       |      /* Sampling factors give # of data units of component in each MCU */
  210|  11.8k|      compptr->MCU_width = compptr->h_samp_factor;
  211|  11.8k|      compptr->MCU_height = compptr->v_samp_factor;
  212|  11.8k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  213|  11.8k|      compptr->MCU_sample_width = compptr->MCU_width *
  214|  11.8k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  11.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  215|       |      /* Figure number of non-dummy data units in last MCU column & row */
  216|  11.8k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  217|  11.8k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (217:11): [True: 9.54k, False: 2.35k]
  ------------------
  218|  11.8k|      compptr->last_col_width = tmp;
  219|  11.8k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  220|  11.8k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (220:11): [True: 8.41k, False: 3.48k]
  ------------------
  221|  11.8k|      compptr->last_row_height = tmp;
  222|       |      /* Prepare array describing MCU composition */
  223|  11.8k|      mcublks = compptr->MCU_blocks;
  224|  11.8k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   71|  11.8k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (224:11): [True: 12, False: 11.8k]
  ------------------
  225|     12|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     12|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  226|  34.7k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (226:14): [True: 22.8k, False: 11.8k]
  ------------------
  227|  22.8k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  228|  22.8k|      }
  229|  11.8k|    }
  230|       |
  231|  4.28k|  }
  232|  23.8k|}
jdinput.c:latch_quant_tables:
  258|  23.8k|{
  259|  23.8k|  int ci, qtblno;
  260|  23.8k|  jpeg_component_info *compptr;
  261|  23.8k|  JQUANT_TBL *qtbl;
  262|       |
  263|  55.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (263:16): [True: 31.3k, False: 23.8k]
  ------------------
  264|  31.3k|    compptr = cinfo->cur_comp_info[ci];
  265|       |    /* No work if we already saved Q-table for this component */
  266|  31.3k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (266:9): [True: 23.7k, False: 7.66k]
  ------------------
  267|  23.7k|      continue;
  268|       |    /* Make sure specified quantization table is present */
  269|  7.66k|    qtblno = compptr->quant_tbl_no;
  270|  7.66k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   57|  15.3k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (270:9): [True: 0, False: 7.66k]
  |  Branch (270:23): [True: 221, False: 7.44k]
  ------------------
  271|  7.66k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (271:9): [True: 116, False: 7.32k]
  ------------------
  272|    337|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|    337|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    337|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    337|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  273|       |    /* OK, save away the quantization table */
  274|  7.66k|    qtbl = (JQUANT_TBL *)
  275|  7.66k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  7.66k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  276|  7.66k|                                  sizeof(JQUANT_TBL));
  277|  7.66k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  278|  7.66k|    compptr->quant_table = qtbl;
  279|  7.66k|  }
  280|  23.8k|}
jdinput.c:finish_input_pass:
  310|  23.2k|{
  311|  23.2k|  cinfo->inputctl->consume_input = consume_markers;
  312|  23.2k|}

jpeg_resync_to_restart:
 1219|  18.0M|{
 1220|  18.0M|  int marker = cinfo->unread_marker;
 1221|  18.0M|  int action = 1;
 1222|       |
 1223|       |  /* Always put up a warning. */
 1224|  18.0M|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|  18.0M|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  18.0M|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  18.0M|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  18.0M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1225|       |
 1226|       |  /* Outer loop handles repeated decision after scanning forward. */
 1227|  18.0M|  for (;;) {
 1228|  18.0M|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1228:9): [True: 944, False: 18.0M]
  ------------------
 1229|    944|      action = 2;               /* invalid marker */
 1230|  18.0M|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1230:14): [True: 2.08M, False: 15.9M]
  |  Branch (1230:38): [True: 15.9M, False: 12.5k]
  ------------------
 1231|  17.9M|      action = 3;               /* valid non-restart marker */
 1232|  12.5k|    else {
 1233|  12.5k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1233:11): [True: 3.65k, False: 8.85k]
  ------------------
 1234|  12.5k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1234:11): [True: 1.46k, False: 7.39k]
  ------------------
 1235|  5.12k|        action = 3;             /* one of the next two expected restarts */
 1236|  7.39k|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1236:16): [True: 687, False: 6.70k]
  ------------------
 1237|  7.39k|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1237:16): [True: 960, False: 5.74k]
  ------------------
 1238|  1.64k|        action = 2;             /* a prior restart, so advance */
 1239|  5.74k|      else
 1240|  5.74k|        action = 1;             /* desired restart or too far away */
 1241|  12.5k|    }
 1242|  18.0M|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|  18.0M|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  18.0M|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  18.0M|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  18.0M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1243|  18.0M|    switch (action) {
  ------------------
  |  Branch (1243:13): [True: 0, False: 18.0M]
  ------------------
 1244|  5.74k|    case 1:
  ------------------
  |  Branch (1244:5): [True: 5.74k, False: 18.0M]
  ------------------
 1245|       |      /* Discard marker and let entropy decoder resume processing. */
 1246|  5.74k|      cinfo->unread_marker = 0;
 1247|  5.74k|      return TRUE;
  ------------------
  |  |  209|  5.74k|#define TRUE    1
  ------------------
 1248|  2.59k|    case 2:
  ------------------
  |  Branch (1248:5): [True: 2.59k, False: 18.0M]
  ------------------
 1249|       |      /* Scan to the next marker, and repeat the decision loop. */
 1250|  2.59k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1250:11): [True: 0, False: 2.59k]
  ------------------
 1251|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1252|  2.59k|      marker = cinfo->unread_marker;
 1253|  2.59k|      break;
 1254|  17.9M|    case 3:
  ------------------
  |  Branch (1254:5): [True: 17.9M, False: 8.33k]
  ------------------
 1255|       |      /* Return without advancing past this marker. */
 1256|       |      /* Entropy decoder will be forced to process an empty segment. */
 1257|  17.9M|      return TRUE;
  ------------------
  |  |  209|  17.9M|#define TRUE    1
  ------------------
 1258|  18.0M|    }
 1259|  18.0M|  } /* end loop */
 1260|  18.0M|}
jinit_marker_reader:
 1289|  5.51k|{
 1290|  5.51k|  my_marker_ptr marker;
 1291|  5.51k|  int i;
 1292|       |
 1293|       |  /* Create subobject in permanent pool */
 1294|  5.51k|  marker = (my_marker_ptr)
 1295|  5.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  872|  5.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1296|  5.51k|                                sizeof(my_marker_reader));
 1297|  5.51k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1298|       |  /* Initialize public method pointers */
 1299|  5.51k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1300|  5.51k|  marker->pub.read_markers = read_markers;
 1301|  5.51k|  marker->pub.read_restart_marker = read_restart_marker;
 1302|       |  /* Initialize COM/APPn processing.
 1303|       |   * By default, we examine and then discard APP0 and APP14,
 1304|       |   * but simply discard COM and all other APPn.
 1305|       |   */
 1306|  5.51k|  marker->process_COM = skip_variable;
 1307|  5.51k|  marker->length_limit_COM = 0;
 1308|  93.7k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1308:15): [True: 88.2k, False: 5.51k]
  ------------------
 1309|  88.2k|    marker->process_APPn[i] = skip_variable;
 1310|  88.2k|    marker->length_limit_APPn[i] = 0;
 1311|  88.2k|  }
 1312|  5.51k|  marker->process_APPn[0] = get_interesting_appn;
 1313|  5.51k|  marker->process_APPn[14] = get_interesting_appn;
 1314|       |  /* Reset marker processing state */
 1315|  5.51k|  reset_marker_reader(cinfo);
 1316|  5.51k|}
jpeg_save_markers:
 1328|  67.9k|{
 1329|  67.9k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1330|  67.9k|  long maxlength;
 1331|  67.9k|  jpeg_marker_parser_method processor;
 1332|       |
 1333|       |  /* Length limit mustn't be larger than what we can allocate
 1334|       |   * (should only be a concern in a 16-bit environment).
 1335|       |   */
 1336|  67.9k|  maxlength = cinfo->mem->max_alloc_chunk - sizeof(struct jpeg_marker_struct);
 1337|  67.9k|  if (((long)length_limit) > maxlength)
  ------------------
  |  Branch (1337:7): [True: 0, False: 67.9k]
  ------------------
 1338|      0|    length_limit = (unsigned int)maxlength;
 1339|       |
 1340|       |  /* Choose processor routine to use.
 1341|       |   * APP0/APP14 have special requirements.
 1342|       |   */
 1343|  67.9k|  if (length_limit) {
  ------------------
  |  Branch (1343:7): [True: 67.9k, False: 0]
  ------------------
 1344|  67.9k|    processor = save_marker;
 1345|       |    /* If saving APP0/APP14, save at least enough for our internal use. */
 1346|  67.9k|    if (marker_code == (int)M_APP0 && length_limit < APP0_DATA_LEN)
  ------------------
  |  |  599|  3.99k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (1346:9): [True: 3.99k, False: 63.9k]
  |  Branch (1346:39): [True: 0, False: 3.99k]
  ------------------
 1347|      0|      length_limit = APP0_DATA_LEN;
  ------------------
  |  |  599|      0|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
 1348|  67.9k|    else if (marker_code == (int)M_APP14 && length_limit < APP14_DATA_LEN)
  ------------------
  |  |  600|  3.99k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (1348:14): [True: 3.99k, False: 63.9k]
  |  Branch (1348:45): [True: 0, False: 3.99k]
  ------------------
 1349|      0|      length_limit = APP14_DATA_LEN;
  ------------------
  |  |  600|      0|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
 1350|  67.9k|  } else {
 1351|      0|    processor = skip_variable;
 1352|       |    /* If discarding APP0/APP14, use our regular on-the-fly processor. */
 1353|      0|    if (marker_code == (int)M_APP0 || marker_code == (int)M_APP14)
  ------------------
  |  Branch (1353:9): [True: 0, False: 0]
  |  Branch (1353:39): [True: 0, False: 0]
  ------------------
 1354|      0|      processor = get_interesting_appn;
 1355|      0|  }
 1356|       |
 1357|  67.9k|  if (marker_code == (int)M_COM) {
  ------------------
  |  Branch (1357:7): [True: 3.99k, False: 63.9k]
  ------------------
 1358|  3.99k|    marker->process_COM = processor;
 1359|  3.99k|    marker->length_limit_COM = length_limit;
 1360|  63.9k|  } else if (marker_code >= (int)M_APP0 && marker_code <= (int)M_APP15) {
  ------------------
  |  Branch (1360:14): [True: 63.9k, False: 0]
  |  Branch (1360:44): [True: 63.9k, False: 0]
  ------------------
 1361|  63.9k|    marker->process_APPn[marker_code - (int)M_APP0] = processor;
 1362|  63.9k|    marker->length_limit_APPn[marker_code - (int)M_APP0] = length_limit;
 1363|  63.9k|  } else
 1364|      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)))
  ------------------
 1365|  67.9k|}
jdmarker.c:next_marker:
  893|   770k|{
  894|   770k|  int c;
  895|   770k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   770k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   770k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   770k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  896|       |
  897|   878k|  for (;;) {
  898|   878k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   878k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   880k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 758]
  |  |  |  |  |  Branch (279:38): [True: 758, False: 877k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   878k|            bytes_in_buffer--; \
  |  |  156|   878k|            V = *next_input_byte++; )
  ------------------
  899|       |    /* Skip any non-FF bytes.
  900|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  901|       |     * We sync after each discarded byte so that a suspending data source
  902|       |     * can discard the byte from its buffer.
  903|       |     */
  904|  5.62M|    while (c != 0xFF) {
  ------------------
  |  Branch (904:12): [True: 4.74M, False: 878k]
  ------------------
  905|  4.74M|      cinfo->marker->discarded_bytes++;
  906|  4.74M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  4.74M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  4.74M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  907|  4.74M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  4.74M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.74M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 939]
  |  |  |  |  |  Branch (279:38): [True: 939, False: 4.74M]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  4.74M|            bytes_in_buffer--; \
  |  |  156|  4.74M|            V = *next_input_byte++; )
  ------------------
  908|  4.74M|    }
  909|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  910|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  911|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  912|       |     * data source's input buffer.
  913|       |     */
  914|   905k|    do {
  915|   905k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   905k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   905k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 26]
  |  |  |  |  |  Branch (279:38): [True: 26, False: 905k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   905k|            bytes_in_buffer--; \
  |  |  156|   905k|            V = *next_input_byte++; )
  ------------------
  916|   905k|    } while (c == 0xFF);
  ------------------
  |  Branch (916:14): [True: 27.6k, False: 878k]
  ------------------
  917|   878k|    if (c != 0)
  ------------------
  |  Branch (917:9): [True: 770k, False: 108k]
  ------------------
  918|   770k|      break;                    /* found a valid marker, exit loop */
  919|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  920|       |     * Discard it and loop back to try again.
  921|       |     */
  922|   108k|    cinfo->marker->discarded_bytes += 2;
  923|   108k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   108k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   108k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  924|   108k|  }
  925|       |
  926|   770k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (926:7): [True: 524k, False: 245k]
  ------------------
  927|   524k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|   524k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   524k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   524k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   524k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  928|   524k|    cinfo->marker->discarded_bytes = 0;
  929|   524k|  }
  930|       |
  931|   770k|  cinfo->unread_marker = c;
  932|       |
  933|   770k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   770k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   770k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  934|   770k|  return TRUE;
  ------------------
  |  |  209|   770k|#define TRUE    1
  ------------------
  935|   770k|}
jdmarker.c:reset_marker_reader:
 1269|  19.0k|{
 1270|  19.0k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1271|       |
 1272|  19.0k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1273|  19.0k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1274|  19.0k|  cinfo->unread_marker = 0;             /* no pending marker */
 1275|  19.0k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  206|  19.0k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|  19.0k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  206|  19.0k|#define FALSE   0               /* values of boolean */
  ------------------
 1277|  19.0k|  marker->pub.discarded_bytes = 0;
 1278|  19.0k|  marker->cur_marker = NULL;
 1279|  19.0k|}
jdmarker.c:read_markers:
  971|  36.7k|{
  972|       |  /* Outer loop repeats once for each marker. */
  973|   802k|  for (;;) {
  974|       |    /* Collect the marker proper, unless we already did. */
  975|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  976|   802k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (976:9): [True: 779k, False: 22.8k]
  ------------------
  977|   779k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (977:11): [True: 13.5k, False: 765k]
  ------------------
  978|  13.5k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (978:13): [True: 0, False: 13.5k]
  ------------------
  979|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  980|   765k|      } else {
  981|   765k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (981:13): [True: 0, False: 765k]
  ------------------
  982|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  983|   765k|      }
  984|   779k|    }
  985|       |    /* At this point cinfo->unread_marker contains the marker code and the
  986|       |     * input point is just past the marker proper, but before any parameters.
  987|       |     * A suspension will cause us to return with this state still true.
  988|       |     */
  989|   802k|    switch (cinfo->unread_marker) {
  990|  13.5k|    case M_SOI:
  ------------------
  |  Branch (990:5): [True: 13.5k, False: 788k]
  ------------------
  991|  13.5k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (991:11): [True: 0, False: 13.5k]
  ------------------
  992|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  993|  13.5k|      break;
  994|       |
  995|  13.5k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (995:5): [True: 1.80k, False: 800k]
  ------------------
  996|  4.79k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (996:5): [True: 2.98k, False: 799k]
  ------------------
  997|  4.79k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  4.79k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  4.79k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  206|  4.79k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (997:11): [True: 0, False: 4.79k]
  ------------------
  998|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  999|  4.79k|      break;
 1000|       |
 1001|  4.79k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1001:5): [True: 2.96k, False: 799k]
  ------------------
 1002|  2.96k|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  209|  2.96k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|  2.96k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  206|  2.96k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1002:11): [True: 0, False: 2.96k]
  ------------------
 1003|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1004|  2.96k|      break;
 1005|       |
 1006|  2.96k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1006:5): [True: 42, False: 802k]
  ------------------
 1007|     42|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|     42|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  209|     42|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  206|     42|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1007:11): [True: 0, False: 42]
  ------------------
 1008|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1009|     42|      break;
 1010|       |
 1011|  1.61k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1011:5): [True: 1.61k, False: 800k]
  ------------------
 1012|  1.61k|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|  1.61k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  206|  1.61k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  209|  1.61k|#define TRUE    1
  ------------------
  |  Branch (1012:11): [True: 0, False: 1.61k]
  ------------------
 1013|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1014|  1.61k|      break;
 1015|       |
 1016|  2.98k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1016:5): [True: 2.98k, False: 799k]
  ------------------
 1017|  2.98k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  209|  2.98k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  206|  2.98k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  209|  2.98k|#define TRUE    1
  ------------------
  |  Branch (1017:11): [True: 0, False: 2.98k]
  ------------------
 1018|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1019|  2.98k|      break;
 1020|       |
 1021|  2.98k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1021:5): [True: 45, False: 802k]
  ------------------
 1022|     45|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  206|     45|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|     45|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  209|     45|#define TRUE    1
  ------------------
  |  Branch (1022:11): [True: 0, False: 45]
  ------------------
 1023|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1024|     45|      break;
 1025|       |
 1026|       |    /* Currently unsupported SOFn types */
 1027|     45|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1027:5): [True: 5, False: 802k]
  ------------------
 1028|     12|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1028:5): [True: 7, False: 802k]
  ------------------
 1029|     18|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1029:5): [True: 6, False: 802k]
  ------------------
 1030|     21|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1030:5): [True: 3, False: 802k]
  ------------------
 1031|     25|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 4, False: 802k]
  ------------------
 1032|     28|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 3, False: 802k]
  ------------------
 1033|     31|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1033:5): [True: 3, False: 802k]
  ------------------
 1034|     31|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|     31|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     31|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     31|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1035|     31|      break;
 1036|       |
 1037|  30.0k|    case M_SOS:
  ------------------
  |  Branch (1037:5): [True: 30.0k, False: 772k]
  ------------------
 1038|  30.0k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1038:11): [True: 0, False: 30.0k]
  ------------------
 1039|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1040|  30.0k|      cinfo->unread_marker = 0; /* processed the marker */
 1041|  30.0k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1095|  30.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1042|       |
 1043|  5.39k|    case M_EOI:
  ------------------
  |  Branch (1043:5): [True: 5.39k, False: 796k]
  ------------------
 1044|  5.39k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|  5.39k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  5.39k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1045|  5.39k|      cinfo->unread_marker = 0; /* processed the marker */
 1046|  5.39k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1096|  5.39k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1047|       |
 1048|    610|    case M_DAC:
  ------------------
  |  Branch (1048:5): [True: 610, False: 801k]
  ------------------
 1049|    610|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1049:11): [True: 0, False: 610]
  ------------------
 1050|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1051|    610|      break;
 1052|       |
 1053|  4.18k|    case M_DHT:
  ------------------
  |  Branch (1053:5): [True: 4.18k, False: 798k]
  ------------------
 1054|  4.18k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1054:11): [True: 0, False: 4.18k]
  ------------------
 1055|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1056|  4.18k|      break;
 1057|       |
 1058|  12.2k|    case M_DQT:
  ------------------
  |  Branch (1058:5): [True: 12.2k, False: 789k]
  ------------------
 1059|  12.2k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1059:11): [True: 0, False: 12.2k]
  ------------------
 1060|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1061|  12.2k|      break;
 1062|       |
 1063|  43.7k|    case M_DRI:
  ------------------
  |  Branch (1063:5): [True: 43.7k, False: 758k]
  ------------------
 1064|  43.7k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1064:11): [True: 0, False: 43.7k]
  ------------------
 1065|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1066|  43.7k|      break;
 1067|       |
 1068|   609k|    case M_APP0:
  ------------------
  |  Branch (1068:5): [True: 609k, False: 192k]
  ------------------
 1069|   658k|    case M_APP1:
  ------------------
  |  Branch (1069:5): [True: 49.1k, False: 753k]
  ------------------
 1070|   659k|    case M_APP2:
  ------------------
  |  Branch (1070:5): [True: 437, False: 801k]
  ------------------
 1071|   659k|    case M_APP3:
  ------------------
  |  Branch (1071:5): [True: 403, False: 801k]
  ------------------
 1072|   659k|    case M_APP4:
  ------------------
  |  Branch (1072:5): [True: 380, False: 801k]
  ------------------
 1073|   660k|    case M_APP5:
  ------------------
  |  Branch (1073:5): [True: 286, False: 801k]
  ------------------
 1074|   660k|    case M_APP6:
  ------------------
  |  Branch (1074:5): [True: 536, False: 801k]
  ------------------
 1075|   661k|    case M_APP7:
  ------------------
  |  Branch (1075:5): [True: 958, False: 801k]
  ------------------
 1076|   662k|    case M_APP8:
  ------------------
  |  Branch (1076:5): [True: 278, False: 801k]
  ------------------
 1077|   662k|    case M_APP9:
  ------------------
  |  Branch (1077:5): [True: 207, False: 801k]
  ------------------
 1078|   662k|    case M_APP10:
  ------------------
  |  Branch (1078:5): [True: 278, False: 801k]
  ------------------
 1079|   662k|    case M_APP11:
  ------------------
  |  Branch (1079:5): [True: 207, False: 801k]
  ------------------
 1080|   663k|    case M_APP12:
  ------------------
  |  Branch (1080:5): [True: 501, False: 801k]
  ------------------
 1081|   663k|    case M_APP13:
  ------------------
  |  Branch (1081:5): [True: 227, False: 801k]
  ------------------
 1082|   675k|    case M_APP14:
  ------------------
  |  Branch (1082:5): [True: 11.6k, False: 790k]
  ------------------
 1083|   675k|    case M_APP15:
  ------------------
  |  Branch (1083:5): [True: 228, False: 801k]
  ------------------
 1084|   675k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1084:11): [True: 0, False: 675k]
  ------------------
 1085|   675k|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1086|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1087|   675k|      break;
 1088|       |
 1089|   675k|    case M_COM:
  ------------------
  |  Branch (1089:5): [True: 778, False: 801k]
  ------------------
 1090|    778|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1090:11): [True: 0, False: 778]
  ------------------
 1091|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1092|    778|      break;
 1093|       |
 1094|    778|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1094:5): [True: 517, False: 801k]
  ------------------
 1095|    741|    case M_RST1:
  ------------------
  |  Branch (1095:5): [True: 224, False: 801k]
  ------------------
 1096|    940|    case M_RST2:
  ------------------
  |  Branch (1096:5): [True: 199, False: 802k]
  ------------------
 1097|  1.15k|    case M_RST3:
  ------------------
  |  Branch (1097:5): [True: 215, False: 801k]
  ------------------
 1098|  1.37k|    case M_RST4:
  ------------------
  |  Branch (1098:5): [True: 216, False: 801k]
  ------------------
 1099|  1.64k|    case M_RST5:
  ------------------
  |  Branch (1099:5): [True: 269, False: 801k]
  ------------------
 1100|  1.87k|    case M_RST6:
  ------------------
  |  Branch (1100:5): [True: 230, False: 801k]
  ------------------
 1101|  2.24k|    case M_RST7:
  ------------------
  |  Branch (1101:5): [True: 376, False: 801k]
  ------------------
 1102|  2.92k|    case M_TEM:
  ------------------
  |  Branch (1102:5): [True: 675, False: 801k]
  ------------------
 1103|  2.92k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  2.92k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.92k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.92k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1104|  2.92k|      break;
 1105|       |
 1106|    567|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1106:5): [True: 567, False: 801k]
  ------------------
 1107|    567|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1107:11): [True: 0, False: 567]
  ------------------
 1108|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1049|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1109|    567|      break;
 1110|       |
 1111|    567|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1111:5): [True: 308, False: 801k]
  ------------------
 1112|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1113|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1114|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1115|       |       * ought to change!
 1116|       |       */
 1117|    308|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|    308|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    308|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    308|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1118|    308|      break;
 1119|   802k|    }
 1120|       |    /* Successfully processed marker, so reset state variable */
 1121|   765k|    cinfo->unread_marker = 0;
 1122|   765k|  } /* end loop */
 1123|  36.7k|}
jdmarker.c:first_marker:
  946|  13.5k|{
  947|  13.5k|  int c, c2;
  948|  13.5k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  13.5k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  13.5k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  13.5k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  949|       |
  950|  13.5k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  13.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13.5k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  13.5k|            bytes_in_buffer--; \
  |  |  156|  13.5k|            V = *next_input_byte++; )
  ------------------
  951|  13.5k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  13.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 13.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  13.5k|            bytes_in_buffer--; \
  |  |  156|  13.5k|            V = *next_input_byte++; )
  ------------------
  952|  13.5k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (952:7): [True: 14, False: 13.4k]
  |  Branch (952:20): [True: 10, False: 13.4k]
  ------------------
  953|     24|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     24|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     24|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  954|       |
  955|  13.5k|  cinfo->unread_marker = c2;
  956|       |
  957|  13.5k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  13.5k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  13.5k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  958|  13.5k|  return TRUE;
  ------------------
  |  |  209|  13.5k|#define TRUE    1
  ------------------
  959|  13.5k|}
jdmarker.c:get_soi:
  204|  13.5k|{
  205|  13.5k|  int i;
  206|       |
  207|  13.5k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  13.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  13.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  13.5k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 78, False: 13.4k]
  ------------------
  210|     78|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|     78|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     78|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|   229k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   59|   229k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 215k, False: 13.5k]
  ------------------
  215|   215k|    cinfo->arith_dc_L[i] = 0;
  216|   215k|    cinfo->arith_dc_U[i] = 1;
  217|   215k|    cinfo->arith_ac_K[i] = 5;
  218|   215k|  }
  219|  13.5k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  13.5k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  13.5k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  206|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  13.5k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  206|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  13.5k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  13.5k|  cinfo->JFIF_minor_version = 1;
  229|  13.5k|  cinfo->density_unit = 0;
  230|  13.5k|  cinfo->X_density = 1;
  231|  13.5k|  cinfo->Y_density = 1;
  232|  13.5k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  206|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  13.5k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  13.5k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  209|  13.5k|#define TRUE    1
  ------------------
  236|       |
  237|  13.5k|  return TRUE;
  ------------------
  |  |  209|  13.5k|#define TRUE    1
  ------------------
  238|  13.5k|}
jdmarker.c:get_sof:
  245|  12.4k|{
  246|  12.4k|  JLONG length;
  247|  12.4k|  int c, ci;
  248|  12.4k|  jpeg_component_info *compptr;
  249|  12.4k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  12.4k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  12.4k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  12.4k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  12.4k|  cinfo->progressive_mode = is_prog;
  252|  12.4k|  cinfo->master->lossless = is_lossless;
  253|  12.4k|  cinfo->arith_code = is_arith;
  254|       |
  255|  12.4k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  12.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  25.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 25]
  |  |  |  |  |  Branch (279:38): [True: 25, False: 12.4k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 14]
  |  |  |  |  |  Branch (279:38): [True: 14, False: 12.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  12.4k|            bytes_in_buffer--; \
  |  |  164|  12.4k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  12.4k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  12.4k|            bytes_in_buffer--; \
  |  |  167|  12.4k|            V += *next_input_byte++; )
  ------------------
  256|       |
  257|  12.4k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  12.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  12.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 42]
  |  |  |  |  |  Branch (279:38): [True: 42, False: 12.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  12.4k|            bytes_in_buffer--; \
  |  |  156|  12.4k|            V = *next_input_byte++; )
  ------------------
  258|  12.4k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  12.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  25.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 20]
  |  |  |  |  |  Branch (279:38): [True: 20, False: 12.4k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 50]
  |  |  |  |  |  Branch (279:38): [True: 50, False: 12.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  12.4k|            bytes_in_buffer--; \
  |  |  164|  12.4k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  12.4k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  12.4k|            bytes_in_buffer--; \
  |  |  167|  12.4k|            V += *next_input_byte++; )
  ------------------
  259|  12.4k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  12.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  25.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 28]
  |  |  |  |  |  Branch (279:38): [True: 28, False: 12.4k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 57]
  |  |  |  |  |  Branch (279:38): [True: 57, False: 12.3k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  12.4k|            bytes_in_buffer--; \
  |  |  164|  12.4k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  12.4k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  12.4k|            bytes_in_buffer--; \
  |  |  167|  12.4k|            V += *next_input_byte++; )
  ------------------
  260|  12.4k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  12.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  12.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 30]
  |  |  |  |  |  Branch (279:38): [True: 30, False: 12.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  12.4k|            bytes_in_buffer--; \
  |  |  156|  12.4k|            V = *next_input_byte++; )
  ------------------
  261|       |
  262|  12.4k|  length -= 8;
  263|       |
  264|  12.4k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  12.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  12.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  12.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  12.4k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  12.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  265|  12.4k|           (int)cinfo->image_width, (int)cinfo->image_height,
  266|  12.4k|           cinfo->num_components);
  267|       |
  268|  12.4k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (268:7): [True: 63, False: 12.3k]
  ------------------
  269|     63|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|     63|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     63|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  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|  12.4k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (274:7): [True: 64, False: 12.3k]
  |  Branch (274:35): [True: 1, False: 12.3k]
  ------------------
  275|  12.4k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (275:7): [True: 3, False: 12.3k]
  ------------------
  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|  12.4k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (278:7): [True: 66, False: 12.3k]
  ------------------
  279|     66|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     66|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     66|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|       |
  281|  12.4k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (281:7): [True: 12.3k, False: 134]
  ------------------
  282|  12.3k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  283|  12.3k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  12.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  284|  12.3k|                         cinfo->num_components * sizeof(jpeg_component_info));
  285|       |
  286|  34.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (286:44): [True: 21.7k, False: 12.4k]
  ------------------
  287|  21.7k|       ci++, compptr++) {
  288|  21.7k|    compptr->component_index = ci;
  289|  21.7k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  21.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  24.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.04k]
  |  |  |  |  |  Branch (279:38): [True: 1.04k, False: 20.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  21.7k|            bytes_in_buffer--; \
  |  |  156|  21.7k|            V = *next_input_byte++; )
  ------------------
  290|  21.7k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  21.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  24.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.02k]
  |  |  |  |  |  Branch (279:38): [True: 1.02k, False: 20.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  21.7k|            bytes_in_buffer--; \
  |  |  156|  21.7k|            V = *next_input_byte++; )
  ------------------
  291|  21.7k|    compptr->h_samp_factor = (c >> 4) & 15;
  292|  21.7k|    compptr->v_samp_factor = (c     ) & 15;
  293|  21.7k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  21.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  24.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.04k]
  |  |  |  |  |  Branch (279:38): [True: 1.04k, False: 20.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  21.7k|            bytes_in_buffer--; \
  |  |  156|  21.7k|            V = *next_input_byte++; )
  ------------------
  294|       |
  295|  21.7k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  21.7k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  21.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  21.7k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  21.7k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  21.7k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  296|  21.7k|             compptr->component_id, compptr->h_samp_factor,
  297|  21.7k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  298|  21.7k|  }
  299|       |
  300|  12.4k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  209|  12.4k|#define TRUE    1
  ------------------
  301|       |
  302|  12.4k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  12.4k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  12.4k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  303|  12.4k|  return TRUE;
  ------------------
  |  |  209|  12.4k|#define TRUE    1
  ------------------
  304|  12.4k|}
jdmarker.c:get_sos:
  310|  30.0k|{
  311|  30.0k|  JLONG length;
  312|  30.0k|  int i, ci, n, c, cc, pi;
  313|  30.0k|  jpeg_component_info *compptr;
  314|  30.0k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  30.0k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  30.0k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  30.0k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  315|       |
  316|  30.0k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (316:7): [True: 14, False: 30.0k]
  ------------------
  317|     14|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  318|       |
  319|  30.0k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  30.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  60.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 16]
  |  |  |  |  |  Branch (279:38): [True: 16, False: 30.0k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 16]
  |  |  |  |  |  Branch (279:38): [True: 16, False: 30.0k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  30.0k|            bytes_in_buffer--; \
  |  |  164|  30.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  30.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  30.0k|            bytes_in_buffer--; \
  |  |  167|  30.0k|            V += *next_input_byte++; )
  ------------------
  320|       |
  321|  30.0k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  30.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  30.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 27]
  |  |  |  |  |  Branch (279:38): [True: 27, False: 29.9k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  30.0k|            bytes_in_buffer--; \
  |  |  156|  30.0k|            V = *next_input_byte++; )
  ------------------
  322|       |
  323|  30.0k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  30.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  30.0k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  30.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  324|       |
  325|  30.0k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   60|  29.9k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (325:7): [True: 99, False: 29.9k]
  |  Branch (325:32): [True: 3, False: 29.9k]
  |  Branch (325:41): [True: 10, False: 29.9k]
  ------------------
  326|     98|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     98|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     98|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  327|       |
  328|  30.0k|  cinfo->comps_in_scan = n;
  329|       |
  330|       |  /* Collect the component-spec parameters */
  331|       |
  332|   149k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   60|   149k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (332:15): [True: 119k, False: 30.0k]
  ------------------
  333|   119k|    cinfo->cur_comp_info[i] = NULL;
  334|       |
  335|  68.4k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (335:15): [True: 38.5k, False: 29.8k]
  ------------------
  336|  38.5k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  38.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  38.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 136]
  |  |  |  |  |  Branch (279:38): [True: 136, False: 38.4k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  38.5k|            bytes_in_buffer--; \
  |  |  156|  38.5k|            V = *next_input_byte++; )
  ------------------
  337|  38.5k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  38.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  39.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 221]
  |  |  |  |  |  Branch (279:38): [True: 221, False: 38.3k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  38.5k|            bytes_in_buffer--; \
  |  |  156|  38.5k|            V = *next_input_byte++; )
  ------------------
  338|       |
  339|  38.5k|    for (ci = 0, compptr = cinfo->comp_info;
  340|  60.2k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   60|  60.0k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (340:10): [True: 60.0k, False: 130]
  |  Branch (340:40): [True: 60.0k, False: 4]
  ------------------
  341|  60.0k|         ci++, compptr++) {
  342|  60.0k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (342:11): [True: 38.8k, False: 21.2k]
  |  Branch (342:42): [True: 38.4k, False: 369]
  ------------------
  343|  38.4k|        goto id_found;
  344|  60.0k|    }
  345|       |
  346|    134|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|    134|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    134|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    134|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  347|       |
  348|  38.4k|id_found:
  349|       |
  350|  38.4k|    cinfo->cur_comp_info[i] = compptr;
  351|  38.4k|    compptr->dc_tbl_no = (c >> 4) & 15;
  352|  38.4k|    compptr->ac_tbl_no = (c     ) & 15;
  353|       |
  354|  38.4k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  38.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  38.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  38.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  38.4k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  38.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  355|  38.4k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  356|       |
  357|       |    /* This CSi (cc) should differ from the previous CSi */
  358|  50.9k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (358:18): [True: 12.4k, False: 38.4k]
  ------------------
  359|  12.4k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (359:11): [True: 5, False: 12.4k]
  ------------------
  360|      5|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|      5|      }
  362|  12.4k|    }
  363|  38.4k|  }
  364|       |
  365|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  366|  29.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  29.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  30.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 159]
  |  |  |  |  |  Branch (279:38): [True: 159, False: 29.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  29.8k|            bytes_in_buffer--; \
  |  |  156|  29.8k|            V = *next_input_byte++; )
  ------------------
  367|  29.8k|  cinfo->Ss = c;
  368|  29.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  29.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  30.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 209]
  |  |  |  |  |  Branch (279:38): [True: 209, False: 29.6k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  29.8k|            bytes_in_buffer--; \
  |  |  156|  29.8k|            V = *next_input_byte++; )
  ------------------
  369|  29.8k|  cinfo->Se = c;
  370|  29.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  29.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  30.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 208]
  |  |  |  |  |  Branch (279:38): [True: 208, False: 29.6k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  29.8k|            bytes_in_buffer--; \
  |  |  156|  29.8k|            V = *next_input_byte++; )
  ------------------
  371|  29.8k|  cinfo->Ah = (c >> 4) & 15;
  372|  29.8k|  cinfo->Al = (c     ) & 15;
  373|       |
  374|  29.8k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  29.8k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  29.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  29.8k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  29.8k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  29.8k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  375|  29.8k|           cinfo->Ah, cinfo->Al);
  376|       |
  377|       |  /* Prepare to scan data & restart markers */
  378|  29.8k|  cinfo->marker->next_restart_num = 0;
  379|       |
  380|       |  /* Count another SOS marker */
  381|  29.8k|  cinfo->input_scan_number++;
  382|       |
  383|  29.8k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  29.8k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  29.8k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  384|  29.8k|  return TRUE;
  ------------------
  |  |  209|  29.8k|#define TRUE    1
  ------------------
  385|  29.8k|}
jdmarker.c:get_dac:
  393|    610|{
  394|    610|  JLONG length;
  395|    610|  int index, val;
  396|    610|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    610|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    610|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    610|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  397|       |
  398|    610|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    610|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 8]
  |  |  |  |  |  Branch (279:38): [True: 8, False: 602]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:38): [True: 13, False: 597]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    610|            bytes_in_buffer--; \
  |  |  164|    610|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    610|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    610|            bytes_in_buffer--; \
  |  |  167|    610|            V += *next_input_byte++; )
  ------------------
  399|    610|  length -= 2;
  400|       |
  401|  1.88k|  while (length > 0) {
  ------------------
  |  Branch (401:10): [True: 1.27k, False: 610]
  ------------------
  402|  1.27k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  1.27k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.34k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 22]
  |  |  |  |  |  Branch (279:38): [True: 22, False: 1.25k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.27k|            bytes_in_buffer--; \
  |  |  156|  1.27k|            V = *next_input_byte++; )
  ------------------
  403|  1.27k|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|  1.27k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.54k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 91]
  |  |  |  |  |  Branch (279:38): [True: 91, False: 1.18k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  1.27k|            bytes_in_buffer--; \
  |  |  156|  1.27k|            V = *next_input_byte++; )
  ------------------
  404|       |
  405|  1.27k|    length -= 2;
  406|       |
  407|  1.27k|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|  1.27k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.27k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.27k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.27k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  408|       |
  409|  1.27k|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   59|  1.27k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (409:9): [True: 0, False: 1.27k]
  |  Branch (409:22): [True: 111, False: 1.16k]
  ------------------
  410|    111|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|    111|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    111|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    111|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  411|       |
  412|  1.27k|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   59|  1.27k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (412:9): [True: 543, False: 732]
  ------------------
  413|    543|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   59|    543|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  414|    732|    } else {                    /* define DC table */
  415|    732|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  416|    732|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  417|    732|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (417:11): [True: 9, False: 723]
  ------------------
  418|      9|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      9|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  419|    732|    }
  420|  1.27k|  }
  421|       |
  422|    610|  if (length != 0)
  ------------------
  |  Branch (422:7): [True: 7, False: 603]
  ------------------
  423|      7|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  424|       |
  425|    610|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    610|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    610|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  426|    610|  return TRUE;
  ------------------
  |  |  209|    610|#define TRUE    1
  ------------------
  427|    610|}
jdmarker.c:get_dht:
  439|  4.18k|{
  440|  4.18k|  JLONG length;
  441|  4.18k|  UINT8 bits[17];
  442|  4.18k|  UINT8 huffval[256];
  443|  4.18k|  int i, index, count;
  444|  4.18k|  JHUFF_TBL **htblptr;
  445|  4.18k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  4.18k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  4.18k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  4.18k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  446|       |
  447|  4.18k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  4.18k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  8.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 9]
  |  |  |  |  |  Branch (279:38): [True: 9, False: 4.17k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:38): [True: 13, False: 4.17k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  4.18k|            bytes_in_buffer--; \
  |  |  164|  4.18k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  4.18k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  4.18k|            bytes_in_buffer--; \
  |  |  167|  4.18k|            V += *next_input_byte++; )
  ------------------
  448|  4.18k|  length -= 2;
  449|       |
  450|  9.65k|  while (length > 16) {
  ------------------
  |  Branch (450:10): [True: 5.46k, False: 4.18k]
  ------------------
  451|  5.46k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  5.46k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.56k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 33]
  |  |  |  |  |  Branch (279:38): [True: 33, False: 5.43k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.46k|            bytes_in_buffer--; \
  |  |  156|  5.46k|            V = *next_input_byte++; )
  ------------------
  452|       |
  453|  5.46k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  5.46k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  5.46k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  5.46k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  454|       |
  455|  5.46k|    bits[0] = 0;
  456|  5.46k|    count = 0;
  457|  92.9k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (457:17): [True: 87.4k, False: 5.46k]
  ------------------
  458|  87.4k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  87.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  89.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 841]
  |  |  |  |  |  Branch (279:38): [True: 841, False: 86.6k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  87.4k|            bytes_in_buffer--; \
  |  |  156|  87.4k|            V = *next_input_byte++; )
  ------------------
  459|  87.4k|      count += bits[i];
  460|  87.4k|    }
  461|       |
  462|  5.46k|    length -= 1 + 16;
  463|       |
  464|  5.46k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  5.46k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.46k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  5.46k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  5.46k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  5.46k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  5.46k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  465|  5.46k|             bits[1], bits[2], bits[3], bits[4],
  466|  5.46k|             bits[5], bits[6], bits[7], bits[8]);
  467|  5.46k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  5.46k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.46k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  5.46k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  5.46k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  5.46k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  5.46k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  468|  5.46k|             bits[9], bits[10], bits[11], bits[12],
  469|  5.46k|             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|  5.46k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (474:9): [True: 275, False: 5.19k]
  |  Branch (474:24): [True: 20, False: 5.17k]
  ------------------
  475|    295|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    295|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    295|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  476|       |
  477|  66.1k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (477:17): [True: 60.6k, False: 5.46k]
  ------------------
  478|  60.6k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|  60.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  83.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 7.47k]
  |  |  |  |  |  Branch (279:38): [True: 7.47k, False: 53.1k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.46k|            bytes_in_buffer--; \
  |  |  156|  5.46k|            V = *next_input_byte++; )
  ------------------
  479|       |
  480|  5.46k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  481|       |
  482|  5.46k|    length -= count;
  483|       |
  484|  5.46k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (484:9): [True: 2.83k, False: 2.63k]
  ------------------
  485|  2.83k|      index -= 0x10;
  486|  2.83k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|  2.83k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (486:11): [True: 0, False: 2.83k]
  |  Branch (486:24): [True: 19, False: 2.81k]
  ------------------
  487|     19|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     19|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     19|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  488|  2.83k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  489|  2.83k|    } else {                    /* DC table definition */
  490|  2.63k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   58|  2.33k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (490:11): [True: 295, False: 2.33k]
  |  Branch (490:24): [True: 32, False: 2.30k]
  ------------------
  491|     32|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     32|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     32|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     32|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  492|  2.63k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  493|  2.63k|    }
  494|       |
  495|  5.46k|    if (*htblptr == NULL)
  ------------------
  |  Branch (495:9): [True: 1.04k, False: 4.42k]
  ------------------
  496|  1.04k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  497|       |
  498|  5.46k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  499|  5.46k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  500|  5.46k|  }
  501|       |
  502|  4.18k|  if (length != 0)
  ------------------
  |  Branch (502:7): [True: 52, False: 4.13k]
  ------------------
  503|     52|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     52|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     52|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  504|       |
  505|  4.18k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  4.18k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  4.18k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  506|  4.18k|  return TRUE;
  ------------------
  |  |  209|  4.18k|#define TRUE    1
  ------------------
  507|  4.18k|}
jdmarker.c:get_dqt:
  513|  12.2k|{
  514|  12.2k|  JLONG length;
  515|  12.2k|  int n, i, prec;
  516|  12.2k|  unsigned int tmp;
  517|  12.2k|  JQUANT_TBL *quant_ptr;
  518|  12.2k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  12.2k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  12.2k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  12.2k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  519|       |
  520|  12.2k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  12.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  24.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 10]
  |  |  |  |  |  Branch (279:38): [True: 10, False: 12.2k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 18]
  |  |  |  |  |  Branch (279:38): [True: 18, False: 12.2k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  12.2k|            bytes_in_buffer--; \
  |  |  164|  12.2k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  12.2k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  12.2k|            bytes_in_buffer--; \
  |  |  167|  12.2k|            V += *next_input_byte++; )
  ------------------
  521|  12.2k|  length -= 2;
  522|       |
  523|  25.8k|  while (length > 0) {
  ------------------
  |  Branch (523:10): [True: 13.6k, False: 12.2k]
  ------------------
  524|  13.6k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  13.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 71]
  |  |  |  |  |  Branch (279:38): [True: 71, False: 13.5k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  13.6k|            bytes_in_buffer--; \
  |  |  156|  13.6k|            V = *next_input_byte++; )
  ------------------
  525|  13.6k|    prec = n >> 4;
  526|  13.6k|    n &= 0x0F;
  527|       |
  528|  13.6k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  13.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  13.6k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  13.6k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  13.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  529|       |
  530|  13.6k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   57|  13.6k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (530:9): [True: 121, False: 13.4k]
  ------------------
  531|    121|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|    121|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    121|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    121|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  532|       |
  533|  13.6k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (533:9): [True: 4.07k, False: 9.53k]
  ------------------
  534|  4.07k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  535|  13.6k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  536|       |
  537|   876k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   56|   876k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (537:17): [True: 863k, False: 13.6k]
  ------------------
  538|   863k|      if (prec)
  ------------------
  |  Branch (538:11): [True: 25.2k, False: 837k]
  ------------------
  539|   863k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  25.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  66.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.95k]
  |  |  |  |  |  Branch (279:38): [True: 3.95k, False: 21.3k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.41k]
  |  |  |  |  |  Branch (279:38): [True: 1.41k, False: 23.8k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   863k|            bytes_in_buffer--; \
  |  |  164|   863k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   863k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   863k|            bytes_in_buffer--; \
  |  |  167|   863k|            V += *next_input_byte++; )
  ------------------
  540|   837k|      else
  541|   863k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|   837k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   845k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.58k]
  |  |  |  |  |  Branch (279:38): [True: 2.58k, False: 835k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   863k|            bytes_in_buffer--; \
  |  |  156|   863k|            V = *next_input_byte++; )
  ------------------
  542|       |      /* We convert the zigzag-order table to natural array order. */
  543|   863k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  544|   863k|    }
  545|       |
  546|  13.6k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (546:9): [True: 0, False: 13.6k]
  ------------------
  547|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   56|      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 - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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|  13.6k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   56|  13.6k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  557|  13.6k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   56|    395|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (557:9): [True: 395, False: 13.2k]
  ------------------
  558|  13.6k|  }
  559|       |
  560|  12.2k|  if (length != 0)
  ------------------
  |  Branch (560:7): [True: 41, False: 12.2k]
  ------------------
  561|     41|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     41|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     41|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  562|       |
  563|  12.2k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  12.2k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  12.2k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  564|  12.2k|  return TRUE;
  ------------------
  |  |  209|  12.2k|#define TRUE    1
  ------------------
  565|  12.2k|}
jdmarker.c:get_dri:
  571|  43.7k|{
  572|  43.7k|  JLONG length;
  573|  43.7k|  unsigned int tmp;
  574|  43.7k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  43.7k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  43.7k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  43.7k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  575|       |
  576|  43.7k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  43.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  87.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 7]
  |  |  |  |  |  Branch (279:38): [True: 7, False: 43.7k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13]
  |  |  |  |  |  Branch (279:38): [True: 13, False: 43.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  43.7k|            bytes_in_buffer--; \
  |  |  164|  43.7k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  43.7k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  43.7k|            bytes_in_buffer--; \
  |  |  167|  43.7k|            V += *next_input_byte++; )
  ------------------
  577|       |
  578|  43.7k|  if (length != 4)
  ------------------
  |  Branch (578:7): [True: 36, False: 43.7k]
  ------------------
  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|  43.7k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  43.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  87.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 43.7k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 8]
  |  |  |  |  |  Branch (279:38): [True: 8, False: 43.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  43.7k|            bytes_in_buffer--; \
  |  |  164|  43.7k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  43.7k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  43.7k|            bytes_in_buffer--; \
  |  |  167|  43.7k|            V += *next_input_byte++; )
  ------------------
  582|       |
  583|  43.7k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|  43.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  43.7k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  43.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  584|       |
  585|  43.7k|  cinfo->restart_interval = tmp;
  586|       |
  587|  43.7k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  43.7k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  43.7k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  588|  43.7k|  return TRUE;
  ------------------
  |  |  209|  43.7k|#define TRUE    1
  ------------------
  589|  43.7k|}
jdmarker.c:read_restart_marker:
 1140|  18.0M|{
 1141|       |  /* Obtain a marker unless we already did. */
 1142|       |  /* Note that next_marker will complain if it skips any data. */
 1143|  18.0M|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1143:7): [True: 1.64k, False: 18.0M]
  ------------------
 1144|  1.64k|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1144:9): [True: 0, False: 1.64k]
  ------------------
 1145|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1146|  1.64k|  }
 1147|       |
 1148|  18.0M|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1148:7): [True: 4.46k, False: 18.0M]
  ------------------
 1149|  18.0M|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1150|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1151|  4.46k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  4.46k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  4.46k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  4.46k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1152|  4.46k|    cinfo->unread_marker = 0;
 1153|  18.0M|  } else {
 1154|       |    /* Uh-oh, the restart markers have been messed up. */
 1155|       |    /* Let the data source manager determine how to resync. */
 1156|  18.0M|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1156:9): [True: 0, False: 18.0M]
  ------------------
 1157|  18.0M|                                           cinfo->marker->next_restart_num))
 1158|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1159|  18.0M|  }
 1160|       |
 1161|       |  /* Update next-restart state */
 1162|  18.0M|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1163|       |
 1164|  18.0M|  return TRUE;
  ------------------
  |  |  209|  18.0M|#define TRUE    1
  ------------------
 1165|  18.0M|}
jdmarker.c:skip_variable:
  865|  39.7k|{
  866|  39.7k|  JLONG length;
  867|  39.7k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  39.7k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  39.7k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  39.7k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  868|       |
  869|  39.7k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  39.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  80.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 113]
  |  |  |  |  |  Branch (279:38): [True: 113, False: 39.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 44]
  |  |  |  |  |  Branch (279:38): [True: 44, False: 39.7k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  39.7k|            bytes_in_buffer--; \
  |  |  164|  39.7k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  39.7k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  39.7k|            bytes_in_buffer--; \
  |  |  167|  39.7k|            V += *next_input_byte++; )
  ------------------
  870|  39.7k|  length -= 2;
  871|       |
  872|  39.7k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  39.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  39.7k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  39.7k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  39.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  873|       |
  874|  39.7k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  39.7k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  39.7k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  875|  39.7k|  if (length > 0)
  ------------------
  |  Branch (875:7): [True: 25.7k, False: 14.0k]
  ------------------
  876|  25.7k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  877|       |
  878|  39.7k|  return TRUE;
  ------------------
  |  |  209|  39.7k|#define TRUE    1
  ------------------
  879|  39.7k|}
jdmarker.c:get_interesting_appn:
  711|   307k|{
  712|   307k|  JLONG length;
  713|   307k|  JOCTET b[APPN_DATA_LEN];
  714|   307k|  unsigned int i, numtoread;
  715|   307k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   307k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   307k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   307k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  716|       |
  717|   307k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   307k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   615k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 45]
  |  |  |  |  |  Branch (279:38): [True: 45, False: 307k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 20]
  |  |  |  |  |  Branch (279:38): [True: 20, False: 307k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   307k|            bytes_in_buffer--; \
  |  |  164|   307k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   307k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   307k|            bytes_in_buffer--; \
  |  |  167|   307k|            V += *next_input_byte++; )
  ------------------
  718|   307k|  length -= 2;
  719|       |
  720|       |  /* get the interesting part of the marker data */
  721|   307k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  601|   307k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (721:7): [True: 300k, False: 7.32k]
  ------------------
  722|   300k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  601|   300k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  723|  7.32k|  else if (length > 0)
  ------------------
  |  Branch (723:12): [True: 3.60k, False: 3.71k]
  ------------------
  724|  3.60k|    numtoread = (unsigned int)length;
  725|  3.71k|  else
  726|  3.71k|    numtoread = 0;
  727|  4.53M|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (727:15): [True: 4.23M, False: 307k]
  ------------------
  728|  4.23M|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  4.23M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.53M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.93k]
  |  |  |  |  |  Branch (279:38): [True: 1.93k, False: 4.22M]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   307k|            bytes_in_buffer--; \
  |  |  156|   307k|            V = *next_input_byte++; )
  ------------------
  729|   307k|  length -= numtoread;
  730|       |
  731|       |  /* process it */
  732|   307k|  switch (cinfo->unread_marker) {
  733|   302k|  case M_APP0:
  ------------------
  |  Branch (733:3): [True: 302k, False: 5.19k]
  ------------------
  734|   302k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  735|   302k|    break;
  736|  5.19k|  case M_APP14:
  ------------------
  |  Branch (736:3): [True: 5.19k, False: 302k]
  ------------------
  737|  5.19k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  738|  5.19k|    break;
  739|      0|  default:
  ------------------
  |  Branch (739:3): [True: 0, False: 307k]
  ------------------
  740|       |    /* can't get here unless jpeg_save_markers chooses wrong processor */
  741|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  742|      0|    break;
  743|   307k|  }
  744|       |
  745|       |  /* skip any remaining data -- could be lots */
  746|   307k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   307k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   307k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  747|   307k|  if (length > 0)
  ------------------
  |  Branch (747:7): [True: 2.90k, False: 304k]
  ------------------
  748|  2.90k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  749|       |
  750|   307k|  return TRUE;
  ------------------
  |  |  209|   307k|#define TRUE    1
  ------------------
  751|   307k|}
jdmarker.c:examine_app0:
  611|   609k|{
  612|   609k|  JLONG totallen = (JLONG)datalen + remaining;
  613|       |
  614|   609k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  599|  1.21M|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (614:7): [True: 599k, False: 10.0k]
  ------------------
  615|   609k|      data[0] == 0x4A &&
  ------------------
  |  Branch (615:7): [True: 587k, False: 12.2k]
  ------------------
  616|   609k|      data[1] == 0x46 &&
  ------------------
  |  Branch (616:7): [True: 562k, False: 24.6k]
  ------------------
  617|   609k|      data[2] == 0x49 &&
  ------------------
  |  Branch (617:7): [True: 3.52k, False: 559k]
  ------------------
  618|   609k|      data[3] == 0x46 &&
  ------------------
  |  Branch (618:7): [True: 2.75k, False: 771]
  ------------------
  619|   609k|      data[4] == 0) {
  ------------------
  |  Branch (619:7): [True: 1.45k, False: 1.29k]
  ------------------
  620|       |    /* Found JFIF APP0 marker: save info */
  621|  1.45k|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  209|  1.45k|#define TRUE    1
  ------------------
  622|  1.45k|    cinfo->JFIF_major_version = data[5];
  623|  1.45k|    cinfo->JFIF_minor_version = data[6];
  624|  1.45k|    cinfo->density_unit = data[7];
  625|  1.45k|    cinfo->X_density = (data[8] << 8) + data[9];
  626|  1.45k|    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.45k|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (633:9): [True: 904, False: 555]
  ------------------
  634|    904|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|    904|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    904|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    904|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    904|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  635|  1.45k|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  636|       |    /* Generate trace messages */
  637|  1.45k|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|  1.45k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.45k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  1.45k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|  1.45k|           _mp[4] = (p5); \
  |  |  322|  1.45k|           (cinfo)->err->msg_code = (code); \
  |  |  323|  1.45k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  638|  1.45k|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  639|  1.45k|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  640|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  641|  1.45k|    if (data[12] | data[13])
  ------------------
  |  Branch (641:9): [True: 851, False: 608]
  ------------------
  642|    851|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    851|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    851|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    851|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    851|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  643|  1.45k|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  599|  1.45k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  644|  1.45k|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (644:9): [True: 744, False: 715]
  ------------------
  645|    744|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    744|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    744|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    744|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  646|   608k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (646:14): [True: 601k, False: 6.72k]
  ------------------
  647|   608k|             data[0] == 0x4A &&
  ------------------
  |  Branch (647:14): [True: 588k, False: 13.3k]
  ------------------
  648|   608k|             data[1] == 0x46 &&
  ------------------
  |  Branch (648:14): [True: 562k, False: 25.2k]
  ------------------
  649|   608k|             data[2] == 0x58 &&
  ------------------
  |  Branch (649:14): [True: 534k, False: 28.7k]
  ------------------
  650|   608k|             data[3] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 2.47k, False: 531k]
  ------------------
  651|   608k|             data[4] == 0) {
  ------------------
  |  Branch (651:14): [True: 1.93k, False: 536]
  ------------------
  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|  1.93k|    switch (data[5]) {
  657|    233|    case 0x10:
  ------------------
  |  Branch (657:5): [True: 233, False: 1.70k]
  ------------------
  658|    233|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|    233|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    233|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    233|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  659|    233|      break;
  660|    585|    case 0x11:
  ------------------
  |  Branch (660:5): [True: 585, False: 1.35k]
  ------------------
  661|    585|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|    585|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    585|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    585|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  662|    585|      break;
  663|    294|    case 0x13:
  ------------------
  |  Branch (663:5): [True: 294, False: 1.64k]
  ------------------
  664|    294|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|    294|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    294|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    294|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  665|    294|      break;
  666|    825|    default:
  ------------------
  |  Branch (666:5): [True: 825, False: 1.11k]
  ------------------
  667|    825|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|    825|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    825|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    825|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    825|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  668|    825|      break;
  669|  1.93k|    }
  670|   606k|  } else {
  671|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  672|   606k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|   606k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   606k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   606k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  673|   606k|  }
  674|   609k|}
jdmarker.c:examine_app14:
  684|  11.6k|{
  685|  11.6k|  unsigned int version, flags0, flags1, transform;
  686|       |
  687|  11.6k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  600|  23.2k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (687:7): [True: 10.2k, False: 1.32k]
  ------------------
  688|  11.6k|      data[0] == 0x41 &&
  ------------------
  |  Branch (688:7): [True: 5.63k, False: 4.65k]
  ------------------
  689|  11.6k|      data[1] == 0x64 &&
  ------------------
  |  Branch (689:7): [True: 5.05k, False: 576]
  ------------------
  690|  11.6k|      data[2] == 0x6F &&
  ------------------
  |  Branch (690:7): [True: 3.67k, False: 1.38k]
  ------------------
  691|  11.6k|      data[3] == 0x62 &&
  ------------------
  |  Branch (691:7): [True: 2.98k, False: 695]
  ------------------
  692|  11.6k|      data[4] == 0x65) {
  ------------------
  |  Branch (692:7): [True: 1.14k, False: 1.83k]
  ------------------
  693|       |    /* Found Adobe APP14 marker */
  694|  1.14k|    version = (data[5] << 8) + data[6];
  695|  1.14k|    flags0 = (data[7] << 8) + data[8];
  696|  1.14k|    flags1 = (data[9] << 8) + data[10];
  697|  1.14k|    transform = data[11];
  698|  1.14k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|  1.14k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  1.14k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  1.14k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  1.14k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  699|  1.14k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  209|  1.14k|#define TRUE    1
  ------------------
  700|  1.14k|    cinfo->Adobe_transform = (UINT8)transform;
  701|  10.4k|  } else {
  702|       |    /* Start of APP14 does not match "Adobe", or too short */
  703|  10.4k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  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)))
  ------------------
  704|  10.4k|  }
  705|  11.6k|}
jdmarker.c:save_marker:
  759|   329k|{
  760|   329k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  761|   329k|  jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
  762|   329k|  unsigned int bytes_read, data_length;
  763|   329k|  JOCTET *data;
  764|   329k|  JLONG length = 0;
  765|   329k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   329k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   329k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   329k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  766|       |
  767|   329k|  if (cur_marker == NULL) {
  ------------------
  |  Branch (767:7): [True: 329k, False: 0]
  ------------------
  768|       |    /* begin reading a marker */
  769|   329k|    INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   329k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   659k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 42]
  |  |  |  |  |  Branch (279:38): [True: 42, False: 329k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 27]
  |  |  |  |  |  Branch (279:38): [True: 27, False: 329k]
  |  |  |  |  |  Branch (279:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   329k|            bytes_in_buffer--; \
  |  |  164|   329k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   329k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   329k|            bytes_in_buffer--; \
  |  |  167|   329k|            V += *next_input_byte++; )
  ------------------
  770|   329k|    length -= 2;
  771|   329k|    if (length >= 0) {          /* watch out for bogus length word */
  ------------------
  |  Branch (771:9): [True: 325k, False: 3.52k]
  ------------------
  772|       |      /* figure out how much we want to save */
  773|   325k|      unsigned int limit;
  774|   325k|      if (cinfo->unread_marker == (int)M_COM)
  ------------------
  |  Branch (774:11): [True: 381, False: 325k]
  ------------------
  775|    381|        limit = marker->length_limit_COM;
  776|   325k|      else
  777|   325k|        limit = marker->length_limit_APPn[cinfo->unread_marker - (int)M_APP0];
  778|   325k|      if ((unsigned int)length < limit)
  ------------------
  |  Branch (778:11): [True: 325k, False: 0]
  ------------------
  779|   325k|        limit = (unsigned int)length;
  780|       |      /* allocate and initialize the marker item */
  781|   325k|      cur_marker = (jpeg_saved_marker_ptr)
  782|   325k|        (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|   325k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|   325k|                                    sizeof(struct jpeg_marker_struct) + limit);
  784|   325k|      cur_marker->next = NULL;
  785|   325k|      cur_marker->marker = (UINT8)cinfo->unread_marker;
  786|   325k|      cur_marker->original_length = (unsigned int)length;
  787|   325k|      cur_marker->data_length = limit;
  788|       |      /* data area is just beyond the jpeg_marker_struct */
  789|   325k|      data = cur_marker->data = (JOCTET *)(cur_marker + 1);
  790|   325k|      marker->cur_marker = cur_marker;
  791|   325k|      marker->bytes_read = 0;
  792|   325k|      bytes_read = 0;
  793|   325k|      data_length = limit;
  794|   325k|    } else {
  795|       |      /* deal with bogus length word */
  796|  3.52k|      bytes_read = data_length = 0;
  797|  3.52k|      data = NULL;
  798|  3.52k|    }
  799|   329k|  } 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|  5.88M|  while (bytes_read < data_length) {
  ------------------
  |  Branch (806:10): [True: 5.55M, False: 329k]
  ------------------
  807|  5.55M|    INPUT_SYNC(cinfo);          /* move the restart point to here */
  ------------------
  |  |  131|  5.55M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  5.55M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  808|  5.55M|    marker->bytes_read = bytes_read;
  809|       |    /* If there's not at least one byte in buffer, suspend */
  810|  5.55M|    MAKE_BYTE_AVAIL(cinfo, return FALSE);
  ------------------
  |  |  144|  5.55M|  if (bytes_in_buffer == 0) { \
  |  |  ------------------
  |  |  |  Branch (144:7): [True: 5.23M, False: 315k]
  |  |  ------------------
  |  |  145|  5.23M|    if (!(*datasrc->fill_input_buffer) (cinfo)) \
  |  |  ------------------
  |  |  |  Branch (145:9): [True: 0, False: 5.23M]
  |  |  ------------------
  |  |  146|  5.23M|      { action; } \
  |  |  147|  5.23M|    INPUT_RELOAD(cinfo); \
  |  |  ------------------
  |  |  |  |  136|  5.23M|  ( next_input_byte = datasrc->next_input_byte, \
  |  |  |  |  137|  5.23M|    bytes_in_buffer = datasrc->bytes_in_buffer )
  |  |  ------------------
  |  |  148|  5.23M|  }
  ------------------
  811|       |    /* Copy bytes with reasonable rapidity */
  812|  26.0M|    while (bytes_read < data_length && bytes_in_buffer > 0) {
  ------------------
  |  Branch (812:12): [True: 25.7M, False: 315k]
  |  Branch (812:40): [True: 20.4M, False: 5.23M]
  ------------------
  813|  20.4M|      *data++ = *next_input_byte++;
  814|  20.4M|      bytes_in_buffer--;
  815|  20.4M|      bytes_read++;
  816|  20.4M|    }
  817|  5.55M|  }
  818|       |
  819|       |  /* Done reading what we want to read */
  820|   329k|  if (cur_marker != NULL) {     /* will be NULL if bogus length word */
  ------------------
  |  Branch (820:7): [True: 325k, False: 3.52k]
  ------------------
  821|       |    /* Add new marker to end of list */
  822|   325k|    if (cinfo->marker_list == NULL) {
  ------------------
  |  Branch (822:9): [True: 674, False: 325k]
  ------------------
  823|    674|      cinfo->marker_list = cur_marker;
  824|   325k|    } else {
  825|   325k|      jpeg_saved_marker_ptr prev = cinfo->marker_list;
  826|  2.11G|      while (prev->next != NULL)
  ------------------
  |  Branch (826:14): [True: 2.11G, False: 325k]
  ------------------
  827|  2.11G|        prev = prev->next;
  828|   325k|      prev->next = cur_marker;
  829|   325k|    }
  830|       |    /* Reset pointer & calc remaining data length */
  831|   325k|    data = cur_marker->data;
  832|   325k|    length = cur_marker->original_length - data_length;
  833|   325k|  }
  834|       |  /* Reset to initial state for next marker */
  835|   329k|  marker->cur_marker = NULL;
  836|       |
  837|       |  /* Process the marker if interesting; else just make a generic trace msg */
  838|   329k|  switch (cinfo->unread_marker) {
  839|   307k|  case M_APP0:
  ------------------
  |  Branch (839:3): [True: 307k, False: 22.0k]
  ------------------
  840|   307k|    examine_app0(cinfo, data, data_length, length);
  841|   307k|    break;
  842|  6.42k|  case M_APP14:
  ------------------
  |  Branch (842:3): [True: 6.42k, False: 322k]
  ------------------
  843|  6.42k|    examine_app14(cinfo, data, data_length, length);
  844|  6.42k|    break;
  845|  15.6k|  default:
  ------------------
  |  Branch (845:3): [True: 15.6k, False: 313k]
  ------------------
  846|  15.6k|    TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
  ------------------
  |  |  304|  15.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  15.6k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  15.6k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  15.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  847|  15.6k|             (int)(data_length + length));
  848|  15.6k|    break;
  849|   329k|  }
  850|       |
  851|       |  /* skip any remaining data -- could be lots */
  852|   329k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|   329k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   329k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  853|   329k|  if (length > 0)
  ------------------
  |  Branch (853:7): [True: 0, False: 329k]
  ------------------
  854|      0|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  855|       |
  856|   329k|  return TRUE;
  ------------------
  |  |  209|   329k|#define TRUE    1
  ------------------
  857|   329k|}

jinit_phuff_decoder:
  654|  1.41k|{
  655|  1.41k|  phuff_entropy_ptr entropy;
  656|  1.41k|  int *coef_bit_ptr;
  657|  1.41k|  int ci, i;
  658|       |
  659|  1.41k|  entropy = (phuff_entropy_ptr)
  660|  1.41k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  1.41k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|  1.41k|                                sizeof(phuff_entropy_decoder));
  662|  1.41k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|  1.41k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  7.07k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   58|  7.07k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 5.66k, False: 1.41k]
  ------------------
  667|  5.66k|    entropy->derived_tbls[i] = NULL;
  668|  5.66k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|  1.41k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|  1.41k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  1.41k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|  1.41k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   56|  1.41k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|  1.41k|                                sizeof(int));
  675|  1.41k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  3.41k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 1.99k, False: 1.41k]
  ------------------
  677|   129k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   56|   129k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 127k, False: 1.99k]
  ------------------
  678|   127k|      *coef_bit_ptr++ = -1;
  679|  1.41k|}
jdphuff.c:start_pass_phuff_decoder:
   83|  4.51k|{
   84|  4.51k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  4.51k|  boolean is_DC_band, bad;
   86|  4.51k|  int ci, coefi, tbl;
   87|  4.51k|  d_derived_tbl **pdtbl;
   88|  4.51k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  4.51k|  jpeg_component_info *compptr;
   90|       |
   91|  4.51k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  4.51k|  bad = FALSE;
  ------------------
  |  |  206|  4.51k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  4.51k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 2.10k, False: 2.41k]
  ------------------
   96|  2.10k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 5, False: 2.09k]
  ------------------
   97|      5|      bad = TRUE;
  ------------------
  |  |  209|      5|#define TRUE    1
  ------------------
   98|  2.41k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  2.41k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   56|  2.39k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 22, False: 2.39k]
  |  Branch (100:34): [True: 19, False: 2.37k]
  ------------------
  101|     41|      bad = TRUE;
  ------------------
  |  |  209|     41|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  2.41k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 13, False: 2.40k]
  ------------------
  104|     13|      bad = TRUE;
  ------------------
  |  |  209|     13|#define TRUE    1
  ------------------
  105|  2.41k|  }
  106|  4.51k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 2.35k, False: 2.16k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|  2.35k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 43, False: 2.31k]
  ------------------
  109|     43|      bad = TRUE;
  ------------------
  |  |  209|     43|#define TRUE    1
  ------------------
  110|  2.35k|  }
  111|  4.51k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 18, False: 4.49k]
  ------------------
  112|     18|    bad = TRUE;
  ------------------
  |  |  209|     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|  4.51k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 58, False: 4.45k]
  ------------------
  120|     58|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     58|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     58|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     58|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     58|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     58|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     58|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  4.51k|             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|  11.4k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 6.93k, False: 4.51k]
  ------------------
  127|  6.93k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  6.93k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  6.93k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  6.93k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 2.36k, False: 4.56k]
  |  Branch (130:24): [True: 1.76k, False: 595]
  ------------------
  131|  1.76k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  1.76k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  1.76k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  1.76k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  1.76k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   141k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  448|  6.93k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (448:26): [True: 4.56k, False: 2.36k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  446|   141k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (446:26): [True: 89.8k, False: 51.2k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 134k, False: 6.93k]
  ------------------
  133|   134k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 96.9k, False: 37.1k]
  ------------------
  134|  96.9k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|  37.1k|      else
  136|  37.1k|        prev_coef_bit_ptr[coefi] = 0;
  137|   134k|    }
  138|  80.5k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 73.5k, False: 6.93k]
  ------------------
  139|  73.5k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 26.6k, False: 46.9k]
  ------------------
  140|  73.5k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 49.3k, False: 24.2k]
  ------------------
  141|  49.3k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  49.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  49.3k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  49.3k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  49.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|  73.5k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|  73.5k|    }
  144|  6.93k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  4.51k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 2.15k, False: 2.35k]
  ------------------
  148|  2.15k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 1.08k, False: 1.07k]
  ------------------
  149|  1.08k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  1.07k|    else
  151|  1.07k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  2.35k|  } else {
  153|  2.35k|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 1.00k, False: 1.35k]
  ------------------
  154|  1.00k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|  1.35k|    else
  156|  1.35k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|  2.35k|  }
  158|       |
  159|  11.4k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 6.93k, False: 4.51k]
  ------------------
  160|  6.93k|    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|  6.93k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 4.56k, False: 2.36k]
  ------------------
  165|  4.56k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 2.24k, False: 2.31k]
  ------------------
  166|  2.24k|        tbl = compptr->dc_tbl_no;
  167|  2.24k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  2.24k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  209|  2.24k|#define TRUE    1
  ------------------
  169|  2.24k|      }
  170|  4.56k|    } else {
  171|  2.36k|      tbl = compptr->ac_tbl_no;
  172|  2.36k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  2.36k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  206|  2.36k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  2.36k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  2.36k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  6.93k|    entropy->saved.last_dc_val[ci] = 0;
  179|  6.93k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  4.51k|  entropy->bitstate.bits_left = 0;
  183|  4.51k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  4.51k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  4.51k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  4.51k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  4.51k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  4.51k|}
jdphuff.c:decode_mcu_DC_first:
  291|  2.54M|{
  292|  2.54M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  2.54M|  int Al = cinfo->Al;
  294|  2.54M|  register int s, r;
  295|  2.54M|  int blkn, ci;
  296|  2.54M|  JBLOCKROW block;
  297|  2.54M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  2.54M|  register bit_buf_type get_buffer; \
  |  |  126|  2.54M|  register int bits_left; \
  |  |  127|  2.54M|  bitread_working_state br_state
  ------------------
  298|  2.54M|  savable_state state;
  299|  2.54M|  d_derived_tbl *tbl;
  300|  2.54M|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  2.54M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 978k, False: 1.56M]
  ------------------
  304|   978k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 73.7k, False: 905k]
  ------------------
  305|  73.7k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 73.7k]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|   978k|  }
  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.54M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 22.4k, False: 2.52M]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  22.4k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  22.4k|  br_state.cinfo = cinfop; \
  |  |  131|  22.4k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  22.4k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  22.4k|  get_buffer = permstate.get_buffer; \
  |  |  134|  22.4k|  bits_left = permstate.bits_left;
  ------------------
  316|  22.4k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  50.2k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 27.7k, False: 22.4k]
  ------------------
  321|  27.7k|      block = MCU_data[blkn];
  322|  27.7k|      ci = cinfo->MCU_membership[blkn];
  323|  27.7k|      compptr = cinfo->cur_comp_info[ci];
  324|  27.7k|      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|  27.7k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  27.7k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  27.7k|  register int nb, look; \
  |  |  202|  27.7k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  27.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 3.71k, False: 24.0k]
  |  |  ------------------
  |  |  203|  3.71k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 3.71k]
  |  |  ------------------
  |  |  204|  3.71k|      { failaction; } \
  |  |  205|  3.71k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  3.71k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  3.71k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2.42k, False: 1.29k]
  |  |  ------------------
  |  |  207|  2.42k|      nb = 1;  goto slowlabel; \
  |  |  208|  2.42k|    } \
  |  |  209|  3.71k|  } \
  |  |  210|  27.7k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  25.3k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  25.3k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  25.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  25.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 23.5k, False: 1.79k]
  |  |  ------------------
  |  |  212|  23.5k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  23.5k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  23.5k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  23.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  23.5k|  } else { \
  |  |  215|  4.21k|slowlabel: \
  |  |  216|  4.21k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.21k]
  |  |  ------------------
  |  |  217|  4.21k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.21k|      { failaction; } \
  |  |  219|  4.21k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.21k|  } \
  |  |  221|  25.3k|}
  ------------------
  330|  27.7k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 12.5k, False: 15.1k]
  ------------------
  331|  12.5k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  12.5k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  12.5k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.14k, False: 9.43k]
  |  |  ------------------
  |  |  162|  3.14k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.14k]
  |  |  ------------------
  |  |  163|  3.14k|      { action; } \
  |  |  164|  3.14k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.14k|  } \
  |  |  166|  12.5k|}
  ------------------
  332|  12.5k|        r = GET_BITS(s);
  ------------------
  |  |  169|  12.5k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  12.5k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  12.5k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  11.5k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 11.5k, False: 1.07k]
  |  |  ------------------
  ------------------
  334|  12.5k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  27.7k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 11.8k, False: 15.9k]
  ------------------
  338|  27.7k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 11.8k]
  ------------------
  339|  27.7k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 15.9k, False: 11.8k]
  |  Branch (339:41): [True: 0, False: 15.9k]
  ------------------
  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|  27.7k|      s += state.last_dc_val[ci];
  342|  27.7k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  27.7k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  27.7k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  27.7k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  22.4k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  22.4k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  22.4k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  22.4k|  permstate.get_buffer = get_buffer; \
  |  |  140|  22.4k|  permstate.bits_left = bits_left
  ------------------
  349|  22.4k|    entropy->saved = state;
  350|  22.4k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  2.54M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 978k, False: 1.56M]
  ------------------
  354|   978k|    entropy->restarts_to_go--;
  355|       |
  356|  2.54M|  return TRUE;
  ------------------
  |  |  209|  2.54M|#define TRUE    1
  ------------------
  357|  2.54M|}
jdphuff.c:process_restart:
  233|   100k|{
  234|   100k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  235|   100k|  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|   100k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  240|   100k|  entropy->bitstate.bits_left = 0;
  241|       |
  242|       |  /* Advance past the RSTn marker */
  243|   100k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (243:7): [True: 0, False: 100k]
  ------------------
  244|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  245|       |
  246|       |  /* Re-initialize DC predictions to 0 */
  247|   348k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (247:16): [True: 247k, False: 100k]
  ------------------
  248|   247k|    entropy->saved.last_dc_val[ci] = 0;
  249|       |  /* Re-init EOB run count, too */
  250|   100k|  entropy->saved.EOBRUN = 0;
  251|       |
  252|       |  /* Reset restart counter */
  253|   100k|  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|   100k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (260:7): [True: 3.23k, False: 97.4k]
  ------------------
  261|  3.23k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  3.23k|#define FALSE   0               /* values of boolean */
  ------------------
  262|       |
  263|   100k|  return TRUE;
  ------------------
  |  |  209|   100k|#define TRUE    1
  ------------------
  264|   100k|}
jdphuff.c:decode_mcu_AC_first:
  367|  1.41M|{
  368|  1.41M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|  1.41M|  int Se = cinfo->Se;
  370|  1.41M|  int Al = cinfo->Al;
  371|  1.41M|  register int s, k, r;
  372|  1.41M|  unsigned int EOBRUN;
  373|  1.41M|  JBLOCKROW block;
  374|  1.41M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  1.41M|  register bit_buf_type get_buffer; \
  |  |  126|  1.41M|  register int bits_left; \
  |  |  127|  1.41M|  bitread_working_state br_state
  ------------------
  375|  1.41M|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|  1.41M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 241k, False: 1.17M]
  ------------------
  379|   241k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 8.19k, False: 232k]
  ------------------
  380|  8.19k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 8.19k]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|   241k|  }
  383|       |
  384|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  385|       |   * This way, we return uniform gray for the remainder of the segment.
  386|       |   */
  387|  1.41M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 50.8k, False: 1.36M]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|  50.8k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|  50.8k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 14.9k, False: 35.9k]
  ------------------
  397|  14.9k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|  35.9k|    else {
  399|  35.9k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  35.9k|  br_state.cinfo = cinfop; \
  |  |  131|  35.9k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  35.9k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  35.9k|  get_buffer = permstate.get_buffer; \
  |  |  134|  35.9k|  bits_left = permstate.bits_left;
  ------------------
  400|  35.9k|      block = MCU_data[0];
  401|  35.9k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|   169k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 138k, False: 30.2k]
  ------------------
  404|   138k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|   138k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   138k|  register int nb, look; \
  |  |  202|   138k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   138k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 17.0k, False: 121k]
  |  |  ------------------
  |  |  203|  17.0k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 17.0k]
  |  |  ------------------
  |  |  204|  17.0k|      { failaction; } \
  |  |  205|  17.0k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  17.0k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  17.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 4.33k, False: 12.7k]
  |  |  ------------------
  |  |  207|  4.33k|      nb = 1;  goto slowlabel; \
  |  |  208|  4.33k|    } \
  |  |  209|  17.0k|  } \
  |  |  210|   138k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   134k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   134k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   134k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   134k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 133k, False: 646]
  |  |  ------------------
  |  |  212|   133k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   133k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   133k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   133k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   133k|  } else { \
  |  |  215|  4.98k|slowlabel: \
  |  |  216|  4.98k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.98k]
  |  |  ------------------
  |  |  217|  4.98k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.98k|      { failaction; } \
  |  |  219|  4.98k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.98k|  } \
  |  |  221|   134k|}
  ------------------
  405|   138k|        r = s >> 4;
  406|   138k|        s &= 15;
  407|   138k|        if (s) {
  ------------------
  |  Branch (407:13): [True: 132k, False: 6.42k]
  ------------------
  408|   132k|          k += r;
  409|   132k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   132k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   132k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.35k, False: 131k]
  |  |  ------------------
  |  |  162|  1.35k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.35k]
  |  |  ------------------
  |  |  163|  1.35k|      { action; } \
  |  |  164|  1.35k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.35k|  } \
  |  |  166|   132k|}
  ------------------
  410|   132k|          r = GET_BITS(s);
  ------------------
  |  |  169|   132k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|   132k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|   132k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|   121k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 121k, False: 10.9k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|   132k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|   132k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|   132k|        } else {
  415|  6.42k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 717, False: 5.70k]
  ------------------
  416|    717|            k += 15;            /* skip 15 zeroes in band */
  417|  5.70k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|  5.70k|            EOBRUN = 1 << r;
  419|  5.70k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 3.99k, False: 1.70k]
  ------------------
  420|  3.99k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  3.99k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  3.99k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 463, False: 3.53k]
  |  |  ------------------
  |  |  162|    463|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 463]
  |  |  ------------------
  |  |  163|    463|      { action; } \
  |  |  164|    463|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    463|  } \
  |  |  166|  3.99k|}
  ------------------
  421|  3.99k|              r = GET_BITS(r);
  ------------------
  |  |  169|  3.99k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  3.99k|              EOBRUN += r;
  423|  3.99k|            }
  424|  5.70k|            EOBRUN--;           /* this band is processed at this moment */
  425|  5.70k|            break;              /* force end-of-band */
  426|  5.70k|          }
  427|  6.42k|        }
  428|   138k|      }
  429|       |
  430|  35.9k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  35.9k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  35.9k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  35.9k|  permstate.get_buffer = get_buffer; \
  |  |  140|  35.9k|  permstate.bits_left = bits_left
  ------------------
  431|  35.9k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|  50.8k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|  50.8k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|  1.41M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 241k, False: 1.17M]
  ------------------
  439|   241k|    entropy->restarts_to_go--;
  440|       |
  441|  1.41M|  return TRUE;
  ------------------
  |  |  209|  1.41M|#define TRUE    1
  ------------------
  442|  1.41M|}
jdphuff.c:decode_mcu_DC_refine:
  453|  1.17M|{
  454|  1.17M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|  1.17M|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|  1.17M|  int blkn;
  457|  1.17M|  JBLOCKROW block;
  458|  1.17M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  1.17M|  register bit_buf_type get_buffer; \
  |  |  126|  1.17M|  register int bits_left; \
  |  |  127|  1.17M|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|  1.17M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 261k, False: 916k]
  ------------------
  462|   261k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 11.3k, False: 250k]
  ------------------
  463|  11.3k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 11.3k]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|   261k|  }
  466|       |
  467|       |  /* Not worth the cycles to check insufficient_data here,
  468|       |   * since we will not change the data anyway if we read zeroes.
  469|       |   */
  470|       |
  471|       |  /* Load up working state */
  472|  1.17M|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  1.17M|  br_state.cinfo = cinfop; \
  |  |  131|  1.17M|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  1.17M|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  1.17M|  get_buffer = permstate.get_buffer; \
  |  |  134|  1.17M|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|  4.56M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 3.39M, False: 1.17M]
  ------------------
  477|  3.39M|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|  3.39M|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|  3.39M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  3.39M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 69.9k, False: 3.32M]
  |  |  ------------------
  |  |  162|  69.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 69.9k]
  |  |  ------------------
  |  |  163|  69.9k|      { action; } \
  |  |  164|  69.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  69.9k|  } \
  |  |  166|  3.39M|}
  ------------------
  481|  3.39M|    if (GET_BITS(1))
  ------------------
  |  |  169|  3.39M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 1.42k, False: 3.39M]
  |  |  ------------------
  ------------------
  482|  1.42k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|  3.39M|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|  1.17M|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  1.17M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  1.17M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  1.17M|  permstate.get_buffer = get_buffer; \
  |  |  140|  1.17M|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|  1.17M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 261k, False: 916k]
  ------------------
  491|   261k|    entropy->restarts_to_go--;
  492|       |
  493|  1.17M|  return TRUE;
  ------------------
  |  |  209|  1.17M|#define TRUE    1
  ------------------
  494|  1.17M|}
jdphuff.c:decode_mcu_AC_refine:
  503|  2.26M|{
  504|  2.26M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|  2.26M|  int Se = cinfo->Se;
  506|  2.26M|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|  2.26M|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|  2.26M|#define NEG_1  ((unsigned)-1)
  ------------------
  508|  2.26M|  register int s, k, r;
  509|  2.26M|  unsigned int EOBRUN;
  510|  2.26M|  JBLOCKROW block;
  511|  2.26M|  JCOEFPTR thiscoef;
  512|  2.26M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  2.26M|  register bit_buf_type get_buffer; \
  |  |  126|  2.26M|  register int bits_left; \
  |  |  127|  2.26M|  bitread_working_state br_state
  ------------------
  513|  2.26M|  d_derived_tbl *tbl;
  514|  2.26M|  int num_newnz;
  515|  2.26M|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|  2.26M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 188k, False: 2.07M]
  ------------------
  519|   188k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 7.36k, False: 180k]
  ------------------
  520|  7.36k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 7.36k]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|   188k|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|  2.26M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 153k, False: 2.11M]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|   153k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   153k|  br_state.cinfo = cinfop; \
  |  |  131|   153k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   153k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   153k|  get_buffer = permstate.get_buffer; \
  |  |  134|   153k|  bits_left = permstate.bits_left;
  ------------------
  530|   153k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|   153k|    block = MCU_data[0];
  534|   153k|    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|   153k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|   153k|    k = cinfo->Ss;
  546|       |
  547|   153k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 132k, False: 21.4k]
  ------------------
  548|  1.28M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 1.15M, False: 126k]
  ------------------
  549|  1.15M|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|  1.15M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  1.15M|  register int nb, look; \
  |  |  202|  1.15M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.15M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 46.8k, False: 1.11M]
  |  |  ------------------
  |  |  203|  46.8k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 46.8k]
  |  |  ------------------
  |  |  204|  46.8k|      { failaction; } \
  |  |  205|  46.8k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  46.8k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  46.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2.41k, False: 44.4k]
  |  |  ------------------
  |  |  207|  2.41k|      nb = 1;  goto slowlabel; \
  |  |  208|  2.41k|    } \
  |  |  209|  46.8k|  } \
  |  |  210|  1.15M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.15M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  1.15M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.15M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.15M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.15M, False: 1.98k]
  |  |  ------------------
  |  |  212|  1.15M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.15M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.15M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.15M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.15M|  } else { \
  |  |  215|  4.40k|slowlabel: \
  |  |  216|  4.40k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.40k]
  |  |  ------------------
  |  |  217|  4.40k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.40k|      { failaction; } \
  |  |  219|  4.40k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.40k|  } \
  |  |  221|  1.15M|}
  ------------------
  550|  1.15M|        r = s >> 4;
  551|  1.15M|        s &= 15;
  552|  1.15M|        if (s) {
  ------------------
  |  Branch (552:13): [True: 1.15M, False: 5.81k]
  ------------------
  553|  1.15M|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 877k, False: 274k]
  ------------------
  554|   877k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|   877k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|   877k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  555|  1.15M|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  1.15M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.15M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 344, False: 1.15M]
  |  |  ------------------
  |  |  162|    344|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 344]
  |  |  ------------------
  |  |  163|    344|      { action; } \
  |  |  164|    344|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    344|  } \
  |  |  166|  1.15M|}
  ------------------
  556|  1.15M|          if (GET_BITS(1))
  ------------------
  |  |  169|  1.15M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 23.8k, False: 1.12M]
  |  |  ------------------
  ------------------
  557|  23.8k|            s = p1;             /* newly nonzero coef is positive */
  558|  1.12M|          else
  559|  1.12M|            s = m1;             /* newly nonzero coef is negative */
  560|  1.15M|        } else {
  561|  5.81k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 5.44k, False: 368]
  ------------------
  562|  5.44k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  5.44k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 2.04k, False: 3.40k]
  ------------------
  564|  2.04k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  2.04k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.04k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 213, False: 1.83k]
  |  |  ------------------
  |  |  162|    213|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 213]
  |  |  ------------------
  |  |  163|    213|      { action; } \
  |  |  164|    213|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    213|  } \
  |  |  166|  2.04k|}
  ------------------
  565|  2.04k|              r = GET_BITS(r);
  ------------------
  |  |  169|  2.04k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  2.04k|              EOBRUN += r;
  567|  2.04k|            }
  568|  5.44k|            break;              /* rest of block is handled by EOB logic */
  569|  5.44k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  5.81k|        }
  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|  4.75M|        do {
  577|  4.75M|          thiscoef = *block + jpeg_natural_order[k];
  578|  4.75M|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 90.9k, False: 4.66M]
  ------------------
  579|  90.9k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  90.9k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  90.9k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 523, False: 90.4k]
  |  |  ------------------
  |  |  162|    523|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 523]
  |  |  ------------------
  |  |  163|    523|      { action; } \
  |  |  164|    523|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    523|  } \
  |  |  166|  90.9k|}
  ------------------
  580|  90.9k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|  90.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 7.87k, False: 83.0k]
  |  |  ------------------
  ------------------
  581|  7.87k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 1.38k, False: 6.48k]
  ------------------
  582|  1.38k|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 678, False: 710]
  ------------------
  583|    678|                  *thiscoef += (JCOEF)p1;
  584|    710|                else
  585|    710|                  *thiscoef += (JCOEF)m1;
  586|  1.38k|              }
  587|  7.87k|            }
  588|  4.66M|          } else {
  589|  4.66M|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 1.07M, False: 3.58M]
  ------------------
  590|  1.07M|              break;            /* reached target zero coefficient */
  591|  4.66M|          }
  592|  3.67M|          k++;
  593|  3.67M|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 3.60M, False: 74.7k]
  ------------------
  594|  1.15M|        if (s) {
  ------------------
  |  Branch (594:13): [True: 1.15M, False: 368]
  ------------------
  595|  1.15M|          int pos = jpeg_natural_order[k];
  596|       |          /* Output newly nonzero coefficient */
  597|  1.15M|          (*block)[pos] = (JCOEF)s;
  598|       |          /* Remember its position in case we have to suspend */
  599|  1.15M|          newnz_pos[num_newnz++] = pos;
  600|  1.15M|        }
  601|  1.15M|      }
  602|   132k|    }
  603|       |
  604|   153k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 26.9k, False: 126k]
  ------------------
  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|   544k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 517k, False: 26.9k]
  ------------------
  611|   517k|        thiscoef = *block + jpeg_natural_order[k];
  612|   517k|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 26.1k, False: 491k]
  ------------------
  613|  26.1k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  26.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  26.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 310, False: 25.8k]
  |  |  ------------------
  |  |  162|    310|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 310]
  |  |  ------------------
  |  |  163|    310|      { action; } \
  |  |  164|    310|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    310|  } \
  |  |  166|  26.1k|}
  ------------------
  614|  26.1k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|  26.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 5.28k, False: 20.9k]
  |  |  ------------------
  ------------------
  615|  5.28k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 1.04k, False: 4.23k]
  ------------------
  616|  1.04k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 400, False: 641]
  ------------------
  617|    400|                *thiscoef += (JCOEF)p1;
  618|    641|              else
  619|    641|                *thiscoef += (JCOEF)m1;
  620|  1.04k|            }
  621|  5.28k|          }
  622|  26.1k|        }
  623|   517k|      }
  624|       |      /* Count one block completed in EOB run */
  625|  26.9k|      EOBRUN--;
  626|  26.9k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|   153k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   153k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   153k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   153k|  permstate.get_buffer = get_buffer; \
  |  |  140|   153k|  permstate.bits_left = bits_left
  ------------------
  630|   153k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|   153k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|  2.26M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 188k, False: 2.07M]
  ------------------
  635|   188k|    entropy->restarts_to_go--;
  636|       |
  637|  2.26M|  return TRUE;
  ------------------
  |  |  209|  2.26M|#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;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  645|  2.26M|}

jpeg_read_coefficients:
   50|  6.34k|{
   51|  6.34k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (51:7): [True: 30, False: 6.31k]
  ------------------
   52|     30|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|     30|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     30|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   53|       |
   54|  6.34k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  6.34k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (54:7): [True: 6.31k, False: 30]
  ------------------
   55|       |    /* First call: initialize active modules */
   56|  6.31k|    transdecode_master_selection(cinfo);
   57|  6.31k|    cinfo->global_state = DSTATE_RDCOEFS;
  ------------------
  |  |   57|  6.31k|#define DSTATE_RDCOEFS   209    /* reading file in jpeg_read_coefficients */
  ------------------
   58|  6.31k|  }
   59|  6.34k|  if (cinfo->global_state == DSTATE_RDCOEFS) {
  ------------------
  |  |   57|  6.34k|#define DSTATE_RDCOEFS   209    /* reading file in jpeg_read_coefficients */
  ------------------
  |  Branch (59:7): [True: 5.84k, False: 498]
  ------------------
   60|       |    /* Absorb whole file into the coef buffer */
   61|  4.98M|    for (;;) {
   62|  4.98M|      int retcode;
   63|       |      /* Call progress monitor hook if present */
   64|  4.98M|      if (cinfo->progress != NULL)
  ------------------
  |  Branch (64:11): [True: 4.98M, False: 0]
  ------------------
   65|  4.98M|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   66|       |      /* Absorb some more input */
   67|  4.98M|      retcode = (*cinfo->inputctl->consume_input) (cinfo);
   68|  4.98M|      if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1049|  4.98M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (68:11): [True: 0, False: 4.98M]
  ------------------
   69|      0|        return NULL;
   70|  4.98M|      if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1096|  4.98M|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (70:11): [True: 4.64k, False: 4.98M]
  ------------------
   71|  4.64k|        break;
   72|       |      /* Advance progress counter if appropriate */
   73|  4.98M|      if (cinfo->progress != NULL &&
  ------------------
  |  Branch (73:11): [True: 4.98M, False: 1.19k]
  ------------------
   74|  4.98M|          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1097|  9.96M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                        (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1095|  40.5k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (74:12): [True: 4.94M, False: 40.5k]
  |  Branch (74:45): [True: 17.3k, False: 23.2k]
  ------------------
   75|  4.95M|        if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (75:13): [True: 14.1k, False: 4.94M]
  ------------------
   76|       |          /* startup underestimated number of scans; ratchet up one scan */
   77|  14.1k|          cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   78|  14.1k|        }
   79|  4.95M|      }
   80|  4.98M|    }
   81|       |    /* Set state so that jpeg_finish_decompress does the right thing */
   82|  5.84k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  5.84k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
   83|  5.84k|  }
   84|       |  /* At this point we should be in state DSTATE_STOPPING if being used
   85|       |   * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
   86|       |   * to the coefficients during a full buffered-image-mode decompression.
   87|       |   */
   88|  6.34k|  if ((cinfo->global_state == DSTATE_STOPPING ||
  ------------------
  |  |   58|  12.6k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (88:8): [True: 6.34k, False: 0]
  ------------------
   89|  6.34k|       cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (89:8): [True: 0, False: 0]
  |  Branch (89:51): [True: 4.64k, False: 0]
  ------------------
   90|  4.64k|    return cinfo->coef->coef_arrays;
   91|  4.64k|  }
   92|       |  /* Oops, improper usage */
   93|  1.69k|  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|  1.69k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.69k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.69k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   94|  1.69k|  return NULL;                  /* keep compiler happy */
   95|  6.34k|}
jdtrans.c:transdecode_master_selection:
  105|  6.31k|{
  106|       |  /* This is effectively a buffered-image operation. */
  107|  6.31k|  cinfo->buffered_image = TRUE;
  ------------------
  |  |  209|  6.31k|#define TRUE    1
  ------------------
  108|       |
  109|       |#if JPEG_LIB_VERSION >= 80
  110|       |  /* Compute output image dimensions and related values. */
  111|       |  jpeg_core_output_dimensions(cinfo);
  112|       |#endif
  113|       |
  114|       |  /* Entropy decoding: either Huffman or arithmetic coding. */
  115|  6.31k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (115:7): [True: 2.19k, False: 4.11k]
  ------------------
  116|  2.19k|#ifdef D_ARITH_CODING_SUPPORTED
  117|  2.19k|    jinit_arith_decoder(cinfo);
  118|       |#else
  119|       |    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  120|       |#endif
  121|  4.11k|  } else {
  122|  4.11k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (122:9): [True: 1.41k, False: 2.70k]
  ------------------
  123|  1.41k|#ifdef D_PROGRESSIVE_SUPPORTED
  124|  1.41k|      jinit_phuff_decoder(cinfo);
  125|       |#else
  126|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  127|       |#endif
  128|  1.41k|    } else
  129|  2.70k|      jinit_huff_decoder(cinfo);
  130|  4.11k|  }
  131|       |
  132|       |  /* Always get a full-image coefficient buffer. */
  133|  6.31k|  if (cinfo->data_precision == 12)
  ------------------
  |  Branch (133:7): [True: 1.08k, False: 5.22k]
  ------------------
  134|  1.08k|    j12init_d_coef_controller(cinfo, TRUE);
  ------------------
  |  |  209|  1.08k|#define TRUE    1
  ------------------
  135|  5.22k|  else
  136|  5.22k|    jinit_d_coef_controller(cinfo, TRUE);
  ------------------
  |  |  209|  5.22k|#define TRUE    1
  ------------------
  137|       |
  138|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  139|  6.31k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  140|       |
  141|       |  /* Initialize input side of decompressor to consume first scan. */
  142|  6.31k|  (*cinfo->inputctl->start_input_pass) (cinfo);
  143|       |
  144|       |  /* Initialize progress monitoring. */
  145|  6.31k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (145:7): [True: 5.84k, False: 468]
  ------------------
  146|  5.84k|    int nscans;
  147|       |    /* Estimate number of scans to set pass_limit. */
  148|  5.84k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (148:9): [True: 2.52k, False: 3.32k]
  ------------------
  149|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  150|  2.52k|      nscans = 2 + 3 * cinfo->num_components;
  151|  3.32k|    } else if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (151:16): [True: 868, False: 2.45k]
  ------------------
  152|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  153|    868|      nscans = cinfo->num_components;
  154|  2.45k|    } else {
  155|  2.45k|      nscans = 1;
  156|  2.45k|    }
  157|  5.84k|    cinfo->progress->pass_counter = 0L;
  158|  5.84k|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  159|  5.84k|    cinfo->progress->completed_passes = 0;
  160|  5.84k|    cinfo->progress->total_passes = 1;
  161|  5.84k|  }
  162|  6.31k|}

jpeg_std_error:
  231|  11.0k|{
  232|  11.0k|  err->error_exit = error_exit;
  233|  11.0k|  err->emit_message = emit_message;
  234|  11.0k|  err->output_message = output_message;
  235|  11.0k|  err->format_message = format_message;
  236|  11.0k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|  11.0k|  err->trace_level = 0;         /* default = no tracing */
  239|  11.0k|  err->num_warnings = 0;        /* no warnings emitted yet */
  240|  11.0k|  err->msg_code = 0;            /* may be useful as a flag for "no error" */
  241|       |
  242|       |  /* Initialize message table pointers */
  243|  11.0k|  err->jpeg_message_table = jpeg_std_message_table;
  244|  11.0k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  245|       |
  246|  11.0k|  err->addon_message_table = NULL;
  247|  11.0k|  err->first_addon_message = 0; /* for safety */
  248|  11.0k|  err->last_addon_message = 0;
  249|       |
  250|  11.0k|  return err;
  251|  11.0k|}
jerror.c:emit_message:
  128|  53.4M|{
  129|  53.4M|  struct jpeg_error_mgr *err = cinfo->err;
  130|       |
  131|  53.4M|  if (msg_level < 0) {
  ------------------
  |  Branch (131:7): [True: 34.5M, False: 18.9M]
  ------------------
  132|       |    /* It's a warning message.  Since corrupt files may generate many warnings,
  133|       |     * the policy implemented here is to show only the first warning,
  134|       |     * unless trace_level >= 3.
  135|       |     */
  136|  34.5M|    if (err->num_warnings == 0 || err->trace_level >= 3)
  ------------------
  |  Branch (136:9): [True: 7.19k, False: 34.5M]
  |  Branch (136:35): [True: 0, False: 34.5M]
  ------------------
  137|  7.19k|      (*err->output_message) (cinfo);
  138|       |    /* Always count warnings in num_warnings. */
  139|  34.5M|    err->num_warnings++;
  140|  34.5M|  } else {
  141|       |    /* It's a trace message.  Show it if trace_level >= msg_level. */
  142|  18.9M|    if (err->trace_level >= msg_level)
  ------------------
  |  Branch (142:9): [True: 1, False: 18.9M]
  ------------------
  143|      1|      (*err->output_message) (cinfo);
  144|  18.9M|  }
  145|  53.4M|}
jerror.c:format_message:
  157|  11.8k|{
  158|  11.8k|  struct jpeg_error_mgr *err = cinfo->err;
  159|  11.8k|  int msg_code = err->msg_code;
  160|  11.8k|  const char *msgtext = NULL;
  161|  11.8k|  const char *msgptr;
  162|  11.8k|  char ch;
  163|  11.8k|  boolean isstring;
  164|       |
  165|       |  /* Look up message string in proper table */
  166|  11.8k|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (166:7): [True: 11.8k, False: 0]
  |  Branch (166:23): [True: 11.8k, False: 0]
  ------------------
  167|  11.8k|    msgtext = err->jpeg_message_table[msg_code];
  168|  11.8k|  } else if (err->addon_message_table != NULL &&
  ------------------
  |  Branch (168:14): [True: 0, False: 0]
  ------------------
  169|      0|             msg_code >= err->first_addon_message &&
  ------------------
  |  Branch (169:14): [True: 0, False: 0]
  ------------------
  170|      0|             msg_code <= err->last_addon_message) {
  ------------------
  |  Branch (170:14): [True: 0, False: 0]
  ------------------
  171|      0|    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  172|      0|  }
  173|       |
  174|       |  /* Defend against bogus message number */
  175|  11.8k|  if (msgtext == NULL) {
  ------------------
  |  Branch (175:7): [True: 0, False: 11.8k]
  ------------------
  176|      0|    err->msg_parm.i[0] = msg_code;
  177|      0|    msgtext = err->jpeg_message_table[0];
  178|      0|  }
  179|       |
  180|       |  /* Check for string parameter, as indicated by %s in the message text */
  181|  11.8k|  isstring = FALSE;
  ------------------
  |  |  206|  11.8k|#define FALSE   0               /* values of boolean */
  ------------------
  182|  11.8k|  msgptr = msgtext;
  183|   413k|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (183:10): [True: 405k, False: 7.91k]
  ------------------
  184|   405k|    if (ch == '%') {
  ------------------
  |  Branch (184:9): [True: 3.93k, False: 401k]
  ------------------
  185|  3.93k|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  |  Branch (185:11): [True: 0, False: 3.93k]
  ------------------
  186|  3.93k|      break;
  187|  3.93k|    }
  188|   405k|  }
  189|       |
  190|       |  /* Format the message into the passed buffer */
  191|  11.8k|  if (isstring)
  ------------------
  |  Branch (191:7): [True: 0, False: 11.8k]
  ------------------
  192|      0|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |   55|      0|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|  11.8k|  else
  194|  11.8k|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|  11.8k|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  776|  11.8k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  195|  11.8k|             err->msg_parm.i[0], err->msg_parm.i[1],
  196|  11.8k|             err->msg_parm.i[2], err->msg_parm.i[3],
  197|  11.8k|             err->msg_parm.i[4], err->msg_parm.i[5],
  198|  11.8k|             err->msg_parm.i[6], err->msg_parm.i[7]);
  199|  11.8k|}
jerror.c:reset_error_mgr:
  212|  20.5k|{
  213|  20.5k|  cinfo->err->num_warnings = 0;
  214|       |  /* trace_level is not reset since it is an application-supplied parameter */
  215|  20.5k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  216|  20.5k|}

jmemmgr.c:GETENV_S:
   80|  11.0k|{
   81|  11.0k|  char *env;
   82|       |
   83|  11.0k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 11.0k]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|  11.0k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 11.0k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  11.0k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 11.0k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  11.0k|  env = getenv(name);
   97|  11.0k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 11.0k, False: 0]
  ------------------
   98|  11.0k|  {
   99|  11.0k|    *buffer = 0;
  100|  11.0k|    return 0;
  101|  11.0k|  }
  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:
 1195|  11.0k|{
 1196|  11.0k|  my_mem_ptr mem;
 1197|  11.0k|  long max_to_use;
 1198|  11.0k|  int pool;
 1199|  11.0k|  size_t test_mac;
 1200|       |
 1201|  11.0k|  cinfo->mem = NULL;            /* for safety if init fails */
 1202|       |
 1203|       |  /* Check for configuration errors.
 1204|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1205|       |   * doesn't reflect any real hardware alignment requirement.
 1206|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1207|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1208|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1209|       |   */
 1210|  11.0k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  11.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  11.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1210:7): [Folded - Ignored]
  ------------------
 1211|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1212|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1213|       |   * a multiple of ALIGN_SIZE.
 1214|       |   * Again, an "unreachable code" warning may be ignored here.
 1215|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1216|       |   */
 1217|  11.0k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  11.0k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1218|  11.0k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  22.0k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1218:7): [True: 0, False: 11.0k]
  ------------------
 1219|  11.0k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  11.0k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  11.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1219:7): [Folded - Ignored]
  ------------------
 1220|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1221|       |
 1222|  11.0k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1223|       |
 1224|       |  /* Attempt to allocate memory manager's control block */
 1225|  11.0k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1226|       |
 1227|  11.0k|  if (mem == NULL) {
  ------------------
  |  Branch (1227:7): [True: 0, False: 11.0k]
  ------------------
 1228|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1229|      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)))
  ------------------
 1230|      0|  }
 1231|       |
 1232|       |  /* OK, fill in the method pointers */
 1233|  11.0k|  mem->pub.alloc_small = alloc_small;
 1234|  11.0k|  mem->pub.alloc_large = alloc_large;
 1235|  11.0k|  mem->pub.alloc_sarray = alloc_sarray;
 1236|  11.0k|  mem->pub.alloc_barray = alloc_barray;
 1237|  11.0k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1238|  11.0k|  mem->pub.request_virt_barray = request_virt_barray;
 1239|  11.0k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1240|  11.0k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1241|  11.0k|  mem->pub.access_virt_barray = access_virt_barray;
 1242|  11.0k|  mem->pub.free_pool = free_pool;
 1243|  11.0k|  mem->pub.self_destruct = self_destruct;
 1244|       |
 1245|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1246|  11.0k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  11.0k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1247|       |
 1248|       |  /* Initialize working state */
 1249|  11.0k|  mem->pub.max_memory_to_use = max_to_use;
 1250|       |
 1251|  33.0k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  874|  11.0k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  872|  33.0k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1251:35): [True: 22.0k, False: 11.0k]
  ------------------
 1252|  22.0k|    mem->small_list[pool] = NULL;
 1253|  22.0k|    mem->large_list[pool] = NULL;
 1254|  22.0k|  }
 1255|  11.0k|  mem->virt_sarray_list = NULL;
 1256|  11.0k|  mem->virt_barray_list = NULL;
 1257|       |
 1258|  11.0k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1259|       |
 1260|       |  /* Declare ourselves open for business */
 1261|  11.0k|  cinfo->mem = &mem->pub;
 1262|       |
 1263|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1264|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1265|       |   * surrounding application may again override this value.
 1266|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1267|       |   * this feature.
 1268|       |   */
 1269|  11.0k|#ifndef NO_GETENV
 1270|  11.0k|  {
 1271|  11.0k|    char memenv[30] = { 0 };
 1272|       |
 1273|  11.0k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1273:9): [True: 11.0k, False: 0]
  |  Branch (1273:45): [True: 0, False: 11.0k]
  ------------------
 1274|      0|      char ch = 'x';
 1275|       |
 1276|       |#ifdef _MSC_VER
 1277|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1278|       |#else
 1279|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1279:11): [True: 0, False: 0]
  ------------------
 1280|      0|#endif
 1281|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1281:13): [True: 0, False: 0]
  |  Branch (1281:26): [True: 0, False: 0]
  ------------------
 1282|      0|          max_to_use *= 1000L;
 1283|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1284|      0|      }
 1285|      0|    }
 1286|  11.0k|  }
 1287|  11.0k|#endif
 1288|       |
 1289|  11.0k|}
jmemmgr.c:alloc_small:
  268|   196k|{
  269|   196k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  270|   196k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  271|   196k|  char *data_ptr;
  272|   196k|  size_t min_request, slop;
  273|       |
  274|       |  /*
  275|       |   * Round up the requested size to a multiple of ALIGN_SIZE in order
  276|       |   * to assure alignment for the next object allocated in the same pool
  277|       |   * and so that algorithms can straddle outside the proper area up
  278|       |   * to the next alignment.
  279|       |   */
  280|   196k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   196k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (280:7): [True: 0, False: 196k]
  ------------------
  281|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  282|       |       is close to SIZE_MAX. */
  283|      0|    out_of_memory(cinfo, 7);
  284|      0|  }
  285|   196k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  286|       |
  287|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  288|   196k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (288:7): [True: 0, False: 196k]
  ------------------
  289|   196k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   196k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  290|      0|    out_of_memory(cinfo, 1);    /* request exceeds malloc's ability */
  291|       |
  292|       |  /* See if space is available in any existing pool */
  293|   196k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  874|   196k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (293:7): [True: 0, False: 196k]
  |  Branch (293:22): [True: 0, False: 196k]
  ------------------
  294|      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)))
  ------------------
  295|   196k|  prev_hdr_ptr = NULL;
  296|   196k|  hdr_ptr = mem->small_list[pool_id];
  297|   240k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (297:10): [True: 194k, False: 45.4k]
  ------------------
  298|   194k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (298:9): [True: 150k, False: 44.0k]
  ------------------
  299|   150k|      break;                    /* found pool with enough space */
  300|  44.0k|    prev_hdr_ptr = hdr_ptr;
  301|  44.0k|    hdr_ptr = hdr_ptr->next;
  302|  44.0k|  }
  303|       |
  304|       |  /* Time to make a new pool? */
  305|   196k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (305:7): [True: 45.4k, False: 150k]
  ------------------
  306|       |    /* min_request is what we need now, slop is what will be leftover */
  307|  45.4k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  45.4k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  308|  45.4k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (308:9): [True: 30.3k, False: 15.0k]
  ------------------
  309|  30.3k|      slop = first_pool_slop[pool_id];
  310|  15.0k|    else
  311|  15.0k|      slop = extra_pool_slop[pool_id];
  312|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  313|  45.4k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  45.4k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (313:9): [True: 0, False: 45.4k]
  ------------------
  314|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  315|       |    /* Try to get space, if fail reduce slop and try again */
  316|  45.4k|    for (;;) {
  317|  45.4k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  318|  45.4k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (318:11): [True: 45.4k, False: 0]
  ------------------
  319|  45.4k|        break;
  320|      0|      slop /= 2;
  321|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  262|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (321:11): [True: 0, False: 0]
  ------------------
  322|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  323|      0|    }
  324|  45.4k|    mem->total_space_allocated += min_request + slop;
  325|       |    /* Success, initialize the new pool header and add to end of list */
  326|  45.4k|    hdr_ptr->next = NULL;
  327|  45.4k|    hdr_ptr->bytes_used = 0;
  328|  45.4k|    hdr_ptr->bytes_left = sizeofobject + slop;
  329|  45.4k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (329:9): [True: 30.3k, False: 15.0k]
  ------------------
  330|  30.3k|      mem->small_list[pool_id] = hdr_ptr;
  331|  15.0k|    else
  332|  15.0k|      prev_hdr_ptr->next = hdr_ptr;
  333|  45.4k|  }
  334|       |
  335|       |  /* OK, allocate the object from the current pool */
  336|   196k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  337|   196k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  338|   196k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (338:7): [True: 196k, False: 0]
  ------------------
  339|   196k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  340|   196k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  341|   196k|  hdr_ptr->bytes_used += sizeofobject;
  342|   196k|  hdr_ptr->bytes_left -= sizeofobject;
  343|       |
  344|   196k|  return (void *)data_ptr;
  345|   196k|}
jmemmgr.c:round_up_pow2:
   45|   545k|{
   46|   545k|  return ((a + b - 1) & (~(b - 1)));
   47|   545k|}
jmemmgr.c:alloc_large:
  365|   348k|{
  366|   348k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  367|   348k|  large_pool_ptr hdr_ptr;
  368|   348k|  char *data_ptr;
  369|       |
  370|       |  /*
  371|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  372|       |   * algorithms can straddle outside the proper area up to the next
  373|       |   * alignment.
  374|       |   */
  375|   348k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   348k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (375:7): [True: 0, False: 348k]
  ------------------
  376|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  377|       |       is close to SIZE_MAX. */
  378|      0|    out_of_memory(cinfo, 8);
  379|      0|  }
  380|   348k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  381|       |
  382|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  383|   348k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (383:7): [True: 0, False: 348k]
  ------------------
  384|   348k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   348k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  385|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  386|       |
  387|       |  /* Always make a new pool */
  388|   348k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  874|   348k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (388:7): [True: 0, False: 348k]
  |  Branch (388:22): [True: 0, False: 348k]
  ------------------
  389|      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)))
  ------------------
  390|       |
  391|   348k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  392|   348k|                                           sizeof(large_pool_hdr) +
  393|   348k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  394|   348k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (394:7): [True: 0, False: 348k]
  ------------------
  395|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  396|   348k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  397|   348k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  398|       |
  399|       |  /* Success, initialize the new pool header and add to list */
  400|   348k|  hdr_ptr->next = mem->large_list[pool_id];
  401|       |  /* We maintain space counts in each pool header for statistical purposes,
  402|       |   * even though they are not needed for allocation.
  403|       |   */
  404|   348k|  hdr_ptr->bytes_used = sizeofobject;
  405|   348k|  hdr_ptr->bytes_left = 0;
  406|   348k|  mem->large_list[pool_id] = hdr_ptr;
  407|       |
  408|   348k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  409|   348k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  410|   348k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (410:7): [True: 348k, False: 0]
  ------------------
  411|   348k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  412|       |
  413|   348k|  return (void *)data_ptr;
  414|   348k|}
jmemmgr.c:alloc_barray:
  554|  15.9k|{
  555|  15.9k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  556|  15.9k|  JBLOCKARRAY result;
  557|  15.9k|  JBLOCKROW workspace;
  558|  15.9k|  JDIMENSION rowsperchunk, currow, i;
  559|  15.9k|  long ltemp;
  560|       |
  561|       |  /* Make sure each row is properly aligned */
  562|  15.9k|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  15.9k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (562:7): [Folded - Ignored]
  ------------------
  563|      0|    out_of_memory(cinfo, 6);    /* safety check */
  564|       |
  565|       |  /* Calculate max # of rows allowed in one allocation chunk */
  566|  15.9k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  15.9k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  567|  15.9k|          ((long)blocksperrow * sizeof(JBLOCK));
  568|  15.9k|  if (ltemp <= 0)
  ------------------
  |  Branch (568:7): [True: 0, False: 15.9k]
  ------------------
  569|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  570|  15.9k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (570:7): [True: 0, False: 15.9k]
  ------------------
  571|      0|    rowsperchunk = (JDIMENSION)ltemp;
  572|  15.9k|  else
  573|  15.9k|    rowsperchunk = numrows;
  574|  15.9k|  mem->last_rowsperchunk = rowsperchunk;
  575|       |
  576|       |  /* Get space for row pointers (small object) */
  577|  15.9k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  578|  15.9k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  579|       |
  580|       |  /* Get the rows themselves (large objects) */
  581|  15.9k|  currow = 0;
  582|  31.8k|  while (currow < numrows) {
  ------------------
  |  Branch (582:10): [True: 15.9k, False: 15.9k]
  ------------------
  583|  15.9k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  448|  15.9k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (448:26): [True: 0, False: 15.9k]
  |  |  ------------------
  ------------------
  584|  15.9k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  585|  15.9k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  586|  15.9k|                  sizeof(JBLOCK)));
  587|  2.16M|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (587:28): [True: 2.14M, False: 15.9k]
  ------------------
  588|  2.14M|      result[currow++] = workspace;
  589|  2.14M|      workspace += blocksperrow;
  590|  2.14M|    }
  591|  15.9k|  }
  592|       |
  593|  15.9k|  return result;
  594|  15.9k|}
jmemmgr.c:request_virt_barray:
  669|  16.0k|{
  670|  16.0k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  671|  16.0k|  jvirt_barray_ptr result;
  672|       |
  673|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  674|  16.0k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  873|  16.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (674:7): [True: 0, False: 16.0k]
  ------------------
  675|      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)))
  ------------------
  676|       |
  677|       |  /* get control block */
  678|  16.0k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  679|  16.0k|                                         sizeof(struct jvirt_barray_control));
  680|       |
  681|  16.0k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  682|  16.0k|  result->rows_in_array = numrows;
  683|  16.0k|  result->blocksperrow = blocksperrow;
  684|  16.0k|  result->maxaccess = maxaccess;
  685|  16.0k|  result->pre_zero = pre_zero;
  686|  16.0k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  206|  16.0k|#define FALSE   0               /* values of boolean */
  ------------------
  687|  16.0k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  688|  16.0k|  mem->virt_barray_list = result;
  689|       |
  690|  16.0k|  return result;
  691|  16.0k|}
jmemmgr.c:realize_virt_arrays:
  697|  13.3k|{
  698|  13.3k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  699|  13.3k|  size_t space_per_minheight, maximum_space, avail_mem;
  700|  13.3k|  size_t minheights, max_minheights;
  701|  13.3k|  jvirt_sarray_ptr sptr;
  702|  13.3k|  jvirt_barray_ptr bptr;
  703|  13.3k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (703:24): [True: 6.30k, False: 7.03k]
  ------------------
  704|  6.30k|                        ((j_decompress_ptr)cinfo)->data_precision :
  705|  13.3k|                        ((j_compress_ptr)cinfo)->data_precision;
  706|  13.3k|  size_t sample_size = data_precision == 16 ?
  ------------------
  |  Branch (706:24): [True: 0, False: 13.3k]
  ------------------
  707|  13.3k|                       sizeof(J16SAMPLE) : (data_precision == 12 ?
  ------------------
  |  Branch (707:45): [True: 2.52k, False: 10.8k]
  ------------------
  708|  2.52k|                                            sizeof(J12SAMPLE) :
  709|  13.3k|                                            sizeof(JSAMPLE));
  710|       |
  711|       |  /* Compute the minimum space needed (maxaccess rows in each buffer)
  712|       |   * and the maximum space needed (full image height in each buffer).
  713|       |   * These may be of use to the system-dependent jpeg_mem_available routine.
  714|       |   */
  715|  13.3k|  space_per_minheight = 0;
  716|  13.3k|  maximum_space = 0;
  717|  13.3k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (717:38): [True: 0, False: 13.3k]
  ------------------
  718|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (718:9): [True: 0, False: 0]
  ------------------
  719|      0|      size_t new_space = (long)sptr->rows_in_array *
  720|      0|                         (long)sptr->samplesperrow * sample_size;
  721|       |
  722|      0|      space_per_minheight += (long)sptr->maxaccess *
  723|      0|                             (long)sptr->samplesperrow * sample_size;
  724|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (724:11): [True: 0, False: 0]
  ------------------
  725|      0|        out_of_memory(cinfo, 10);
  726|      0|      maximum_space += new_space;
  727|      0|    }
  728|      0|  }
  729|  29.2k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (729:38): [True: 15.9k, False: 13.3k]
  ------------------
  730|  15.9k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (730:9): [True: 15.9k, False: 0]
  ------------------
  731|  15.9k|      size_t new_space = (long)bptr->rows_in_array *
  732|  15.9k|                         (long)bptr->blocksperrow * sizeof(JBLOCK);
  733|       |
  734|  15.9k|      space_per_minheight += (long)bptr->maxaccess *
  735|  15.9k|                             (long)bptr->blocksperrow * sizeof(JBLOCK);
  736|  15.9k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (736:11): [True: 0, False: 15.9k]
  ------------------
  737|      0|        out_of_memory(cinfo, 11);
  738|  15.9k|      maximum_space += new_space;
  739|  15.9k|    }
  740|  15.9k|  }
  741|       |
  742|  13.3k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (742:7): [True: 7.03k, False: 6.30k]
  ------------------
  743|  7.03k|    return;                     /* no unrealized arrays, no work */
  744|       |
  745|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  746|  6.30k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  747|  6.30k|                                 mem->total_space_allocated);
  748|       |
  749|       |  /* If the maximum space needed is available, make all the buffers full
  750|       |   * height; otherwise parcel it out with the same number of minheights
  751|       |   * in each buffer.
  752|       |   */
  753|  6.30k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (753:7): [True: 6.30k, False: 0]
  ------------------
  754|  6.30k|    max_minheights = 1000000000L;
  755|      0|  else {
  756|      0|    max_minheights = avail_mem / space_per_minheight;
  757|       |    /* If there doesn't seem to be enough space, try to get the minimum
  758|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  759|       |     */
  760|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (760:9): [True: 0, False: 0]
  ------------------
  761|      0|      max_minheights = 1;
  762|      0|  }
  763|       |
  764|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  765|       |
  766|  6.30k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (766:38): [True: 0, False: 6.30k]
  ------------------
  767|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (767:9): [True: 0, False: 0]
  ------------------
  768|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  769|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (769:11): [True: 0, False: 0]
  ------------------
  770|       |        /* This buffer fits in memory */
  771|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  772|      0|      } else {
  773|       |        /* It doesn't fit in memory, create backing store. */
  774|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  775|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  776|      0|                                (long)sptr->rows_in_array *
  777|      0|                                (long)sptr->samplesperrow *
  778|      0|                                (long)sample_size);
  779|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  780|      0|      }
  781|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  782|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  783|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  784|      0|      sptr->cur_start_row = 0;
  785|      0|      sptr->first_undef_row = 0;
  786|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  787|      0|    }
  788|      0|  }
  789|       |
  790|  22.2k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (790:38): [True: 15.9k, False: 6.30k]
  ------------------
  791|  15.9k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (791:9): [True: 15.9k, False: 0]
  ------------------
  792|  15.9k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  793|  15.9k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (793:11): [True: 15.9k, False: 0]
  ------------------
  794|       |        /* This buffer fits in memory */
  795|  15.9k|        bptr->rows_in_mem = bptr->rows_in_array;
  796|  15.9k|      } else {
  797|       |        /* It doesn't fit in memory, create backing store. */
  798|      0|        bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
  799|      0|        jpeg_open_backing_store(cinfo, &bptr->b_s_info,
  800|      0|                                (long)bptr->rows_in_array *
  801|      0|                                (long)bptr->blocksperrow *
  802|      0|                                (long)sizeof(JBLOCK));
  803|      0|        bptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  804|      0|      }
  805|  15.9k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  15.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  806|  15.9k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  807|  15.9k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  808|  15.9k|      bptr->cur_start_row = 0;
  809|  15.9k|      bptr->first_undef_row = 0;
  810|  15.9k|      bptr->dirty = FALSE;
  ------------------
  |  |  206|  15.9k|#define FALSE   0               /* values of boolean */
  ------------------
  811|  15.9k|    }
  812|  15.9k|  }
  813|  6.30k|}
jmemmgr.c:access_virt_barray:
 1014|  25.2M|{
 1015|  25.2M|  JDIMENSION end_row = start_row + num_rows;
 1016|  25.2M|  JDIMENSION undef_row;
 1017|       |
 1018|       |  /* debugging check */
 1019|  25.2M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1019:7): [True: 0, False: 25.2M]
  |  Branch (1019:39): [True: 0, False: 25.2M]
  ------------------
 1020|  25.2M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1020:7): [True: 0, False: 25.2M]
  ------------------
 1021|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1022|       |
 1023|       |  /* Make the desired part of the virtual array accessible */
 1024|  25.2M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1024:7): [True: 0, False: 25.2M]
  ------------------
 1025|  25.2M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1025:7): [True: 0, False: 25.2M]
  ------------------
 1026|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (1026:9): [True: 0, False: 0]
  ------------------
 1027|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1028|       |    /* Flush old buffer contents if necessary */
 1029|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (1029:9): [True: 0, False: 0]
  ------------------
 1030|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1031|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1032|      0|    }
 1033|       |    /* Decide what part of virtual array to access.
 1034|       |     * Algorithm: if target address > current window, assume forward scan,
 1035|       |     * load starting at target address.  If target address < current window,
 1036|       |     * assume backward scan, load so that target area is top of window.
 1037|       |     * Note that when switching from forward write to forward read, will have
 1038|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
 1039|       |     */
 1040|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (1040:9): [True: 0, False: 0]
  ------------------
 1041|      0|      ptr->cur_start_row = start_row;
 1042|      0|    } else {
 1043|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
 1044|      0|      long ltemp;
 1045|       |
 1046|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
 1047|      0|      if (ltemp < 0)
  ------------------
  |  Branch (1047:11): [True: 0, False: 0]
  ------------------
 1048|      0|        ltemp = 0;              /* don't fall off front end of file */
 1049|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
 1050|      0|    }
 1051|       |    /* Read in the selected part of the array.
 1052|       |     * During the initial write pass, we will do no actual read
 1053|       |     * because the selected part is all undefined.
 1054|       |     */
 1055|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1056|      0|  }
 1057|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
 1058|       |   * To improve locality of access, we only prezero the part of the array
 1059|       |   * that the caller is about to access, not the entire in-memory array.
 1060|       |   */
 1061|  25.2M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1061:7): [True: 1.91M, False: 23.3M]
  ------------------
 1062|  1.91M|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1062:9): [True: 898k, False: 1.02M]
  ------------------
 1063|   898k|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1063:11): [True: 0, False: 898k]
  ------------------
 1064|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1065|   898k|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1066|  1.02M|    } else {
 1067|  1.02M|      undef_row = ptr->first_undef_row;
 1068|  1.02M|    }
 1069|  1.91M|    if (writable)
  ------------------
  |  Branch (1069:9): [True: 1.01M, False: 906k]
  ------------------
 1070|  1.01M|      ptr->first_undef_row = end_row;
 1071|  1.91M|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1071:9): [True: 1.80M, False: 119k]
  ------------------
 1072|  1.80M|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1073|  1.80M|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1074|  1.80M|      end_row -= ptr->cur_start_row;
 1075|  4.40M|      while (undef_row < end_row) {
  ------------------
  |  Branch (1075:14): [True: 2.60M, False: 1.80M]
  ------------------
 1076|  2.60M|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1077|  2.60M|        undef_row++;
 1078|  2.60M|      }
 1079|  1.80M|    } else {
 1080|   119k|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (1080:11): [True: 0, False: 119k]
  ------------------
 1081|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1082|   119k|    }
 1083|  1.91M|  }
 1084|       |  /* Flag the buffer dirty if caller will write in it */
 1085|  25.2M|  if (writable)
  ------------------
  |  Branch (1085:7): [True: 7.15M, False: 18.1M]
  ------------------
 1086|  7.15M|    ptr->dirty = TRUE;
  ------------------
  |  |  209|  7.15M|#define TRUE    1
  ------------------
 1087|       |  /* Return address of proper part of the buffer */
 1088|  25.2M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1089|  25.2M|}
jmemmgr.c:free_pool:
 1098|  41.9k|{
 1099|  41.9k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1100|  41.9k|  small_pool_ptr shdr_ptr;
 1101|  41.9k|  large_pool_ptr lhdr_ptr;
 1102|  41.9k|  size_t space_freed;
 1103|       |
 1104|  41.9k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  874|  41.9k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1104:7): [True: 0, False: 41.9k]
  |  Branch (1104:22): [True: 0, False: 41.9k]
  ------------------
 1105|      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)))
  ------------------
 1106|       |
 1107|       |#ifdef MEM_STATS
 1108|       |  if (cinfo->err->trace_level > 1)
 1109|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1110|       |#endif
 1111|       |
 1112|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1113|  41.9k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  873|  41.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1113:7): [True: 30.9k, False: 11.0k]
  ------------------
 1114|  30.9k|    jvirt_sarray_ptr sptr;
 1115|  30.9k|    jvirt_barray_ptr bptr;
 1116|       |
 1117|  30.9k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1117:40): [True: 0, False: 30.9k]
  ------------------
 1118|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1118:11): [True: 0, False: 0]
  ------------------
 1119|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1120|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1121|      0|      }
 1122|      0|    }
 1123|  30.9k|    mem->virt_sarray_list = NULL;
 1124|  47.0k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1124:40): [True: 16.0k, False: 30.9k]
  ------------------
 1125|  16.0k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1125:11): [True: 0, False: 16.0k]
  ------------------
 1126|      0|        bptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1127|      0|        (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
 1128|      0|      }
 1129|  16.0k|    }
 1130|  30.9k|    mem->virt_barray_list = NULL;
 1131|  30.9k|  }
 1132|       |
 1133|       |  /* Release large objects */
 1134|  41.9k|  lhdr_ptr = mem->large_list[pool_id];
 1135|  41.9k|  mem->large_list[pool_id] = NULL;
 1136|       |
 1137|   390k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1137:10): [True: 348k, False: 41.9k]
  ------------------
 1138|   348k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1139|   348k|    space_freed = lhdr_ptr->bytes_used +
 1140|   348k|                  lhdr_ptr->bytes_left +
 1141|   348k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   348k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1142|   348k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1143|   348k|    mem->total_space_allocated -= space_freed;
 1144|   348k|    lhdr_ptr = next_lhdr_ptr;
 1145|   348k|  }
 1146|       |
 1147|       |  /* Release small objects */
 1148|  41.9k|  shdr_ptr = mem->small_list[pool_id];
 1149|  41.9k|  mem->small_list[pool_id] = NULL;
 1150|       |
 1151|  87.4k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1151:10): [True: 45.4k, False: 41.9k]
  ------------------
 1152|  45.4k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1153|  45.4k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1154|  45.4k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  45.4k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1155|  45.4k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1156|  45.4k|    mem->total_space_allocated -= space_freed;
 1157|  45.4k|    shdr_ptr = next_shdr_ptr;
 1158|  45.4k|  }
 1159|  41.9k|}
jmemmgr.c:self_destruct:
 1169|  11.0k|{
 1170|  11.0k|  int pool;
 1171|       |
 1172|       |  /* Close all backing store, release all memory.
 1173|       |   * Releasing pools in reverse order might help avoid fragmentation
 1174|       |   * with some (brain-damaged) malloc libraries.
 1175|       |   */
 1176|  33.0k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  874|  11.0k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  872|  33.0k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1176:35): [True: 22.0k, False: 11.0k]
  ------------------
 1177|  22.0k|    free_pool(cinfo, pool);
 1178|  22.0k|  }
 1179|       |
 1180|       |  /* Release the memory manager control block too. */
 1181|  11.0k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1182|  11.0k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1183|       |
 1184|  11.0k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1185|  11.0k|}

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

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

jdiv_round_up:
   81|   154k|{
   82|   154k|  return (a + b - 1L) / b;
   83|   154k|}
jround_up:
   90|  19.6k|{
   91|  19.6k|  a += b - 1L;
   92|  19.6k|  return a - (a % b);
   93|  19.6k|}
jzero_far:
  144|  2.61M|{
  145|  2.61M|  memset(target, 0, bytestozero);
  146|  2.61M|}

jsimd_can_huff_encode_one_block:
 1039|    854|{
 1040|    854|  init_simd();
 1041|       |
 1042|    854|  if (DCTSIZE != 8)
  ------------------
  |  |   55|    854|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1042:7): [Folded - Ignored]
  ------------------
 1043|      0|    return 0;
 1044|    854|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1044:7): [Folded - Ignored]
  ------------------
 1045|      0|    return 0;
 1046|       |
 1047|    854|  if ((simd_support & JSIMD_SSE2) && simd_huffman &&
  ------------------
  |  |   24|    854|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (1047:7): [True: 854, False: 0]
  |  Branch (1047:38): [True: 854, False: 0]
  ------------------
 1048|    854|      IS_ALIGNED_SSE(jconst_huff_encode_one_block))
  ------------------
  |  |   31|    854|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|    854|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 854, False: 0]
  |  |  ------------------
  ------------------
 1049|    854|    return 1;
 1050|       |
 1051|      0|  return 0;
 1052|    854|}
jsimd_huff_encode_one_block:
 1058|   569k|{
 1059|   569k|  return jsimd_huff_encode_one_block_sse2(state, buffer, block, last_dc_val,
 1060|   569k|                                          dctbl, actbl);
 1061|   569k|}
jsimd_can_encode_mcu_AC_first_prepare:
 1065|  18.5k|{
 1066|  18.5k|  init_simd();
 1067|       |
 1068|  18.5k|  if (DCTSIZE != 8)
  ------------------
  |  |   55|  18.5k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1068:7): [Folded - Ignored]
  ------------------
 1069|      0|    return 0;
 1070|  18.5k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1070:7): [Folded - Ignored]
  ------------------
 1071|      0|    return 0;
 1072|  18.5k|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   24|  18.5k|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (1072:7): [True: 18.5k, False: 0]
  ------------------
 1073|  18.5k|    return 1;
 1074|       |
 1075|      0|  return 0;
 1076|  18.5k|}
jsimd_encode_mcu_AC_first_prepare:
 1082|  40.9M|{
 1083|  40.9M|  jsimd_encode_mcu_AC_first_prepare_sse2(block, jpeg_natural_order_start,
 1084|  40.9M|                                         Sl, Al, values, zerobits);
 1085|  40.9M|}
jsimd_can_encode_mcu_AC_refine_prepare:
 1089|  12.7k|{
 1090|  12.7k|  init_simd();
 1091|       |
 1092|  12.7k|  if (DCTSIZE != 8)
  ------------------
  |  |   55|  12.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1092:7): [Folded - Ignored]
  ------------------
 1093|      0|    return 0;
 1094|  12.7k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1094:7): [Folded - Ignored]
  ------------------
 1095|      0|    return 0;
 1096|  12.7k|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   24|  12.7k|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (1096:7): [True: 12.7k, False: 0]
  ------------------
 1097|  12.7k|    return 1;
 1098|       |
 1099|      0|  return 0;
 1100|  12.7k|}
jsimd_encode_mcu_AC_refine_prepare:
 1106|  40.4M|{
 1107|  40.4M|  return jsimd_encode_mcu_AC_refine_prepare_sse2(block,
 1108|  40.4M|                                                 jpeg_natural_order_start,
 1109|  40.4M|                                                 Sl, Al, absvalues, bits);
 1110|  40.4M|}
jsimd.c:init_simd:
   42|  32.1k|{
   43|  32.1k|#ifndef NO_GETENV
   44|  32.1k|  char env[2] = { 0 };
   45|  32.1k|#endif
   46|       |
   47|  32.1k|  if (simd_support != ~0U)
  ------------------
  |  Branch (47:7): [True: 32.1k, False: 1]
  ------------------
   48|  32.1k|    return;
   49|       |
   50|      1|  simd_support = jpeg_simd_cpu_support();
   51|       |
   52|      1|#ifndef NO_GETENV
   53|       |  /* Force different settings through environment variables */
   54|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (54:7): [True: 1, False: 0]
  |  Branch (54:47): [True: 0, False: 1]
  ------------------
   55|      0|    simd_support &= JSIMD_SSE2;
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
   56|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCEAVX2") && !strcmp(env, "1"))
  ------------------
  |  Branch (56:7): [True: 1, False: 0]
  |  Branch (56:47): [True: 0, False: 1]
  ------------------
   57|      0|    simd_support &= JSIMD_AVX2;
  ------------------
  |  |   28|      0|#define JSIMD_AVX2     0x80
  ------------------
   58|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (58:7): [True: 1, False: 0]
  |  Branch (58:47): [True: 0, False: 1]
  ------------------
   59|      0|    simd_support = 0;
   60|      1|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (60:7): [True: 1, False: 0]
  |  Branch (60:47): [True: 0, False: 1]
  ------------------
   61|      0|    simd_huffman = 0;
   62|      1|#endif
   63|      1|}

jtransform_request_workspace:
 1494|  14.3k|{
 1495|  14.3k|  jvirt_barray_ptr *coef_arrays;
 1496|  14.3k|  boolean need_workspace, transpose_it;
 1497|  14.3k|  jpeg_component_info *compptr;
 1498|  14.3k|  JDIMENSION xoffset, yoffset, dtemp;
 1499|  14.3k|  JDIMENSION width_in_iMCUs, height_in_iMCUs;
 1500|  14.3k|  JDIMENSION width_in_blocks, height_in_blocks;
 1501|  14.3k|  int itemp, ci, h_samp_factor, v_samp_factor;
 1502|       |
 1503|       |  /* Determine number of components in output image */
 1504|  14.3k|  if (info->force_grayscale &&
  ------------------
  |  Branch (1504:7): [True: 3.99k, False: 10.3k]
  ------------------
 1505|  14.3k|      srcinfo->jpeg_color_space == JCS_YCbCr &&
  ------------------
  |  Branch (1505:7): [True: 882, False: 3.11k]
  ------------------
 1506|  14.3k|      srcinfo->num_components == 3)
  ------------------
  |  Branch (1506:7): [True: 882, False: 0]
  ------------------
 1507|       |    /* We'll only process the first component */
 1508|    882|    info->num_components = 1;
 1509|  13.4k|  else
 1510|       |    /* Process all the components */
 1511|  13.4k|    info->num_components = srcinfo->num_components;
 1512|       |
 1513|       |  /* Compute output image dimensions and related values. */
 1514|       |#if JPEG_LIB_VERSION >= 80
 1515|       |  jpeg_core_output_dimensions(srcinfo);
 1516|       |#else
 1517|  14.3k|  srcinfo->output_width = srcinfo->image_width;
 1518|  14.3k|  srcinfo->output_height = srcinfo->image_height;
 1519|  14.3k|#endif
 1520|       |
 1521|       |  /* Return right away if -perfect is given and transformation is not perfect.
 1522|       |   */
 1523|  14.3k|  if (info->perfect) {
  ------------------
  |  Branch (1523:7): [True: 0, False: 14.3k]
  ------------------
 1524|      0|    if (info->num_components == 1) {
  ------------------
  |  Branch (1524:9): [True: 0, False: 0]
  ------------------
 1525|      0|      if (!jtransform_perfect_transform(srcinfo->output_width,
  ------------------
  |  Branch (1525:11): [True: 0, False: 0]
  ------------------
 1526|      0|          srcinfo->output_height,
 1527|      0|          srcinfo->_min_DCT_h_scaled_size,
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1528|      0|          srcinfo->_min_DCT_v_scaled_size,
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1529|      0|          info->transform))
 1530|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1531|      0|    } else {
 1532|      0|      if (!jtransform_perfect_transform(srcinfo->output_width,
  ------------------
  |  Branch (1532:11): [True: 0, False: 0]
  ------------------
 1533|      0|          srcinfo->output_height,
 1534|      0|          srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size,
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1535|      0|          srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size,
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1536|      0|          info->transform))
 1537|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1538|      0|    }
 1539|      0|  }
 1540|       |
 1541|       |  /* If there is only one output component, force the iMCU size to be 1;
 1542|       |   * else use the source iMCU size.  (This allows us to do the right thing
 1543|       |   * when reducing color to grayscale, and also provides a handy way of
 1544|       |   * cleaning up "funny" grayscale images whose sampling factors are not 1x1.)
 1545|       |   */
 1546|  14.3k|  switch (info->transform) {
 1547|  3.99k|  case JXFORM_TRANSPOSE:
  ------------------
  |  Branch (1547:3): [True: 3.99k, False: 10.3k]
  ------------------
 1548|  3.99k|  case JXFORM_TRANSVERSE:
  ------------------
  |  Branch (1548:3): [True: 0, False: 14.3k]
  ------------------
 1549|  6.34k|  case JXFORM_ROT_90:
  ------------------
  |  Branch (1549:3): [True: 2.34k, False: 11.9k]
  ------------------
 1550|  6.34k|  case JXFORM_ROT_270:
  ------------------
  |  Branch (1550:3): [True: 0, False: 14.3k]
  ------------------
 1551|  6.34k|    info->output_width = srcinfo->output_height;
 1552|  6.34k|    info->output_height = srcinfo->output_width;
 1553|  6.34k|    if (info->num_components == 1) {
  ------------------
  |  Branch (1553:9): [True: 5.55k, False: 793]
  ------------------
 1554|  5.55k|      info->iMCU_sample_width = srcinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  5.55k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1555|  5.55k|      info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  5.55k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1556|  5.55k|    } else {
 1557|    793|      info->iMCU_sample_width =
 1558|    793|        srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|    793|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1559|    793|      info->iMCU_sample_height =
 1560|    793|        srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|    793|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1561|    793|    }
 1562|  6.34k|    break;
 1563|  7.99k|  default:
  ------------------
  |  Branch (1563:3): [True: 7.99k, False: 6.34k]
  ------------------
 1564|  7.99k|    info->output_width = srcinfo->output_width;
 1565|  7.99k|    info->output_height = srcinfo->output_height;
 1566|  7.99k|    if (info->num_components == 1) {
  ------------------
  |  Branch (1566:9): [True: 5.85k, False: 2.14k]
  ------------------
 1567|  5.85k|      info->iMCU_sample_width = srcinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  5.85k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1568|  5.85k|      info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  5.85k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1569|  5.85k|    } else {
 1570|  2.14k|      info->iMCU_sample_width =
 1571|  2.14k|        srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  2.14k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
 1572|  2.14k|      info->iMCU_sample_height =
 1573|  2.14k|        srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  2.14k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
 1574|  2.14k|    }
 1575|  7.99k|    break;
 1576|  14.3k|  }
 1577|       |
 1578|       |  /* If cropping has been requested, compute the crop area's position and
 1579|       |   * dimensions, ensuring that its upper left corner falls at an iMCU boundary.
 1580|       |   */
 1581|  14.3k|  if (info->crop) {
  ------------------
  |  Branch (1581:7): [True: 3.99k, False: 10.3k]
  ------------------
 1582|       |    /* Insert default values for unset crop parameters */
 1583|  3.99k|    if (info->crop_xoffset_set == JCROP_UNSET)
  ------------------
  |  Branch (1583:9): [True: 0, False: 3.99k]
  ------------------
 1584|      0|      info->crop_xoffset = 0;   /* default to +0 */
 1585|  3.99k|    if (info->crop_yoffset_set == JCROP_UNSET)
  ------------------
  |  Branch (1585:9): [True: 0, False: 3.99k]
  ------------------
 1586|      0|      info->crop_yoffset = 0;   /* default to +0 */
 1587|  3.99k|    if (info->crop_width_set == JCROP_UNSET) {
  ------------------
  |  Branch (1587:9): [True: 0, False: 3.99k]
  ------------------
 1588|      0|      if (info->crop_xoffset >= info->output_width)
  ------------------
  |  Branch (1588:11): [True: 0, False: 0]
  ------------------
 1589|      0|        ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1590|      0|      info->crop_width = info->output_width - info->crop_xoffset;
 1591|  3.99k|    } else {
 1592|       |      /* Check for crop extension */
 1593|  3.99k|      if (info->crop_width > info->output_width) {
  ------------------
  |  Branch (1593:11): [True: 719, False: 3.27k]
  ------------------
 1594|       |        /* Crop extension does not work when transforming! */
 1595|    719|        if (info->transform != JXFORM_NONE ||
  ------------------
  |  Branch (1595:13): [True: 719, False: 0]
  ------------------
 1596|    719|            info->crop_xoffset >= info->crop_width ||
  ------------------
  |  Branch (1596:13): [True: 0, False: 0]
  ------------------
 1597|    719|            info->crop_xoffset > info->crop_width - info->output_width)
  ------------------
  |  Branch (1597:13): [True: 0, False: 0]
  ------------------
 1598|    719|          ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|    719|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    719|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1599|  3.27k|      } else {
 1600|  3.27k|        if (info->crop_xoffset >= info->output_width ||
  ------------------
  |  Branch (1600:13): [True: 0, False: 3.27k]
  ------------------
 1601|  3.27k|            info->crop_width <= 0 ||
  ------------------
  |  Branch (1601:13): [True: 0, False: 3.27k]
  ------------------
 1602|  3.27k|            info->crop_xoffset > info->output_width - info->crop_width)
  ------------------
  |  Branch (1602:13): [True: 0, False: 3.27k]
  ------------------
 1603|      0|          ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1604|  3.27k|      }
 1605|  3.99k|    }
 1606|  3.99k|    if (info->crop_height_set == JCROP_UNSET) {
  ------------------
  |  Branch (1606:9): [True: 0, False: 3.99k]
  ------------------
 1607|      0|      if (info->crop_yoffset >= info->output_height)
  ------------------
  |  Branch (1607:11): [True: 0, False: 0]
  ------------------
 1608|      0|        ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1609|      0|      info->crop_height = info->output_height - info->crop_yoffset;
 1610|  3.99k|    } else {
 1611|       |      /* Check for crop extension */
 1612|  3.99k|      if (info->crop_height > info->output_height) {
  ------------------
  |  Branch (1612:11): [True: 871, False: 3.12k]
  ------------------
 1613|       |        /* Crop extension does not work when transforming! */
 1614|    871|        if (info->transform != JXFORM_NONE ||
  ------------------
  |  Branch (1614:13): [True: 871, False: 0]
  ------------------
 1615|    871|            info->crop_yoffset >= info->crop_height ||
  ------------------
  |  Branch (1615:13): [True: 0, False: 0]
  ------------------
 1616|    871|            info->crop_yoffset > info->crop_height - info->output_height)
  ------------------
  |  Branch (1616:13): [True: 0, False: 0]
  ------------------
 1617|    871|          ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|    871|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    871|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1618|  3.12k|      } else {
 1619|  3.12k|        if (info->crop_yoffset >= info->output_height ||
  ------------------
  |  Branch (1619:13): [True: 719, False: 2.40k]
  ------------------
 1620|  3.12k|            info->crop_height <= 0 ||
  ------------------
  |  Branch (1620:13): [True: 0, False: 2.40k]
  ------------------
 1621|  3.12k|            info->crop_yoffset > info->output_height - info->crop_height)
  ------------------
  |  Branch (1621:13): [True: 0, False: 2.40k]
  ------------------
 1622|      0|          ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1623|  3.12k|      }
 1624|  3.99k|    }
 1625|       |    /* Convert negative crop offsets into regular offsets */
 1626|  3.99k|    if (info->crop_xoffset_set != JCROP_NEG)
  ------------------
  |  Branch (1626:9): [True: 2.40k, False: 1.59k]
  ------------------
 1627|  2.40k|      xoffset = info->crop_xoffset;
 1628|  1.59k|    else if (info->crop_width > info->output_width) /* crop extension */
  ------------------
  |  Branch (1628:14): [True: 0, False: 1.59k]
  ------------------
 1629|      0|      xoffset = info->crop_width - info->output_width - info->crop_xoffset;
 1630|  1.59k|    else
 1631|  1.59k|      xoffset = info->output_width - info->crop_width - info->crop_xoffset;
 1632|  3.99k|    if (info->crop_yoffset_set != JCROP_NEG)
  ------------------
  |  Branch (1632:9): [True: 2.40k, False: 1.59k]
  ------------------
 1633|  2.40k|      yoffset = info->crop_yoffset;
 1634|  1.59k|    else if (info->crop_height > info->output_height) /* crop extension */
  ------------------
  |  Branch (1634:14): [True: 0, False: 1.59k]
  ------------------
 1635|      0|      yoffset = info->crop_height - info->output_height - info->crop_yoffset;
 1636|  1.59k|    else
 1637|  1.59k|      yoffset = info->output_height - info->crop_height - info->crop_yoffset;
 1638|       |    /* Now adjust so that upper left corner falls at an iMCU boundary */
 1639|  3.99k|    switch (info->transform) {
 1640|      0|    case JXFORM_DROP:
  ------------------
  |  Branch (1640:5): [True: 0, False: 3.99k]
  ------------------
 1641|       |      /* Ensure the effective drop region will not exceed the requested */
 1642|      0|      itemp = info->iMCU_sample_width;
 1643|      0|      dtemp = itemp - 1 - ((xoffset + itemp - 1) % itemp);
 1644|      0|      xoffset += dtemp;
 1645|      0|      if (info->crop_width <= dtemp)
  ------------------
  |  Branch (1645:11): [True: 0, False: 0]
  ------------------
 1646|      0|        info->drop_width = 0;
 1647|      0|      else if (xoffset + info->crop_width - dtemp == info->output_width)
  ------------------
  |  Branch (1647:16): [True: 0, False: 0]
  ------------------
 1648|       |        /* Matching right edge: include partial iMCU */
 1649|      0|        info->drop_width = (info->crop_width - dtemp + itemp - 1) / itemp;
 1650|      0|      else
 1651|      0|        info->drop_width = (info->crop_width - dtemp) / itemp;
 1652|      0|      itemp = info->iMCU_sample_height;
 1653|      0|      dtemp = itemp - 1 - ((yoffset + itemp - 1) % itemp);
 1654|      0|      yoffset += dtemp;
 1655|      0|      if (info->crop_height <= dtemp)
  ------------------
  |  Branch (1655:11): [True: 0, False: 0]
  ------------------
 1656|      0|        info->drop_height = 0;
 1657|      0|      else if (yoffset + info->crop_height - dtemp == info->output_height)
  ------------------
  |  Branch (1657:16): [True: 0, False: 0]
  ------------------
 1658|       |        /* Matching bottom edge: include partial iMCU */
 1659|      0|        info->drop_height = (info->crop_height - dtemp + itemp - 1) / itemp;
 1660|      0|      else
 1661|      0|        info->drop_height = (info->crop_height - dtemp) / itemp;
 1662|       |      /* Check if sampling factors match for dropping */
 1663|      0|      if (info->drop_width != 0 && info->drop_height != 0)
  ------------------
  |  Branch (1663:11): [True: 0, False: 0]
  |  Branch (1663:36): [True: 0, False: 0]
  ------------------
 1664|      0|        for (ci = 0; ci < info->num_components &&
  ------------------
  |  Branch (1664:22): [True: 0, False: 0]
  ------------------
 1665|      0|                     ci < info->drop_ptr->num_components; ci++) {
  ------------------
  |  Branch (1665:22): [True: 0, False: 0]
  ------------------
 1666|      0|          if (info->drop_ptr->comp_info[ci].h_samp_factor *
  ------------------
  |  Branch (1666:15): [True: 0, False: 0]
  ------------------
 1667|      0|              srcinfo->max_h_samp_factor !=
 1668|      0|              srcinfo->comp_info[ci].h_samp_factor *
 1669|      0|              info->drop_ptr->max_h_samp_factor)
 1670|      0|            ERREXIT6(srcinfo, JERR_BAD_DROP_SAMPLING, ci,
  ------------------
  |  |  265|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  266|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  267|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  268|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  269|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  270|      0|   (cinfo)->err->msg_parm.i[4] = (p5), \
  |  |  271|      0|   (cinfo)->err->msg_parm.i[5] = (p6), \
  |  |  272|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1671|      0|              info->drop_ptr->comp_info[ci].h_samp_factor,
 1672|      0|              info->drop_ptr->max_h_samp_factor,
 1673|      0|              srcinfo->comp_info[ci].h_samp_factor,
 1674|      0|              srcinfo->max_h_samp_factor, 'h');
 1675|      0|          if (info->drop_ptr->comp_info[ci].v_samp_factor *
  ------------------
  |  Branch (1675:15): [True: 0, False: 0]
  ------------------
 1676|      0|              srcinfo->max_v_samp_factor !=
 1677|      0|              srcinfo->comp_info[ci].v_samp_factor *
 1678|      0|              info->drop_ptr->max_v_samp_factor)
 1679|      0|            ERREXIT6(srcinfo, JERR_BAD_DROP_SAMPLING, ci,
  ------------------
  |  |  265|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  266|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  267|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  268|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  269|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  270|      0|   (cinfo)->err->msg_parm.i[4] = (p5), \
  |  |  271|      0|   (cinfo)->err->msg_parm.i[5] = (p6), \
  |  |  272|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1680|      0|              info->drop_ptr->comp_info[ci].v_samp_factor,
 1681|      0|              info->drop_ptr->max_v_samp_factor,
 1682|      0|              srcinfo->comp_info[ci].v_samp_factor,
 1683|      0|              srcinfo->max_v_samp_factor, 'v');
 1684|      0|        }
 1685|      0|      break;
 1686|      0|    case JXFORM_WIPE:
  ------------------
  |  Branch (1686:5): [True: 0, False: 3.99k]
  ------------------
 1687|       |      /* Ensure the effective wipe region will cover the requested */
 1688|      0|      info->drop_width = (JDIMENSION)jdiv_round_up
 1689|      0|        ((long)(info->crop_width + (xoffset % info->iMCU_sample_width)),
 1690|      0|         (long)info->iMCU_sample_width);
 1691|      0|      info->drop_height = (JDIMENSION)jdiv_round_up
 1692|      0|        ((long)(info->crop_height + (yoffset % info->iMCU_sample_height)),
 1693|      0|         (long)info->iMCU_sample_height);
 1694|      0|      break;
 1695|  2.40k|    default:
  ------------------
  |  Branch (1695:5): [True: 2.40k, False: 1.59k]
  ------------------
 1696|       |      /* Ensure the effective crop region will cover the requested */
 1697|  2.40k|      if (info->crop_width_set == JCROP_FORCE ||
  ------------------
  |  Branch (1697:11): [True: 0, False: 2.40k]
  ------------------
 1698|  2.40k|          info->crop_width > info->output_width)
  ------------------
  |  Branch (1698:11): [True: 0, False: 2.40k]
  ------------------
 1699|      0|        info->output_width = info->crop_width;
 1700|  2.40k|      else
 1701|  2.40k|        info->output_width =
 1702|  2.40k|          info->crop_width + (xoffset % info->iMCU_sample_width);
 1703|  2.40k|      if (info->crop_height_set == JCROP_FORCE ||
  ------------------
  |  Branch (1703:11): [True: 0, False: 2.40k]
  ------------------
 1704|  2.40k|          info->crop_height > info->output_height)
  ------------------
  |  Branch (1704:11): [True: 0, False: 2.40k]
  ------------------
 1705|      0|        info->output_height = info->crop_height;
 1706|  2.40k|      else
 1707|  2.40k|        info->output_height =
 1708|  2.40k|          info->crop_height + (yoffset % info->iMCU_sample_height);
 1709|  3.99k|    }
 1710|       |    /* Save x/y offsets measured in iMCUs */
 1711|  2.40k|    info->x_crop_offset = xoffset / info->iMCU_sample_width;
 1712|  2.40k|    info->y_crop_offset = yoffset / info->iMCU_sample_height;
 1713|  10.3k|  } else {
 1714|  10.3k|    info->x_crop_offset = 0;
 1715|  10.3k|    info->y_crop_offset = 0;
 1716|  10.3k|  }
 1717|       |
 1718|       |  /* Figure out whether we need workspace arrays,
 1719|       |   * and if so whether they are transposed relative to the source.
 1720|       |   */
 1721|  12.7k|  need_workspace = FALSE;
  ------------------
  |  |  206|  12.7k|#define FALSE   0               /* values of boolean */
  ------------------
 1722|  12.7k|  transpose_it = FALSE;
  ------------------
  |  |  206|  12.7k|#define FALSE   0               /* values of boolean */
  ------------------
 1723|  12.7k|  switch (info->transform) {
  ------------------
  |  Branch (1723:11): [True: 0, False: 12.7k]
  ------------------
 1724|  7.99k|  case JXFORM_NONE:
  ------------------
  |  Branch (1724:3): [True: 7.99k, False: 4.75k]
  ------------------
 1725|  7.99k|    if (info->x_crop_offset != 0 || info->y_crop_offset != 0 ||
  ------------------
  |  Branch (1725:9): [True: 0, False: 7.99k]
  |  Branch (1725:37): [True: 0, False: 7.99k]
  ------------------
 1726|  7.99k|        info->output_width > srcinfo->output_width ||
  ------------------
  |  Branch (1726:9): [True: 0, False: 7.99k]
  ------------------
 1727|  7.99k|        info->output_height > srcinfo->output_height)
  ------------------
  |  Branch (1727:9): [True: 0, False: 7.99k]
  ------------------
 1728|      0|      need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1729|       |    /* No workspace needed if neither cropping nor transforming */
 1730|  7.99k|    break;
 1731|      0|  case JXFORM_FLIP_H:
  ------------------
  |  Branch (1731:3): [True: 0, False: 12.7k]
  ------------------
 1732|      0|    if (info->trim)
  ------------------
  |  Branch (1732:9): [True: 0, False: 0]
  ------------------
 1733|      0|      trim_right_edge(info, srcinfo->output_width);
 1734|      0|    if (info->y_crop_offset != 0 || info->slow_hflip)
  ------------------
  |  Branch (1734:9): [True: 0, False: 0]
  |  Branch (1734:37): [True: 0, False: 0]
  ------------------
 1735|      0|      need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1736|       |    /* do_flip_h_no_crop doesn't need a workspace array */
 1737|      0|    break;
 1738|      0|  case JXFORM_FLIP_V:
  ------------------
  |  Branch (1738:3): [True: 0, False: 12.7k]
  ------------------
 1739|      0|    if (info->trim)
  ------------------
  |  Branch (1739:9): [True: 0, False: 0]
  ------------------
 1740|      0|      trim_bottom_edge(info, srcinfo->output_height);
 1741|       |    /* Need workspace arrays having same dimensions as source image. */
 1742|      0|    need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1743|      0|    break;
 1744|  2.40k|  case JXFORM_TRANSPOSE:
  ------------------
  |  Branch (1744:3): [True: 2.40k, False: 10.3k]
  ------------------
 1745|       |    /* transpose does NOT have to trim anything */
 1746|       |    /* Need workspace arrays having transposed dimensions. */
 1747|  2.40k|    need_workspace = TRUE;
  ------------------
  |  |  209|  2.40k|#define TRUE    1
  ------------------
 1748|  2.40k|    transpose_it = TRUE;
  ------------------
  |  |  209|  2.40k|#define TRUE    1
  ------------------
 1749|  2.40k|    break;
 1750|      0|  case JXFORM_TRANSVERSE:
  ------------------
  |  Branch (1750:3): [True: 0, False: 12.7k]
  ------------------
 1751|      0|    if (info->trim) {
  ------------------
  |  Branch (1751:9): [True: 0, False: 0]
  ------------------
 1752|      0|      trim_right_edge(info, srcinfo->output_height);
 1753|      0|      trim_bottom_edge(info, srcinfo->output_width);
 1754|      0|    }
 1755|       |    /* Need workspace arrays having transposed dimensions. */
 1756|      0|    need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1757|      0|    transpose_it = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1758|      0|    break;
 1759|  2.34k|  case JXFORM_ROT_90:
  ------------------
  |  Branch (1759:3): [True: 2.34k, False: 10.3k]
  ------------------
 1760|  2.34k|    if (info->trim)
  ------------------
  |  Branch (1760:9): [True: 2.34k, False: 0]
  ------------------
 1761|  2.34k|      trim_right_edge(info, srcinfo->output_height);
 1762|       |    /* Need workspace arrays having transposed dimensions. */
 1763|  2.34k|    need_workspace = TRUE;
  ------------------
  |  |  209|  2.34k|#define TRUE    1
  ------------------
 1764|  2.34k|    transpose_it = TRUE;
  ------------------
  |  |  209|  2.34k|#define TRUE    1
  ------------------
 1765|  2.34k|    break;
 1766|      0|  case JXFORM_ROT_180:
  ------------------
  |  Branch (1766:3): [True: 0, False: 12.7k]
  ------------------
 1767|      0|    if (info->trim) {
  ------------------
  |  Branch (1767:9): [True: 0, False: 0]
  ------------------
 1768|      0|      trim_right_edge(info, srcinfo->output_width);
 1769|      0|      trim_bottom_edge(info, srcinfo->output_height);
 1770|      0|    }
 1771|       |    /* Need workspace arrays having same dimensions as source image. */
 1772|      0|    need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1773|      0|    break;
 1774|      0|  case JXFORM_ROT_270:
  ------------------
  |  Branch (1774:3): [True: 0, False: 12.7k]
  ------------------
 1775|      0|    if (info->trim)
  ------------------
  |  Branch (1775:9): [True: 0, False: 0]
  ------------------
 1776|      0|      trim_bottom_edge(info, srcinfo->output_width);
 1777|       |    /* Need workspace arrays having transposed dimensions. */
 1778|      0|    need_workspace = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1779|      0|    transpose_it = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 1780|      0|    break;
 1781|      0|  case JXFORM_WIPE:
  ------------------
  |  Branch (1781:3): [True: 0, False: 12.7k]
  ------------------
 1782|      0|    break;
 1783|      0|  case JXFORM_DROP:
  ------------------
  |  Branch (1783:3): [True: 0, False: 12.7k]
  ------------------
 1784|      0|    break;
 1785|  12.7k|  }
 1786|       |
 1787|       |  /* Allocate workspace if needed.
 1788|       |   * Note that we allocate arrays padded out to the next iMCU boundary,
 1789|       |   * so that transform routines need not worry about missing edge blocks.
 1790|       |   */
 1791|  12.7k|  if (need_workspace) {
  ------------------
  |  Branch (1791:7): [True: 4.75k, False: 7.99k]
  ------------------
 1792|  4.75k|    coef_arrays = (jvirt_barray_ptr *)
 1793|  4.75k|      (*srcinfo->mem->alloc_small) ((j_common_ptr)srcinfo, JPOOL_IMAGE,
  ------------------
  |  |  873|  4.75k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1794|  4.75k|                sizeof(jvirt_barray_ptr) * info->num_components);
 1795|  4.75k|    width_in_iMCUs = (JDIMENSION)
 1796|  4.75k|      jdiv_round_up((long)info->output_width, (long)info->iMCU_sample_width);
 1797|  4.75k|    height_in_iMCUs = (JDIMENSION)
 1798|  4.75k|      jdiv_round_up((long)info->output_height, (long)info->iMCU_sample_height);
 1799|  11.0k|    for (ci = 0; ci < info->num_components; ci++) {
  ------------------
  |  Branch (1799:18): [True: 6.27k, False: 4.75k]
  ------------------
 1800|  6.27k|      compptr = srcinfo->comp_info + ci;
 1801|  6.27k|      if (info->num_components == 1) {
  ------------------
  |  Branch (1801:11): [True: 4.04k, False: 2.23k]
  ------------------
 1802|       |        /* we're going to force samp factors to 1x1 in this case */
 1803|  4.04k|        h_samp_factor = v_samp_factor = 1;
 1804|  4.04k|      } else if (transpose_it) {
  ------------------
  |  Branch (1804:18): [True: 2.23k, False: 0]
  ------------------
 1805|  2.23k|        h_samp_factor = compptr->v_samp_factor;
 1806|  2.23k|        v_samp_factor = compptr->h_samp_factor;
 1807|  2.23k|      } else {
 1808|      0|        h_samp_factor = compptr->h_samp_factor;
 1809|      0|        v_samp_factor = compptr->v_samp_factor;
 1810|      0|      }
 1811|  6.27k|      width_in_blocks = width_in_iMCUs * h_samp_factor;
 1812|  6.27k|      height_in_blocks = height_in_iMCUs * v_samp_factor;
 1813|  6.27k|      coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
 1814|  6.27k|        ((j_common_ptr)srcinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  873|  6.27k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)srcinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  206|  6.27k|#define FALSE   0               /* values of boolean */
  ------------------
 1815|  6.27k|         width_in_blocks, height_in_blocks, (JDIMENSION)v_samp_factor);
 1816|  6.27k|    }
 1817|  4.75k|    info->workspace_coef_arrays = coef_arrays;
 1818|  4.75k|  } else
 1819|  7.99k|    info->workspace_coef_arrays = NULL;
 1820|       |
 1821|  12.7k|  return TRUE;
  ------------------
  |  |  209|  12.7k|#define TRUE    1
  ------------------
 1822|  12.7k|}
jtransform_adjust_parameters:
 2042|  7.09k|{
 2043|       |  /* If force-to-grayscale is requested, adjust destination parameters */
 2044|  7.09k|  if (info->force_grayscale) {
  ------------------
  |  Branch (2044:7): [True: 1.47k, False: 5.61k]
  ------------------
 2045|       |    /* First, ensure we have YCbCr or grayscale data, and that the source's
 2046|       |     * Y channel is full resolution.  (No reasonable person would make Y
 2047|       |     * be less than full resolution, so actually coping with that case
 2048|       |     * isn't worth extra code space.  But we check it to avoid crashing.)
 2049|       |     */
 2050|  1.47k|    if (((dstinfo->jpeg_color_space == JCS_YCbCr &&
  ------------------
  |  Branch (2050:11): [True: 216, False: 1.26k]
  ------------------
 2051|  1.47k|          dstinfo->num_components == 3) ||
  ------------------
  |  Branch (2051:11): [True: 216, False: 0]
  ------------------
 2052|  1.47k|         (dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
  ------------------
  |  Branch (2052:11): [True: 1.19k, False: 63]
  ------------------
 2053|  1.26k|          dstinfo->num_components == 1)) &&
  ------------------
  |  Branch (2053:11): [True: 1.19k, False: 0]
  ------------------
 2054|  1.47k|        srcinfo->comp_info[0].h_samp_factor == srcinfo->max_h_samp_factor &&
  ------------------
  |  Branch (2054:9): [True: 1.41k, False: 0]
  ------------------
 2055|  1.47k|        srcinfo->comp_info[0].v_samp_factor == srcinfo->max_v_samp_factor) {
  ------------------
  |  Branch (2055:9): [True: 1.41k, False: 0]
  ------------------
 2056|       |      /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
 2057|       |       * properly.  Among other things, it sets the target h_samp_factor &
 2058|       |       * v_samp_factor to 1, which typically won't match the source.
 2059|       |       * We have to preserve the source's quantization table number, however.
 2060|       |       */
 2061|  1.41k|      int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no;
 2062|  1.41k|      jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE);
 2063|  1.41k|      dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no;
 2064|  1.41k|    } else {
 2065|       |      /* Sorry, can't do it */
 2066|     63|      ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     63|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     63|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 2067|     63|    }
 2068|  5.61k|  } else if (info->num_components == 1) {
  ------------------
  |  Branch (2068:14): [True: 4.57k, False: 1.04k]
  ------------------
 2069|       |    /* For a single-component source, we force the destination sampling factors
 2070|       |     * to 1x1, with or without force_grayscale.  This is useful because some
 2071|       |     * decoders choke on grayscale images with other sampling factors.
 2072|       |     */
 2073|  4.57k|    dstinfo->comp_info[0].h_samp_factor = 1;
 2074|  4.57k|    dstinfo->comp_info[0].v_samp_factor = 1;
 2075|  4.57k|  }
 2076|       |
 2077|       |  /* Correct the destination's image dimensions as necessary
 2078|       |   * for rotate/flip, resize, and crop operations.
 2079|       |   */
 2080|       |#if JPEG_LIB_VERSION >= 80
 2081|       |  dstinfo->jpeg_width = info->output_width;
 2082|       |  dstinfo->jpeg_height = info->output_height;
 2083|       |#endif
 2084|       |
 2085|       |  /* Transpose destination image parameters, adjust quantization */
 2086|  7.09k|  switch (info->transform) {
 2087|  1.41k|  case JXFORM_TRANSPOSE:
  ------------------
  |  Branch (2087:3): [True: 1.41k, False: 5.68k]
  ------------------
 2088|  1.41k|  case JXFORM_TRANSVERSE:
  ------------------
  |  Branch (2088:3): [True: 0, False: 7.09k]
  ------------------
 2089|  2.81k|  case JXFORM_ROT_90:
  ------------------
  |  Branch (2089:3): [True: 1.39k, False: 5.69k]
  ------------------
 2090|  2.81k|  case JXFORM_ROT_270:
  ------------------
  |  Branch (2090:3): [True: 0, False: 7.09k]
  ------------------
 2091|  2.81k|#if JPEG_LIB_VERSION < 80
 2092|  2.81k|    dstinfo->image_width = info->output_height;
 2093|  2.81k|    dstinfo->image_height = info->output_width;
 2094|  2.81k|#endif
 2095|  2.81k|    transpose_critical_parameters(dstinfo);
 2096|  2.81k|    break;
 2097|      0|  case JXFORM_DROP:
  ------------------
  |  Branch (2097:3): [True: 0, False: 7.09k]
  ------------------
 2098|      0|    if (info->drop_width != 0 && info->drop_height != 0)
  ------------------
  |  Branch (2098:9): [True: 0, False: 0]
  |  Branch (2098:34): [True: 0, False: 0]
  ------------------
 2099|      0|      adjust_quant(srcinfo, src_coef_arrays,
 2100|      0|                   info->drop_ptr, info->drop_coef_arrays,
 2101|      0|                   info->trim, dstinfo);
 2102|      0|    break;
 2103|  4.22k|  default:
  ------------------
  |  Branch (2103:3): [True: 4.22k, False: 2.87k]
  ------------------
 2104|  4.22k|#if JPEG_LIB_VERSION < 80
 2105|  4.22k|    dstinfo->image_width = info->output_width;
 2106|  4.22k|    dstinfo->image_height = info->output_height;
 2107|  4.22k|#endif
 2108|  4.22k|    break;
 2109|  7.09k|  }
 2110|       |
 2111|       |  /* Adjust Exif properties */
 2112|  7.03k|  if (srcinfo->marker_list != NULL &&
  ------------------
  |  Branch (2112:7): [True: 471, False: 6.56k]
  ------------------
 2113|  7.03k|      srcinfo->marker_list->marker == JPEG_APP0 + 1 &&
  ------------------
  |  | 1152|    471|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  |  Branch (2113:7): [True: 55, False: 416]
  ------------------
 2114|  7.03k|      srcinfo->marker_list->data_length >= 6 &&
  ------------------
  |  Branch (2114:7): [True: 40, False: 15]
  ------------------
 2115|  7.03k|      srcinfo->marker_list->data[0] == 0x45 &&
  ------------------
  |  Branch (2115:7): [True: 17, False: 23]
  ------------------
 2116|  7.03k|      srcinfo->marker_list->data[1] == 0x78 &&
  ------------------
  |  Branch (2116:7): [True: 8, False: 9]
  ------------------
 2117|  7.03k|      srcinfo->marker_list->data[2] == 0x69 &&
  ------------------
  |  Branch (2117:7): [True: 7, False: 1]
  ------------------
 2118|  7.03k|      srcinfo->marker_list->data[3] == 0x66 &&
  ------------------
  |  Branch (2118:7): [True: 3, False: 4]
  ------------------
 2119|  7.03k|      srcinfo->marker_list->data[4] == 0 &&
  ------------------
  |  Branch (2119:7): [True: 2, False: 1]
  ------------------
 2120|  7.03k|      srcinfo->marker_list->data[5] == 0) {
  ------------------
  |  Branch (2120:7): [True: 1, False: 1]
  ------------------
 2121|       |    /* Suppress output of JFIF marker */
 2122|      1|    dstinfo->write_JFIF_header = FALSE;
  ------------------
  |  |  206|      1|#define FALSE   0               /* values of boolean */
  ------------------
 2123|       |    /* Adjust Exif image parameters */
 2124|       |#if JPEG_LIB_VERSION >= 80
 2125|       |    if (dstinfo->jpeg_width != srcinfo->image_width ||
 2126|       |        dstinfo->jpeg_height != srcinfo->image_height)
 2127|       |      /* Align data segment to start of TIFF structure for parsing */
 2128|       |      adjust_exif_parameters(srcinfo->marker_list->data + 6,
 2129|       |                             srcinfo->marker_list->data_length - 6,
 2130|       |                             dstinfo->jpeg_width, dstinfo->jpeg_height);
 2131|       |#else
 2132|      1|    if (dstinfo->image_width != srcinfo->image_width ||
  ------------------
  |  Branch (2132:9): [True: 0, False: 1]
  ------------------
 2133|      1|        dstinfo->image_height != srcinfo->image_height)
  ------------------
  |  Branch (2133:9): [True: 0, False: 1]
  ------------------
 2134|       |      /* Align data segment to start of TIFF structure for parsing */
 2135|      0|      adjust_exif_parameters(srcinfo->marker_list->data + 6,
 2136|      0|                             srcinfo->marker_list->data_length - 6,
 2137|      0|                             dstinfo->image_width, dstinfo->image_height);
 2138|      1|#endif
 2139|      1|  }
 2140|       |
 2141|       |  /* Return the appropriate output data set */
 2142|  7.03k|  if (info->workspace_coef_arrays != NULL)
  ------------------
  |  Branch (2142:7): [True: 2.81k, False: 4.22k]
  ------------------
 2143|  2.81k|    return info->workspace_coef_arrays;
 2144|  4.22k|  return src_coef_arrays;
 2145|  7.03k|}
jtransform_execute_transform:
 2161|  7.03k|{
 2162|  7.03k|  jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays;
 2163|       |
 2164|       |  /* Note: conditions tested here should match those in switch statement
 2165|       |   * in jtransform_request_workspace()
 2166|       |   */
 2167|  7.03k|  switch (info->transform) {
  ------------------
  |  Branch (2167:11): [True: 0, False: 7.03k]
  ------------------
 2168|  4.22k|  case JXFORM_NONE:
  ------------------
  |  Branch (2168:3): [True: 4.22k, False: 2.81k]
  ------------------
 2169|  4.22k|    if (info->output_width > srcinfo->output_width ||
  ------------------
  |  Branch (2169:9): [True: 0, False: 4.22k]
  ------------------
 2170|  4.22k|        info->output_height > srcinfo->output_height) {
  ------------------
  |  Branch (2170:9): [True: 0, False: 4.22k]
  ------------------
 2171|      0|      if (info->output_width > srcinfo->output_width &&
  ------------------
  |  Branch (2171:11): [True: 0, False: 0]
  ------------------
 2172|      0|          info->crop_width_set == JCROP_REFLECT)
  ------------------
  |  Branch (2172:11): [True: 0, False: 0]
  ------------------
 2173|      0|        do_crop_ext_reflect(srcinfo, dstinfo,
 2174|      0|                            info->x_crop_offset, info->y_crop_offset,
 2175|      0|                            src_coef_arrays, dst_coef_arrays);
 2176|      0|      else if (info->output_width > srcinfo->output_width &&
  ------------------
  |  Branch (2176:16): [True: 0, False: 0]
  ------------------
 2177|      0|               info->crop_width_set == JCROP_FORCE)
  ------------------
  |  Branch (2177:16): [True: 0, False: 0]
  ------------------
 2178|      0|        do_crop_ext_flat(srcinfo, dstinfo,
 2179|      0|                         info->x_crop_offset, info->y_crop_offset,
 2180|      0|                         src_coef_arrays, dst_coef_arrays);
 2181|      0|      else
 2182|      0|        do_crop_ext_zero(srcinfo, dstinfo,
 2183|      0|                         info->x_crop_offset, info->y_crop_offset,
 2184|      0|                         src_coef_arrays, dst_coef_arrays);
 2185|  4.22k|    } else if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
  ------------------
  |  Branch (2185:16): [True: 0, False: 4.22k]
  |  Branch (2185:44): [True: 0, False: 4.22k]
  ------------------
 2186|      0|      do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2187|      0|              src_coef_arrays, dst_coef_arrays);
 2188|  4.22k|    break;
 2189|      0|  case JXFORM_FLIP_H:
  ------------------
  |  Branch (2189:3): [True: 0, False: 7.03k]
  ------------------
 2190|      0|    if (info->y_crop_offset != 0 || info->slow_hflip)
  ------------------
  |  Branch (2190:9): [True: 0, False: 0]
  |  Branch (2190:37): [True: 0, False: 0]
  ------------------
 2191|      0|      do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2192|      0|                src_coef_arrays, dst_coef_arrays);
 2193|      0|    else
 2194|      0|      do_flip_h_no_crop(srcinfo, dstinfo, info->x_crop_offset,
 2195|      0|                        src_coef_arrays);
 2196|      0|    break;
 2197|      0|  case JXFORM_FLIP_V:
  ------------------
  |  Branch (2197:3): [True: 0, False: 7.03k]
  ------------------
 2198|      0|    do_flip_v(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2199|      0|              src_coef_arrays, dst_coef_arrays);
 2200|      0|    break;
 2201|  1.41k|  case JXFORM_TRANSPOSE:
  ------------------
  |  Branch (2201:3): [True: 1.41k, False: 5.61k]
  ------------------
 2202|  1.41k|    do_transpose(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2203|  1.41k|                 src_coef_arrays, dst_coef_arrays);
 2204|  1.41k|    break;
 2205|      0|  case JXFORM_TRANSVERSE:
  ------------------
  |  Branch (2205:3): [True: 0, False: 7.03k]
  ------------------
 2206|      0|    do_transverse(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2207|      0|                  src_coef_arrays, dst_coef_arrays);
 2208|      0|    break;
 2209|  1.39k|  case JXFORM_ROT_90:
  ------------------
  |  Branch (2209:3): [True: 1.39k, False: 5.63k]
  ------------------
 2210|  1.39k|    do_rot_90(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2211|  1.39k|              src_coef_arrays, dst_coef_arrays);
 2212|  1.39k|    break;
 2213|      0|  case JXFORM_ROT_180:
  ------------------
  |  Branch (2213:3): [True: 0, False: 7.03k]
  ------------------
 2214|      0|    do_rot_180(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2215|      0|               src_coef_arrays, dst_coef_arrays);
 2216|      0|    break;
 2217|      0|  case JXFORM_ROT_270:
  ------------------
  |  Branch (2217:3): [True: 0, False: 7.03k]
  ------------------
 2218|      0|    do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2219|      0|               src_coef_arrays, dst_coef_arrays);
 2220|      0|    break;
 2221|      0|  case JXFORM_WIPE:
  ------------------
  |  Branch (2221:3): [True: 0, False: 7.03k]
  ------------------
 2222|      0|    if (info->crop_width_set == JCROP_REFLECT &&
  ------------------
  |  Branch (2222:9): [True: 0, False: 0]
  ------------------
 2223|      0|        info->y_crop_offset == 0 && info->drop_height ==
  ------------------
  |  Branch (2223:9): [True: 0, False: 0]
  |  Branch (2223:37): [True: 0, False: 0]
  ------------------
 2224|      0|        (JDIMENSION)jdiv_round_up
 2225|      0|          ((long)info->output_height, (long)info->iMCU_sample_height) &&
 2226|      0|        (info->x_crop_offset == 0 ||
  ------------------
  |  Branch (2226:10): [True: 0, False: 0]
  ------------------
 2227|      0|         info->x_crop_offset + info->drop_width ==
  ------------------
  |  Branch (2227:10): [True: 0, False: 0]
  ------------------
 2228|      0|         (JDIMENSION)jdiv_round_up
 2229|      0|           ((long)info->output_width, (long)info->iMCU_sample_width)))
 2230|      0|      do_reflect(srcinfo, dstinfo, info->x_crop_offset,
 2231|      0|                 src_coef_arrays, info->drop_width, info->drop_height);
 2232|      0|    else if (info->crop_width_set == JCROP_FORCE)
  ------------------
  |  Branch (2232:14): [True: 0, False: 0]
  ------------------
 2233|      0|      do_flatten(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2234|      0|                 src_coef_arrays, info->drop_width, info->drop_height);
 2235|      0|    else
 2236|      0|      do_wipe(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2237|      0|              src_coef_arrays, info->drop_width, info->drop_height);
 2238|      0|    break;
 2239|      0|  case JXFORM_DROP:
  ------------------
  |  Branch (2239:3): [True: 0, False: 7.03k]
  ------------------
 2240|      0|    if (info->drop_width != 0 && info->drop_height != 0)
  ------------------
  |  Branch (2240:9): [True: 0, False: 0]
  |  Branch (2240:34): [True: 0, False: 0]
  ------------------
 2241|      0|      do_drop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
 2242|      0|              src_coef_arrays, info->drop_ptr, info->drop_coef_arrays,
 2243|      0|              info->drop_width, info->drop_height);
 2244|      0|    break;
 2245|  7.03k|  }
 2246|  7.03k|}
jcopy_markers_setup:
 2310|  7.99k|{
 2311|  7.99k|#ifdef SAVE_MARKERS_SUPPORTED
 2312|  7.99k|  int m;
 2313|       |
 2314|       |  /* Save comments except under NONE option */
 2315|  7.99k|  if (option != JCOPYOPT_NONE && option != JCOPYOPT_ICC) {
  ------------------
  |  Branch (2315:7): [True: 3.99k, False: 3.99k]
  |  Branch (2315:34): [True: 3.99k, False: 0]
  ------------------
 2316|  3.99k|    jpeg_save_markers(srcinfo, JPEG_COM, 0xFFFF);
  ------------------
  |  | 1153|  3.99k|#define JPEG_COM        0xFE    /* COM marker code */
  ------------------
 2317|  3.99k|  }
 2318|       |  /* Save all types of APPn markers iff ALL option */
 2319|  7.99k|  if (option == JCOPYOPT_ALL || option == JCOPYOPT_ALL_EXCEPT_ICC) {
  ------------------
  |  Branch (2319:7): [True: 3.99k, False: 3.99k]
  |  Branch (2319:33): [True: 0, False: 3.99k]
  ------------------
 2320|  67.9k|    for (m = 0; m < 16; m++) {
  ------------------
  |  Branch (2320:17): [True: 63.9k, False: 3.99k]
  ------------------
 2321|  63.9k|      if (option == JCOPYOPT_ALL_EXCEPT_ICC && m == 2)
  ------------------
  |  Branch (2321:11): [True: 0, False: 63.9k]
  |  Branch (2321:48): [True: 0, False: 0]
  ------------------
 2322|      0|        continue;
 2323|  63.9k|      jpeg_save_markers(srcinfo, JPEG_APP0 + m, 0xFFFF);
  ------------------
  |  | 1152|  63.9k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
 2324|  63.9k|    }
 2325|  3.99k|  }
 2326|       |  /* Save only APP2 markers if ICC option selected */
 2327|  7.99k|  if (option == JCOPYOPT_ICC) {
  ------------------
  |  Branch (2327:7): [True: 0, False: 7.99k]
  ------------------
 2328|      0|    jpeg_save_markers(srcinfo, JPEG_APP0 + 2, 0xFFFF);
  ------------------
  |  | 1152|      0|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
 2329|      0|  }
 2330|  7.99k|#endif /* SAVE_MARKERS_SUPPORTED */
 2331|  7.99k|}
jcopy_markers_execute:
 2343|  7.03k|{
 2344|  7.03k|  jpeg_saved_marker_ptr marker;
 2345|       |
 2346|       |  /* In the current implementation, we don't actually need to examine the
 2347|       |   * option flag here; we just copy everything that got saved.
 2348|       |   * But to avoid confusion, we do not output JFIF and Adobe APP14 markers
 2349|       |   * if the encoder library already wrote one.
 2350|       |   */
 2351|   301k|  for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) {
  ------------------
  |  Branch (2351:39): [True: 294k, False: 7.03k]
  ------------------
 2352|   294k|    if (dstinfo->write_JFIF_header &&
  ------------------
  |  Branch (2352:9): [True: 288k, False: 5.53k]
  ------------------
 2353|   294k|        marker->marker == JPEG_APP0 &&
  ------------------
  |  | 1152|   582k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  |  Branch (2353:9): [True: 273k, False: 14.6k]
  ------------------
 2354|   294k|        marker->data_length >= 5 &&
  ------------------
  |  Branch (2354:9): [True: 273k, False: 585]
  ------------------
 2355|   294k|        marker->data[0] == 0x4A &&
  ------------------
  |  Branch (2355:9): [True: 267k, False: 5.81k]
  ------------------
 2356|   294k|        marker->data[1] == 0x46 &&
  ------------------
  |  Branch (2356:9): [True: 255k, False: 11.6k]
  ------------------
 2357|   294k|        marker->data[2] == 0x49 &&
  ------------------
  |  Branch (2357:9): [True: 1.63k, False: 254k]
  ------------------
 2358|   294k|        marker->data[3] == 0x46 &&
  ------------------
  |  Branch (2358:9): [True: 1.25k, False: 380]
  ------------------
 2359|   294k|        marker->data[4] == 0)
  ------------------
  |  Branch (2359:9): [True: 570, False: 686]
  ------------------
 2360|    570|      continue;                 /* reject duplicate JFIF */
 2361|   293k|    if (dstinfo->write_Adobe_marker &&
  ------------------
  |  Branch (2361:9): [True: 5.53k, False: 288k]
  ------------------
 2362|   293k|        marker->marker == JPEG_APP0 + 14 &&
  ------------------
  |  | 1152|  5.53k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  ------------------
  |  Branch (2362:9): [True: 4.87k, False: 657]
  ------------------
 2363|   293k|        marker->data_length >= 5 &&
  ------------------
  |  Branch (2363:9): [True: 4.67k, False: 201]
  ------------------
 2364|   293k|        marker->data[0] == 0x41 &&
  ------------------
  |  Branch (2364:9): [True: 2.76k, False: 1.90k]
  ------------------
 2365|   293k|        marker->data[1] == 0x64 &&
  ------------------
  |  Branch (2365:9): [True: 2.53k, False: 229]
  ------------------
 2366|   293k|        marker->data[2] == 0x6F &&
  ------------------
  |  Branch (2366:9): [True: 2.17k, False: 366]
  ------------------
 2367|   293k|        marker->data[3] == 0x62 &&
  ------------------
  |  Branch (2367:9): [True: 1.79k, False: 380]
  ------------------
 2368|   293k|        marker->data[4] == 0x65)
  ------------------
  |  Branch (2368:9): [True: 631, False: 1.16k]
  ------------------
 2369|    631|      continue;                 /* reject duplicate Adobe */
 2370|   292k|    jpeg_write_marker(dstinfo, marker->marker,
 2371|   292k|                      marker->data, marker->data_length);
 2372|   292k|  }
 2373|  7.03k|}
transupp.c:trim_right_edge:
 1453|  2.34k|{
 1454|  2.34k|  JDIMENSION MCU_cols;
 1455|       |
 1456|  2.34k|  MCU_cols = info->output_width / info->iMCU_sample_width;
 1457|  2.34k|  if (MCU_cols > 0 && info->x_crop_offset + MCU_cols ==
  ------------------
  |  Branch (1457:7): [True: 2.31k, False: 33]
  |  Branch (1457:23): [True: 2.31k, False: 0]
  ------------------
 1458|  2.31k|      full_width / info->iMCU_sample_width)
 1459|  2.31k|    info->output_width = MCU_cols * info->iMCU_sample_width;
 1460|  2.34k|}
transupp.c:transpose_critical_parameters:
 1829|  2.81k|{
 1830|  2.81k|  int tblno, i, j, ci, itemp;
 1831|  2.81k|  jpeg_component_info *compptr;
 1832|  2.81k|  JQUANT_TBL *qtblptr;
 1833|  2.81k|  JDIMENSION jtemp;
 1834|  2.81k|  UINT16 qtemp;
 1835|       |
 1836|       |  /* Transpose image dimensions */
 1837|  2.81k|  jtemp = dstinfo->image_width;
 1838|  2.81k|  dstinfo->image_width = dstinfo->image_height;
 1839|  2.81k|  dstinfo->image_height = jtemp;
 1840|       |#if JPEG_LIB_VERSION >= 70
 1841|       |  itemp = dstinfo->min_DCT_h_scaled_size;
 1842|       |  dstinfo->min_DCT_h_scaled_size = dstinfo->min_DCT_v_scaled_size;
 1843|       |  dstinfo->min_DCT_v_scaled_size = itemp;
 1844|       |#endif
 1845|       |
 1846|       |  /* Transpose sampling factors */
 1847|  6.05k|  for (ci = 0; ci < dstinfo->num_components; ci++) {
  ------------------
  |  Branch (1847:16): [True: 3.24k, False: 2.81k]
  ------------------
 1848|  3.24k|    compptr = dstinfo->comp_info + ci;
 1849|  3.24k|    itemp = compptr->h_samp_factor;
 1850|  3.24k|    compptr->h_samp_factor = compptr->v_samp_factor;
 1851|  3.24k|    compptr->v_samp_factor = itemp;
 1852|  3.24k|  }
 1853|       |
 1854|       |  /* Transpose quantization tables */
 1855|  14.0k|  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
  ------------------
  |  |   57|  14.0k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (1855:19): [True: 11.2k, False: 2.81k]
  ------------------
 1856|  11.2k|    qtblptr = dstinfo->quant_tbl_ptrs[tblno];
 1857|  11.2k|    if (qtblptr != NULL) {
  ------------------
  |  Branch (1857:9): [True: 5.63k, False: 5.60k]
  ------------------
 1858|  50.7k|      for (i = 0; i < DCTSIZE; i++) {
  ------------------
  |  |   55|  50.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1858:19): [True: 45.0k, False: 5.63k]
  ------------------
 1859|   202k|        for (j = 0; j < i; j++) {
  ------------------
  |  Branch (1859:21): [True: 157k, False: 45.0k]
  ------------------
 1860|   157k|          qtemp = qtblptr->quantval[i * DCTSIZE + j];
  ------------------
  |  |   55|   157k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1861|   157k|          qtblptr->quantval[i * DCTSIZE + j] =
  ------------------
  |  |   55|   157k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1862|   157k|            qtblptr->quantval[j * DCTSIZE + i];
  ------------------
  |  |   55|   157k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1863|   157k|          qtblptr->quantval[j * DCTSIZE + i] = qtemp;
  ------------------
  |  |   55|   157k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1864|   157k|        }
 1865|  45.0k|      }
 1866|  5.63k|    }
 1867|  11.2k|  }
 1868|  2.81k|}
transupp.c:do_transpose:
  935|  1.41k|{
  936|  1.41k|  JDIMENSION dst_blk_x, dst_blk_y, x_crop_blocks, y_crop_blocks;
  937|  1.41k|  int ci, i, j, offset_x, offset_y;
  938|  1.41k|  JBLOCKARRAY src_buffer, dst_buffer;
  939|  1.41k|  JCOEFPTR src_ptr, dst_ptr;
  940|  1.41k|  jpeg_component_info *compptr;
  941|       |
  942|       |  /* Transposing pixels within a block just requires transposing the
  943|       |   * DCT coefficients.
  944|       |   * Partial iMCUs at the edges require no special treatment; we simply
  945|       |   * process all the available DCT blocks for every component.
  946|       |   */
  947|  2.82k|  for (ci = 0; ci < dstinfo->num_components; ci++) {
  ------------------
  |  Branch (947:16): [True: 1.41k, False: 1.41k]
  ------------------
  948|  1.41k|    compptr = dstinfo->comp_info + ci;
  949|  1.41k|    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
  950|  1.41k|    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
  951|  40.3k|    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
  ------------------
  |  Branch (951:25): [True: 38.8k, False: 1.41k]
  ------------------
  952|  38.8k|         dst_blk_y += compptr->v_samp_factor) {
  953|  38.8k|      dst_buffer = (*srcinfo->mem->access_virt_barray)
  954|  38.8k|        ((j_common_ptr)srcinfo, dst_coef_arrays[ci], dst_blk_y,
  955|  38.8k|         (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|  38.8k|#define TRUE    1
  ------------------
  956|  77.7k|      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
  ------------------
  |  Branch (956:26): [True: 38.8k, False: 38.8k]
  ------------------
  957|  1.75M|        for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
  ------------------
  |  Branch (957:29): [True: 1.71M, False: 38.8k]
  ------------------
  958|  1.71M|             dst_blk_x += compptr->h_samp_factor) {
  959|  1.71M|          src_buffer = (*srcinfo->mem->access_virt_barray)
  960|  1.71M|            ((j_common_ptr)srcinfo, src_coef_arrays[ci],
  961|  1.71M|             dst_blk_x + x_crop_blocks,
  962|  1.71M|             (JDIMENSION)compptr->h_samp_factor, FALSE);
  ------------------
  |  |  206|  1.71M|#define FALSE   0               /* values of boolean */
  ------------------
  963|  3.43M|          for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
  ------------------
  |  Branch (963:30): [True: 1.71M, False: 1.71M]
  ------------------
  964|  1.71M|            dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
  965|  1.71M|            src_ptr =
  966|  1.71M|              src_buffer[offset_x][dst_blk_y + offset_y + y_crop_blocks];
  967|  15.4M|            for (i = 0; i < DCTSIZE; i++)
  ------------------
  |  |   55|  15.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (967:25): [True: 13.7M, False: 1.71M]
  ------------------
  968|   123M|              for (j = 0; j < DCTSIZE; j++)
  ------------------
  |  |   55|   123M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (968:27): [True: 110M, False: 13.7M]
  ------------------
  969|   110M|                dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   110M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                              dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   110M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  970|  1.71M|          }
  971|  1.71M|        }
  972|  38.8k|      }
  973|  38.8k|    }
  974|  1.41k|  }
  975|  1.41k|}
transupp.c:do_rot_90:
  988|  1.39k|{
  989|  1.39k|  JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
  990|  1.39k|  JDIMENSION x_crop_blocks, y_crop_blocks;
  991|  1.39k|  int ci, i, j, offset_x, offset_y;
  992|  1.39k|  JBLOCKARRAY src_buffer, dst_buffer;
  993|  1.39k|  JCOEFPTR src_ptr, dst_ptr;
  994|  1.39k|  jpeg_component_info *compptr;
  995|       |
  996|       |  /* Because of the horizontal mirror step, we can't process partial iMCUs
  997|       |   * at the (output) right edge properly.  They just get transposed and
  998|       |   * not mirrored.
  999|       |   */
 1000|  1.39k|  MCU_cols = srcinfo->output_height /
 1001|  1.39k|             (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
  ------------------
  |  |   34|  1.39k|#define dstinfo_min_DCT_h_scaled_size  DCTSIZE
  |  |  ------------------
  |  |  |  |   55|  1.39k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  |  |  ------------------
  ------------------
 1002|       |
 1003|  3.22k|  for (ci = 0; ci < dstinfo->num_components; ci++) {
  ------------------
  |  Branch (1003:16): [True: 1.82k, False: 1.39k]
  ------------------
 1004|  1.82k|    compptr = dstinfo->comp_info + ci;
 1005|  1.82k|    comp_width = MCU_cols * compptr->h_samp_factor;
 1006|  1.82k|    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
 1007|  1.82k|    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
 1008|  82.3k|    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
  ------------------
  |  Branch (1008:25): [True: 80.5k, False: 1.82k]
  ------------------
 1009|  80.5k|         dst_blk_y += compptr->v_samp_factor) {
 1010|  80.5k|      dst_buffer = (*srcinfo->mem->access_virt_barray)
 1011|  80.5k|        ((j_common_ptr)srcinfo, dst_coef_arrays[ci], dst_blk_y,
 1012|  80.5k|         (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|  80.5k|#define TRUE    1
  ------------------
 1013|   166k|      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
  ------------------
  |  Branch (1013:26): [True: 86.0k, False: 80.5k]
  ------------------
 1014|  8.01M|        for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
  ------------------
  |  Branch (1014:29): [True: 7.93M, False: 86.0k]
  ------------------
 1015|  7.93M|             dst_blk_x += compptr->h_samp_factor) {
 1016|  7.93M|          if (x_crop_blocks + dst_blk_x < comp_width) {
  ------------------
  |  Branch (1016:15): [True: 7.93M, False: 73]
  ------------------
 1017|       |            /* Block is within the mirrorable area. */
 1018|  7.93M|            src_buffer = (*srcinfo->mem->access_virt_barray)
 1019|  7.93M|              ((j_common_ptr)srcinfo, src_coef_arrays[ci],
 1020|  7.93M|               comp_width - x_crop_blocks - dst_blk_x -
 1021|  7.93M|               (JDIMENSION)compptr->h_samp_factor,
 1022|  7.93M|               (JDIMENSION)compptr->h_samp_factor, FALSE);
  ------------------
  |  |  206|  7.93M|#define FALSE   0               /* values of boolean */
  ------------------
 1023|  7.93M|          } else {
 1024|       |            /* Edge blocks are transposed but not mirrored. */
 1025|     73|            src_buffer = (*srcinfo->mem->access_virt_barray)
 1026|     73|              ((j_common_ptr)srcinfo, src_coef_arrays[ci],
 1027|     73|               dst_blk_x + x_crop_blocks,
 1028|     73|               (JDIMENSION)compptr->h_samp_factor, FALSE);
  ------------------
  |  |  206|     73|#define FALSE   0               /* values of boolean */
  ------------------
 1029|     73|          }
 1030|  15.9M|          for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
  ------------------
  |  Branch (1030:30): [True: 7.97M, False: 7.93M]
  ------------------
 1031|  7.97M|            dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
 1032|  7.97M|            if (x_crop_blocks + dst_blk_x < comp_width) {
  ------------------
  |  Branch (1032:17): [True: 7.97M, False: 113]
  ------------------
 1033|       |              /* Block is within the mirrorable area. */
 1034|  7.97M|              src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
 1035|  7.97M|                [dst_blk_y + offset_y + y_crop_blocks];
 1036|  39.8M|              for (i = 0; i < DCTSIZE; i++) {
  ------------------
  |  |   55|  39.8M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1036:27): [True: 31.9M, False: 7.97M]
  ------------------
 1037|   287M|                for (j = 0; j < DCTSIZE; j++)
  ------------------
  |  |   55|   287M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1037:29): [True: 255M, False: 31.9M]
  ------------------
 1038|   255M|                  dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   255M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                                dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   255M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1039|  31.9M|                i++;
 1040|   287M|                for (j = 0; j < DCTSIZE; j++)
  ------------------
  |  |   55|   287M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1040:29): [True: 255M, False: 31.9M]
  ------------------
 1041|   255M|                  dst_ptr[j * DCTSIZE + i] = -src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   255M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                                dst_ptr[j * DCTSIZE + i] = -src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|   255M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1042|  31.9M|              }
 1043|  7.97M|            } else {
 1044|       |              /* Edge blocks are transposed but not mirrored. */
 1045|    113|              src_ptr = src_buffer[offset_x]
 1046|    113|                [dst_blk_y + offset_y + y_crop_blocks];
 1047|  1.01k|              for (i = 0; i < DCTSIZE; i++)
  ------------------
  |  |   55|  1.01k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1047:27): [True: 904, False: 113]
  ------------------
 1048|  8.13k|                for (j = 0; j < DCTSIZE; j++)
  ------------------
  |  |   55|  8.13k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (1048:29): [True: 7.23k, False: 904]
  ------------------
 1049|  7.23k|                  dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|  7.23k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                                dst_ptr[j * DCTSIZE + i] = src_ptr[i * DCTSIZE + j];
  ------------------
  |  |   55|  7.23k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 1050|    113|            }
 1051|  7.97M|          }
 1052|  7.93M|        }
 1053|  86.0k|      }
 1054|  80.5k|    }
 1055|  1.82k|  }
 1056|  1.39k|}

tj3Init:
  533|  5.51k|{
  534|  5.51k|  static const char FUNCTION_NAME[] = "tj3Init";
  535|  5.51k|  tjinstance *this = NULL;
  536|  5.51k|  tjhandle retval = NULL;
  537|       |
  538|  5.51k|  if (initType < 0 || initType >= TJ_NUMINIT)
  ------------------
  |  |   85|  5.51k|#define TJ_NUMINIT  3
  ------------------
  |  Branch (538:7): [True: 0, False: 5.51k]
  |  Branch (538:23): [True: 0, False: 5.51k]
  ------------------
  539|  5.51k|    THROWG("Invalid argument", NULL);
  ------------------
  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  226|      0|}
  ------------------
  540|       |
  541|  5.51k|  if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL)
  ------------------
  |  Branch (541:7): [True: 0, False: 5.51k]
  ------------------
  542|  5.51k|    THROWG("Memory allocation failure", NULL);
  ------------------
  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  226|      0|}
  ------------------
  543|  5.51k|  memset(this, 0, sizeof(tjinstance));
  544|  5.51k|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |   42|  5.51k|#define SNPRINTF  snprintf
  ------------------
                SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |  776|  5.51k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  545|       |
  546|  5.51k|  this->quality = -1;
  547|  5.51k|  this->subsamp = TJSAMP_UNKNOWN;
  548|  5.51k|  this->jpegWidth = -1;
  549|  5.51k|  this->jpegHeight = -1;
  550|  5.51k|  this->precision = 8;
  551|  5.51k|  this->colorspace = -1;
  552|  5.51k|  this->losslessPSV = 1;
  553|  5.51k|  this->xDensity = 1;
  554|  5.51k|  this->yDensity = 1;
  555|  5.51k|  this->scalingFactor = TJUNSCALED;
  556|       |
  557|  5.51k|  switch (initType) {
  ------------------
  |  Branch (557:11): [True: 0, False: 5.51k]
  ------------------
  558|      0|  case TJINIT_COMPRESS:  return _tjInitCompress(this);
  ------------------
  |  Branch (558:3): [True: 0, False: 5.51k]
  ------------------
  559|      0|  case TJINIT_DECOMPRESS:  return _tjInitDecompress(this);
  ------------------
  |  Branch (559:3): [True: 0, False: 5.51k]
  ------------------
  560|  5.51k|  case TJINIT_TRANSFORM:
  ------------------
  |  Branch (560:3): [True: 5.51k, False: 0]
  ------------------
  561|  5.51k|    retval = _tjInitCompress(this);
  562|  5.51k|    if (!retval) return NULL;
  ------------------
  |  Branch (562:9): [True: 0, False: 5.51k]
  ------------------
  563|  5.51k|    retval = _tjInitDecompress(this);
  564|  5.51k|    return retval;
  565|  5.51k|  }
  566|       |
  567|      0|bailout:
  568|      0|  return retval;
  569|  5.51k|}
tj3Set:
  586|  11.9k|{
  587|  11.9k|  static const char FUNCTION_NAME[] = "tj3Set";
  588|  11.9k|  int retval = 0;
  589|       |
  590|  11.9k|  GET_TJINSTANCE(handle, -1);
  ------------------
  |  |  299|  11.9k|  tjinstance *this = (tjinstance *)handle; \
  |  |  300|  11.9k|  \
  |  |  301|  11.9k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (301:7): [True: 0, False: 11.9k]
  |  |  ------------------
  |  |  302|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  303|      0|    return errorReturn; \
  |  |  304|      0|  } \
  |  |  305|  11.9k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  206|  11.9k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  306|  11.9k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  206|  11.9k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
  591|       |
  592|  11.9k|  switch (param) {
  593|      0|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  594|      0|  case TJPARAM_MAXPIXELS:
  ------------------
  |  Branch (594:3): [True: 0, False: 11.9k]
  ------------------
  595|      0|    SET_PARAM(maxPixels, 0, -1);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  596|      0|    break;
  597|      0|#endif
  598|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (598:3): [True: 0, False: 11.9k]
  ------------------
  599|      0|    SET_BOOL_PARAM(jerr.stopOnWarning);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  600|      0|    break;
  601|      0|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (601:3): [True: 0, False: 11.9k]
  ------------------
  602|      0|    SET_BOOL_PARAM(bottomUp);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  603|      0|    break;
  604|  7.99k|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (604:3): [True: 7.99k, False: 3.99k]
  ------------------
  605|  7.99k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (605:9): [True: 0, False: 7.99k]
  ------------------
  606|  7.99k|      THROW("TJPARAM_NOREALLOC is not applicable to decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  607|  7.99k|    SET_BOOL_PARAM(noRealloc);
  ------------------
  |  |  578|  7.99k|#define SET_BOOL_PARAM(field) { \
  |  |  579|  7.99k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 7.99k]
  |  |  |  Branch (579:20): [True: 0, False: 7.99k]
  |  |  ------------------
  |  |  580|  7.99k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|  7.99k|  this->field = (boolean)value; \
  |  |  582|  7.99k|}
  ------------------
  608|  7.99k|    break;
  609|      0|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (609:3): [True: 0, False: 11.9k]
  ------------------
  610|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (610:9): [True: 0, False: 0]
  ------------------
  611|      0|      THROW("TJPARAM_QUALITY is not applicable to decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  612|      0|    SET_PARAM(quality, 1, 100);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  613|      0|    break;
  614|      0|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (614:3): [True: 0, False: 11.9k]
  ------------------
  615|      0|    SET_PARAM(subsamp, 0, TJ_NUMSAMP - 1);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  616|      0|    break;
  617|      0|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (617:3): [True: 0, False: 11.9k]
  ------------------
  618|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (618:9): [True: 0, False: 0]
  ------------------
  619|      0|      THROW("TJPARAM_JPEGWIDTH is not applicable to compression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  620|      0|    THROW("TJPARAM_JPEGWIDTH is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  621|      0|    break;
  622|      0|  case TJPARAM_JPEGHEIGHT:
  ------------------
  |  Branch (622:3): [True: 0, False: 11.9k]
  ------------------
  623|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (623:9): [True: 0, False: 0]
  ------------------
  624|      0|      THROW("TJPARAM_JPEGHEIGHT is not applicable to compression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  625|      0|    THROW("TJPARAM_JPEGHEIGHT is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  626|      0|    break;
  627|      0|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (627:3): [True: 0, False: 11.9k]
  ------------------
  628|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (628:9): [True: 0, False: 0]
  ------------------
  629|      0|      THROW("TJPARAM_PRECISION is not applicable to compression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  630|      0|    THROW("TJPARAM_PRECISION is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  631|      0|    break;
  632|      0|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (632:3): [True: 0, False: 11.9k]
  ------------------
  633|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (633:9): [True: 0, False: 0]
  ------------------
  634|      0|      THROW("TJPARAM_COLORSPACE is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  635|      0|    SET_PARAM(colorspace, 0, TJ_NUMCS - 1);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  636|      0|    break;
  637|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (637:3): [True: 0, False: 11.9k]
  ------------------
  638|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (638:9): [True: 0, False: 0]
  ------------------
  639|      0|      THROW("TJPARAM_FASTUPSAMPLE is not applicable to compression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  640|      0|    SET_BOOL_PARAM(fastUpsample);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  641|      0|    break;
  642|      0|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (642:3): [True: 0, False: 11.9k]
  ------------------
  643|      0|    SET_BOOL_PARAM(fastDCT);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  644|      0|    break;
  645|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (645:3): [True: 0, False: 11.9k]
  ------------------
  646|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (646:9): [True: 0, False: 0]
  ------------------
  647|      0|      THROW("TJPARAM_OPTIMIZE is not applicable to decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  648|      0|    SET_BOOL_PARAM(optimize);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  649|      0|    break;
  650|      0|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (650:3): [True: 0, False: 11.9k]
  ------------------
  651|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (651:9): [True: 0, False: 0]
  ------------------
  652|      0|      THROW("TJPARAM_PROGRESSIVE is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  653|      0|    SET_BOOL_PARAM(progressive);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  654|      0|    break;
  655|  3.99k|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (655:3): [True: 3.99k, False: 7.99k]
  ------------------
  656|  3.99k|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (656:9): [True: 0, False: 3.99k]
  ------------------
  657|  3.99k|      THROW("TJPARAM_SCANLIMIT is not applicable to compression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  658|  3.99k|    SET_PARAM(scanLimit, 0, -1);
  ------------------
  |  |  572|  3.99k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|  3.99k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 3.99k]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|  3.99k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|  3.99k|  this->field = value; \
  |  |  576|  3.99k|}
  ------------------
  659|  3.99k|    break;
  660|      0|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (660:3): [True: 0, False: 11.9k]
  ------------------
  661|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (661:9): [True: 0, False: 0]
  ------------------
  662|      0|      THROW("TJPARAM_ARITHMETIC is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  663|      0|    SET_BOOL_PARAM(arithmetic);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  664|      0|    break;
  665|      0|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (665:3): [True: 0, False: 11.9k]
  ------------------
  666|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      THROW("TJPARAM_LOSSLESS is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  668|      0|    SET_BOOL_PARAM(lossless);
  ------------------
  |  |  578|      0|#define SET_BOOL_PARAM(field) { \
  |  |  579|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (579:7): [True: 0, False: 0]
  |  |  |  Branch (579:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  581|      0|  this->field = (boolean)value; \
  |  |  582|      0|}
  ------------------
  669|      0|    break;
  670|      0|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (670:3): [True: 0, False: 11.9k]
  ------------------
  671|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (671:9): [True: 0, False: 0]
  ------------------
  672|      0|      THROW("TJPARAM_LOSSLESSPSV is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  673|      0|    SET_PARAM(losslessPSV, 1, 7);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  674|      0|    break;
  675|      0|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (675:3): [True: 0, False: 11.9k]
  ------------------
  676|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (676:9): [True: 0, False: 0]
  ------------------
  677|      0|      THROW("TJPARAM_LOSSLESSPT is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  678|      0|    SET_PARAM(losslessPt, 0, this->precision - 1);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [True: 0, False: 0]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  679|      0|    break;
  680|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (680:3): [True: 0, False: 11.9k]
  ------------------
  681|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (681:9): [True: 0, False: 0]
  ------------------
  682|      0|      THROW("TJPARAM_RESTARTBLOCKS is not applicable to decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  683|      0|    SET_PARAM(restartIntervalBlocks, 0, 65535);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  684|      0|    if (value != 0) this->restartIntervalRows = 0;
  ------------------
  |  Branch (684:9): [True: 0, False: 0]
  ------------------
  685|      0|    break;
  686|      0|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (686:3): [True: 0, False: 11.9k]
  ------------------
  687|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (687:9): [True: 0, False: 0]
  ------------------
  688|      0|      THROW("TJPARAM_RESTARTROWS is not applicable to decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  689|      0|    SET_PARAM(restartIntervalRows, 0, 65535);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  690|      0|    if (value != 0) this->restartIntervalBlocks = 0;
  ------------------
  |  Branch (690:9): [True: 0, False: 0]
  ------------------
  691|      0|    break;
  692|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (692:3): [True: 0, False: 11.9k]
  ------------------
  693|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (693:9): [True: 0, False: 0]
  ------------------
  694|      0|      THROW("TJPARAM_XDENSITY is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  695|      0|    SET_PARAM(xDensity, 1, 65535);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  696|      0|    break;
  697|      0|  case TJPARAM_YDENSITY:
  ------------------
  |  Branch (697:3): [True: 0, False: 11.9k]
  ------------------
  698|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (698:9): [True: 0, False: 0]
  ------------------
  699|      0|      THROW("TJPARAM_YDENSITY is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  700|      0|    SET_PARAM(yDensity, 1, 65535);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  701|      0|    break;
  702|      0|  case TJPARAM_DENSITYUNITS:
  ------------------
  |  Branch (702:3): [True: 0, False: 11.9k]
  ------------------
  703|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (703:9): [True: 0, False: 0]
  ------------------
  704|      0|      THROW("TJPARAM_DENSITYUNITS is read-only in decompression instances.");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  705|      0|    SET_PARAM(densityUnits, 0, 2);
  ------------------
  |  |  572|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  573|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (573:7): [True: 0, False: 0]
  |  |  |  Branch (573:28): [Folded - Ignored]
  |  |  |  Branch (573:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  574|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  248|      0|#define THROW(m) { \
  |  |  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  209|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  226|      0|}
  |  |  |  |  ------------------
  |  |  |  |  251|      0|}
  |  |  ------------------
  |  |  575|      0|  this->field = value; \
  |  |  576|      0|}
  ------------------
  706|      0|    break;
  707|      0|  default:
  ------------------
  |  Branch (707:3): [True: 0, False: 11.9k]
  ------------------
  708|      0|    THROW("Invalid parameter");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
  709|  11.9k|  }
  710|       |
  711|  11.9k|bailout:
  712|  11.9k|  return retval;
  713|  11.9k|}
tj3Get:
  718|  14.2k|{
  719|  14.2k|  tjinstance *this = (tjinstance *)handle;
  720|  14.2k|  if (!this) return -1;
  ------------------
  |  Branch (720:7): [True: 0, False: 14.2k]
  ------------------
  721|       |
  722|  14.2k|  switch (param) {
  ------------------
  |  Branch (722:11): [True: 0, False: 14.2k]
  ------------------
  723|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (723:3): [True: 0, False: 14.2k]
  ------------------
  724|      0|    return this->jerr.stopOnWarning;
  725|      0|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (725:3): [True: 0, False: 14.2k]
  ------------------
  726|      0|    return this->bottomUp;
  727|      0|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (727:3): [True: 0, False: 14.2k]
  ------------------
  728|      0|    return this->noRealloc;
  729|      0|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (729:3): [True: 0, False: 14.2k]
  ------------------
  730|      0|    return this->quality;
  731|  4.73k|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (731:3): [True: 4.73k, False: 9.47k]
  ------------------
  732|  4.73k|    return this->subsamp;
  733|  4.73k|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (733:3): [True: 4.73k, False: 9.47k]
  ------------------
  734|  4.73k|    return this->jpegWidth;
  735|  4.73k|  case TJPARAM_JPEGHEIGHT:
  ------------------
  |  Branch (735:3): [True: 4.73k, False: 9.47k]
  ------------------
  736|  4.73k|    return this->jpegHeight;
  737|      0|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (737:3): [True: 0, False: 14.2k]
  ------------------
  738|      0|    return this->precision;
  739|      0|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (739:3): [True: 0, False: 14.2k]
  ------------------
  740|      0|    return this->colorspace;
  741|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (741:3): [True: 0, False: 14.2k]
  ------------------
  742|      0|    return this->fastUpsample;
  743|      0|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (743:3): [True: 0, False: 14.2k]
  ------------------
  744|      0|    return this->fastDCT;
  745|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (745:3): [True: 0, False: 14.2k]
  ------------------
  746|      0|    return this->optimize;
  747|      0|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (747:3): [True: 0, False: 14.2k]
  ------------------
  748|      0|    return this->progressive;
  749|      0|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (749:3): [True: 0, False: 14.2k]
  ------------------
  750|      0|    return this->scanLimit;
  751|      0|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (751:3): [True: 0, False: 14.2k]
  ------------------
  752|      0|    return this->arithmetic;
  753|      0|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (753:3): [True: 0, False: 14.2k]
  ------------------
  754|      0|    return this->lossless;
  755|      0|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (755:3): [True: 0, False: 14.2k]
  ------------------
  756|      0|    return this->losslessPSV;
  757|      0|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (757:3): [True: 0, False: 14.2k]
  ------------------
  758|      0|    return this->losslessPt;
  759|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (759:3): [True: 0, False: 14.2k]
  ------------------
  760|      0|    return this->restartIntervalBlocks;
  761|      0|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (761:3): [True: 0, False: 14.2k]
  ------------------
  762|      0|    return this->restartIntervalRows;
  763|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (763:3): [True: 0, False: 14.2k]
  ------------------
  764|      0|    return this->xDensity;
  765|      0|  case TJPARAM_YDENSITY:
  ------------------
  |  Branch (765:3): [True: 0, False: 14.2k]
  ------------------
  766|      0|    return this->yDensity;
  767|      0|  case TJPARAM_DENSITYUNITS:
  ------------------
  |  Branch (767:3): [True: 0, False: 14.2k]
  ------------------
  768|      0|    return this->densityUnits;
  769|  14.2k|  }
  770|       |
  771|      0|  return -1;
  772|  14.2k|}
tj3Destroy:
  818|  5.51k|{
  819|  5.51k|  tjinstance *this = (tjinstance *)handle;
  820|  5.51k|  j_compress_ptr cinfo = NULL;
  821|  5.51k|  j_decompress_ptr dinfo = NULL;
  822|       |
  823|  5.51k|  if (!this) return;
  ------------------
  |  Branch (823:7): [True: 0, False: 5.51k]
  ------------------
  824|       |
  825|  5.51k|  cinfo = &this->cinfo;  dinfo = &this->dinfo;
  826|  5.51k|  this->jerr.warning = FALSE;
  ------------------
  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  ------------------
  827|  5.51k|  this->isInstanceError = FALSE;
  ------------------
  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  ------------------
  828|       |
  829|  5.51k|  if (setjmp(this->jerr.setjmp_buffer)) return;
  830|  5.51k|  if (this->init & COMPRESS) jpeg_destroy_compress(cinfo);
  ------------------
  |  Branch (830:7): [True: 5.51k, False: 0]
  ------------------
  831|  5.51k|  if (this->init & DECOMPRESS) jpeg_destroy_decompress(dinfo);
  ------------------
  |  Branch (831:7): [True: 5.51k, False: 0]
  ------------------
  832|  5.51k|  free(this);
  833|  5.51k|}
tj3JPEGBufSize:
  924|  20.5k|{
  925|  20.5k|  static const char FUNCTION_NAME[] = "tj3JPEGBufSize";
  926|  20.5k|  unsigned long long retval = 0;
  927|  20.5k|  int mcuw, mcuh, chromasf;
  928|       |
  929|  20.5k|  if (width < 1 || height < 1 || jpegSubsamp < TJSAMP_UNKNOWN ||
  ------------------
  |  Branch (929:7): [True: 0, False: 20.5k]
  |  Branch (929:20): [True: 0, False: 20.5k]
  |  Branch (929:34): [True: 0, False: 20.5k]
  ------------------
  930|  20.5k|      jpegSubsamp >= TJ_NUMSAMP)
  ------------------
  |  |  110|  20.5k|#define TJ_NUMSAMP  7
  ------------------
  |  Branch (930:7): [True: 0, False: 20.5k]
  ------------------
  931|  20.5k|    THROWG("Invalid argument", 0);
  ------------------
  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  226|      0|}
  ------------------
  932|       |
  933|  20.5k|  if (jpegSubsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (933:7): [True: 0, False: 20.5k]
  ------------------
  934|      0|    jpegSubsamp = TJSAMP_444;
  935|       |
  936|       |  /* This allows for rare corner cases in which a JPEG image can actually be
  937|       |     larger than the uncompressed input (we wouldn't mention it if it hadn't
  938|       |     happened before.) */
  939|  20.5k|  mcuw = tjMCUWidth[jpegSubsamp];
  940|  20.5k|  mcuh = tjMCUHeight[jpegSubsamp];
  941|  20.5k|  chromasf = jpegSubsamp == TJSAMP_GRAY ? 0 : 4 * 64 / (mcuw * mcuh);
  ------------------
  |  Branch (941:14): [True: 16.4k, False: 4.13k]
  ------------------
  942|  20.5k|  retval = PAD(width, mcuw) * PAD(height, mcuh) * (2ULL + chromasf) + 2048ULL;
  ------------------
  |  |   51|  20.5k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
                retval = PAD(width, mcuw) * PAD(height, mcuh) * (2ULL + chromasf) + 2048ULL;
  ------------------
  |  |   51|  20.5k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  943|  20.5k|  if (retval > (unsigned long long)((unsigned long)-1))
  ------------------
  |  Branch (943:7): [True: 0, False: 20.5k]
  ------------------
  944|  20.5k|    THROWG("Image is too large", 0);
  ------------------
  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  226|      0|}
  ------------------
  945|       |
  946|  20.5k|bailout:
  947|  20.5k|  return (size_t)retval;
  948|  20.5k|}
tj3DecompressHeader:
 1746|  5.51k|{
 1747|  5.51k|  static const char FUNCTION_NAME[] = "tj3DecompressHeader";
 1748|  5.51k|  int retval = 0;
 1749|       |
 1750|  5.51k|  GET_DINSTANCE(handle);
  ------------------
  |  |  287|  5.51k|  tjinstance *this = (tjinstance *)handle; \
  |  |  288|  5.51k|  j_decompress_ptr dinfo = NULL; \
  |  |  289|  5.51k|  \
  |  |  290|  5.51k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (290:7): [True: 0, False: 5.51k]
  |  |  ------------------
  |  |  291|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  292|      0|    return -1; \
  |  |  293|      0|  } \
  |  |  294|  5.51k|  dinfo = &this->dinfo; \
  |  |  295|  5.51k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  296|  5.51k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  206|  5.51k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
 1751|  5.51k|  if ((this->init & DECOMPRESS) == 0)
  ------------------
  |  Branch (1751:7): [True: 0, False: 5.51k]
  ------------------
 1752|  5.51k|    THROW("Instance has not been initialized for decompression");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 1753|       |
 1754|  5.51k|  if (jpegBuf == NULL || jpegSize <= 0)
  ------------------
  |  Branch (1754:7): [True: 0, False: 5.51k]
  |  Branch (1754:26): [True: 0, False: 5.51k]
  ------------------
 1755|  5.51k|    THROW("Invalid argument");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 1756|       |
 1757|  5.51k|  if (setjmp(this->jerr.setjmp_buffer)) {
 1758|       |    /* If we get here, the JPEG code has signaled an error. */
 1759|    607|    return -1;
 1760|    607|  }
 1761|       |
 1762|  4.90k|  jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
 1763|       |
 1764|       |  /* jpeg_read_header() calls jpeg_abort() and returns JPEG_HEADER_TABLES_ONLY
 1765|       |     if the datastream is a tables-only datastream.  Since we aren't using a
 1766|       |     suspending data source, the only other value it can return is
 1767|       |     JPEG_HEADER_OK. */
 1768|  4.90k|  if (jpeg_read_header(dinfo, FALSE) == JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |  206|  4.90k|#define FALSE   0               /* values of boolean */
  ------------------
                if (jpeg_read_header(dinfo, FALSE) == JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  | 1051|  4.90k|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  |  Branch (1768:7): [True: 721, False: 4.18k]
  ------------------
 1769|    721|    return 0;
 1770|       |
 1771|  4.18k|  setDecompParameters(this);
 1772|       |
 1773|  4.18k|  jpeg_abort_decompress(dinfo);
 1774|       |
 1775|  4.18k|  if (this->colorspace < 0)
  ------------------
  |  Branch (1775:7): [True: 5, False: 4.18k]
  ------------------
 1776|  4.18k|    THROW("Could not determine colorspace of JPEG image");
  ------------------
  |  |  248|      5|#define THROW(m) { \
  |  |  249|      5|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      5|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      5|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      5|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      5|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      5|#define THROWG(m, rv) { \
  |  |  |  |  224|      5|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      5|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      5|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      5|  retval = rv;  goto bailout; \
  |  |  |  |  226|      5|}
  |  |  ------------------
  |  |  251|      5|}
  ------------------
 1777|  4.18k|  if (this->jpegWidth < 1 || this->jpegHeight < 1)
  ------------------
  |  Branch (1777:7): [True: 0, False: 4.18k]
  |  Branch (1777:30): [True: 0, False: 4.18k]
  ------------------
 1778|  4.18k|    THROW("Invalid data returned in header");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 1779|       |
 1780|  4.18k|bailout:
 1781|  4.18k|  if (this->jerr.warning) retval = -1;
  ------------------
  |  Branch (1781:7): [True: 173, False: 4.01k]
  ------------------
 1782|  4.18k|  return retval;
 1783|  4.18k|}
tj3Transform:
 2617|  7.99k|{
 2618|  7.99k|  static const char FUNCTION_NAME[] = "tj3Transform";
 2619|  7.99k|  jpeg_transform_info *xinfo = NULL;
 2620|  7.99k|  jvirt_barray_ptr *srccoefs, *dstcoefs;
 2621|  7.99k|  int retval = 0, i, saveMarkers = 0;
 2622|  7.99k|  boolean alloc = TRUE;
  ------------------
  |  |  209|  7.99k|#define TRUE    1
  ------------------
 2623|  7.99k|  struct my_progress_mgr progress;
 2624|       |
 2625|  7.99k|  GET_INSTANCE(handle);
  ------------------
  |  |  262|  7.99k|  tjinstance *this = (tjinstance *)handle; \
  |  |  263|  7.99k|  j_compress_ptr cinfo = NULL; \
  |  |  264|  7.99k|  j_decompress_ptr dinfo = NULL; \
  |  |  265|  7.99k|  \
  |  |  266|  7.99k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (266:7): [True: 0, False: 7.99k]
  |  |  ------------------
  |  |  267|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  268|      0|    return -1; \
  |  |  269|      0|  } \
  |  |  270|  7.99k|  cinfo = &this->cinfo;  dinfo = &this->dinfo; \
  |  |  271|  7.99k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  206|  7.99k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  272|  7.99k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  206|  7.99k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
 2626|  7.99k|  if ((this->init & COMPRESS) == 0 || (this->init & DECOMPRESS) == 0)
  ------------------
  |  Branch (2626:7): [True: 0, False: 7.99k]
  |  Branch (2626:39): [True: 0, False: 7.99k]
  ------------------
 2627|  7.99k|    THROW("Instance has not been initialized for transformation");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 2628|       |
 2629|  7.99k|  if (jpegBuf == NULL || jpegSize <= 0 || n < 1 || dstBufs == NULL ||
  ------------------
  |  Branch (2629:7): [True: 0, False: 7.99k]
  |  Branch (2629:26): [True: 0, False: 7.99k]
  |  Branch (2629:43): [True: 0, False: 7.99k]
  |  Branch (2629:52): [True: 0, False: 7.99k]
  ------------------
 2630|  7.99k|      dstSizes == NULL || t == NULL)
  ------------------
  |  Branch (2630:7): [True: 0, False: 7.99k]
  |  Branch (2630:27): [True: 0, False: 7.99k]
  ------------------
 2631|  7.99k|    THROW("Invalid argument");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 2632|       |
 2633|  7.99k|  if (this->scanLimit) {
  ------------------
  |  Branch (2633:7): [True: 7.99k, False: 0]
  ------------------
 2634|  7.99k|    memset(&progress, 0, sizeof(struct my_progress_mgr));
 2635|  7.99k|    progress.pub.progress_monitor = my_progress_monitor;
 2636|  7.99k|    progress.this = this;
 2637|  7.99k|    dinfo->progress = &progress.pub;
 2638|  7.99k|  } else
 2639|      0|    dinfo->progress = NULL;
 2640|       |
 2641|  7.99k|  if ((xinfo =
  ------------------
  |  Branch (2641:7): [True: 0, False: 7.99k]
  ------------------
 2642|  7.99k|       (jpeg_transform_info *)malloc(sizeof(jpeg_transform_info) * n)) == NULL)
 2643|  7.99k|    THROW("Memory allocation failure");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 2644|  7.99k|  memset(xinfo, 0, sizeof(jpeg_transform_info) * n);
 2645|       |
 2646|  7.99k|  if (setjmp(this->jerr.setjmp_buffer)) {
 2647|       |    /* If we get here, the JPEG code has signaled an error. */
 2648|  4.04k|    retval = -1;  goto bailout;
 2649|  4.04k|  }
 2650|       |
 2651|  3.94k|  if (dinfo->global_state <= DSTATE_START)
  ------------------
  |  |   48|  3.94k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (2651:7): [True: 7.99k, False: 18.4E]
  ------------------
 2652|  7.99k|    jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
 2653|       |
 2654|  19.9k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (2654:15): [True: 15.9k, False: 3.94k]
  ------------------
 2655|  15.9k|    xinfo[i].transform = xformtypes[t[i].op];
 2656|  15.9k|    xinfo[i].perfect = (t[i].options & TJXOPT_PERFECT) ? 1 : 0;
  ------------------
  |  |  852|  15.9k|#define TJXOPT_PERFECT  (1 << 0)
  ------------------
  |  Branch (2656:24): [True: 0, False: 15.9k]
  ------------------
 2657|  15.9k|    xinfo[i].trim = (t[i].options & TJXOPT_TRIM) ? 1 : 0;
  ------------------
  |  |  857|  15.9k|#define TJXOPT_TRIM  (1 << 1)
  ------------------
  |  Branch (2657:21): [True: 3.99k, False: 11.9k]
  ------------------
 2658|  15.9k|    xinfo[i].force_grayscale = (t[i].options & TJXOPT_GRAY) ? 1 : 0;
  ------------------
  |  |  867|  15.9k|#define TJXOPT_GRAY  (1 << 3)
  ------------------
  |  Branch (2658:32): [True: 3.99k, False: 11.9k]
  ------------------
 2659|  15.9k|    xinfo[i].crop = (t[i].options & TJXOPT_CROP) ? 1 : 0;
  ------------------
  |  |  862|  15.9k|#define TJXOPT_CROP  (1 << 2)
  ------------------
  |  Branch (2659:21): [True: 3.99k, False: 11.9k]
  ------------------
 2660|  15.9k|    if (n != 1 && t[i].op == TJXOP_HFLIP) xinfo[i].slow_hflip = 1;
  ------------------
  |  Branch (2660:9): [True: 11.9k, False: 3.99k]
  |  Branch (2660:19): [True: 0, False: 11.9k]
  ------------------
 2661|  15.9k|    else xinfo[i].slow_hflip = 0;
 2662|       |
 2663|  15.9k|    if (xinfo[i].crop) {
  ------------------
  |  Branch (2663:9): [True: 3.99k, False: 11.9k]
  ------------------
 2664|  3.99k|      xinfo[i].crop_xoffset = t[i].r.x;  xinfo[i].crop_xoffset_set = JCROP_POS;
 2665|  3.99k|      xinfo[i].crop_yoffset = t[i].r.y;  xinfo[i].crop_yoffset_set = JCROP_POS;
 2666|  3.99k|      if (t[i].r.w != 0) {
  ------------------
  |  Branch (2666:11): [True: 3.99k, False: 0]
  ------------------
 2667|  3.99k|        xinfo[i].crop_width = t[i].r.w;  xinfo[i].crop_width_set = JCROP_POS;
 2668|  3.99k|      } else
 2669|      0|        xinfo[i].crop_width = JCROP_UNSET;
 2670|  3.99k|      if (t[i].r.h != 0) {
  ------------------
  |  Branch (2670:11): [True: 3.99k, False: 0]
  ------------------
 2671|  3.99k|        xinfo[i].crop_height = t[i].r.h;  xinfo[i].crop_height_set = JCROP_POS;
 2672|  3.99k|      } else
 2673|      0|        xinfo[i].crop_height = JCROP_UNSET;
 2674|  3.99k|    }
 2675|  15.9k|    if (!(t[i].options & TJXOPT_COPYNONE)) saveMarkers = 1;
  ------------------
  |  |  889|  15.9k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
  |  Branch (2675:9): [True: 3.99k, False: 11.9k]
  ------------------
 2676|  15.9k|  }
 2677|       |
 2678|  18.4E|  jcopy_markers_setup(dinfo, saveMarkers ? JCOPYOPT_ALL : JCOPYOPT_NONE);
  ------------------
  |  Branch (2678:30): [True: 3.99k, False: 18.4E]
  ------------------
 2679|  3.94k|  if (dinfo->global_state <= DSTATE_START)
  ------------------
  |  |   48|  3.94k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (2679:7): [True: 7.99k, False: 18.4E]
  ------------------
 2680|  7.99k|    jpeg_read_header(dinfo, TRUE);
  ------------------
  |  |  209|  7.99k|#define TRUE    1
  ------------------
 2681|  3.94k|  this->subsamp = getSubsamp(&this->dinfo);
 2682|       |
 2683|  18.2k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (2683:15): [True: 14.3k, False: 3.88k]
  ------------------
 2684|  14.3k|    if (!jtransform_request_workspace(dinfo, &xinfo[i]))
  ------------------
  |  Branch (2684:9): [True: 0, False: 14.3k]
  ------------------
 2685|  14.3k|      THROW("Transform is not perfect");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 2686|       |
 2687|  14.3k|    if (xinfo[i].crop) {
  ------------------
  |  Branch (2687:9): [True: 2.40k, False: 11.9k]
  ------------------
 2688|  2.40k|      if (this->subsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (2688:11): [True: 59, False: 2.34k]
  ------------------
 2689|  2.34k|        THROW("Could not determine subsampling level of JPEG image");
  ------------------
  |  |  248|     59|#define THROW(m) { \
  |  |  249|     59|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|     59|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|     59|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|     59|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|     59|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|     59|#define THROWG(m, rv) { \
  |  |  |  |  224|     59|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     59|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|     59|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|     59|  retval = rv;  goto bailout; \
  |  |  |  |  226|     59|}
  |  |  ------------------
  |  |  251|     59|}
  ------------------
 2690|  2.34k|      if ((t[i].r.x % tjMCUWidth[this->subsamp]) != 0 ||
  ------------------
  |  Branch (2690:11): [True: 0, False: 2.34k]
  ------------------
 2691|  2.34k|          (t[i].r.y % tjMCUHeight[this->subsamp]) != 0)
  ------------------
  |  Branch (2691:11): [True: 0, False: 2.34k]
  ------------------
 2692|      0|        THROWI("To crop this JPEG image, x must be a multiple of %d\n"
  ------------------
  |  |  252|      0|#define THROWI(format, val1, val2) { \
  |  |  253|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): " format, FUNCTION_NAME, \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): " format, FUNCTION_NAME, \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  254|      0|           val1, val2); \
  |  |  255|      0|  this->isInstanceError = TRUE; \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |  256|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): " format, FUNCTION_NAME, val1, \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): " format, FUNCTION_NAME, val1, \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  257|      0|           val2); \
  |  |  258|      0|  retval = -1;  goto bailout; \
  |  |  259|      0|}
  ------------------
 2693|  2.34k|               "and y must be a multiple of %d.", tjMCUWidth[this->subsamp],
 2694|  2.34k|               tjMCUHeight[this->subsamp]);
 2695|  2.34k|    }
 2696|  14.3k|  }
 2697|       |
 2698|  3.88k|  srccoefs = jpeg_read_coefficients(dinfo);
 2699|       |
 2700|  11.4k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (2700:15): [True: 7.52k, False: 3.88k]
  ------------------
 2701|  7.52k|    int w, h;
 2702|       |
 2703|  7.52k|    if (!xinfo[i].crop) {
  ------------------
  |  Branch (2703:9): [True: 6.04k, False: 1.47k]
  ------------------
 2704|  6.04k|      w = dinfo->image_width;  h = dinfo->image_height;
 2705|  6.04k|    } else {
 2706|  1.47k|      w = xinfo[i].crop_width;  h = xinfo[i].crop_height;
 2707|  1.47k|    }
 2708|  7.52k|    if (this->noRealloc) {
  ------------------
  |  Branch (2708:9): [True: 4.55k, False: 2.96k]
  ------------------
 2709|  4.55k|      alloc = FALSE;  dstSizes[i] = tj3JPEGBufSize(w, h, this->subsamp);
  ------------------
  |  |  206|  4.55k|#define FALSE   0               /* values of boolean */
  ------------------
 2710|  4.55k|    }
 2711|  7.52k|    if (!(t[i].options & TJXOPT_NOOUTPUT))
  ------------------
  |  |  874|  7.52k|#define TJXOPT_NOOUTPUT  (1 << 4)
  ------------------
  |  Branch (2711:9): [True: 7.52k, False: 0]
  ------------------
 2712|  7.52k|      jpeg_mem_dest_tj(cinfo, &dstBufs[i], &dstSizes[i], alloc);
 2713|  7.52k|    jpeg_copy_critical_parameters(dinfo, cinfo);
 2714|  7.52k|    dstcoefs = jtransform_adjust_parameters(dinfo, cinfo, srccoefs, &xinfo[i]);
 2715|  7.52k|    if (this->optimize || t[i].options & TJXOPT_OPTIMIZE)
  ------------------
  |  |  903|  7.03k|#define TJXOPT_OPTIMIZE  (1 << 8)
  ------------------
  |  Branch (2715:9): [True: 488, False: 7.03k]
  |  Branch (2715:27): [True: 2.69k, False: 4.33k]
  ------------------
 2716|  2.69k|      cinfo->optimize_coding = TRUE;
  ------------------
  |  |  209|  2.69k|#define TRUE    1
  ------------------
 2717|  7.52k|#ifdef C_PROGRESSIVE_SUPPORTED
 2718|  7.52k|    if (this->progressive || t[i].options & TJXOPT_PROGRESSIVE)
  ------------------
  |  |  883|  3.86k|#define TJXOPT_PROGRESSIVE  (1 << 5)
  ------------------
  |  Branch (2718:9): [True: 3.65k, False: 3.86k]
  |  Branch (2718:30): [True: 2.24k, False: 1.61k]
  ------------------
 2719|  5.41k|      jpeg_simple_progression(cinfo);
 2720|  7.52k|#endif
 2721|  7.52k|    if (this->arithmetic || t[i].options & TJXOPT_ARITHMETIC) {
  ------------------
  |  |  897|  4.33k|#define TJXOPT_ARITHMETIC  (1 << 7)
  ------------------
  |  Branch (2721:9): [True: 3.18k, False: 4.33k]
  |  Branch (2721:29): [True: 862, False: 3.47k]
  ------------------
 2722|  3.55k|      cinfo->arith_code = TRUE;
  ------------------
  |  |  209|  3.55k|#define TRUE    1
  ------------------
 2723|  3.55k|      cinfo->optimize_coding = FALSE;
  ------------------
  |  |  206|  3.55k|#define FALSE   0               /* values of boolean */
  ------------------
 2724|  3.55k|    }
 2725|  7.52k|    if (!(t[i].options & TJXOPT_NOOUTPUT)) {
  ------------------
  |  |  874|  7.52k|#define TJXOPT_NOOUTPUT  (1 << 4)
  ------------------
  |  Branch (2725:9): [True: 7.03k, False: 488]
  ------------------
 2726|  7.03k|      jpeg_write_coefficients(cinfo, dstcoefs);
 2727|  7.03k|      jcopy_markers_execute(dinfo, cinfo, t[i].options & TJXOPT_COPYNONE ?
  ------------------
  |  |  889|  7.03k|#define TJXOPT_COPYNONE  (1 << 6)
  ------------------
  |  Branch (2727:43): [True: 4.33k, False: 2.69k]
  ------------------
 2728|  4.33k|                                          JCOPYOPT_NONE : JCOPYOPT_ALL);
 2729|  7.03k|    } else
 2730|    488|      jinit_c_master_control(cinfo, TRUE);
  ------------------
  |  |  209|    488|#define TRUE    1
  ------------------
 2731|  7.52k|    jtransform_execute_transformation(dinfo, cinfo, srccoefs, &xinfo[i]);
  ------------------
  |  |  206|  7.52k|#define jtransform_execute_transformation       jtransform_execute_transform
  ------------------
 2732|  7.52k|    if (t[i].customFilter) {
  ------------------
  |  Branch (2732:9): [True: 0, False: 7.52k]
  ------------------
 2733|      0|      int ci, y;
 2734|      0|      JDIMENSION by;
 2735|       |
 2736|      0|      for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (2736:20): [True: 0, False: 0]
  ------------------
 2737|      0|        jpeg_component_info *compptr = &cinfo->comp_info[ci];
 2738|      0|        tjregion arrayRegion = { 0, 0, 0, 0 };
 2739|      0|        tjregion planeRegion = { 0, 0, 0, 0 };
 2740|       |
 2741|      0|        arrayRegion.w = compptr->width_in_blocks * DCTSIZE;
  ------------------
  |  |   55|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 2742|      0|        arrayRegion.h = DCTSIZE;
  ------------------
  |  |   55|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 2743|      0|        planeRegion.w = compptr->width_in_blocks * DCTSIZE;
  ------------------
  |  |   55|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 2744|      0|        planeRegion.h = compptr->height_in_blocks * DCTSIZE;
  ------------------
  |  |   55|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 2745|       |
 2746|      0|        for (by = 0; by < compptr->height_in_blocks;
  ------------------
  |  Branch (2746:22): [True: 0, False: 0]
  ------------------
 2747|      0|             by += compptr->v_samp_factor) {
 2748|      0|          JBLOCKARRAY barray = (dinfo->mem->access_virt_barray)
 2749|      0|            ((j_common_ptr)dinfo, dstcoefs[ci], by, compptr->v_samp_factor,
 2750|      0|             TRUE);
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
 2751|       |
 2752|      0|          for (y = 0; y < compptr->v_samp_factor; y++) {
  ------------------
  |  Branch (2752:23): [True: 0, False: 0]
  ------------------
 2753|      0|            if (t[i].customFilter(barray[y][0], arrayRegion, planeRegion, ci,
  ------------------
  |  Branch (2753:17): [True: 0, False: 0]
  ------------------
 2754|      0|                                  i, (tjtransform *)&t[i]) == -1)
 2755|      0|              THROW("Error in custom filter");
  ------------------
  |  |  248|      0|#define THROW(m) { \
  |  |  249|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  250|      0|  this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  209|      0|#define TRUE    1
  |  |  ------------------
  |  |                 this->isInstanceError = TRUE;  THROWG(m, -1) \
  |  |  ------------------
  |  |  |  |  223|      0|#define THROWG(m, rv) { \
  |  |  |  |  224|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  776|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  225|      0|  retval = rv;  goto bailout; \
  |  |  |  |  226|      0|}
  |  |  ------------------
  |  |  251|      0|}
  ------------------
 2756|      0|            arrayRegion.y += DCTSIZE;
  ------------------
  |  |   55|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
 2757|      0|          }
 2758|      0|        }
 2759|      0|      }
 2760|      0|    }
 2761|  7.52k|    if (!(t[i].options & TJXOPT_NOOUTPUT)) jpeg_finish_compress(cinfo);
  ------------------
  |  |  874|  7.52k|#define TJXOPT_NOOUTPUT  (1 << 4)
  ------------------
  |  Branch (2761:9): [True: 7.03k, False: 488]
  ------------------
 2762|  7.52k|  }
 2763|       |
 2764|  3.88k|  jpeg_finish_decompress(dinfo);
 2765|       |
 2766|  7.99k|bailout:
 2767|  7.99k|  if (cinfo->global_state > CSTATE_START) {
  ------------------
  |  |   44|  7.99k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (2767:7): [True: 274, False: 7.71k]
  ------------------
 2768|    274|    if (alloc) (*cinfo->dest->term_destination) (cinfo);
  ------------------
  |  Branch (2768:9): [True: 274, False: 0]
  ------------------
 2769|    274|    jpeg_abort_compress(cinfo);
 2770|    274|  }
 2771|  7.99k|  if (dinfo->global_state > DSTATE_START) jpeg_abort_decompress(dinfo);
  ------------------
  |  |   48|  7.99k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (2771:7): [True: 4.10k, False: 3.88k]
  ------------------
 2772|  7.99k|  free(xinfo);
 2773|  7.99k|  if (this->jerr.warning) retval = -1;
  ------------------
  |  Branch (2773:7): [True: 5.80k, False: 2.18k]
  ------------------
 2774|  7.99k|  return retval;
 2775|  3.88k|}
turbojpeg.c:_tjInitCompress:
  886|  5.51k|{
  887|  5.51k|  static unsigned char buffer[1];
  888|  5.51k|  unsigned char *buf = buffer;
  889|  5.51k|  size_t size = 1;
  890|       |
  891|       |  /* This is also straight out of example.c */
  892|  5.51k|  this->cinfo.err = jpeg_std_error(&this->jerr.pub);
  893|  5.51k|  this->jerr.pub.error_exit = my_error_exit;
  894|  5.51k|  this->jerr.pub.output_message = my_output_message;
  895|  5.51k|  this->jerr.emit_message = this->jerr.pub.emit_message;
  896|  5.51k|  this->jerr.pub.emit_message = my_emit_message;
  897|  5.51k|  this->jerr.pub.addon_message_table = turbojpeg_message_table;
  898|  5.51k|  this->jerr.pub.first_addon_message = JMSG_FIRSTADDONCODE;
  899|  5.51k|  this->jerr.pub.last_addon_message = JMSG_LASTADDONCODE;
  900|       |
  901|  5.51k|  if (setjmp(this->jerr.setjmp_buffer)) {
  902|       |    /* If we get here, the JPEG code has signaled an error. */
  903|      0|    free(this);
  904|      0|    return NULL;
  905|      0|  }
  906|       |
  907|  5.51k|  jpeg_create_compress(&this->cinfo);
  ------------------
  |  |  953|  5.51k|  jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
  |  |  ------------------
  |  |  |  |    4|  5.51k|#define JPEG_LIB_VERSION  62
  |  |  ------------------
  |  |  954|  5.51k|                      (size_t)sizeof(struct jpeg_compress_struct))
  ------------------
  908|       |  /* Make an initial call so it will create the destination manager */
  909|  5.51k|  jpeg_mem_dest_tj(&this->cinfo, &buf, &size, 0);
  910|       |
  911|  5.51k|  this->init |= COMPRESS;
  912|  5.51k|  return (tjhandle)this;
  913|  5.51k|}
turbojpeg.c:my_error_exit:
   74|  4.65k|{
   75|  4.65k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   76|       |
   77|  4.65k|  (*cinfo->err->output_message) (cinfo);
   78|  4.65k|  longjmp(myerr->setjmp_buffer, 1);
   79|  4.65k|}
turbojpeg.c:my_output_message:
   84|  11.8k|{
   85|  11.8k|  (*cinfo->err->format_message) (cinfo, errStr);
   86|  11.8k|}
turbojpeg.c:my_emit_message:
   89|  53.4M|{
   90|  53.4M|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   91|       |
   92|  53.4M|  myerr->emit_message(cinfo, msg_level);
   93|  53.4M|  if (msg_level < 0) {
  ------------------
  |  Branch (93:7): [True: 34.5M, False: 18.9M]
  ------------------
   94|  34.5M|    myerr->warning = TRUE;
  ------------------
  |  |  209|  34.5M|#define TRUE    1
  ------------------
   95|  34.5M|    if (myerr->stopOnWarning) longjmp(myerr->setjmp_buffer, 1);
  ------------------
  |  Branch (95:9): [True: 0, False: 34.5M]
  ------------------
   96|  34.5M|  }
   97|  53.4M|}
turbojpeg.c:my_progress_monitor:
  151|  4.98M|{
  152|  4.98M|  my_error_ptr myerr = (my_error_ptr)dinfo->err;
  153|  4.98M|  my_progress_ptr myprog = (my_progress_ptr)dinfo->progress;
  154|       |
  155|  4.98M|  if (dinfo->is_decompressor) {
  ------------------
  |  Branch (155:7): [True: 4.98M, False: 0]
  ------------------
  156|  4.98M|    int scan_no = ((j_decompress_ptr)dinfo)->input_scan_number;
  157|       |
  158|  4.98M|    if (scan_no > myprog->this->scanLimit) {
  ------------------
  |  Branch (158:9): [True: 3, False: 4.98M]
  ------------------
  159|      3|      SNPRINTF(myprog->this->errStr, JMSG_LENGTH_MAX,
  ------------------
  |  |   42|      3|#define SNPRINTF  snprintf
  ------------------
                    SNPRINTF(myprog->this->errStr, JMSG_LENGTH_MAX,
  ------------------
  |  |  776|      3|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  160|      3|               "Progressive JPEG image has more than %d scans",
  161|      3|               myprog->this->scanLimit);
  162|      3|      SNPRINTF(errStr, JMSG_LENGTH_MAX,
  ------------------
  |  |   42|      3|#define SNPRINTF  snprintf
  ------------------
                    SNPRINTF(errStr, JMSG_LENGTH_MAX,
  ------------------
  |  |  776|      3|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  163|      3|               "Progressive JPEG image has more than %d scans",
  164|      3|               myprog->this->scanLimit);
  165|      3|      myprog->this->isInstanceError = TRUE;
  ------------------
  |  |  209|      3|#define TRUE    1
  ------------------
  166|      3|      myerr->warning = FALSE;
  ------------------
  |  |  206|      3|#define FALSE   0               /* values of boolean */
  ------------------
  167|      3|      longjmp(myerr->setjmp_buffer, 1);
  168|      3|    }
  169|  4.98M|  }
  170|  4.98M|}
turbojpeg.c:setDecompParameters:
  475|  4.18k|{
  476|  4.18k|  this->subsamp = getSubsamp(&this->dinfo);
  477|  4.18k|  this->jpegWidth = this->dinfo.image_width;
  478|  4.18k|  this->jpegHeight = this->dinfo.image_height;
  479|  4.18k|  this->precision = this->dinfo.data_precision;
  480|  4.18k|  switch (this->dinfo.jpeg_color_space) {
  481|  2.99k|  case JCS_GRAYSCALE:  this->colorspace = TJCS_GRAY;  break;
  ------------------
  |  Branch (481:3): [True: 2.99k, False: 1.19k]
  ------------------
  482|     80|  case JCS_RGB:        this->colorspace = TJCS_RGB;  break;
  ------------------
  |  Branch (482:3): [True: 80, False: 4.10k]
  ------------------
  483|    975|  case JCS_YCbCr:      this->colorspace = TJCS_YCbCr;  break;
  ------------------
  |  Branch (483:3): [True: 975, False: 3.21k]
  ------------------
  484|    125|  case JCS_CMYK:       this->colorspace = TJCS_CMYK;  break;
  ------------------
  |  Branch (484:3): [True: 125, False: 4.06k]
  ------------------
  485|      7|  case JCS_YCCK:       this->colorspace = TJCS_YCCK;  break;
  ------------------
  |  Branch (485:3): [True: 7, False: 4.18k]
  ------------------
  486|      5|  default:             this->colorspace = -1;  break;
  ------------------
  |  Branch (486:3): [True: 5, False: 4.18k]
  ------------------
  487|  4.18k|  }
  488|  4.18k|  this->progressive = this->dinfo.progressive_mode;
  489|  4.18k|  this->arithmetic = this->dinfo.arith_code;
  490|  4.18k|  this->lossless = this->dinfo.master->lossless;
  491|  4.18k|  this->losslessPSV = this->dinfo.Ss;
  492|  4.18k|  this->losslessPt = this->dinfo.Al;
  493|  4.18k|  this->xDensity = this->dinfo.X_density;
  494|  4.18k|  this->yDensity = this->dinfo.Y_density;
  495|  4.18k|  this->densityUnits = this->dinfo.density_unit;
  496|  4.18k|}
turbojpeg.c:_tjInitDecompress:
 1708|  5.51k|{
 1709|  5.51k|  static unsigned char buffer[1];
 1710|       |
 1711|       |  /* This is also straight out of example.c */
 1712|  5.51k|  this->dinfo.err = jpeg_std_error(&this->jerr.pub);
 1713|  5.51k|  this->jerr.pub.error_exit = my_error_exit;
 1714|  5.51k|  this->jerr.pub.output_message = my_output_message;
 1715|  5.51k|  this->jerr.emit_message = this->jerr.pub.emit_message;
 1716|  5.51k|  this->jerr.pub.emit_message = my_emit_message;
 1717|  5.51k|  this->jerr.pub.addon_message_table = turbojpeg_message_table;
 1718|  5.51k|  this->jerr.pub.first_addon_message = JMSG_FIRSTADDONCODE;
 1719|  5.51k|  this->jerr.pub.last_addon_message = JMSG_LASTADDONCODE;
 1720|       |
 1721|  5.51k|  if (setjmp(this->jerr.setjmp_buffer)) {
 1722|       |    /* If we get here, the JPEG code has signaled an error. */
 1723|      0|    free(this);
 1724|      0|    return NULL;
 1725|      0|  }
 1726|       |
 1727|  5.51k|  jpeg_create_decompress(&this->dinfo);
  ------------------
  |  |  956|  5.51k|  jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
  |  |  ------------------
  |  |  |  |    4|  5.51k|#define JPEG_LIB_VERSION  62
  |  |  ------------------
  |  |  957|  5.51k|                        (size_t)sizeof(struct jpeg_decompress_struct))
  ------------------
 1728|       |  /* Make an initial call so it will create the source manager */
 1729|  5.51k|  jpeg_mem_src_tj(&this->dinfo, buffer, 1);
 1730|       |
 1731|  5.51k|  this->init |= DECOMPRESS;
 1732|  5.51k|  return (tjhandle)this;
 1733|  5.51k|}
turbojpeg.c:getSubsamp:
  393|  12.1k|{
  394|  12.1k|  int retval = TJSAMP_UNKNOWN, i, k;
  395|       |
  396|       |  /* The sampling factors actually have no meaning with grayscale JPEG files,
  397|       |     and in fact it's possible to generate grayscale JPEGs with sampling
  398|       |     factors > 1 (even though those sampling factors are ignored by the
  399|       |     decompressor.)  Thus, we need to treat grayscale as a special case. */
  400|  12.1k|  if (dinfo->num_components == 1 && dinfo->jpeg_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (400:7): [True: 8.84k, False: 3.33k]
  |  Branch (400:37): [True: 8.84k, False: 0]
  ------------------
  401|  8.84k|    return TJSAMP_GRAY;
  402|       |
  403|  12.2k|  for (i = 0; i < TJ_NUMSAMP; i++) {
  ------------------
  |  |  110|  12.2k|#define TJ_NUMSAMP  7
  ------------------
  |  Branch (403:15): [True: 11.6k, False: 627]
  ------------------
  404|  11.6k|    if (i == TJSAMP_GRAY) continue;
  ------------------
  |  Branch (404:9): [True: 743, False: 10.8k]
  ------------------
  405|       |
  406|  10.8k|    if (dinfo->num_components == 3 ||
  ------------------
  |  Branch (406:9): [True: 9.58k, False: 1.31k]
  ------------------
  407|  10.8k|        ((dinfo->jpeg_color_space == JCS_YCCK ||
  ------------------
  |  Branch (407:11): [True: 54, False: 1.25k]
  ------------------
  408|  1.31k|          dinfo->jpeg_color_space == JCS_CMYK) &&
  ------------------
  |  Branch (408:11): [True: 1.22k, False: 30]
  ------------------
  409|  10.8k|         dinfo->num_components == 4)) {
  ------------------
  |  Branch (409:10): [True: 1.28k, False: 0]
  ------------------
  410|  10.8k|      if (dinfo->comp_info[0].h_samp_factor == tjMCUWidth[i] / 8 &&
  ------------------
  |  Branch (410:11): [True: 5.34k, False: 5.51k]
  ------------------
  411|  10.8k|          dinfo->comp_info[0].v_samp_factor == tjMCUHeight[i] / 8) {
  ------------------
  |  Branch (411:11): [True: 2.75k, False: 2.59k]
  ------------------
  412|  2.75k|        int match = 0;
  413|       |
  414|  8.49k|        for (k = 1; k < dinfo->num_components; k++) {
  ------------------
  |  Branch (414:21): [True: 5.74k, False: 2.75k]
  ------------------
  415|  5.74k|          int href = 1, vref = 1;
  416|       |
  417|  5.74k|          if ((dinfo->jpeg_color_space == JCS_YCCK ||
  ------------------
  |  Branch (417:16): [True: 30, False: 5.71k]
  ------------------
  418|  5.74k|               dinfo->jpeg_color_space == JCS_CMYK) && k == 3) {
  ------------------
  |  Branch (418:16): [True: 711, False: 5.00k]
  |  Branch (418:56): [True: 247, False: 494]
  ------------------
  419|    247|            href = tjMCUWidth[i] / 8;  vref = tjMCUHeight[i] / 8;
  420|    247|          }
  421|  5.74k|          if (dinfo->comp_info[k].h_samp_factor == href &&
  ------------------
  |  Branch (421:15): [True: 5.36k, False: 379]
  ------------------
  422|  5.74k|              dinfo->comp_info[k].v_samp_factor == vref)
  ------------------
  |  Branch (422:15): [True: 5.15k, False: 217]
  ------------------
  423|  5.15k|            match++;
  424|  5.74k|        }
  425|  2.75k|        if (match == dinfo->num_components - 1) {
  ------------------
  |  Branch (425:13): [True: 2.35k, False: 394]
  ------------------
  426|  2.35k|          retval = i;  break;
  427|  2.35k|        }
  428|  2.75k|      }
  429|       |      /* Handle 4:2:2 and 4:4:0 images whose sampling factors are specified
  430|       |         in non-standard ways. */
  431|  8.50k|      if (dinfo->comp_info[0].h_samp_factor == 2 &&
  ------------------
  |  Branch (431:11): [True: 6.58k, False: 1.92k]
  ------------------
  432|  8.50k|          dinfo->comp_info[0].v_samp_factor == 2 &&
  ------------------
  |  Branch (432:11): [True: 5.31k, False: 1.26k]
  ------------------
  433|  8.50k|          (i == TJSAMP_422 || i == TJSAMP_440)) {
  ------------------
  |  Branch (433:12): [True: 2.14k, False: 3.17k]
  |  Branch (433:31): [True: 261, False: 2.91k]
  ------------------
  434|  2.40k|        int match = 0;
  435|       |
  436|  7.33k|        for (k = 1; k < dinfo->num_components; k++) {
  ------------------
  |  Branch (436:21): [True: 4.92k, False: 2.40k]
  ------------------
  437|  4.92k|          int href = tjMCUHeight[i] / 8, vref = tjMCUWidth[i] / 8;
  438|       |
  439|  4.92k|          if ((dinfo->jpeg_color_space == JCS_YCCK ||
  ------------------
  |  Branch (439:16): [True: 36, False: 4.89k]
  ------------------
  440|  4.92k|               dinfo->jpeg_color_space == JCS_CMYK) && k == 3) {
  ------------------
  |  Branch (440:16): [True: 309, False: 4.58k]
  |  Branch (440:56): [True: 115, False: 230]
  ------------------
  441|    115|            href = vref = 2;
  442|    115|          }
  443|  4.92k|          if (dinfo->comp_info[k].h_samp_factor == href &&
  ------------------
  |  Branch (443:15): [True: 4.21k, False: 711]
  ------------------
  444|  4.92k|              dinfo->comp_info[k].v_samp_factor == vref)
  ------------------
  |  Branch (444:15): [True: 867, False: 3.35k]
  ------------------
  445|    867|            match++;
  446|  4.92k|        }
  447|  2.40k|        if (match == dinfo->num_components - 1) {
  ------------------
  |  Branch (447:13): [True: 351, False: 2.05k]
  ------------------
  448|    351|          retval = i;  break;
  449|    351|        }
  450|  2.40k|      }
  451|       |      /* Handle 4:4:4 images whose sampling factors are specified in
  452|       |         non-standard ways. */
  453|  8.15k|      if (dinfo->comp_info[0].h_samp_factor *
  ------------------
  |  Branch (453:11): [True: 1.39k, False: 6.76k]
  ------------------
  454|  8.15k|          dinfo->comp_info[0].v_samp_factor <=
  455|  8.15k|          D_MAX_BLOCKS_IN_MCU / 3 && i == TJSAMP_444) {
  ------------------
  |  |   71|  8.15k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (455:38): [True: 690, False: 705]
  ------------------
  456|    690|        int match = 0;
  457|  2.10k|        for (k = 1; k < dinfo->num_components; k++) {
  ------------------
  |  Branch (457:21): [True: 1.43k, False: 669]
  ------------------
  458|  1.43k|          if (dinfo->comp_info[k].h_samp_factor ==
  ------------------
  |  Branch (458:15): [True: 176, False: 1.25k]
  ------------------
  459|  1.43k|              dinfo->comp_info[0].h_samp_factor &&
  460|  1.43k|              dinfo->comp_info[k].v_samp_factor ==
  ------------------
  |  Branch (460:15): [True: 89, False: 87]
  ------------------
  461|    176|              dinfo->comp_info[0].v_samp_factor)
  462|     89|            match++;
  463|  1.43k|          if (match == dinfo->num_components - 1) {
  ------------------
  |  Branch (463:15): [True: 21, False: 1.41k]
  ------------------
  464|     21|            retval = i;  break;
  465|     21|          }
  466|  1.43k|        }
  467|    690|      }
  468|  8.15k|    }
  469|  10.8k|  }
  470|  3.33k|  return retval;
  471|  12.1k|}

