LLVMFuzzerTestOneInput:
   88|     34|{
   89|     34|  struct heif_context* ctx;
   90|     34|  struct heif_error err;
   91|     34|  struct heif_image_handle* primary_handle = nullptr;
   92|     34|  int images_count;
   93|     34|  heif_item_id* image_IDs = NULL;
   94|     34|  bool explicit_init = size == 0 || data[size - 1] & 1;
  ------------------
  |  Branch (94:24): [True: 0, False: 34]
  |  Branch (94:37): [True: 8, False: 26]
  ------------------
   95|       |
   96|     34|  if (explicit_init) {
  ------------------
  |  Branch (96:7): [True: 8, False: 26]
  ------------------
   97|      8|    heif_init(nullptr);
   98|      8|  }
   99|       |
  100|     34|  heif_check_filetype(data, clip_int(size));
  101|     34|  heif_main_brand(data, clip_int(size));
  102|     34|  heif_get_file_mime_type(data, clip_int(size));
  103|       |
  104|     34|  ctx = heif_context_alloc();
  105|     34|  heif_context_get_security_limits(ctx)->max_total_memory = UINT64_C(2) * 1024 * 1024 * 1024;
  106|     34|  assert(ctx);
  ------------------
  |  Branch (106:3): [True: 34, False: 0]
  ------------------
  107|       |
  108|     34|  auto* limits = heif_context_get_security_limits(ctx);
  109|     34|  limits->max_memory_block_size = 128 * 1024 * 1024; // 128 MB
  110|       |
  111|     34|  err = heif_context_read_from_memory(ctx, data, size, nullptr);
  112|     34|  if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (112:7): [True: 14, False: 20]
  ------------------
  113|       |    // Not a valid HEIF file passed (which is most likely while fuzzing).
  114|     14|    goto quit;
  115|     14|  }
  116|       |
  117|     20|  err = heif_context_get_primary_image_handle(ctx, &primary_handle);
  118|     20|  if (err.code == heif_error_Ok) {
  ------------------
  |  Branch (118:7): [True: 9, False: 11]
  ------------------
  119|      9|    assert(heif_image_handle_is_primary_image(primary_handle));
  ------------------
  |  Branch (119:5): [True: 9, False: 0]
  ------------------
  120|      9|    TestDecodeImage(ctx, primary_handle, size);
  121|      9|    heif_image_handle_release(primary_handle);
  122|      9|    primary_handle = nullptr;
  123|      9|  }
  124|       |
  125|     20|  images_count = heif_context_get_number_of_top_level_images(ctx);
  126|     20|  if (!images_count) {
  ------------------
  |  Branch (126:7): [True: 0, False: 20]
  ------------------
  127|       |    // File doesn't contain any images.
  128|      0|    goto quit;
  129|      0|  }
  130|       |
  131|     20|  image_IDs = (heif_item_id*) malloc(images_count * sizeof(heif_item_id));
  132|     20|  assert(image_IDs);
  ------------------
  |  Branch (132:3): [True: 20, False: 0]
  ------------------
  133|     20|  images_count = heif_context_get_list_of_top_level_image_IDs(ctx, image_IDs, images_count);
  134|     20|  if (!images_count) {
  ------------------
  |  Branch (134:7): [True: 0, False: 20]
  ------------------
  135|       |    // Could not get list of image ids.
  136|      0|    goto quit;
  137|      0|  }
  138|       |
  139|     83|  for (int i = 0; i < images_count; ++i) {
  ------------------
  |  Branch (139:19): [True: 63, False: 20]
  ------------------
  140|     63|    struct heif_image_handle* image_handle = nullptr;
  141|     63|    err = heif_context_get_image_handle(ctx, image_IDs[i], &image_handle);
  142|     63|    if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (142:9): [True: 15, False: 48]
  ------------------
  143|     15|      heif_image_handle_release(image_handle);
  144|       |      // Ignore, we are only interested in crashes here.
  145|     15|      continue;
  146|     15|    }
  147|       |
  148|     48|    TestDecodeImage(ctx, image_handle, size);
  149|       |
  150|     48|    int num_thumbnails = heif_image_handle_get_number_of_thumbnails(image_handle);
  151|     51|    for (int t = 0; t < num_thumbnails; ++t) {
  ------------------
  |  Branch (151:21): [True: 3, False: 48]
  ------------------
  152|      3|      struct heif_image_handle* thumbnail_handle = nullptr;
  153|      3|      heif_image_handle_get_thumbnail(image_handle, t, &thumbnail_handle);
  154|      3|      if (thumbnail_handle) {
  ------------------
  |  Branch (154:11): [True: 0, False: 3]
  ------------------
  155|      0|        TestDecodeImage(ctx, thumbnail_handle, size);
  156|      0|        heif_image_handle_release(thumbnail_handle);
  157|      0|      }
  158|      3|    }
  159|       |
  160|     48|    heif_image_handle_release(image_handle);
  161|     48|  }
  162|       |
  163|     34|  quit:
  164|     34|  heif_image_handle_release(primary_handle);
  165|     34|  heif_context_free(ctx);
  166|     34|  free(image_IDs);
  167|       |
  168|     34|  if (explicit_init) {
  ------------------
  |  Branch (168:7): [True: 8, False: 26]
  ------------------
  169|      8|    heif_deinit();
  170|      8|  }
  171|       |
  172|     34|  return 0;
  173|     20|}
file_fuzzer.cc:_ZL8clip_intm:
   83|    102|{
   84|    102|  return size > INT_MAX ? INT_MAX : static_cast<int>(size);
  ------------------
  |  Branch (84:10): [True: 0, False: 102]
  ------------------
   85|    102|}
file_fuzzer.cc:_ZL15TestDecodeImageP12heif_contextPK17heif_image_handlem:
   32|     57|{
   33|     57|  struct heif_image* image = nullptr;
   34|     57|  struct heif_error err;
   35|       |
   36|     57|  bool primary = heif_image_handle_is_primary_image(handle);
   37|     57|  (void) primary;
   38|     57|  int width = heif_image_handle_get_width(handle);
   39|     57|  int height = heif_image_handle_get_height(handle);
   40|     57|  (void)width; (void)height;
   41|     57|  assert(width >= 0);
  ------------------
  |  Branch (41:3): [True: 57, False: 0]
  ------------------
   42|     57|  assert(height >= 0);
  ------------------
  |  Branch (42:3): [True: 57, False: 0]
  ------------------
   43|     57|  int metadata_count = heif_image_handle_get_number_of_metadata_blocks(handle, nullptr);
   44|     57|  assert(metadata_count >= 0);
  ------------------
  |  Branch (44:3): [True: 57, False: 0]
  ------------------
   45|     57|  assert(static_cast<size_t>(metadata_count) < filesize / sizeof(heif_item_id));
  ------------------
  |  Branch (45:3): [True: 57, False: 0]
  ------------------
   46|     57|  heif_item_id* metadata_ids = static_cast<heif_item_id*>(malloc(metadata_count * sizeof(heif_item_id)));
   47|     57|  assert(metadata_ids);
  ------------------
  |  Branch (47:3): [True: 57, False: 0]
  ------------------
   48|     57|  int metadata_ids_count = heif_image_handle_get_list_of_metadata_block_IDs(handle, nullptr, metadata_ids,
   49|     57|                                                                            metadata_count);
   50|     57|  assert(metadata_count == metadata_ids_count);
  ------------------
  |  Branch (50:3): [True: 57, False: 0]
  ------------------
   51|     57|  (void)metadata_ids_count;
   52|     57|  for (int i = 0; i < metadata_count; i++) {
  ------------------
  |  Branch (52:19): [True: 0, False: 57]
  ------------------
   53|      0|    heif_image_handle_get_metadata_type(handle, metadata_ids[i]);
   54|      0|    heif_image_handle_get_metadata_content_type(handle, metadata_ids[i]);
   55|      0|    size_t metadata_size = heif_image_handle_get_metadata_size(handle, metadata_ids[i]);
   56|       |
   57|       |    // This assertion is invalid. Metadata can in fact be larger than the file if there are several
   58|       |    // overlapping iloc extents. Does not make much sense, but it is technically valid.
   59|       |    //assert(metadata_size < filesize);
   60|       |
   61|      0|    uint8_t* metadata_data = static_cast<uint8_t*>(malloc(metadata_size));
   62|      0|    assert(metadata_data);
  ------------------
  |  Branch (62:5): [True: 0, False: 0]
  ------------------
   63|      0|    heif_image_handle_get_metadata(handle, metadata_ids[i], metadata_data);
   64|      0|    free(metadata_data);
   65|      0|  }
   66|     57|  free(metadata_ids);
   67|       |
   68|     57|  err = heif_decode_image(handle, &image, kFuzzColorSpace, kFuzzChroma, nullptr);
   69|     57|  if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (69:7): [True: 52, False: 5]
  ------------------
   70|     52|    heif_image_release(image);
   71|     52|    return;
   72|     52|  }
   73|       |
   74|     57|  assert(heif_image_get_colorspace(image) == kFuzzColorSpace);
  ------------------
  |  Branch (74:3): [True: 5, False: 0]
  ------------------
   75|      5|  assert(heif_image_get_chroma_format(image) == kFuzzChroma);
  ------------------
  |  Branch (75:3): [True: 5, False: 0]
  ------------------
   76|       |
   77|       |  // TODO(fancycode): Should we also check the planes?
   78|       |
   79|      5|  heif_image_release(image);
   80|      5|}

heif_image_handle_get_number_of_thumbnails:
  136|     48|{
  137|     48|  return (int) handle->image->get_thumbnails().size();
  138|     48|}
heif_image_handle_get_thumbnail:
  162|      3|{
  163|      3|  if (!out_thumbnail_handle) {
  ------------------
  |  Branch (163:7): [True: 0, False: 3]
  ------------------
  164|      0|    return heif_error_null_pointer_argument;
  165|      0|  }
  166|       |
  167|      3|  auto thumbnails = handle->image->get_thumbnails();
  168|      3|  for (const auto& thumb : thumbnails) {
  ------------------
  |  Branch (168:26): [True: 3, False: 3]
  ------------------
  169|      3|    if (thumb->get_id() == thumbnail_id) {
  ------------------
  |  Branch (169:9): [True: 0, False: 3]
  ------------------
  170|      0|      *out_thumbnail_handle = new heif_image_handle();
  171|      0|      (*out_thumbnail_handle)->image = thumb;
  172|      0|      (*out_thumbnail_handle)->context = handle->context;
  173|       |
  174|      0|      return Error::Ok.error_struct(handle->image.get());
  175|      0|    }
  176|      3|  }
  177|       |
  178|      3|  Error err(heif_error_Usage_error, heif_suberror_Nonexisting_item_referenced);
  179|      3|  return err.error_struct(handle->image.get());
  180|      3|}

heif_read_main_brand:
   35|     66|{
   36|     66|  if (len < 12) {
  ------------------
  |  Branch (36:7): [True: 0, False: 66]
  ------------------
   37|      0|    return heif_unknown_brand;
   38|      0|  }
   39|       |
   40|     66|  return heif_fourcc_to_brand((char*) (data + 8));
   41|     66|}
heif_fourcc_to_brand:
   54|     66|{
   55|     66|  if (fourcc_string == nullptr || !fourcc_string[0] || !fourcc_string[1] || !fourcc_string[2] || !fourcc_string[3]) {
  ------------------
  |  Branch (55:7): [True: 0, False: 66]
  |  Branch (55:35): [True: 16, False: 50]
  |  Branch (55:56): [True: 2, False: 48]
  |  Branch (55:77): [True: 0, False: 48]
  |  Branch (55:98): [True: 0, False: 48]
  ------------------
   56|     18|    return 0;
   57|     18|  }
   58|       |
   59|     48|  return fourcc(fourcc_string);
   60|     66|}
heif_get_file_mime_type:
  227|     34|{
  228|     34|  heif_brand2 mainBrand = heif_read_main_brand(data, len);
  229|       |
  230|     34|  if (mainBrand == heif_brand2_heic ||
  ------------------
  |  |   44|     34|#define heif_brand2_heic   heif_fourcc('h','e','i','c')
  |  |  ------------------
  |  |  |  |   71|     68|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (230:7): [True: 1, False: 33]
  ------------------
  231|     34|      mainBrand == heif_brand2_heix ||
  ------------------
  |  |   53|     33|#define heif_brand2_heix   heif_fourcc('h','e','i','x')
  |  |  ------------------
  |  |  |  |   71|     67|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (231:7): [True: 1, False: 32]
  ------------------
  232|     34|      mainBrand == heif_brand2_heim ||
  ------------------
  |  |   80|     32|#define heif_brand2_heim   heif_fourcc('h','e','i','m')
  |  |  ------------------
  |  |  |  |   71|     66|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (232:7): [True: 0, False: 32]
  ------------------
  233|     32|      mainBrand == heif_brand2_heis) {
  ------------------
  |  |   90|     32|#define heif_brand2_heis   heif_fourcc('h','e','i','s')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (233:7): [True: 0, False: 32]
  ------------------
  234|      2|    return "image/heic";
  235|      2|  }
  236|     32|  else if (mainBrand == heif_brand2_mif1) {
  ------------------
  |  |  132|     32|#define heif_brand2_mif1   heif_fourcc('m','i','f','1')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (236:12): [True: 0, False: 32]
  ------------------
  237|      0|    return "image/heif";
  238|      0|  }
  239|     32|  else if (mainBrand == heif_brand2_hevc ||
  ------------------
  |  |   62|     32|#define heif_brand2_hevc   heif_fourcc('h','e','v','c')
  |  |  ------------------
  |  |  |  |   71|     64|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (239:12): [True: 0, False: 32]
  ------------------
  240|     32|           mainBrand == heif_brand2_hevx ||
  ------------------
  |  |   71|     32|#define heif_brand2_hevx   heif_fourcc('h','e','v','x')
  |  |  ------------------
  |  |  |  |   71|     64|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (240:12): [True: 0, False: 32]
  ------------------
  241|     32|           mainBrand == heif_brand2_hevm ||
  ------------------
  |  |   99|     32|#define heif_brand2_hevm   heif_fourcc('h','e','v','m')
  |  |  ------------------
  |  |  |  |   71|     64|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (241:12): [True: 0, False: 32]
  ------------------
  242|     32|           mainBrand == heif_brand2_hevs) {
  ------------------
  |  |  109|     32|#define heif_brand2_hevs   heif_fourcc('h','e','v','s')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (242:12): [True: 0, False: 32]
  ------------------
  243|      0|    return "image/heic-sequence";
  244|      0|  }
  245|     32|  else if (mainBrand == heif_brand2_msf1) {
  ------------------
  |  |  159|     32|#define heif_brand2_msf1   heif_fourcc('m','s','f','1')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (245:12): [True: 0, False: 32]
  ------------------
  246|      0|    return "image/heif-sequence";
  247|      0|  }
  248|     32|  else if (mainBrand == heif_brand2_avif) {
  ------------------
  |  |  116|     32|#define heif_brand2_avif   heif_fourcc('a','v','i','f')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (248:12): [True: 0, False: 32]
  ------------------
  249|      0|    return "image/avif";
  250|      0|  }
  251|     32|  else if (mainBrand == heif_brand2_avis) {
  ------------------
  |  |  123|     32|#define heif_brand2_avis   heif_fourcc('a','v','i','s') // AVIF sequence
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (251:12): [True: 0, False: 32]
  ------------------
  252|      0|    return "image/avif-sequence";
  253|      0|  }
  254|     32|  else if (mainBrand == heif_brand2_avci) {
  ------------------
  |  |  250|     32|#define heif_brand2_avci   heif_fourcc('a','v','c','i')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (254:12): [True: 0, False: 32]
  ------------------
  255|      0|    return "image/avci";
  256|      0|  }
  257|     32|  else if (mainBrand == heif_brand2_avcs) {
  ------------------
  |  |  251|     32|#define heif_brand2_avcs   heif_fourcc('a','v','c','s')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (257:12): [True: 0, False: 32]
  ------------------
  258|      0|    return "image/avcs";
  259|      0|  }
  260|       |#if ENABLE_EXPERIMENTAL_MINI_FORMAT
  261|       |  else if (mainBrand == heif_brand2_mif3) {
  262|       |    heif_brand2 minorBrand = heif_read_minor_version_brand(data, len);
  263|       |    if (minorBrand == heif_brand2_avif) {
  264|       |      return "image/avif";
  265|       |    }
  266|       |    if (minorBrand == heif_brand2_heic ||
  267|       |        minorBrand == heif_brand2_heix ||
  268|       |        minorBrand == heif_brand2_heim ||
  269|       |        minorBrand == heif_brand2_heis) {
  270|       |      return "image/heic";
  271|       |    }
  272|       |    // There could be other options in here, like VVC or J2K
  273|       |    return "image/heif";
  274|       |  }
  275|       |#endif
  276|     32|  else if (mainBrand == heif_brand2_j2ki) {
  ------------------
  |  |  222|     32|#define heif_brand2_j2ki   heif_fourcc('j','2','k','i')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (276:12): [True: 0, False: 32]
  ------------------
  277|      0|    return "image/hej2k";
  278|      0|  }
  279|     32|  else if (mainBrand == heif_brand2_j2is) {
  ------------------
  |  |  229|     32|#define heif_brand2_j2is   heif_fourcc('j','2','i','s')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (279:12): [True: 0, False: 32]
  ------------------
  280|      0|    return "image/j2is";
  281|      0|  }
  282|     32|  else if (is_jpeg(data, len) == TriBool::Yes) {
  ------------------
  |  Branch (282:12): [True: 0, False: 32]
  ------------------
  283|      0|    return "image/jpeg";
  284|      0|  }
  285|     32|  else if (is_png(data, len) == TriBool::Yes) {
  ------------------
  |  Branch (285:12): [True: 0, False: 32]
  ------------------
  286|      0|    return "image/png";
  287|      0|  }
  288|     32|  else {
  289|     32|    return "";
  290|     32|  }
  291|     34|}
heif_check_filetype:
  294|     34|{
  295|     34|  if (len < 8) {
  ------------------
  |  Branch (295:7): [True: 0, False: 34]
  ------------------
  296|      0|    return heif_filetype_maybe;
  297|      0|  }
  298|       |
  299|     34|  if (data[4] != 'f' ||
  ------------------
  |  Branch (299:7): [True: 2, False: 32]
  ------------------
  300|     32|      data[5] != 't' ||
  ------------------
  |  Branch (300:7): [True: 0, False: 32]
  ------------------
  301|     32|      data[6] != 'y' ||
  ------------------
  |  Branch (301:7): [True: 0, False: 32]
  ------------------
  302|     32|      data[7] != 'p') {
  ------------------
  |  Branch (302:7): [True: 0, False: 32]
  ------------------
  303|      2|    return heif_filetype_no;
  304|      2|  }
  305|       |
  306|     32|  if (len >= 12) {
  ------------------
  |  Branch (306:7): [True: 32, False: 0]
  ------------------
  307|     32|    heif_brand2 brand = heif_read_main_brand(data, len);
  308|       |
  309|     32|    if (brand == heif_brand2_heic) {
  ------------------
  |  |   44|     32|#define heif_brand2_heic   heif_fourcc('h','e','i','c')
  |  |  ------------------
  |  |  |  |   71|     32|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (309:9): [True: 1, False: 31]
  ------------------
  310|      1|      return heif_filetype_yes_supported;
  311|      1|    }
  312|     31|    else if (brand == heif_brand2_heix) {
  ------------------
  |  |   53|     31|#define heif_brand2_heix   heif_fourcc('h','e','i','x')
  |  |  ------------------
  |  |  |  |   71|     31|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (312:14): [True: 1, False: 30]
  ------------------
  313|      1|      return heif_filetype_yes_supported;
  314|      1|    }
  315|     30|    else if (brand == heif_brand2_avif) {
  ------------------
  |  |  116|     30|#define heif_brand2_avif   heif_fourcc('a','v','i','f')
  |  |  ------------------
  |  |  |  |   71|     30|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (315:14): [True: 0, False: 30]
  ------------------
  316|      0|      return heif_filetype_yes_supported;
  317|      0|    }
  318|     30|    else if (brand == heif_brand2_jpeg) {
  ------------------
  |  |  208|     30|#define heif_brand2_jpeg   heif_fourcc('j','p','e','g')
  |  |  ------------------
  |  |  |  |   71|     30|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (318:14): [True: 0, False: 30]
  ------------------
  319|      0|      return heif_filetype_yes_supported;
  320|      0|    }
  321|     30|    else if (brand == heif_brand2_j2ki) {
  ------------------
  |  |  222|     30|#define heif_brand2_j2ki   heif_fourcc('j','2','k','i')
  |  |  ------------------
  |  |  |  |   71|     30|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (321:14): [True: 0, False: 30]
  ------------------
  322|      0|      return heif_filetype_yes_supported;
  323|      0|    }
  324|     30|    else if (brand == heif_brand2_mif1) {
  ------------------
  |  |  132|     30|#define heif_brand2_mif1   heif_fourcc('m','i','f','1')
  |  |  ------------------
  |  |  |  |   71|     30|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (324:14): [True: 0, False: 30]
  ------------------
  325|      0|      return heif_filetype_maybe;
  326|      0|    }
  327|     30|    else if (brand == heif_brand2_mif2) {
  ------------------
  |  |  143|     30|#define heif_brand2_mif2   heif_fourcc('m','i','f','2')
  |  |  ------------------
  |  |  |  |   71|     30|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (327:14): [True: 0, False: 30]
  ------------------
  328|      0|      return heif_filetype_maybe;
  329|      0|    }
  330|     30|    else {
  331|     30|      return heif_filetype_yes_unsupported;
  332|     30|    }
  333|     32|  }
  334|       |
  335|      0|  return heif_filetype_maybe;
  336|     32|}
heif_main_brand:
  467|     34|{
  468|     34|  if (len < 12) {
  ------------------
  |  Branch (468:7): [True: 0, False: 34]
  ------------------
  469|      0|    return heif_unknown_brand;
  470|      0|  }
  471|       |
  472|     34|  return heif_fourcc_to_brand_enum((char*) (data + 8));
  473|     34|}
heif_brands.cc:_ZL7is_jpegPKhi:
  189|     32|{
  190|     32|  if (len < 12) {
  ------------------
  |  Branch (190:7): [True: 0, False: 32]
  ------------------
  191|      0|    return TriBool::Unknown;
  192|      0|  }
  193|       |
  194|     32|  if (data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF && data[3] == 0xE0 &&
  ------------------
  |  Branch (194:7): [True: 0, False: 32]
  |  Branch (194:26): [True: 0, False: 0]
  |  Branch (194:45): [True: 0, False: 0]
  |  Branch (194:64): [True: 0, False: 0]
  ------------------
  195|      0|      data[4] == 0x00 && data[5] == 0x10 && data[6] == 0x4A && data[7] == 0x46 &&
  ------------------
  |  Branch (195:7): [True: 0, False: 0]
  |  Branch (195:26): [True: 0, False: 0]
  |  Branch (195:45): [True: 0, False: 0]
  |  Branch (195:64): [True: 0, False: 0]
  ------------------
  196|      0|      data[8] == 0x49 && data[9] == 0x46 && data[10] == 0x00 && data[11] == 0x01) {
  ------------------
  |  Branch (196:7): [True: 0, False: 0]
  |  Branch (196:26): [True: 0, False: 0]
  |  Branch (196:45): [True: 0, False: 0]
  |  Branch (196:65): [True: 0, False: 0]
  ------------------
  197|      0|    return TriBool::Yes;
  198|      0|  }
  199|     32|  if (data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF && data[3] == 0xE1 &&
  ------------------
  |  Branch (199:7): [True: 0, False: 32]
  |  Branch (199:26): [True: 0, False: 0]
  |  Branch (199:45): [True: 0, False: 0]
  |  Branch (199:64): [True: 0, False: 0]
  ------------------
  200|      0|      data[6] == 0x45 && data[7] == 0x78 && data[8] == 0x69 && data[9] == 0x66 &&
  ------------------
  |  Branch (200:7): [True: 0, False: 0]
  |  Branch (200:26): [True: 0, False: 0]
  |  Branch (200:45): [True: 0, False: 0]
  |  Branch (200:64): [True: 0, False: 0]
  ------------------
  201|      0|      data[10] == 0x00 && data[11] == 0x00) {
  ------------------
  |  Branch (201:7): [True: 0, False: 0]
  |  Branch (201:27): [True: 0, False: 0]
  ------------------
  202|      0|    return TriBool::Yes;
  203|      0|  }
  204|     32|  else {
  205|     32|    return TriBool::No;
  206|     32|  }
  207|     32|}
heif_brands.cc:_ZL6is_pngPKhi:
  211|     32|{
  212|     32|  if (len < 8) {
  ------------------
  |  Branch (212:7): [True: 0, False: 32]
  ------------------
  213|      0|    return TriBool::Unknown;
  214|      0|  }
  215|       |
  216|     32|  if (data[0] == 0x89 && data[1] == 0x50 && data[2] == 0x4E && data[3] == 0x47 &&
  ------------------
  |  Branch (216:7): [True: 0, False: 32]
  |  Branch (216:26): [True: 0, False: 0]
  |  Branch (216:45): [True: 0, False: 0]
  |  Branch (216:64): [True: 0, False: 0]
  ------------------
  217|      0|      data[4] == 0x0D && data[5] == 0x0A && data[6] == 0x1A && data[7] == 0x0A) {
  ------------------
  |  Branch (217:7): [True: 0, False: 0]
  |  Branch (217:26): [True: 0, False: 0]
  |  Branch (217:45): [True: 0, False: 0]
  |  Branch (217:64): [True: 0, False: 0]
  ------------------
  218|      0|    return TriBool::Yes;
  219|      0|  }
  220|     32|  else {
  221|     32|    return TriBool::No;
  222|     32|  }
  223|     32|}
heif_brands.cc:_ZL25heif_fourcc_to_brand_enumPKc:
  403|     34|{
  404|     34|  if (fourcc == nullptr || !fourcc[0] || !fourcc[1] || !fourcc[2] || !fourcc[3]) {
  ------------------
  |  Branch (404:7): [True: 0, False: 34]
  |  Branch (404:28): [True: 9, False: 25]
  |  Branch (404:42): [True: 1, False: 24]
  |  Branch (404:56): [True: 0, False: 24]
  |  Branch (404:70): [True: 0, False: 24]
  ------------------
  405|     10|    return heif_unknown_brand;
  406|     10|  }
  407|       |
  408|     24|  char brand[5];
  409|     24|  brand[0] = fourcc[0];
  410|     24|  brand[1] = fourcc[1];
  411|     24|  brand[2] = fourcc[2];
  412|     24|  brand[3] = fourcc[3];
  413|     24|  brand[4] = 0;
  414|       |
  415|     24|  if (strcmp(brand, "heic") == 0) {
  ------------------
  |  Branch (415:7): [True: 1, False: 23]
  ------------------
  416|      1|    return heif_heic;
  417|      1|  }
  418|     23|  else if (strcmp(brand, "heix") == 0) {
  ------------------
  |  Branch (418:12): [True: 1, False: 22]
  ------------------
  419|      1|    return heif_heix;
  420|      1|  }
  421|     22|  else if (strcmp(brand, "hevc") == 0) {
  ------------------
  |  Branch (421:12): [True: 0, False: 22]
  ------------------
  422|      0|    return heif_hevc;
  423|      0|  }
  424|     22|  else if (strcmp(brand, "hevx") == 0) {
  ------------------
  |  Branch (424:12): [True: 0, False: 22]
  ------------------
  425|      0|    return heif_hevx;
  426|      0|  }
  427|     22|  else if (strcmp(brand, "heim") == 0) {
  ------------------
  |  Branch (427:12): [True: 0, False: 22]
  ------------------
  428|      0|    return heif_heim;
  429|      0|  }
  430|     22|  else if (strcmp(brand, "heis") == 0) {
  ------------------
  |  Branch (430:12): [True: 0, False: 22]
  ------------------
  431|      0|    return heif_heis;
  432|      0|  }
  433|     22|  else if (strcmp(brand, "hevm") == 0) {
  ------------------
  |  Branch (433:12): [True: 0, False: 22]
  ------------------
  434|      0|    return heif_hevm;
  435|      0|  }
  436|     22|  else if (strcmp(brand, "hevs") == 0) {
  ------------------
  |  Branch (436:12): [True: 0, False: 22]
  ------------------
  437|      0|    return heif_hevs;
  438|      0|  }
  439|     22|  else if (strcmp(brand, "mif1") == 0) {
  ------------------
  |  Branch (439:12): [True: 0, False: 22]
  ------------------
  440|      0|    return heif_mif1;
  441|      0|  }
  442|     22|  else if (strcmp(brand, "msf1") == 0) {
  ------------------
  |  Branch (442:12): [True: 0, False: 22]
  ------------------
  443|      0|    return heif_msf1;
  444|      0|  }
  445|     22|  else if (strcmp(brand, "avif") == 0) {
  ------------------
  |  Branch (445:12): [True: 0, False: 22]
  ------------------
  446|      0|    return heif_avif;
  447|      0|  }
  448|     22|  else if (strcmp(brand, "avis") == 0) {
  ------------------
  |  Branch (448:12): [True: 0, False: 22]
  ------------------
  449|      0|    return heif_avis;
  450|      0|  }
  451|     22|  else if (strcmp(brand, "vvic") == 0) {
  ------------------
  |  Branch (451:12): [True: 1, False: 21]
  ------------------
  452|      1|    return heif_vvic;
  453|      1|  }
  454|     21|  else if (strcmp(brand, "j2ki") == 0) {
  ------------------
  |  Branch (454:12): [True: 0, False: 21]
  ------------------
  455|      0|    return heif_j2ki;
  456|      0|  }
  457|     21|  else if (strcmp(brand, "j2is") == 0) {
  ------------------
  |  Branch (457:12): [True: 0, False: 21]
  ------------------
  458|      0|    return heif_j2is;
  459|      0|  }
  460|     21|  else {
  461|     21|    return heif_unknown_brand;
  462|     21|  }
  463|     24|}

heif_color_conversion_options_ext_alloc:
   68|      5|{
   69|      5|  auto options = new heif_color_conversion_options_ext;
   70|       |
   71|      5|  fill_default_color_conversion_options_ext(*options);
   72|       |
   73|      5|  return options;
   74|      5|}
heif_color_conversion_options_ext_copy:
   79|      5|{
   80|      5|  if (src == nullptr) {
  ------------------
  |  Branch (80:7): [True: 5, False: 0]
  ------------------
   81|      5|    return;
   82|      5|  }
   83|       |
   84|      0|  int min_version = std::min(dst->version, src->version);
   85|       |
   86|      0|  switch (min_version) {
  ------------------
  |  Branch (86:11): [True: 0, False: 0]
  ------------------
   87|      0|    case 1:
  ------------------
  |  Branch (87:5): [True: 0, False: 0]
  ------------------
   88|      0|      dst->alpha_composition_mode = src->alpha_composition_mode;
   89|      0|      dst->background_red = src->background_red;
   90|      0|      dst->background_green = src->background_green;
   91|      0|      dst->background_blue = src->background_blue;
   92|      0|      dst->secondary_background_red = src->secondary_background_red;
   93|      0|      dst->secondary_background_green = src->secondary_background_green;
   94|      0|      dst->secondary_background_blue = src->secondary_background_blue;
   95|      0|      dst->checkerboard_square_size = src->checkerboard_square_size;
   96|      0|  }
   97|      0|}
heif_color_conversion_options_ext_free:
  101|      5|{
  102|      5|  delete options;
  103|      5|}
heif_nclx_color_profile_alloc:
  289|      5|{
  290|      5|  auto profile = new heif_color_profile_nclx;
  291|       |
  292|      5|  if (profile) {
  ------------------
  |  Branch (292:7): [True: 5, False: 0]
  ------------------
  293|      5|    profile->version = 1;
  294|       |
  295|       |    // sRGB defaults
  296|      5|    profile->color_primaries = heif_color_primaries_ITU_R_BT_709_5; // 1
  297|      5|    profile->transfer_characteristics = heif_transfer_characteristic_IEC_61966_2_1; // 13
  298|      5|    profile->matrix_coefficients = heif_matrix_coefficients_ITU_R_BT_601_6; // 6
  299|      5|    profile->full_range_flag = true;
  300|      5|  }
  301|       |
  302|      5|  return profile;
  303|      5|}
heif_nclx_color_profile_free:
  307|      5|{
  308|      5|  delete nclx_profile;
  309|      5|}
heif_color.cc:_ZL41fill_default_color_conversion_options_extR33heif_color_conversion_options_ext:
   58|      5|{
   59|      5|  options.version = 1;
   60|      5|  options.alpha_composition_mode = heif_alpha_composition_mode_none;
   61|      5|  options.background_red = options.background_green = options.background_blue = 0xFFFF;
   62|      5|  options.secondary_background_red = options.secondary_background_green = options.secondary_background_blue = 0xCCCC;
   63|      5|  options.checkerboard_square_size = 16;
   64|      5|}

heif_context_alloc:
   43|     34|{
   44|     34|  load_plugins_if_not_initialized_yet();
   45|       |
   46|     34|  heif_context* ctx = new heif_context;
   47|     34|  ctx->context = std::make_shared<HeifContext>();
   48|       |
   49|     34|  return ctx;
   50|     34|}
heif_context_free:
   53|     34|{
   54|     34|  delete ctx;
   55|     34|}
heif_context_read_from_memory:
   66|     34|{
   67|     34|  Error err = ctx->context->read_from_memory(mem, size, true);
   68|     34|  return err.error_struct(ctx->context.get());
   69|     34|}
heif_context_get_number_of_top_level_images:
   92|     20|{
   93|     20|  return (int) ctx->context->get_top_level_images(true).size();
   94|     20|}
heif_context_get_list_of_top_level_image_IDs:
  114|     20|{
  115|     20|  if (ID_array == nullptr || count == 0 || ctx == nullptr) {
  ------------------
  |  Branch (115:7): [True: 0, False: 20]
  |  Branch (115:30): [True: 0, False: 20]
  |  Branch (115:44): [True: 0, False: 20]
  ------------------
  116|      0|    return 0;
  117|      0|  }
  118|       |
  119|       |
  120|       |  // fill in ID values into output array
  121|       |
  122|     20|  const std::vector<std::shared_ptr<ImageItem> > imgs = ctx->context->get_top_level_images(true);
  123|     20|  int n = (int) std::min(count, (int) imgs.size());
  124|     83|  for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (124:19): [True: 63, False: 20]
  ------------------
  125|     63|    ID_array[i] = imgs[i]->get_id();
  126|     63|  }
  127|       |
  128|     20|  return n;
  129|     20|}
heif_context_get_primary_image_handle:
  152|     20|{
  153|     20|  if (!img) {
  ------------------
  |  Branch (153:7): [True: 0, False: 20]
  ------------------
  154|      0|    Error err(heif_error_Usage_error,
  155|      0|              heif_suberror_Null_pointer_argument);
  156|      0|    return err.error_struct(ctx->context.get());
  157|      0|  }
  158|       |
  159|     20|  std::shared_ptr<ImageItem> primary_image = ctx->context->get_primary_image(true);
  160|       |
  161|       |  // It is a requirement of an HEIF file there is always a primary image.
  162|       |  // If there is none, an error is generated when loading the file.
  163|     20|  if (!primary_image) {
  ------------------
  |  Branch (163:7): [True: 0, False: 20]
  ------------------
  164|      0|    Error err(heif_error_Invalid_input,
  165|      0|              heif_suberror_No_or_invalid_primary_item);
  166|      0|    return err.error_struct(ctx->context.get());
  167|      0|  }
  168|       |
  169|     20|  if (auto errImage = std::dynamic_pointer_cast<ImageItem_Error>(primary_image)) {
  ------------------
  |  Branch (169:12): [True: 11, False: 9]
  ------------------
  170|     11|    Error error = errImage->get_item_error();
  171|     11|    return error.error_struct(ctx->context.get());
  172|     11|  }
  173|       |
  174|      9|  *img = new heif_image_handle();
  175|      9|  (*img)->image = std::move(primary_image);
  176|      9|  (*img)->context = ctx->context;
  177|       |
  178|      9|  return Error::Ok.error_struct(ctx->context.get());
  179|     20|}
heif_context_get_image_handle:
  185|     63|{
  186|     63|  if (!imgHdl) {
  ------------------
  |  Branch (186:7): [True: 0, False: 63]
  ------------------
  187|      0|    return {heif_error_Usage_error, heif_suberror_Null_pointer_argument, ""};
  188|      0|  }
  189|       |
  190|     63|  auto image = ctx->context->get_image(id, true);
  191|       |
  192|     63|  if (auto errImage = std::dynamic_pointer_cast<ImageItem_Error>(image)) {
  ------------------
  |  Branch (192:12): [True: 15, False: 48]
  ------------------
  193|     15|    Error error = errImage->get_item_error();
  194|     15|    return error.error_struct(ctx->context.get());
  195|     15|  }
  196|       |
  197|     48|  if (!image) {
  ------------------
  |  Branch (197:7): [True: 0, False: 48]
  ------------------
  198|      0|    *imgHdl = nullptr;
  199|       |
  200|      0|    return {heif_error_Usage_error, heif_suberror_Nonexisting_item_referenced, ""};
  201|      0|  }
  202|       |
  203|     48|  *imgHdl = new heif_image_handle();
  204|     48|  (*imgHdl)->image = std::move(image);
  205|     48|  (*imgHdl)->context = ctx->context;
  206|       |
  207|     48|  return heif_error_success;
  208|     48|}

heif_decoding_options_copy:
  113|     57|{
  114|     57|  if (src == nullptr) {
  ------------------
  |  Branch (114:7): [True: 57, False: 0]
  ------------------
  115|     57|    return;
  116|     57|  }
  117|       |
  118|      0|  int min_version = std::min(dst->version, src->version);
  119|       |
  120|      0|  switch (min_version) {
  ------------------
  |  Branch (120:11): [True: 0, False: 0]
  ------------------
  121|      0|    case 8:
  ------------------
  |  Branch (121:5): [True: 0, False: 0]
  ------------------
  122|      0|      dst->num_library_threads = src->num_library_threads;
  123|      0|      dst->num_codec_threads = src->num_codec_threads;
  124|      0|      dst->output_image_nclx_profile = src->output_image_nclx_profile;
  125|      0|      dst->ignore_sequence_editlist = src->ignore_sequence_editlist;
  126|      0|      [[fallthrough]];
  127|      0|    case 7:
  ------------------
  |  Branch (127:5): [True: 0, False: 0]
  ------------------
  128|      0|      dst->color_conversion_options_ext = src->color_conversion_options_ext;
  129|      0|      [[fallthrough]];
  130|      0|    case 6:
  ------------------
  |  Branch (130:5): [True: 0, False: 0]
  ------------------
  131|      0|      dst->cancel_decoding = src->cancel_decoding;
  132|      0|      [[fallthrough]];
  133|      0|    case 5:
  ------------------
  |  Branch (133:5): [True: 0, False: 0]
  ------------------
  134|      0|      dst->color_conversion_options = src->color_conversion_options;
  135|      0|      [[fallthrough]];
  136|      0|    case 4:
  ------------------
  |  Branch (136:5): [True: 0, False: 0]
  ------------------
  137|      0|      dst->decoder_id = src->decoder_id;
  138|      0|      [[fallthrough]];
  139|      0|    case 3:
  ------------------
  |  Branch (139:5): [True: 0, False: 0]
  ------------------
  140|      0|      dst->strict_decoding = src->strict_decoding;
  141|      0|      [[fallthrough]];
  142|      0|    case 2:
  ------------------
  |  Branch (142:5): [True: 0, False: 0]
  ------------------
  143|      0|      dst->convert_hdr_to_8bit = src->convert_hdr_to_8bit;
  144|      0|      [[fallthrough]];
  145|      0|    case 1:
  ------------------
  |  Branch (145:5): [True: 0, False: 0]
  ------------------
  146|      0|      dst->ignore_transformations = src->ignore_transformations;
  147|      0|      dst->start_progress = src->start_progress;
  148|      0|      dst->on_progress = src->on_progress;
  149|      0|      dst->end_progress = src->end_progress;
  150|      0|      dst->progress_user_data = src->progress_user_data;
  151|      0|  }
  152|      0|}
heif_decode_image:
  232|     57|{
  233|     57|  if (out_img == nullptr || in_handle == nullptr) {
  ------------------
  |  Branch (233:7): [True: 0, False: 57]
  |  Branch (233:29): [True: 0, False: 57]
  ------------------
  234|      0|    return heif_error_null_pointer_argument;
  235|      0|  }
  236|       |
  237|     57|  *out_img = nullptr;
  238|     57|  heif_item_id id = in_handle->image->get_id();
  239|       |
  240|     57|  heif_decoding_options dec_options;
  241|     57|  fill_default_decoding_options(dec_options);
  242|     57|  heif_decoding_options_copy(&dec_options, input_options);
  243|       |
  244|     57|  Result<std::shared_ptr<HeifPixelImage> > decodingResult = in_handle->context->decode_image(id,
  245|     57|                                                                                             colorspace,
  246|     57|                                                                                             chroma,
  247|     57|                                                                                             dec_options,
  248|     57|                                                                                             false, 0, 0, {});
  249|       |
  250|     57|  if (!decodingResult) {
  ------------------
  |  Branch (250:7): [True: 52, False: 5]
  ------------------
  251|     52|    return decodingResult.error_struct(in_handle->image.get());
  252|     52|  }
  253|       |
  254|      5|  std::shared_ptr<HeifPixelImage> img = *decodingResult;
  255|       |
  256|      5|  *out_img = new heif_image();
  257|      5|  (*out_img)->image = std::move(img);
  258|       |
  259|      5|  return Error::Ok.error_struct(in_handle->image.get());
  260|     57|}
heif_decoding.cc:_ZL29fill_default_decoding_optionsR21heif_decoding_options:
   54|     57|{
   55|     57|  options.version = 8;
   56|       |
   57|     57|  options.ignore_transformations = false;
   58|       |
   59|     57|  options.start_progress = nullptr;
   60|     57|  options.on_progress = nullptr;
   61|     57|  options.end_progress = nullptr;
   62|     57|  options.progress_user_data = nullptr;
   63|       |
   64|       |  // version 2
   65|       |
   66|     57|  options.convert_hdr_to_8bit = false;
   67|       |
   68|       |  // version 3
   69|       |
   70|     57|  options.strict_decoding = false;
   71|       |
   72|       |  // version 4
   73|       |
   74|     57|  options.decoder_id = nullptr;
   75|       |
   76|       |  // version 5
   77|       |
   78|     57|  options.color_conversion_options.version = 1;
   79|     57|  options.color_conversion_options.preferred_chroma_downsampling_algorithm = heif_chroma_downsampling_average;
   80|     57|  options.color_conversion_options.preferred_chroma_upsampling_algorithm = heif_chroma_upsampling_bilinear;
   81|     57|  options.color_conversion_options.only_use_preferred_chroma_algorithm = false;
   82|       |
   83|       |  // version 6
   84|       |
   85|     57|  options.cancel_decoding = nullptr;
   86|       |
   87|       |  // version 7
   88|       |
   89|     57|  options.color_conversion_options_ext = nullptr;
   90|       |
   91|       |  // version 8
   92|       |
   93|     57|  options.ignore_sequence_editlist = false;
   94|     57|  options.output_image_nclx_profile = nullptr;
   95|     57|  options.num_codec_threads = 0;
   96|     57|  options.num_library_threads = 0;
   97|     57|}

heif_image_get_colorspace:
   36|      5|{
   37|      5|  return img->image->get_colorspace();
   38|      5|}
heif_image_get_chroma_format:
   41|      5|{
   42|      5|  return img->image->get_chroma_format();
   43|      5|}
heif_image_release:
  297|     57|{
  298|     57|  delete img;
  299|     57|}

heif_image_handle_release:
   35|    106|{
   36|    106|  delete handle;
   37|    106|}
heif_image_handle_is_primary_image:
   41|     66|{
   42|     66|  return handle->image->is_primary();
   43|     66|}
heif_image_handle_get_width:
   53|     57|{
   54|     57|  if (handle && handle->image) {
  ------------------
  |  Branch (54:7): [True: 57, False: 0]
  |  Branch (54:17): [True: 57, False: 0]
  ------------------
   55|     57|    uint32_t w = handle->image->get_width();
   56|     57|    if (w > INT_MAX) {
  ------------------
  |  Branch (56:9): [True: 0, False: 57]
  ------------------
   57|      0|      return 0;
   58|      0|    }
   59|     57|    else {
   60|     57|      return static_cast<int>(w);
   61|     57|    }
   62|     57|  }
   63|      0|  else {
   64|      0|    return 0;
   65|      0|  }
   66|     57|}
heif_image_handle_get_height:
   70|     57|{
   71|     57|  if (handle && handle->image) {
  ------------------
  |  Branch (71:7): [True: 57, False: 0]
  |  Branch (71:17): [True: 57, False: 0]
  ------------------
   72|     57|    uint32_t h = handle->image->get_height();
   73|     57|    if (h > INT_MAX) {
  ------------------
  |  Branch (73:9): [True: 0, False: 57]
  ------------------
   74|      0|      return 0;
   75|      0|    }
   76|     57|    else {
   77|     57|      return static_cast<int>(h);
   78|     57|    }
   79|     57|  }
   80|      0|  else {
   81|      0|    return 0;
   82|      0|  }
   83|     57|}

heif_image_handle_get_number_of_metadata_blocks:
   63|     57|{
   64|     57|  int cnt = 0;
   65|     57|  for (const auto& metadata : handle->image->get_metadata()) {
  ------------------
  |  Branch (65:29): [True: 0, False: 57]
  ------------------
   66|      0|    if (type_filter == nullptr ||
  ------------------
  |  Branch (66:9): [True: 0, False: 0]
  ------------------
   67|      0|        metadata->item_type == type_filter) {
  ------------------
  |  Branch (67:9): [True: 0, False: 0]
  ------------------
   68|      0|      cnt++;
   69|      0|    }
   70|      0|  }
   71|       |
   72|     57|  return cnt;
   73|     57|}
heif_image_handle_get_list_of_metadata_block_IDs:
   79|     57|{
   80|     57|  int cnt = 0;
   81|     57|  for (const auto& metadata : handle->image->get_metadata()) {
  ------------------
  |  Branch (81:29): [True: 0, False: 57]
  ------------------
   82|      0|    if (type_filter == nullptr ||
  ------------------
  |  Branch (82:9): [True: 0, False: 0]
  ------------------
   83|      0|        metadata->item_type == type_filter) {
  ------------------
  |  Branch (83:9): [True: 0, False: 0]
  ------------------
   84|      0|      if (cnt < count) {
  ------------------
  |  Branch (84:11): [True: 0, False: 0]
  ------------------
   85|      0|        ids[cnt] = metadata->item_id;
   86|      0|        cnt++;
   87|      0|      }
   88|      0|      else {
   89|      0|        break;
   90|      0|      }
   91|      0|    }
   92|      0|  }
   93|       |
   94|     57|  return cnt;
   95|     57|}

heif_context_get_security_limits:
   41|     68|{
   42|     68|  if (!ctx) {
  ------------------
  |  Branch (42:7): [True: 0, False: 68]
  ------------------
   43|      0|    return nullptr;
   44|      0|  }
   45|       |
   46|     68|  return ctx->context->get_security_limits();
   47|     68|}

heif_tai_timestamp_packet_release:
  167|    361|{
  168|    361|  delete tai;
  169|    361|}

_ZN19StreamReader_memoryC2EPKhmb:
   78|     34|    : m_length(size),
   79|     34|      m_position(0)
   80|     34|{
   81|     34|  if (copy) {
  ------------------
  |  Branch (81:7): [True: 34, False: 0]
  ------------------
   82|     34|    m_owned_data = new uint8_t[m_length];
   83|     34|    memcpy(m_owned_data, data, size);
   84|       |
   85|     34|    m_data = m_owned_data;
   86|     34|  }
   87|      0|  else {
   88|      0|    m_data = data;
   89|      0|  }
   90|     34|}
_ZN19StreamReader_memoryD2Ev:
   93|     34|{
   94|     34|  if (m_owned_data) {
  ------------------
  |  Branch (94:7): [True: 34, False: 0]
  ------------------
   95|     34|    delete[] m_owned_data;
   96|     34|  }
   97|     34|}
_ZNK19StreamReader_memory12get_positionEv:
  100|  27.2k|{
  101|  27.2k|  return m_position;
  102|  27.2k|}
_ZN19StreamReader_memory18wait_for_file_sizeEm:
  105|  25.6k|{
  106|  25.6k|  return (target_size > m_length) ? grow_status::size_beyond_eof : grow_status::size_reached;
  ------------------
  |  Branch (106:10): [True: 43, False: 25.6k]
  ------------------
  107|  25.6k|}
_ZN19StreamReader_memory4readEPvm:
  110|   143k|{
  111|   143k|  uint64_t end_pos = m_position + size;
  112|   143k|  if (end_pos > m_length) {
  ------------------
  |  Branch (112:7): [True: 0, False: 143k]
  ------------------
  113|      0|    return false;
  114|      0|  }
  115|       |
  116|   143k|  memcpy(data, &m_data[m_position], size);
  117|   143k|  m_position += size;
  118|       |
  119|   143k|  return true;
  120|   143k|}
_ZN19StreamReader_memory4seekEm:
  123|  9.90k|{
  124|  9.90k|  if (position > m_length)
  ------------------
  |  Branch (124:7): [True: 0, False: 9.90k]
  ------------------
  125|      0|    return false;
  126|       |
  127|  9.90k|  m_position = position;
  128|  9.90k|  return true;
  129|  9.90k|}
_ZN14BitstreamRangeC2ENSt3__110shared_ptrI12StreamReaderEEmPS_:
  157|  11.6k|    : m_istr(std::move(istr)), m_parent_range(parent), m_remaining(length)
  158|  11.6k|{
  159|  11.6k|  if (parent) {
  ------------------
  |  Branch (159:7): [True: 11.5k, False: 34]
  ------------------
  160|  11.5k|    m_nesting_level = parent->m_nesting_level + 1;
  161|  11.5k|  }
  162|  11.6k|}
_ZN14BitstreamRangeC2ENSt3__110shared_ptrI12StreamReaderEEmm:
  168|  7.97k|  : m_istr(std::move(istr)), m_remaining(end - start)
  169|  7.97k|{
  170|  7.97k|  assert(end >= start);
  ------------------
  |  Branch (170:3): [True: 7.97k, False: 0]
  ------------------
  171|       |
  172|  7.97k|  bool success = m_istr->seek(start);
  173|  7.97k|  assert(success);
  ------------------
  |  Branch (173:3): [True: 7.97k, False: 0]
  ------------------
  174|  7.97k|  (void)success; // TODO
  175|  7.97k|}
_ZN14BitstreamRange5read8Ev:
  185|  18.6k|{
  186|  18.6k|  if (!prepare_read(1)) {
  ------------------
  |  Branch (186:7): [True: 478, False: 18.1k]
  ------------------
  187|    478|    return 0;
  188|    478|  }
  189|       |
  190|  18.1k|  uint8_t buf;
  191|       |
  192|  18.1k|  auto istr = get_istream();
  193|  18.1k|  bool success = istr->read((char*) &buf, 1);
  194|       |
  195|  18.1k|  if (!success) {
  ------------------
  |  Branch (195:7): [True: 0, False: 18.1k]
  ------------------
  196|      0|    set_eof_while_reading();
  197|      0|    return 0;
  198|      0|  }
  199|       |
  200|  18.1k|  return buf;
  201|  18.1k|}
_ZN14BitstreamRange6read16Ev:
  205|  12.8k|{
  206|  12.8k|  if (!prepare_read(2)) {
  ------------------
  |  Branch (206:7): [True: 0, False: 12.8k]
  ------------------
  207|      0|    return 0;
  208|      0|  }
  209|       |
  210|  12.8k|  uint8_t buf[2];
  211|       |
  212|  12.8k|  auto istr = get_istream();
  213|  12.8k|  bool success = istr->read((char*) buf, 2);
  214|       |
  215|  12.8k|  if (!success) {
  ------------------
  |  Branch (215:7): [True: 0, False: 12.8k]
  ------------------
  216|      0|    set_eof_while_reading();
  217|      0|    return 0;
  218|      0|  }
  219|       |
  220|  12.8k|  return static_cast<uint16_t>((buf[0] << 8) | (buf[1]));
  221|  12.8k|}
_ZN14BitstreamRange6read32Ev:
  260|  48.9k|{
  261|  48.9k|  if (!prepare_read(4)) {
  ------------------
  |  Branch (261:7): [True: 10, False: 48.9k]
  ------------------
  262|     10|    return 0;
  263|     10|  }
  264|       |
  265|  48.9k|  uint8_t buf[4];
  266|       |
  267|  48.9k|  auto istr = get_istream();
  268|  48.9k|  bool success = istr->read((char*) buf, 4);
  269|       |
  270|  48.9k|  if (!success) {
  ------------------
  |  Branch (270:7): [True: 0, False: 48.9k]
  ------------------
  271|      0|    set_eof_while_reading();
  272|      0|    return 0;
  273|      0|  }
  274|       |
  275|  48.9k|  return four_bytes_to_uint32(buf[0], buf[1], buf[2], buf[3]);
  276|  48.9k|}
_ZN14BitstreamRange9read_uintEi:
  280|  1.30k|{
  281|  1.30k|  switch (len)
  282|  1.30k|  {
  283|      0|    case 8:
  ------------------
  |  Branch (283:5): [True: 0, False: 1.30k]
  ------------------
  284|      0|      return read8();
  285|  1.30k|    case 16:
  ------------------
  |  Branch (285:5): [True: 1.30k, False: 0]
  ------------------
  286|  1.30k|      return read16();
  287|      0|    case 24:
  ------------------
  |  Branch (287:5): [True: 0, False: 1.30k]
  ------------------
  288|      0|      return read24();
  289|      0|    case 32:
  ------------------
  |  Branch (289:5): [True: 0, False: 1.30k]
  ------------------
  290|      0|      return read32();
  291|      0|    case 64:
  ------------------
  |  Branch (291:5): [True: 0, False: 1.30k]
  ------------------
  292|      0|      return read64();
  293|      0|    default:
  ------------------
  |  Branch (293:5): [True: 0, False: 1.30k]
  ------------------
  294|      0|      assert(false);
  ------------------
  |  Branch (294:7): [Folded, False: 0]
  ------------------
  295|      0|      return 0;
  296|  1.30k|  }
  297|  1.30k|}
_ZN14BitstreamRange11read_stringEv:
  390|  7.81k|{
  391|  7.81k|  std::string str;
  392|       |
  393|       |  // Reading a string when no more data is available, returns an empty string.
  394|       |  // Such a case happens, for example, when reading a 'url' box without content.
  395|  7.81k|  if (eof()) {
  ------------------
  |  Branch (395:7): [True: 1.82k, False: 5.98k]
  ------------------
  396|  1.82k|    return std::string();
  397|  1.82k|  }
  398|       |
  399|  5.98k|  auto istr = get_istream();
  400|       |
  401|  61.0k|  for (;;) {
  402|  61.0k|    if (!prepare_read(1)) {
  ------------------
  |  Branch (402:9): [True: 0, False: 61.0k]
  ------------------
  403|      0|      return std::string();
  404|      0|    }
  405|       |
  406|  61.0k|    char c;
  407|  61.0k|    bool success = istr->read(&c, 1);
  408|       |
  409|  61.0k|    if (!success) {
  ------------------
  |  Branch (409:9): [True: 0, False: 61.0k]
  ------------------
  410|      0|      set_eof_while_reading();
  411|      0|      return std::string();
  412|      0|    }
  413|       |
  414|  61.0k|    if (c == 0 || m_remaining==0) {
  ------------------
  |  Branch (414:9): [True: 4.62k, False: 56.4k]
  |  Branch (414:19): [True: 1.36k, False: 55.1k]
  ------------------
  415|  5.98k|      break;
  416|  5.98k|    }
  417|  55.1k|    else {
  418|  55.1k|      str += (char) c;
  419|  55.1k|    }
  420|  61.0k|  }
  421|       |
  422|  5.98k|  return str;
  423|  5.98k|}
_ZN14BitstreamRange4readEPhm:
  476|  2.03k|{
  477|  2.03k|  if (!prepare_read(n)) {
  ------------------
  |  Branch (477:7): [True: 0, False: 2.03k]
  ------------------
  478|      0|    return false;
  479|      0|  }
  480|       |
  481|  2.03k|  auto istr = get_istream();
  482|  2.03k|  bool success = istr->read(data, n);
  483|       |
  484|  2.03k|  if (!success) {
  ------------------
  |  Branch (484:7): [True: 0, False: 2.03k]
  ------------------
  485|      0|    set_eof_while_reading();
  486|      0|  }
  487|       |
  488|  2.03k|  return success;
  489|  2.03k|}
_ZN14BitstreamRange12prepare_readEm:
  493|   441k|{
  494|       |  // Note: we do not test for negative nBytes anymore because we now use the unsigned size_t
  495|       |
  496|   441k|  if (m_remaining < nBytes) {
  ------------------
  |  Branch (496:7): [True: 488, False: 440k]
  ------------------
  497|       |    // --- not enough data left in box -> move to end of box and set error flag
  498|       |
  499|    488|    skip_to_end_of_box();
  500|       |
  501|    488|    m_error = true;
  502|    488|    return false;
  503|    488|  }
  504|   440k|  else {
  505|       |    // --- this is the normal case (m_remaining >= nBytes)
  506|       |
  507|   440k|    if (m_parent_range) {
  ------------------
  |  Branch (507:9): [True: 297k, False: 143k]
  ------------------
  508|   297k|      if (!m_parent_range->prepare_read(nBytes)) {
  ------------------
  |  Branch (508:11): [True: 0, False: 297k]
  ------------------
  509|      0|        return false;
  510|      0|      }
  511|   297k|    }
  512|       |
  513|   440k|    m_remaining -= nBytes;
  514|       |
  515|   440k|    return true;
  516|   440k|  }
  517|   441k|}
_ZN14BitstreamRange24wait_for_available_bytesEm:
  521|  25.4k|{
  522|  25.4k|  int64_t target_size = m_istr->get_position() + nBytes;
  523|       |
  524|  25.4k|  return m_istr->wait_for_file_size(target_size);
  525|  25.4k|}
_ZN14BitstreamRange31skip_without_advancing_file_posEm:
  529|  3.82k|{
  530|  3.82k|  assert(n <= m_remaining);
  ------------------
  |  Branch (530:3): [True: 3.82k, False: 0]
  ------------------
  531|       |
  532|  3.82k|  m_remaining -= n;
  533|       |
  534|  3.82k|  if (m_parent_range) {
  ------------------
  |  Branch (534:7): [True: 2.04k, False: 1.78k]
  ------------------
  535|  2.04k|    m_parent_range->skip_without_advancing_file_pos(n);
  536|  2.04k|  }
  537|  3.82k|}
_ZN9BitReaderC2EPKhi:
  541|     33|  : data_start(buffer),
  542|     33|    data_length(len)
  543|     33|{
  544|     33|  data = buffer;
  545|     33|  bytes_remaining = len;
  546|       |
  547|     33|  nextbits = 0;
  548|     33|  nextbits_cnt = 0;
  549|       |
  550|     33|  refill();
  551|     33|}
_ZN9BitReader8get_bitsEi:
  567|  1.18k|{
  568|  1.18k|  assert(n <= 32);
  ------------------
  |  Branch (568:3): [True: 1.18k, False: 0]
  ------------------
  569|       |
  570|  1.18k|  if (nextbits_cnt < n) {
  ------------------
  |  Branch (570:7): [True: 33, False: 1.15k]
  ------------------
  571|     33|    refill();
  572|     33|  }
  573|       |
  574|  1.18k|  uint64_t val = nextbits;
  575|  1.18k|  val >>= 64 - n;
  576|       |
  577|  1.18k|#if AVOID_FUZZER_FALSE_POSITIVE
  578|       |  // Shifting an unsigned integer left such that some MSBs fall out is well defined in C++ despite the fuzzer claiming otherwise.
  579|  1.18k|  nextbits &= (0xffffffffffffffffULL >> n);
  580|  1.18k|#endif
  581|       |
  582|  1.18k|  nextbits <<= n;
  583|  1.18k|  nextbits_cnt -= n;
  584|       |
  585|  1.18k|  return static_cast<uint32_t>(val);
  586|  1.18k|}
_ZN9BitReader9get_bits8Ei:
  590|    198|{
  591|    198|  assert(n>0 && n <= 8);
  ------------------
  |  Branch (591:3): [True: 198, False: 0]
  |  Branch (591:3): [True: 198, False: 0]
  |  Branch (591:3): [True: 198, False: 0]
  ------------------
  592|    198|  return static_cast<uint8_t>(get_bits(n));
  593|    198|}
_ZN9BitReader10get_bits32Ei:
  602|     33|{
  603|     33|  assert(n>0 && n <= 32);
  ------------------
  |  Branch (603:3): [True: 33, False: 0]
  |  Branch (603:3): [True: 33, False: 0]
  |  Branch (603:3): [True: 33, False: 0]
  ------------------
  604|     33|  return static_cast<uint32_t>(get_bits(n));
  605|     33|}
_ZN9BitReader9skip_bitsEi:
  664|    165|{
  665|    165|  if (nextbits_cnt < n) {
  ------------------
  |  Branch (665:7): [True: 33, False: 132]
  ------------------
  666|     33|    refill();
  667|     33|  }
  668|       |
  669|    165|#if AVOID_FUZZER_FALSE_POSITIVE
  670|    165|  nextbits &= (0xffffffffffffffffULL >> n);
  671|    165|#endif
  672|       |
  673|    165|  nextbits <<= n;
  674|    165|  nextbits_cnt -= n;
  675|    165|}
_ZN9BitReader8get_uvlcEPj:
  700|    198|{
  701|    198|  int num_zeros = 0;
  702|       |
  703|    825|  while (get_bits(1) == 0) {
  ------------------
  |  Branch (703:10): [True: 627, False: 198]
  ------------------
  704|    627|    num_zeros++;
  705|       |
  706|    627|    if (num_zeros > MAX_UVLC_LEADING_ZEROS) { return false; }
  ------------------
  |  |   35|    627|#define MAX_UVLC_LEADING_ZEROS 20
  ------------------
  |  Branch (706:9): [True: 0, False: 627]
  ------------------
  707|    627|  }
  708|       |
  709|    198|  if (num_zeros != 0) {
  ------------------
  |  Branch (709:7): [True: 99, False: 99]
  ------------------
  710|     99|    uint32_t offset = get_bits(num_zeros);
  711|     99|    *value = offset + (1u << num_zeros) - 1u;
  712|     99|    assert(*value > 0);
  ------------------
  |  Branch (712:5): [True: 99, False: 0]
  ------------------
  713|     99|    return true;
  714|     99|  }
  715|     99|  else {
  716|     99|    *value = 0;
  717|     99|    return true;
  718|     99|  }
  719|    198|}
_ZN9BitReader6refillEv:
  738|     99|{
  739|       |#if 0
  740|       |  // TODO: activate me once I'm sure this works
  741|       |  while (nextbits_cnt <= 64-8 && bytes_remaining) {
  742|       |    uint64_t newval = *data++;
  743|       |    bytes_remaining--;
  744|       |
  745|       |    nextbits_cnt += 8;
  746|       |    newval <<= 64-nextbits_cnt;
  747|       |    nextbits |= newval;
  748|       |  }
  749|       |#else
  750|     99|  int shift = 64 - nextbits_cnt;
  751|       |
  752|    891|  while (shift >= 8 && bytes_remaining) {
  ------------------
  |  Branch (752:10): [True: 792, False: 99]
  |  Branch (752:24): [True: 792, False: 0]
  ------------------
  753|    792|    uint64_t newval = *data++;
  754|    792|    bytes_remaining--;
  755|       |
  756|    792|    shift -= 8;
  757|    792|    newval <<= shift;
  758|    792|    nextbits |= newval;
  759|    792|  }
  760|       |
  761|     99|  nextbits_cnt = 64 - shift;
  762|     99|#endif
  763|     99|}
_ZN12StreamWriter6write8Eh:
  818|      6|{
  819|      6|  if (m_position == m_data.size()) {
  ------------------
  |  Branch (819:7): [True: 6, False: 0]
  ------------------
  820|      6|    m_data.push_back(v);
  821|      6|    m_position++;
  822|      6|  }
  823|      0|  else {
  824|      0|    m_data[m_position++] = v;
  825|      0|  }
  826|      6|}
_ZN12StreamWriter7write16Et:
  830|     18|{
  831|     18|  size_t required_size = m_position + 2;
  832|       |
  833|     18|  if (required_size > m_data.size()) {
  ------------------
  |  Branch (833:7): [True: 18, False: 0]
  ------------------
  834|     18|    m_data.resize(required_size);
  835|     18|  }
  836|       |
  837|     18|  m_data[m_position++] = uint8_t((v >> 8) & 0xFF);
  838|     18|  m_data[m_position++] = uint8_t(v & 0xFF);
  839|     18|}
_ZN12StreamWriter7write32Ej:
  872|  1.06k|{
  873|  1.06k|  size_t required_size = m_position + 4;
  874|       |
  875|  1.06k|  if (required_size > m_data.size()) {
  ------------------
  |  Branch (875:7): [True: 356, False: 712]
  ------------------
  876|    356|    m_data.resize(required_size);
  877|    356|  }
  878|       |
  879|  1.06k|  m_data[m_position++] = uint8_t((v >> 24) & 0xFF);
  880|  1.06k|  m_data[m_position++] = uint8_t((v >> 16) & 0xFF);
  881|  1.06k|  m_data[m_position++] = uint8_t((v >> 8) & 0xFF);
  882|  1.06k|  m_data[m_position++] = uint8_t(v & 0xFF);
  883|  1.06k|}
_ZN12StreamWriter5writeERKNSt3__16vectorIhNS0_9allocatorIhEEEE:
  989|    350|{
  990|    350|  size_t required_size = m_position + vec.size();
  991|       |
  992|    350|  if (required_size > m_data.size()) {
  ------------------
  |  Branch (992:7): [True: 350, False: 0]
  ------------------
  993|    350|    m_data.resize(required_size);
  994|    350|  }
  995|       |
  996|    350|  memcpy(m_data.data() + m_position, vec.data(), vec.size());
  997|    350|  m_position += vec.size();
  998|    350|}
_ZN12StreamWriter4skipEi:
 1018|    356|{
 1019|    356|  assert(m_position == m_data.size());
  ------------------
  |  Branch (1019:3): [True: 356, False: 0]
  ------------------
 1020|    356|  m_data.resize(m_data.size() + n);
 1021|    356|  m_position += n;
 1022|    356|}

_ZN12StreamReader8seek_curEm:
   62|  1.78k|  {
   63|  1.78k|    return seek(get_position() + position_offset);
   64|  1.78k|  }
_ZN19StreamReader_memory13request_rangeEmm:
  139|    192|  uint64_t request_range(uint64_t start, uint64_t end_pos) override {
  140|    192|    return m_length;
  141|    192|  }
_ZN14BitstreamRange4skipEm:
  330|      2|  {
  331|      2|    size_t actual_skip = std::min(static_cast<size_t>(n), m_remaining);
  332|       |
  333|      2|    if (m_parent_range) {
  ------------------
  |  Branch (333:9): [True: 2, False: 0]
  ------------------
  334|       |      // also advance position in parent range
  335|      2|      m_parent_range->skip_without_advancing_file_pos(actual_skip);
  336|      2|    }
  337|       |
  338|      2|    assert(actual_skip <= static_cast<uint64_t>(std::numeric_limits<int64_t>::max()));
  ------------------
  |  Branch (338:5): [True: 2, False: 0]
  ------------------
  339|       |
  340|      2|    m_istr->seek_cur(static_cast<int64_t>(actual_skip));
  341|      2|    m_remaining -= actual_skip;
  342|      2|  }
_ZN14BitstreamRange18skip_to_end_of_boxEv:
  345|  12.0k|  {
  346|  12.0k|    if (m_remaining > 0) {
  ------------------
  |  Branch (346:9): [True: 1.77k, False: 10.3k]
  ------------------
  347|  1.77k|      if (m_parent_range) {
  ------------------
  |  Branch (347:11): [True: 1.77k, False: 0]
  ------------------
  348|       |        // also advance position in parent range
  349|  1.77k|        m_parent_range->skip_without_advancing_file_pos(m_remaining);
  350|  1.77k|      }
  351|       |
  352|  1.77k|      m_istr->seek_cur(m_remaining);
  353|  1.77k|      m_remaining = 0;
  354|  1.77k|    }
  355|  12.0k|  }
_ZNK14BitstreamRange3eofEv:
  369|  29.4k|  {
  370|  29.4k|    return m_remaining == 0;
  371|  29.4k|  }
_ZNK14BitstreamRange5errorEv:
  374|  23.7k|  {
  375|  23.7k|    return m_error;
  376|  23.7k|  }
_ZNK14BitstreamRange9get_errorEv:
  379|  33.2k|  {
  380|  33.2k|    if (m_error) {
  ------------------
  |  Branch (380:9): [True: 2, False: 33.2k]
  ------------------
  381|      2|      return Error(heif_error_Invalid_input,
  382|      2|                   heif_suberror_End_of_data);
  383|      2|    }
  384|  33.2k|    else {
  385|  33.2k|      return Error::Ok;
  386|  33.2k|    }
  387|  33.2k|  }
_ZN14BitstreamRange11get_istreamEv:
  389|  99.6k|  std::shared_ptr<StreamReader> get_istream() { return m_istr; }
_ZNK14BitstreamRange17get_nesting_levelEv:
  391|  11.5k|  int get_nesting_level() const { return m_nesting_level; }
_ZNK14BitstreamRange19get_remaining_bytesEv:
  393|  15.0k|  size_t get_remaining_bytes() const { return m_remaining; }
_ZNK12StreamWriter9data_sizeEv:
  546|    356|  size_t data_size() const { return m_data.size(); }
_ZNK12StreamWriter12get_positionEv:
  548|    356|  size_t get_position() const { return m_position; }
_ZN12StreamWriter12set_positionEm:
  550|    356|  void set_position(size_t pos) { m_position = pos; }
_ZN12StreamWriter19set_position_to_endEv:
  552|    356|  void set_position_to_end() { m_position = m_data.size(); }
_ZNK12StreamWriter8get_dataEv:
  554|    356|  const std::vector<uint8_t> get_data() const { return m_data; }
_ZN12StreamReaderD2Ev:
   42|     34|  virtual ~StreamReader() = default;

_ZN8FractionC2Eii:
   64|    596|{
   65|       |  // Reduce resolution of fraction until we are in a safe range.
   66|       |  // We need this as adding fractions may lead to very large denominators
   67|       |  // (e.g. 0x10000 * 0x10000 > 0x100000000 -> overflow, leading to integer 0)
   68|       |
   69|    596|  numerator = num;
   70|    596|  denominator = den;
   71|       |
   72|  5.61k|  while (denominator > MAX_FRACTION_VALUE || denominator < -MAX_FRACTION_VALUE) {
  ------------------
  |  Branch (72:10): [True: 5.01k, False: 596]
  |  Branch (72:46): [True: 0, False: 596]
  ------------------
   73|  5.01k|    numerator /= 2;
   74|  5.01k|    denominator /= 2;
   75|  5.01k|  }
   76|       |
   77|  1.53k|  while (denominator > 1 && (numerator > MAX_FRACTION_VALUE || numerator < -MAX_FRACTION_VALUE)) {
  ------------------
  |  Branch (77:10): [True: 1.37k, False: 153]
  |  Branch (77:30): [True: 934, False: 443]
  |  Branch (77:64): [True: 0, False: 443]
  ------------------
   78|    934|    numerator /= 2;
   79|    934|    denominator /= 2;
   80|    934|  }
   81|    596|}
_ZN8FractionC2Ejj:
   84|    298|{
   85|    298|  assert(num <= (uint32_t) std::numeric_limits<int32_t>::max());
  ------------------
  |  Branch (85:3): [True: 298, False: 0]
  ------------------
   86|    298|  assert(den <= (uint32_t) std::numeric_limits<int32_t>::max());
  ------------------
  |  Branch (86:3): [True: 298, False: 0]
  ------------------
   87|       |
   88|    298|  *this = Fraction(int32_t(num), int32_t(den));
   89|    298|}
_ZNK8Fraction8is_validEv:
  162|    440|{
  163|    440|  return denominator != 0;
  164|    440|}
_ZN9BoxHeaderC2Ev:
  167|  29.5k|BoxHeader::BoxHeader() = default;
_ZNK9BoxHeader15get_type_stringEv:
  187|  11.5k|{
  188|  11.5k|  if (m_type == fourcc("uuid")) {
  ------------------
  |  Branch (188:7): [True: 0, False: 11.5k]
  ------------------
  189|       |    // 8-4-4-4-12
  190|       |
  191|      0|    std::ostringstream sstr;
  192|      0|    sstr << std::hex;
  193|      0|    sstr << std::setfill('0');
  194|       |
  195|      0|    for (int i = 0; i < 16; i++) {
  ------------------
  |  Branch (195:21): [True: 0, False: 0]
  ------------------
  196|      0|      if (i == 4 || i == 6 || i == 8 || i == 10) {
  ------------------
  |  Branch (196:11): [True: 0, False: 0]
  |  Branch (196:21): [True: 0, False: 0]
  |  Branch (196:31): [True: 0, False: 0]
  |  Branch (196:41): [True: 0, False: 0]
  ------------------
  197|      0|        sstr << '-';
  198|      0|      }
  199|       |
  200|      0|      sstr << std::setw(2);
  201|      0|      sstr << ((int) m_uuid_type[i]);
  202|      0|    }
  203|       |
  204|      0|    return sstr.str();
  205|      0|  }
  206|  11.5k|  else {
  207|  11.5k|    return fourcc_to_string(m_type);
  208|  11.5k|  }
  209|  11.5k|}
_ZN9BoxHeader12parse_headerER14BitstreamRange:
  230|  16.8k|{
  231|  16.8k|  StreamReader::grow_status status;
  232|  16.8k|  status = range.wait_for_available_bytes(8);
  233|  16.8k|  if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (233:7): [True: 0, False: 16.8k]
  ------------------
  234|       |    // TODO: return recoverable error at timeout
  235|      0|    return Error(heif_error_Invalid_input,
  236|      0|                 heif_suberror_End_of_data);
  237|      0|  }
  238|       |
  239|  16.8k|  m_size = range.read32();
  240|  16.8k|  m_type = range.read32();
  241|       |
  242|  16.8k|  m_header_size = 8;
  243|       |
  244|  16.8k|  if (m_size == 1) {
  ------------------
  |  Branch (244:7): [True: 0, False: 16.8k]
  ------------------
  245|      0|    status = range.wait_for_available_bytes(8);
  246|      0|    if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (246:9): [True: 0, False: 0]
  ------------------
  247|       |      // TODO: return recoverable error at timeout
  248|      0|      return Error(heif_error_Invalid_input,
  249|      0|                   heif_suberror_End_of_data);
  250|      0|    }
  251|       |
  252|      0|    uint64_t high = range.read32();
  253|      0|    uint64_t low = range.read32();
  254|       |
  255|      0|    m_size = (high << 32) | low;
  256|      0|    m_header_size += 8;
  257|       |
  258|      0|    std::stringstream sstr;
  259|      0|    sstr << "Box size " << m_size << " exceeds security limit.";
  260|       |
  261|      0|    if (m_size > MAX_LARGE_BOX_SIZE) {
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  ------------------
  262|      0|      return Error(heif_error_Memory_allocation_error,
  263|      0|                   heif_suberror_Security_limit_exceeded,
  264|      0|                   sstr.str());
  265|      0|    }
  266|      0|  }
  267|       |
  268|  16.8k|  if (m_type == fourcc("uuid")) {
  ------------------
  |  Branch (268:7): [True: 0, False: 16.8k]
  ------------------
  269|      0|    status = range.wait_for_available_bytes(16);
  270|      0|    if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (270:9): [True: 0, False: 0]
  ------------------
  271|       |      // TODO: return recoverable error at timeout
  272|      0|      return Error(heif_error_Invalid_input,
  273|      0|                   heif_suberror_End_of_data);
  274|      0|    }
  275|       |
  276|      0|    if (range.prepare_read(16)) {
  ------------------
  |  Branch (276:9): [True: 0, False: 0]
  ------------------
  277|      0|      m_uuid_type.resize(16);
  278|      0|      bool success = range.get_istream()->read((char*) m_uuid_type.data(), 16);
  279|      0|      assert(success);
  ------------------
  |  Branch (279:7): [True: 0, False: 0]
  ------------------
  280|      0|      (void) success;
  281|      0|    }
  282|       |
  283|      0|    m_header_size += 16;
  284|      0|  }
  285|       |
  286|  16.8k|  return range.get_error();
  287|  16.8k|}
_ZNK3Box21calculate_header_sizeEb:
  291|    356|{
  292|    356|  int header_size = 8;  // does not include "FullBox" fields.
  293|       |
  294|    356|  if (get_short_type() == fourcc("uuid")) {
  ------------------
  |  Branch (294:7): [True: 0, False: 356]
  ------------------
  295|      0|    header_size += 16;
  296|      0|  }
  297|       |
  298|    356|  if (data64bit) {
  ------------------
  |  Branch (298:7): [True: 0, False: 356]
  ------------------
  299|      0|    header_size += 8;
  300|      0|  }
  301|       |
  302|    356|  return header_size;
  303|    356|}
_ZNK3Box24reserve_box_header_spaceER12StreamWriterb:
  307|    356|{
  308|    356|  size_t start_pos = writer.get_position();
  309|       |
  310|    356|  int header_size = calculate_header_size(data64bit);
  311|       |
  312|    356|  writer.skip(header_size);
  313|       |
  314|    356|  return start_pos;
  315|    356|}
_ZNK3Box14prepend_headerER12StreamWritermb:
  344|    356|{
  345|    356|  size_t total_size = writer.data_size() - box_start;
  346|       |
  347|    356|  writer.set_position(box_start);
  348|       |
  349|    356|  auto err = write_header(writer, total_size, data64bit);
  350|       |
  351|    356|  writer.set_position_to_end();  // Note: should we move to the end of the box after writing the header?
  352|       |
  353|    356|  return err;
  354|    356|}
_ZNK3Box12write_headerER12StreamWritermb:
  358|    356|{
  359|    356|  bool large_size = (total_size > 0xFFFFFFFF);
  360|       |
  361|       |  // --- write header
  362|       |
  363|    356|  if (large_size && !data64bit) {
  ------------------
  |  Branch (363:7): [True: 0, False: 356]
  |  Branch (363:21): [True: 0, False: 0]
  ------------------
  364|       |    // Note: as an alternative, we could return an error here. If it fails, the user has to try again with 64 bit.
  365|      0|    writer.insert(8);
  366|      0|  }
  367|       |
  368|    356|  if (large_size) {
  ------------------
  |  Branch (368:7): [True: 0, False: 356]
  ------------------
  369|      0|    writer.write32(1);
  370|      0|  }
  371|    356|  else {
  372|    356|    assert(total_size <= 0xFFFFFFFF);
  ------------------
  |  Branch (372:5): [True: 356, False: 0]
  ------------------
  373|    356|    writer.write32((uint32_t) total_size);
  374|    356|  }
  375|       |
  376|    356|  writer.write32(get_short_type());
  377|       |
  378|    356|  if (large_size) {
  ------------------
  |  Branch (378:7): [True: 0, False: 356]
  ------------------
  379|      0|    writer.write64(total_size);
  380|      0|  }
  381|       |
  382|    356|  if (get_short_type() == fourcc("uuid")) {
  ------------------
  |  Branch (382:7): [True: 0, False: 356]
  ------------------
  383|      0|    assert(get_type().size() == 16);
  ------------------
  |  Branch (383:5): [True: 0, False: 0]
  ------------------
  384|      0|    writer.write(get_type());
  385|      0|  }
  386|       |
  387|    356|  return Error::Ok;
  388|    356|}
_ZN7FullBox21parse_full_box_headerER14BitstreamRange:
  439|  5.59k|{
  440|  5.59k|  uint32_t data = range.read32();
  441|  5.59k|  m_version = static_cast<uint8_t>(data >> 24);
  442|  5.59k|  m_flags = data & 0x00FFFFFF;
  443|       |  //m_is_full_box = true;
  444|       |
  445|  5.59k|  m_header_size += 4;
  446|       |
  447|  5.59k|  return range.get_error();
  448|  5.59k|}
_ZN3Box4readER14BitstreamRangePNSt3__110shared_ptrIS_EEPK20heif_security_limits:
  452|  11.5k|{
  453|  11.5k|  BoxHeader hdr;
  454|  11.5k|  Error err = hdr.parse_header(range);
  455|  11.5k|  if (err) {
  ------------------
  |  Branch (455:7): [True: 0, False: 11.5k]
  ------------------
  456|      0|    return err;
  457|      0|  }
  458|       |
  459|  11.5k|  if (range.error()) {
  ------------------
  |  Branch (459:7): [True: 0, False: 11.5k]
  ------------------
  460|      0|    return range.get_error();
  461|      0|  }
  462|       |
  463|  11.5k|  result->reset();
  464|       |
  465|  11.5k|  std::shared_ptr<Box> box;
  466|       |
  467|  11.5k|  switch (hdr.get_short_type()) {
  468|     32|    case fourcc("ftyp"):
  ------------------
  |  Branch (468:5): [True: 32, False: 11.5k]
  ------------------
  469|     32|      box = std::make_shared<Box_ftyp>();
  470|     32|      break;
  471|       |
  472|      0|    case fourcc("free"):
  ------------------
  |  Branch (472:5): [True: 0, False: 11.5k]
  ------------------
  473|      0|    case fourcc("skip"):
  ------------------
  |  Branch (473:5): [True: 0, False: 11.5k]
  ------------------
  474|      0|      box = std::make_shared<Box_free>();
  475|      0|      break;
  476|       |
  477|    551|    case fourcc("meta"):
  ------------------
  |  Branch (477:5): [True: 551, False: 11.0k]
  ------------------
  478|    551|      box = std::make_shared<Box_meta>();
  479|    551|      break;
  480|       |
  481|    160|    case fourcc("hdlr"):
  ------------------
  |  Branch (481:5): [True: 160, False: 11.4k]
  ------------------
  482|    160|      box = std::make_shared<Box_hdlr>();
  483|    160|      break;
  484|       |
  485|    516|    case fourcc("pitm"):
  ------------------
  |  Branch (485:5): [True: 516, False: 11.0k]
  ------------------
  486|    516|      box = std::make_shared<Box_pitm>();
  487|    516|      break;
  488|       |
  489|    414|    case fourcc("iloc"):
  ------------------
  |  Branch (489:5): [True: 414, False: 11.1k]
  ------------------
  490|    414|      box = std::make_shared<Box_iloc>();
  491|    414|      break;
  492|       |
  493|    159|    case fourcc("iinf"):
  ------------------
  |  Branch (493:5): [True: 159, False: 11.4k]
  ------------------
  494|    159|      box = std::make_shared<Box_iinf>();
  495|    159|      break;
  496|       |
  497|  1.14k|    case fourcc("infe"):
  ------------------
  |  Branch (497:5): [True: 1.14k, False: 10.4k]
  ------------------
  498|  1.14k|      box = std::make_shared<Box_infe>();
  499|  1.14k|      break;
  500|       |
  501|    159|    case fourcc("iprp"):
  ------------------
  |  Branch (501:5): [True: 159, False: 11.4k]
  ------------------
  502|    159|      box = std::make_shared<Box_iprp>();
  503|    159|      break;
  504|       |
  505|    159|    case fourcc("ipco"):
  ------------------
  |  Branch (505:5): [True: 159, False: 11.4k]
  ------------------
  506|    159|      box = std::make_shared<Box_ipco>();
  507|    159|      break;
  508|       |
  509|    158|    case fourcc("ipma"):
  ------------------
  |  Branch (509:5): [True: 158, False: 11.4k]
  ------------------
  510|    158|      box = std::make_shared<Box_ipma>();
  511|    158|      break;
  512|       |
  513|     57|    case fourcc("ispe"):
  ------------------
  |  Branch (513:5): [True: 57, False: 11.5k]
  ------------------
  514|     57|      box = std::make_shared<Box_ispe>();
  515|     57|      break;
  516|       |
  517|    141|    case fourcc("auxC"):
  ------------------
  |  Branch (517:5): [True: 141, False: 11.4k]
  ------------------
  518|    141|      box = std::make_shared<Box_auxC>();
  519|    141|      break;
  520|       |
  521|      3|    case fourcc("irot"):
  ------------------
  |  Branch (521:5): [True: 3, False: 11.5k]
  ------------------
  522|      3|      box = std::make_shared<Box_irot>();
  523|      3|      break;
  524|       |
  525|      0|    case fourcc("imir"):
  ------------------
  |  Branch (525:5): [True: 0, False: 11.5k]
  ------------------
  526|      0|      box = std::make_shared<Box_imir>();
  527|      0|      break;
  528|       |
  529|    403|    case fourcc("clap"):
  ------------------
  |  Branch (529:5): [True: 403, False: 11.1k]
  ------------------
  530|    403|      box = std::make_shared<Box_clap>();
  531|    403|      break;
  532|       |
  533|    155|    case fourcc("iref"):
  ------------------
  |  Branch (533:5): [True: 155, False: 11.4k]
  ------------------
  534|    155|      box = std::make_shared<Box_iref>();
  535|    155|      break;
  536|       |
  537|     11|    case fourcc("hvcC"):
  ------------------
  |  Branch (537:5): [True: 11, False: 11.5k]
  ------------------
  538|     11|      box = std::make_shared<Box_hvcC>();
  539|     11|      break;
  540|       |
  541|      0|    case fourcc("hvc1"):
  ------------------
  |  Branch (541:5): [True: 0, False: 11.5k]
  ------------------
  542|      0|      box = std::make_shared<Box_hvc1>();
  543|      0|      break;
  544|       |
  545|    144|    case fourcc("av1C"):
  ------------------
  |  Branch (545:5): [True: 144, False: 11.4k]
  ------------------
  546|    144|      box = std::make_shared<Box_av1C>();
  547|    144|      break;
  548|       |
  549|      0|    case fourcc("av01"):
  ------------------
  |  Branch (549:5): [True: 0, False: 11.5k]
  ------------------
  550|      0|      box = std::make_shared<Box_av01>();
  551|      0|      break;
  552|       |
  553|      0|    case fourcc("vvcC"):
  ------------------
  |  Branch (553:5): [True: 0, False: 11.5k]
  ------------------
  554|      0|      box = std::make_shared<Box_vvcC>();
  555|      0|      break;
  556|       |
  557|      0|    case fourcc("vvc1"):
  ------------------
  |  Branch (557:5): [True: 0, False: 11.5k]
  ------------------
  558|      0|      box = std::make_shared<Box_vvc1>();
  559|      0|      break;
  560|       |
  561|     11|    case fourcc("idat"):
  ------------------
  |  Branch (561:5): [True: 11, False: 11.5k]
  ------------------
  562|     11|      box = std::make_shared<Box_idat>();
  563|     11|      break;
  564|       |
  565|      0|    case fourcc("grpl"):
  ------------------
  |  Branch (565:5): [True: 0, False: 11.5k]
  ------------------
  566|      0|      box = std::make_shared<Box_grpl>();
  567|      0|      break;
  568|       |
  569|    136|    case fourcc("pymd"):
  ------------------
  |  Branch (569:5): [True: 136, False: 11.4k]
  ------------------
  570|    136|      box = std::make_shared<Box_pymd>();
  571|    136|      break;
  572|       |
  573|      0|    case fourcc("altr"):
  ------------------
  |  Branch (573:5): [True: 0, False: 11.5k]
  ------------------
  574|      0|      box = std::make_shared<Box_EntityToGroup>();
  575|      0|      break;
  576|       |
  577|      0|    case fourcc("ster"):
  ------------------
  |  Branch (577:5): [True: 0, False: 11.5k]
  ------------------
  578|      0|      box = std::make_shared<Box_ster>();
  579|      0|      break;
  580|       |
  581|     11|    case fourcc("dinf"):
  ------------------
  |  Branch (581:5): [True: 11, False: 11.5k]
  ------------------
  582|     11|      box = std::make_shared<Box_dinf>();
  583|     11|      break;
  584|       |
  585|      0|    case fourcc("dref"):
  ------------------
  |  Branch (585:5): [True: 0, False: 11.5k]
  ------------------
  586|      0|      box = std::make_shared<Box_dref>();
  587|      0|      break;
  588|       |
  589|      0|    case fourcc("url "):
  ------------------
  |  Branch (589:5): [True: 0, False: 11.5k]
  ------------------
  590|      0|      box = std::make_shared<Box_url>();
  591|      0|      break;
  592|       |
  593|    153|    case fourcc("colr"):
  ------------------
  |  Branch (593:5): [True: 153, False: 11.4k]
  ------------------
  594|    153|      box = std::make_shared<Box_colr>();
  595|    153|      break;
  596|       |
  597|     51|    case fourcc("pixi"):
  ------------------
  |  Branch (597:5): [True: 51, False: 11.5k]
  ------------------
  598|     51|      box = std::make_shared<Box_pixi>();
  599|     51|      break;
  600|       |
  601|      0|    case fourcc("pasp"):
  ------------------
  |  Branch (601:5): [True: 0, False: 11.5k]
  ------------------
  602|      0|      box = std::make_shared<Box_pasp>();
  603|      0|      break;
  604|       |
  605|      0|    case fourcc("lsel"):
  ------------------
  |  Branch (605:5): [True: 0, False: 11.5k]
  ------------------
  606|      0|      box = std::make_shared<Box_lsel>();
  607|      0|      break;
  608|       |
  609|      0|    case fourcc("a1op"):
  ------------------
  |  Branch (609:5): [True: 0, False: 11.5k]
  ------------------
  610|      0|      box = std::make_shared<Box_a1op>();
  611|      0|      break;
  612|       |
  613|      0|    case fourcc("a1lx"):
  ------------------
  |  Branch (613:5): [True: 0, False: 11.5k]
  ------------------
  614|      0|      box = std::make_shared<Box_a1lx>();
  615|      0|      break;
  616|       |
  617|      0|    case fourcc("clli"):
  ------------------
  |  Branch (617:5): [True: 0, False: 11.5k]
  ------------------
  618|      0|      box = std::make_shared<Box_clli>();
  619|      0|      break;
  620|       |
  621|      0|    case fourcc("mdcv"):
  ------------------
  |  Branch (621:5): [True: 0, False: 11.5k]
  ------------------
  622|      0|      box = std::make_shared<Box_mdcv>();
  623|      0|      break;
  624|       |
  625|      0|    case fourcc("amve"):
  ------------------
  |  Branch (625:5): [True: 0, False: 11.5k]
  ------------------
  626|      0|      box = std::make_shared<Box_amve>();
  627|      0|      break;
  628|       |
  629|      0|    case fourcc("cmin"):
  ------------------
  |  Branch (629:5): [True: 0, False: 11.5k]
  ------------------
  630|      0|      box = std::make_shared<Box_cmin>();
  631|      0|      break;
  632|       |
  633|     11|    case fourcc("cmex"):
  ------------------
  |  Branch (633:5): [True: 11, False: 11.5k]
  ------------------
  634|     11|      box = std::make_shared<Box_cmex>();
  635|     11|      break;
  636|       |
  637|  1.74k|    case fourcc("udes"):
  ------------------
  |  Branch (637:5): [True: 1.74k, False: 9.83k]
  ------------------
  638|  1.74k|      box = std::make_shared<Box_udes>();
  639|  1.74k|      break;
  640|       |
  641|      0|    case fourcc("jpgC"):
  ------------------
  |  Branch (641:5): [True: 0, False: 11.5k]
  ------------------
  642|      0|      box = std::make_shared<Box_jpgC>();
  643|      0|      break;
  644|       |
  645|      0|    case fourcc("mjpg"):
  ------------------
  |  Branch (645:5): [True: 0, False: 11.5k]
  ------------------
  646|      0|      box = std::make_shared<Box_mjpg>();
  647|      0|      break;
  648|       |
  649|      0|    case fourcc("elng"):
  ------------------
  |  Branch (649:5): [True: 0, False: 11.5k]
  ------------------
  650|      0|      box = std::make_shared<Box_elng>();
  651|      0|      break;
  652|       |
  653|       |
  654|      0|#if WITH_UNCOMPRESSED_CODEC
  655|      0|    case fourcc("cmpd"):
  ------------------
  |  Branch (655:5): [True: 0, False: 11.5k]
  ------------------
  656|      0|      box = std::make_shared<Box_cmpd>();
  657|      0|      break;
  658|       |
  659|      0|    case fourcc("uncC"):
  ------------------
  |  Branch (659:5): [True: 0, False: 11.5k]
  ------------------
  660|      0|      box = std::make_shared<Box_uncC>();
  661|      0|      break;
  662|       |
  663|      0|    case fourcc("cmpC"):
  ------------------
  |  Branch (663:5): [True: 0, False: 11.5k]
  ------------------
  664|      0|      box = std::make_shared<Box_cmpC>();
  665|      0|      break;
  666|       |
  667|      0|    case fourcc("icef"):
  ------------------
  |  Branch (667:5): [True: 0, False: 11.5k]
  ------------------
  668|      0|      box = std::make_shared<Box_icef>();
  669|      0|      break;
  670|       |
  671|      0|    case fourcc("cpat"):
  ------------------
  |  Branch (671:5): [True: 0, False: 11.5k]
  ------------------
  672|      0|      box = std::make_shared<Box_cpat>();
  673|      0|      break;
  674|       |
  675|      0|    case fourcc("splz"):
  ------------------
  |  Branch (675:5): [True: 0, False: 11.5k]
  ------------------
  676|      0|      box = std::make_shared<Box_splz>();
  677|      0|      break;
  678|       |
  679|      0|    case fourcc("sbpm"):
  ------------------
  |  Branch (679:5): [True: 0, False: 11.5k]
  ------------------
  680|      0|      box = std::make_shared<Box_sbpm>();
  681|      0|      break;
  682|       |
  683|      0|    case fourcc("snuc"):
  ------------------
  |  Branch (683:5): [True: 0, False: 11.5k]
  ------------------
  684|      0|      box = std::make_shared<Box_snuc>();
  685|      0|      break;
  686|       |
  687|      0|    case fourcc("cloc"):
  ------------------
  |  Branch (687:5): [True: 0, False: 11.5k]
  ------------------
  688|      0|      box = std::make_shared<Box_cloc>();
  689|      0|      break;
  690|       |
  691|      0|    case fourcc("uncv"):
  ------------------
  |  Branch (691:5): [True: 0, False: 11.5k]
  ------------------
  692|      0|      box = std::make_shared<Box_uncv>();
  693|      0|      break;
  694|      0|#endif
  695|       |
  696|       |    // --- JPEG 2000
  697|       |
  698|      0|    case fourcc("j2kH"):
  ------------------
  |  Branch (698:5): [True: 0, False: 11.5k]
  ------------------
  699|      0|      box = std::make_shared<Box_j2kH>();
  700|      0|      break;
  701|       |
  702|      0|    case fourcc("cdef"):
  ------------------
  |  Branch (702:5): [True: 0, False: 11.5k]
  ------------------
  703|      0|      box = std::make_shared<Box_cdef>();
  704|      0|      break;
  705|       |
  706|      0|    case fourcc("cmap"):
  ------------------
  |  Branch (706:5): [True: 0, False: 11.5k]
  ------------------
  707|      0|      box = std::make_shared<Box_cmap>();
  708|      0|      break;
  709|       |
  710|      0|    case fourcc("pclr"):
  ------------------
  |  Branch (710:5): [True: 0, False: 11.5k]
  ------------------
  711|      0|      box = std::make_shared<Box_pclr>();
  712|      0|      break;
  713|       |
  714|      0|    case fourcc("j2kL"):
  ------------------
  |  Branch (714:5): [True: 0, False: 11.5k]
  ------------------
  715|      0|      box = std::make_shared<Box_j2kL>();
  716|      0|      break;
  717|       |
  718|      0|    case fourcc("j2ki"):
  ------------------
  |  Branch (718:5): [True: 0, False: 11.5k]
  ------------------
  719|      0|      box = std::make_shared<Box_j2ki>();
  720|      0|      break;
  721|       |
  722|       |
  723|       |    // --- mski
  724|       |
  725|      0|    case fourcc("mskC"):
  ------------------
  |  Branch (725:5): [True: 0, False: 11.5k]
  ------------------
  726|      0|      box = std::make_shared<Box_mskC>();
  727|      0|      break;
  728|       |
  729|       |    // --- TAI timestamps
  730|       |
  731|      0|    case fourcc("itai"):
  ------------------
  |  Branch (731:5): [True: 0, False: 11.5k]
  ------------------
  732|      0|      box = std::make_shared<Box_itai>();
  733|      0|      break;
  734|       |
  735|      0|    case fourcc("taic"):
  ------------------
  |  Branch (735:5): [True: 0, False: 11.5k]
  ------------------
  736|      0|      box = std::make_shared<Box_taic>();
  737|      0|      break;
  738|       |
  739|       |    // --- AVC (H.264)
  740|       |
  741|      0|    case fourcc("avcC"):
  ------------------
  |  Branch (741:5): [True: 0, False: 11.5k]
  ------------------
  742|      0|      box = std::make_shared<Box_avcC>();
  743|      0|      break;
  744|       |
  745|      0|    case fourcc("avc1"):
  ------------------
  |  Branch (745:5): [True: 0, False: 11.5k]
  ------------------
  746|      0|      box = std::make_shared<Box_avc1>();
  747|      0|      break;
  748|       |
  749|      0|#if HEIF_ENABLE_EXPERIMENTAL_FEATURES
  750|      0|    case fourcc("tilC"):
  ------------------
  |  Branch (750:5): [True: 0, False: 11.5k]
  ------------------
  751|      0|      box = std::make_shared<Box_tilC>();
  752|      0|      break;
  753|      0|#endif
  754|       |
  755|       |#if ENABLE_EXPERIMENTAL_MINI_FORMAT
  756|       |    case fourcc("mini"):
  757|       |      box = std::make_shared<Box_mini>();
  758|       |      break;
  759|       |#endif
  760|       |
  761|      0|    case fourcc("mdat"):
  ------------------
  |  Branch (761:5): [True: 0, False: 11.5k]
  ------------------
  762|       |      // avoid generating a 'Box_other'
  763|      0|      box = std::make_shared<Box>();
  764|      0|      break;
  765|       |
  766|      0|    case fourcc("uuid"):
  ------------------
  |  Branch (766:5): [True: 0, False: 11.5k]
  ------------------
  767|      0|      if (hdr.get_uuid_type() == std::vector<uint8_t>{0x22, 0xcc, 0x04, 0xc7, 0xd6, 0xd9, 0x4e, 0x07, 0x9d, 0x90, 0x4e, 0xb6, 0xec, 0xba, 0xf3, 0xa3}) {
  ------------------
  |  Branch (767:11): [True: 0, False: 0]
  ------------------
  768|      0|        box = std::make_shared<Box_cmin>();
  769|      0|      }
  770|      0|      else if (hdr.get_uuid_type() == std::vector<uint8_t>{0x43, 0x63, 0xe9, 0x14, 0x5b, 0x7d, 0x4a, 0xab, 0x97, 0xae, 0xbe, 0xa6, 0x98, 0x03, 0xb4, 0x34}) {
  ------------------
  |  Branch (770:16): [True: 0, False: 0]
  ------------------
  771|      0|        box = std::make_shared<Box_cmex>();
  772|      0|      }
  773|      0|      else if (hdr.get_uuid_type() == std::vector<uint8_t>{0x26, 0x1e, 0xf3, 0x74, 0x1d, 0x97, 0x5b, 0xba, 0xac, 0xbd, 0x9d, 0x2c, 0x8e, 0xa7, 0x35, 0x22}) {
  ------------------
  |  Branch (773:16): [True: 0, False: 0]
  ------------------
  774|      0|        box = std::make_shared<Box_gimi_content_id>();
  775|      0|      }
  776|      0|#if WITH_UNCOMPRESSED_CODEC
  777|      0|      else if (hdr.get_uuid_type() == std::vector<uint8_t>{0x9d, 0xb9, 0xdd, 0x6e, 0x37, 0x3c, 0x5a, 0x4e, 0x81, 0x10, 0x21, 0xfc, 0x83, 0xa9, 0x11, 0xfd}) {
  ------------------
  |  Branch (777:16): [True: 0, False: 0]
  ------------------
  778|      0|        box = std::make_shared<Box_gimi_component_content_ids>();
  779|      0|      }
  780|      0|#endif
  781|      0|      else {
  782|      0|        box = std::make_shared<Box_other>(hdr.get_short_type());
  783|      0|      }
  784|      0|      break;
  785|       |
  786|       |    // --- sequences
  787|       |
  788|  2.46k|    case fourcc("moov"):
  ------------------
  |  Branch (788:5): [True: 2.46k, False: 9.12k]
  ------------------
  789|  2.46k|      box = std::make_shared<Box_moov>();
  790|  2.46k|      break;
  791|       |
  792|      0|    case fourcc("mvhd"):
  ------------------
  |  Branch (792:5): [True: 0, False: 11.5k]
  ------------------
  793|      0|      box = std::make_shared<Box_mvhd>();
  794|      0|      break;
  795|       |
  796|      0|    case fourcc("trak"):
  ------------------
  |  Branch (796:5): [True: 0, False: 11.5k]
  ------------------
  797|      0|      box = std::make_shared<Box_trak>();
  798|      0|      break;
  799|       |
  800|      0|    case fourcc("tkhd"):
  ------------------
  |  Branch (800:5): [True: 0, False: 11.5k]
  ------------------
  801|      0|      box = std::make_shared<Box_tkhd>();
  802|      0|      break;
  803|       |
  804|      0|    case fourcc("mdia"):
  ------------------
  |  Branch (804:5): [True: 0, False: 11.5k]
  ------------------
  805|      0|      box = std::make_shared<Box_mdia>();
  806|      0|      break;
  807|       |
  808|      2|    case fourcc("mdhd"):
  ------------------
  |  Branch (808:5): [True: 2, False: 11.5k]
  ------------------
  809|      2|      box = std::make_shared<Box_mdhd>();
  810|      2|      break;
  811|       |
  812|      0|    case fourcc("minf"):
  ------------------
  |  Branch (812:5): [True: 0, False: 11.5k]
  ------------------
  813|      0|      box = std::make_shared<Box_minf>();
  814|      0|      break;
  815|       |
  816|      0|    case fourcc("vmhd"):
  ------------------
  |  Branch (816:5): [True: 0, False: 11.5k]
  ------------------
  817|      0|      box = std::make_shared<Box_vmhd>();
  818|      0|      break;
  819|       |
  820|      0|    case fourcc("stbl"):
  ------------------
  |  Branch (820:5): [True: 0, False: 11.5k]
  ------------------
  821|      0|      box = std::make_shared<Box_stbl>();
  822|      0|      break;
  823|       |
  824|      0|    case fourcc("stsd"):
  ------------------
  |  Branch (824:5): [True: 0, False: 11.5k]
  ------------------
  825|      0|      box = std::make_shared<Box_stsd>();
  826|      0|      break;
  827|       |
  828|      0|    case fourcc("stts"):
  ------------------
  |  Branch (828:5): [True: 0, False: 11.5k]
  ------------------
  829|      0|      box = std::make_shared<Box_stts>();
  830|      0|      break;
  831|       |
  832|      0|    case fourcc("ctts"):
  ------------------
  |  Branch (832:5): [True: 0, False: 11.5k]
  ------------------
  833|      0|      box = std::make_shared<Box_ctts>();
  834|      0|      break;
  835|       |
  836|      0|    case fourcc("stsc"):
  ------------------
  |  Branch (836:5): [True: 0, False: 11.5k]
  ------------------
  837|      0|      box = std::make_shared<Box_stsc>();
  838|      0|      break;
  839|       |
  840|      0|    case fourcc("stco"):
  ------------------
  |  Branch (840:5): [True: 0, False: 11.5k]
  ------------------
  841|      0|      box = std::make_shared<Box_stco>();
  842|      0|      break;
  843|       |
  844|      0|    case fourcc("stsz"):
  ------------------
  |  Branch (844:5): [True: 0, False: 11.5k]
  ------------------
  845|      0|      box = std::make_shared<Box_stsz>();
  846|      0|      break;
  847|       |
  848|    193|    case fourcc("stss"):
  ------------------
  |  Branch (848:5): [True: 193, False: 11.3k]
  ------------------
  849|    193|      box = std::make_shared<Box_stss>();
  850|    193|      break;
  851|       |
  852|      0|    case fourcc("ccst"):
  ------------------
  |  Branch (852:5): [True: 0, False: 11.5k]
  ------------------
  853|      0|      box = std::make_shared<Box_ccst>();
  854|      0|      break;
  855|       |
  856|      0|    case fourcc("auxi"):
  ------------------
  |  Branch (856:5): [True: 0, False: 11.5k]
  ------------------
  857|      0|      box = std::make_shared<Box_auxi>();
  858|      0|      break;
  859|       |
  860|      0|    case fourcc("edts"):
  ------------------
  |  Branch (860:5): [True: 0, False: 11.5k]
  ------------------
  861|      0|      box = std::make_shared<Box_edts>();
  862|      0|      break;
  863|       |
  864|      0|    case fourcc("elst"):
  ------------------
  |  Branch (864:5): [True: 0, False: 11.5k]
  ------------------
  865|      0|      box = std::make_shared<Box_elst>();
  866|      0|      break;
  867|       |
  868|      0|    case fourcc("sbgp"):
  ------------------
  |  Branch (868:5): [True: 0, False: 11.5k]
  ------------------
  869|      0|      box = std::make_shared<Box_sbgp>();
  870|      0|      break;
  871|       |
  872|      0|    case fourcc("sgpd"):
  ------------------
  |  Branch (872:5): [True: 0, False: 11.5k]
  ------------------
  873|      0|      box = std::make_shared<Box_sgpd>();
  874|      0|      break;
  875|       |
  876|      0|    case fourcc("btrt"):
  ------------------
  |  Branch (876:5): [True: 0, False: 11.5k]
  ------------------
  877|      0|      box = std::make_shared<Box_btrt>();
  878|      0|      break;
  879|       |
  880|      0|    case fourcc("saiz"):
  ------------------
  |  Branch (880:5): [True: 0, False: 11.5k]
  ------------------
  881|      0|      box = std::make_shared<Box_saiz>();
  882|      0|      break;
  883|       |
  884|      0|    case fourcc("saio"):
  ------------------
  |  Branch (884:5): [True: 0, False: 11.5k]
  ------------------
  885|      0|      box = std::make_shared<Box_saio>();
  886|      0|      break;
  887|       |
  888|      0|    case fourcc("urim"):
  ------------------
  |  Branch (888:5): [True: 0, False: 11.5k]
  ------------------
  889|      0|      box = std::make_shared<Box_URIMetaSampleEntry>();
  890|      0|      break;
  891|       |
  892|      0|    case fourcc("uri "):
  ------------------
  |  Branch (892:5): [True: 0, False: 11.5k]
  ------------------
  893|      0|      box = std::make_shared<Box_uri>();
  894|      0|      break;
  895|       |
  896|      0|    case fourcc("nmhd"):
  ------------------
  |  Branch (896:5): [True: 0, False: 11.5k]
  ------------------
  897|      0|      box = std::make_shared<Box_nmhd>();
  898|      0|      break;
  899|       |
  900|      0|    case fourcc("tref"):
  ------------------
  |  Branch (900:5): [True: 0, False: 11.5k]
  ------------------
  901|      0|      box = std::make_shared<Box_tref>();
  902|      0|      break;
  903|       |
  904|      0|    case fourcc("sdtp"):
  ------------------
  |  Branch (904:5): [True: 0, False: 11.5k]
  ------------------
  905|      0|      box = std::make_shared<Box_sdtp>();
  906|      0|      break;
  907|       |
  908|      0|#if HEIF_WITH_OMAF
  909|       |    // OMAF
  910|      0|    case fourcc("prfr"):
  ------------------
  |  Branch (910:5): [True: 0, False: 11.5k]
  ------------------
  911|      0|      box = std::make_shared<Box_prfr>();
  912|      0|      break;
  913|      0|#endif
  914|       |
  915|  2.43k|    default:
  ------------------
  |  Branch (915:5): [True: 2.43k, False: 9.14k]
  ------------------
  916|  2.43k|      box = std::make_shared<Box_other>(hdr.get_short_type());
  917|  2.43k|      break;
  918|  11.5k|  }
  919|       |
  920|  11.5k|  box->set_short_header(hdr);
  921|       |
  922|  11.5k|  box->m_debug_box_type = hdr.get_type_string(); // only for debugging
  923|       |
  924|       |
  925|  11.5k|  if (range.get_nesting_level() > MAX_BOX_NESTING_LEVEL) {
  ------------------
  |  Branch (925:7): [True: 0, False: 11.5k]
  ------------------
  926|      0|    return Error(heif_error_Memory_allocation_error,
  927|      0|                 heif_suberror_Security_limit_exceeded,
  928|      0|                 "Security limit for maximum nesting of boxes has been exceeded");
  929|      0|  }
  930|       |
  931|  11.5k|  if (hdr.has_fixed_box_size()) {
  ------------------
  |  Branch (931:7): [True: 8.43k, False: 3.14k]
  ------------------
  932|       |    // Sanity checks
  933|  8.43k|    if (hdr.get_box_size() < hdr.get_header_size()) {
  ------------------
  |  Branch (933:9): [True: 1, False: 8.43k]
  ------------------
  934|      1|      std::stringstream sstr;
  935|      1|      sstr << "Box size (" << hdr.get_box_size() << " bytes) smaller than header size ("
  936|      1|           << hdr.get_header_size() << " bytes)";
  937|       |
  938|      1|      return {heif_error_Invalid_input,
  939|      1|              heif_suberror_Invalid_box_size,
  940|      1|              sstr.str()};
  941|      1|    }
  942|       |
  943|       |    // this is >= 0 because of above condition
  944|  8.43k|    auto nBytes = static_cast<uint64_t>(hdr.get_box_size() - hdr.get_header_size());
  945|  8.43k|    if (nBytes > SIZE_MAX) {
  ------------------
  |  Branch (945:9): [True: 0, False: 8.43k]
  ------------------
  946|      0|      return {heif_error_Memory_allocation_error,
  947|      0|              heif_suberror_Invalid_box_size,
  948|      0|              "Box size too large"};
  949|      0|    }
  950|       |
  951|       |    // Security check: make sure that box size does not exceed int64 size.
  952|       |
  953|  8.43k|    if (hdr.get_box_size() > (uint64_t) std::numeric_limits<int64_t>::max()) {
  ------------------
  |  Branch (953:9): [True: 0, False: 8.43k]
  ------------------
  954|      0|      return {heif_error_Invalid_input,
  955|      0|              heif_suberror_Invalid_box_size};
  956|      0|    }
  957|       |
  958|       |    // --- wait for data to arrive
  959|       |
  960|  8.43k|    auto status = range.wait_for_available_bytes(static_cast<size_t>(nBytes));
  961|  8.43k|    if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (961:9): [True: 3, False: 8.43k]
  ------------------
  962|       |      // TODO: return recoverable error at timeout
  963|      3|      return {heif_error_Invalid_input,
  964|      3|              heif_suberror_End_of_data};
  965|      3|    }
  966|  8.43k|  }
  967|       |
  968|  11.5k|  auto box_size = static_cast<int64_t>(hdr.get_box_size());
  969|  11.5k|  int64_t box_size_without_header = hdr.has_fixed_box_size() ? (box_size - hdr.get_header_size()) : (int64_t)range.get_remaining_bytes();
  ------------------
  |  Branch (969:37): [True: 8.43k, False: 3.14k]
  ------------------
  970|       |
  971|       |  // Box size may not be larger than remaining bytes in parent box.
  972|       |
  973|  11.5k|  if ((int64_t)range.get_remaining_bytes() < box_size_without_header) {
  ------------------
  |  Branch (973:7): [True: 0, False: 11.5k]
  ------------------
  974|      0|    return {heif_error_Invalid_input,
  975|      0|            heif_suberror_Invalid_box_size};
  976|      0|  }
  977|       |
  978|       |
  979|       |  // Create child bitstream range and read box from that range.
  980|       |
  981|  11.5k|  BitstreamRange boxrange(range.get_istream(),
  982|  11.5k|                          box_size_without_header,
  983|  11.5k|                          &range);
  984|       |
  985|  11.5k|  err = box->parse(boxrange, limits);
  986|  11.5k|  boxrange.skip_to_end_of_box();
  987|       |
  988|  11.5k|  if (err == Error::Ok) {
  ------------------
  |  Branch (988:7): [True: 10.8k, False: 772]
  ------------------
  989|  10.8k|    *result = std::move(box);
  990|  10.8k|  }
  991|    772|  else {
  992|    772|    parse_error_fatality fatality = box->get_parse_error_fatality();
  993|       |
  994|    772|    box = std::make_shared<Box_Error>(box->get_short_type(), err, fatality);
  995|       |
  996|       |    // We return a Box_Error that represents the parse error.
  997|    772|    *result = std::move(box);
  998|    772|  }
  999|       |
 1000|  11.5k|  return err;
 1001|  11.5k|}
_ZNK3BoxeqERKS_:
 1040|    193|{
 1041|    193|  if (this->get_short_type() != other.get_short_type()) {
  ------------------
  |  Branch (1041:7): [True: 15, False: 178]
  ------------------
 1042|     15|    return false;
 1043|     15|  }
 1044|       |
 1045|    178|  StreamWriter writer1;
 1046|    178|  StreamWriter writer2;
 1047|       |
 1048|    178|  this->write(writer1);
 1049|    178|  other.write(writer2);
 1050|       |
 1051|    178|  return writer1.get_data() == writer2.get_data();
 1052|    193|}
_ZN3Box5equalERKNSt3__110shared_ptrIS_EES4_:
 1069|    193|{
 1070|    193|    if (!box1 || !box2) {
  ------------------
  |  Branch (1070:9): [True: 0, False: 193]
  |  Branch (1070:18): [True: 0, False: 193]
  ------------------
 1071|      0|        return false;
 1072|      0|    }
 1073|       |
 1074|       |    // This was introduced because of j2kH having child boxes.
 1075|       |    // TODO: we might also deduplicate them by comparing all child boxes.
 1076|    193|    if (box1->has_child_boxes() || box2->has_child_boxes()) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 193]
  |  Branch (1076:36): [True: 0, False: 193]
  ------------------
 1077|      0|      return false;
 1078|      0|    }
 1079|       |
 1080|    193|    return *box1 == *box2;
 1081|    193|}
_ZN3Box13read_childrenER14BitstreamRangejPK20heif_security_limits:
 1085|  3.50k|{
 1086|  3.50k|  uint32_t count = 0;
 1087|       |
 1088|  12.0k|  while (!range.eof() && !range.error()) {
  ------------------
  |  Branch (1088:10): [True: 8.53k, False: 3.48k]
  |  Branch (1088:26): [True: 8.53k, False: 0]
  ------------------
 1089|  8.53k|    std::shared_ptr<Box> box;
 1090|  8.53k|    Error error = Box::read(range, &box, limits);
 1091|  8.53k|    if (error != Error::Ok && (!box || box->get_parse_error_fatality() == parse_error_fatality::fatal)) {
  ------------------
  |  Branch (1091:9): [True: 764, False: 7.77k]
  |  Branch (1091:32): [True: 4, False: 760]
  |  Branch (1091:40): [True: 3, False: 757]
  ------------------
 1092|      7|      return error;
 1093|      7|    }
 1094|       |
 1095|  8.53k|    if (max_number == READ_CHILDREN_ALL) {
  ------------------
  |  Branch (1095:9): [True: 7.09k, False: 1.43k]
  ------------------
 1096|  7.09k|      uint32_t max_children;
 1097|  7.09k|      if (get_short_type() == fourcc("iinf")) {
  ------------------
  |  Branch (1097:11): [True: 0, False: 7.09k]
  ------------------
 1098|      0|        max_children = limits->max_items;
 1099|      0|      }
 1100|  7.09k|      else {
 1101|  7.09k|        max_children = limits->max_children_per_box;
 1102|  7.09k|      }
 1103|       |
 1104|  7.09k|      if (max_children && m_children.size() > max_children) {
  ------------------
  |  Branch (1104:11): [True: 7.09k, False: 0]
  |  Branch (1104:27): [True: 0, False: 7.09k]
  ------------------
 1105|      0|        std::stringstream sstr;
 1106|      0|        sstr << "Maximum number of child boxes (" << max_children << ") in '" << get_type_string() << "' box exceeded.";
 1107|       |
 1108|       |        // Sanity check.
 1109|      0|        return Error(heif_error_Memory_allocation_error,
 1110|      0|                     heif_suberror_Security_limit_exceeded,
 1111|      0|                     sstr.str());
 1112|      0|      }
 1113|  7.09k|    }
 1114|       |
 1115|  8.53k|    m_children.push_back(std::move(box));
 1116|       |
 1117|       |
 1118|       |    // count the new child and end reading new children when we reached the expected number
 1119|       |
 1120|  8.53k|    count++;
 1121|       |
 1122|  8.53k|    if (max_number != READ_CHILDREN_ALL &&
  ------------------
  |  Branch (1122:9): [True: 1.43k, False: 7.09k]
  ------------------
 1123|  1.43k|        count == max_number) {
  ------------------
  |  Branch (1123:9): [True: 14, False: 1.42k]
  ------------------
 1124|     14|      break;
 1125|     14|    }
 1126|  8.53k|  }
 1127|       |
 1128|  3.49k|  return range.get_error();
 1129|  3.50k|}
_ZN9Box_other5parseER14BitstreamRangePK20heif_security_limits:
 1195|  2.43k|{
 1196|  2.43k|  if (has_fixed_box_size()) {
  ------------------
  |  Branch (1196:7): [True: 1.89k, False: 538]
  ------------------
 1197|  1.89k|    size_t len;
 1198|  1.89k|    if (get_box_size() >= get_header_size()) {
  ------------------
  |  Branch (1198:9): [True: 1.89k, False: 0]
  ------------------
 1199|  1.89k|      auto len64 = get_box_size() - get_header_size();
 1200|  1.89k|      if (len64 > MAX_BOX_SIZE) {
  ------------------
  |  Branch (1200:11): [True: 0, False: 1.89k]
  ------------------
 1201|      0|        return {heif_error_Invalid_input,
 1202|      0|                heif_suberror_Security_limit_exceeded,
 1203|      0|                "Box size too large"};
 1204|      0|      }
 1205|       |
 1206|  1.89k|      len = static_cast<size_t>(len64);
 1207|       |
 1208|  1.89k|      m_data.resize(len);
 1209|  1.89k|      range.read(m_data.data(), len);
 1210|  1.89k|    }
 1211|      0|    else {
 1212|      0|      return {heif_error_Invalid_input,
 1213|      0|              heif_suberror_Invalid_box_size};
 1214|      0|    }
 1215|  1.89k|  }
 1216|    538|  else {
 1217|       |    // TODO: boxes until end of file (we will probably never need this)
 1218|    538|  }
 1219|       |
 1220|  2.43k|  return range.get_error();
 1221|  2.43k|}
_ZNK9Box_Error24get_parse_error_fatalityEv:
 1281|    949|{
 1282|    949|  return m_fatality;
 1283|    949|}
_ZN8Box_ftyp5parseER14BitstreamRangePK20heif_security_limits:
 1287|     32|{
 1288|     32|  m_major_brand = range.read32();
 1289|     32|  m_minor_version = range.read32();
 1290|       |
 1291|     32|  uint64_t box_size = get_box_size();
 1292|     32|  if (box_size < 8 || box_size - 8 < get_header_size()) {
  ------------------
  |  Branch (1292:7): [True: 0, False: 32]
  |  Branch (1292:23): [True: 7, False: 25]
  ------------------
 1293|       |    // Sanity check.
 1294|      7|    return Error(heif_error_Invalid_input,
 1295|      7|                 heif_suberror_Invalid_box_size,
 1296|      7|                 "ftyp box too small (less than 8 bytes)");
 1297|      7|  }
 1298|       |
 1299|     25|  uint64_t n_minor_brands = (get_box_size() - get_header_size() - 8) / 4;
 1300|       |
 1301|     25|  if (limits->max_number_of_file_brands && n_minor_brands > limits->max_number_of_file_brands) {
  ------------------
  |  Branch (1301:7): [True: 25, False: 0]
  |  Branch (1301:44): [True: 0, False: 25]
  ------------------
 1302|      0|    return {
 1303|      0|      heif_error_Memory_allocation_error,
 1304|      0|      heif_suberror_Security_limit_exceeded,
 1305|      0|      "Number of minor brands in file exceeds security limit"
 1306|      0|    };
 1307|      0|  }
 1308|       |
 1309|    151|  for (uint64_t i = 0; i < n_minor_brands && !range.error(); i++) {
  ------------------
  |  Branch (1309:24): [True: 126, False: 25]
  |  Branch (1309:46): [True: 126, False: 0]
  ------------------
 1310|    126|    m_compatible_brands.push_back(range.read32());
 1311|    126|  }
 1312|       |
 1313|     25|  return range.get_error();
 1314|     25|}
_ZNK8Box_ftyp20has_compatible_brandEj:
 1318|    148|{
 1319|    148|  return std::find(m_compatible_brands.begin(),
 1320|    148|                   m_compatible_brands.end(),
 1321|    148|                   brand) !=
 1322|    148|         m_compatible_brands.end();
 1323|    148|}
_ZN8Box_meta5parseER14BitstreamRangePK20heif_security_limits:
 1405|    551|{
 1406|    551|  parse_full_box_header(range);
 1407|       |
 1408|    551|  if (get_version() != 0) {
  ------------------
  |  Branch (1408:7): [True: 0, False: 551]
  ------------------
 1409|      0|    return unsupported_version_error("meta");
 1410|      0|  }
 1411|       |
 1412|       |  /*
 1413|       |  uint64_t boxSizeLimit;
 1414|       |  if (get_box_size() == BoxHeader::size_until_end_of_file) {
 1415|       |    boxSizeLimit = sizeLimit;
 1416|       |  }
 1417|       |  else {
 1418|       |    boxSizeLimit = get_box_size() - get_header_size();
 1419|       |  }
 1420|       |  */
 1421|       |
 1422|    551|  return read_children(range, READ_CHILDREN_ALL, limits);
 1423|    551|}
_ZNK7FullBox25unsupported_version_errorEPKc:
 1437|    217|{
 1438|    217|  std::stringstream sstr;
 1439|    217|  sstr << box << " box data version " << ((int) m_version) << " is not implemented yet";
 1440|       |
 1441|    217|  return {heif_error_Unsupported_feature,
 1442|    217|          heif_suberror_Unsupported_data_version,
 1443|    217|          sstr.str()};
 1444|    217|}
_ZN8Box_hdlr5parseER14BitstreamRangePK20heif_security_limits:
 1448|    160|{
 1449|    160|  parse_full_box_header(range);
 1450|       |
 1451|    160|  if (get_version() != 0) {
  ------------------
  |  Branch (1451:7): [True: 0, False: 160]
  ------------------
 1452|      0|    return unsupported_version_error("hdlr");
 1453|      0|  }
 1454|       |
 1455|    160|  m_pre_defined = range.read32();
 1456|    160|  m_handler_type = range.read32();
 1457|       |
 1458|    640|  for (int i = 0; i < 3; i++) {
  ------------------
  |  Branch (1458:19): [True: 480, False: 160]
  ------------------
 1459|    480|    m_reserved[i] = range.read32();
 1460|    480|  }
 1461|       |
 1462|    160|  m_name = range.read_string();
 1463|       |
 1464|    160|  return range.get_error();
 1465|    160|}
_ZN8Box_pitm5parseER14BitstreamRangePK20heif_security_limits:
 1500|    516|{
 1501|    516|  parse_full_box_header(range);
 1502|       |
 1503|    516|  if (get_version() > 1) {
  ------------------
  |  Branch (1503:7): [True: 0, False: 516]
  ------------------
 1504|      0|    return unsupported_version_error("pitm");
 1505|      0|  }
 1506|       |
 1507|       |
 1508|    516|  if (get_version() == 0) {
  ------------------
  |  Branch (1508:7): [True: 516, False: 0]
  ------------------
 1509|    516|    m_item_ID = range.read16();
 1510|    516|  }
 1511|      0|  else {
 1512|      0|    m_item_ID = range.read32();
 1513|      0|  }
 1514|       |
 1515|    516|  return range.get_error();
 1516|    516|}
_ZN8Box_iloc5parseER14BitstreamRangePK20heif_security_limits:
 1559|    414|{
 1560|    414|  parse_full_box_header(range);
 1561|       |
 1562|    414|  if (get_version() > 2) {
  ------------------
  |  Branch (1562:7): [True: 0, False: 414]
  ------------------
 1563|      0|    return unsupported_version_error("iloc");
 1564|      0|  }
 1565|       |
 1566|    414|  const int version = get_version();
 1567|       |
 1568|    414|  uint16_t values4 = range.read16();
 1569|       |
 1570|    414|  int offset_size = (values4 >> 12) & 0xF;
 1571|    414|  int length_size = (values4 >> 8) & 0xF;
 1572|    414|  int base_offset_size = (values4 >> 4) & 0xF;
 1573|    414|  int index_size = 0;
 1574|       |
 1575|    414|  if (version == 1 || version == 2) {
  ------------------
  |  Branch (1575:7): [True: 11, False: 403]
  |  Branch (1575:23): [True: 254, False: 149]
  ------------------
 1576|    265|    index_size = (values4 & 0xF);
 1577|    265|  }
 1578|       |
 1579|    414|  uint32_t item_count = 0;
 1580|    414|  if (version < 2) {
  ------------------
  |  Branch (1580:7): [True: 160, False: 254]
  ------------------
 1581|    160|    item_count = range.read16();
 1582|    160|  }
 1583|    254|  else if (version == 2) {
  ------------------
  |  Branch (1583:12): [True: 254, False: 0]
  ------------------
 1584|    254|    item_count = range.read32();
 1585|    254|  }
 1586|       |
 1587|       |  // Sanity check. (This might be obsolete now as we check for range.error() below).
 1588|    414|  if (limits->max_items && item_count > limits->max_items) {
  ------------------
  |  Branch (1588:7): [True: 414, False: 0]
  |  Branch (1588:28): [True: 0, False: 414]
  ------------------
 1589|      0|    std::stringstream sstr;
 1590|      0|    sstr << "iloc box contains " << item_count << " items, which exceeds the security limit of "
 1591|      0|         << limits->max_items << " items.";
 1592|       |
 1593|      0|    return Error(heif_error_Memory_allocation_error,
 1594|      0|                 heif_suberror_Security_limit_exceeded,
 1595|      0|                 sstr.str());
 1596|      0|  }
 1597|       |
 1598|  2.13k|  for (uint32_t i = 0; i < item_count; i++) {
  ------------------
  |  Branch (1598:24): [True: 1.71k, False: 413]
  ------------------
 1599|  1.71k|    Item item;
 1600|       |
 1601|  1.71k|    if (range.eof()) {
  ------------------
  |  Branch (1601:9): [True: 0, False: 1.71k]
  ------------------
 1602|      0|      std::stringstream sstr;
 1603|      0|      sstr << "iloc box should contain " << item_count << " items, but we can only read " << i << " items.";
 1604|       |
 1605|      0|      return {heif_error_Invalid_input,
 1606|      0|              heif_suberror_End_of_data,
 1607|      0|              sstr.str()};
 1608|      0|    }
 1609|       |
 1610|  1.71k|    if (version < 2) {
  ------------------
  |  Branch (1610:9): [True: 1.71k, False: 0]
  ------------------
 1611|  1.71k|      item.item_ID = range.read16();
 1612|  1.71k|    }
 1613|      0|    else if (version == 2) {
  ------------------
  |  Branch (1613:14): [True: 0, False: 0]
  ------------------
 1614|      0|      item.item_ID = range.read32();
 1615|      0|    }
 1616|       |
 1617|  1.71k|    if (version >= 1) {
  ------------------
  |  Branch (1617:9): [True: 561, False: 1.15k]
  ------------------
 1618|    561|      values4 = range.read16();
 1619|    561|      item.construction_method = (values4 & 0xF);
 1620|    561|    }
 1621|       |
 1622|  1.71k|    item.data_reference_index = range.read16();
 1623|       |
 1624|  1.71k|    item.base_offset = 0;
 1625|  1.71k|    if (base_offset_size == 4) {
  ------------------
  |  Branch (1625:9): [True: 0, False: 1.71k]
  ------------------
 1626|      0|      item.base_offset = range.read32();
 1627|      0|    }
 1628|  1.71k|    else if (base_offset_size == 8) {
  ------------------
  |  Branch (1628:14): [True: 0, False: 1.71k]
  ------------------
 1629|      0|      item.base_offset = ((uint64_t) range.read32()) << 32;
 1630|      0|      item.base_offset |= range.read32();
 1631|      0|    }
 1632|       |
 1633|  1.71k|    uint16_t extent_count = range.read16();
 1634|       |
 1635|       |    // Sanity check.
 1636|  1.71k|    auto max_iloc_extents = limits->max_iloc_extents_per_item;
 1637|  1.71k|    if (max_iloc_extents && extent_count > max_iloc_extents) {
  ------------------
  |  Branch (1637:9): [True: 1.71k, False: 0]
  |  Branch (1637:29): [True: 1, False: 1.71k]
  ------------------
 1638|      1|      std::stringstream sstr;
 1639|      1|      sstr << "Number of extents in iloc box (" << extent_count << ") exceeds security limit ("
 1640|      1|           << max_iloc_extents << ")\n";
 1641|       |
 1642|      1|      return Error(heif_error_Memory_allocation_error,
 1643|      1|                   heif_suberror_Security_limit_exceeded,
 1644|      1|                   sstr.str());
 1645|      1|    }
 1646|       |
 1647|  3.30k|    for (int e = 0; e < extent_count; e++) {
  ------------------
  |  Branch (1647:21): [True: 1.58k, False: 1.71k]
  ------------------
 1648|  1.58k|      Extent extent;
 1649|       |
 1650|  1.58k|      if (range.eof()) {
  ------------------
  |  Branch (1650:11): [True: 0, False: 1.58k]
  ------------------
 1651|      0|        std::stringstream sstr;
 1652|      0|        sstr << "iloc item should contain " << extent_count << " extents, but we can only read " << e << " extents.";
 1653|       |
 1654|      0|        return {heif_error_Invalid_input,
 1655|      0|                heif_suberror_End_of_data,
 1656|      0|                sstr.str()};
 1657|      0|      }
 1658|       |
 1659|  1.58k|      if ((version == 1 || version == 2) && index_size > 0) {
  ------------------
  |  Branch (1659:12): [True: 385, False: 1.20k]
  |  Branch (1659:28): [True: 0, False: 1.20k]
  |  Branch (1659:45): [True: 0, False: 385]
  ------------------
 1660|      0|        if (index_size == 4) {
  ------------------
  |  Branch (1660:13): [True: 0, False: 0]
  ------------------
 1661|      0|          extent.index = range.read32();
 1662|      0|        }
 1663|      0|        else if (index_size == 8) {
  ------------------
  |  Branch (1663:18): [True: 0, False: 0]
  ------------------
 1664|      0|          extent.index = ((uint64_t) range.read32()) << 32;
 1665|      0|          extent.index |= range.read32();
 1666|      0|        }
 1667|      0|      }
 1668|       |
 1669|  1.58k|      extent.offset = 0;
 1670|  1.58k|      if (offset_size == 4) {
  ------------------
  |  Branch (1670:11): [True: 1.53k, False: 51]
  ------------------
 1671|  1.53k|        extent.offset = range.read32();
 1672|  1.53k|      }
 1673|     51|      else if (offset_size == 8) {
  ------------------
  |  Branch (1673:16): [True: 0, False: 51]
  ------------------
 1674|      0|        extent.offset = ((uint64_t) range.read32()) << 32;
 1675|      0|        extent.offset |= range.read32();
 1676|      0|      }
 1677|       |
 1678|       |
 1679|  1.58k|      extent.length = 0;
 1680|  1.58k|      if (length_size == 4) {
  ------------------
  |  Branch (1680:11): [True: 1.58k, False: 0]
  ------------------
 1681|  1.58k|        extent.length = range.read32();
 1682|  1.58k|      }
 1683|      0|      else if (length_size == 8) {
  ------------------
  |  Branch (1683:16): [True: 0, False: 0]
  ------------------
 1684|      0|        extent.length = ((uint64_t) range.read32()) << 32;
 1685|      0|        extent.length |= range.read32();
 1686|      0|      }
 1687|       |
 1688|  1.58k|      item.extents.push_back(extent);
 1689|  1.58k|    }
 1690|       |
 1691|  1.71k|    if (!range.error()) {
  ------------------
  |  Branch (1691:9): [True: 1.71k, False: 0]
  ------------------
 1692|  1.71k|      m_items.push_back(item);
 1693|  1.71k|    }
 1694|  1.71k|  }
 1695|       |
 1696|    413|  return range.get_error();
 1697|    414|}
_ZN8Box_ilocC2Ev:
 1701|    414|{
 1702|    414|  set_short_type(fourcc("iloc"));
 1703|       |
 1704|    414|  set_use_tmp_file(false);
 1705|    414|}
_ZN8Box_ilocD2Ev:
 1709|    414|{
 1710|    414|  if (m_use_tmpfile) {
  ------------------
  |  Branch (1710:7): [True: 0, False: 414]
  ------------------
 1711|      0|    unlink(m_tmp_filename);
 1712|      0|  }
 1713|    414|}
_ZN8Box_iloc16set_use_tmp_fileEb:
 1717|    414|{
 1718|    414|  m_use_tmpfile = flag;
 1719|    414|  if (flag) {
  ------------------
  |  Branch (1719:7): [True: 0, False: 414]
  ------------------
 1720|      0|#if !defined(_WIN32)
 1721|      0|    strcpy(m_tmp_filename, "/tmp/libheif-XXXXXX");
 1722|      0|    m_tmpfile_fd = mkstemp(m_tmp_filename);
 1723|       |#else
 1724|       |    // TODO Currently unused code. Implement when needed.
 1725|       |    assert(false);
 1726|       |#  if 0
 1727|       |    char tmpname[L_tmpnam_s];
 1728|       |    // TODO: check return value (errno_t)
 1729|       |    tmpnam_s(tmpname, L_tmpnam_s);
 1730|       |    _sopen_s(&m_tmpfile_fd, tmpname, _O_CREAT | _O_TEMPORARY | _O_TRUNC | _O_RDWR, _SH_DENYRW, _S_IREAD | _S_IWRITE);
 1731|       |#  endif
 1732|       |#endif
 1733|      0|  }
 1734|    414|}
_ZNK8Box_iloc9read_dataEjRKNSt3__110shared_ptrI12StreamReaderEERKNS1_I8Box_idatEEPNS0_6vectorIhNS0_9allocatorIhEEEEPK20heif_security_limits:
 1769|    213|{
 1770|    213|  return read_data(item, istr, idat, dest, 0, std::numeric_limits<uint64_t>::max(), limits);
 1771|    213|}
_ZNK8Box_iloc9read_dataEjRKNSt3__110shared_ptrI12StreamReaderEERKNS1_I8Box_idatEEPNS0_6vectorIhNS0_9allocatorIhEEEEmmPK20heif_security_limits:
 1780|    247|{
 1781|    247|  const Item* item = nullptr;
 1782|  9.27k|  for (auto& i : m_items) {
  ------------------
  |  Branch (1782:16): [True: 9.27k, False: 104]
  ------------------
 1783|  9.27k|    if (i.item_ID == item_id) {
  ------------------
  |  Branch (1783:9): [True: 143, False: 9.12k]
  ------------------
 1784|    143|      item = &i;
 1785|    143|      break;
 1786|    143|    }
 1787|  9.27k|  }
 1788|       |
 1789|    247|  if (!item) {
  ------------------
  |  Branch (1789:7): [True: 104, False: 143]
  ------------------
 1790|    104|    std::stringstream sstr;
 1791|    104|    sstr << "Item with ID " << item_id << " has no compressed data";
 1792|       |
 1793|    104|    return Error(heif_error_Invalid_input,
 1794|    104|                 heif_suberror_No_item_data,
 1795|    104|                 sstr.str());
 1796|    104|  }
 1797|       |
 1798|    143|#if ENABLE_MULTITHREADING_SUPPORT
 1799|    143|  static std::mutex read_mutex;
 1800|       |
 1801|    143|  std::lock_guard<std::mutex> lock(read_mutex);
 1802|    143|#endif
 1803|       |
 1804|    143|  bool limited_size = (size != std::numeric_limits<uint64_t>::max());
 1805|       |
 1806|       |
 1807|       |  // TODO: this function should always append the data to the output vector as this is used when
 1808|       |  //       the image data is concatenated with data in a configuration box. However, it seems that
 1809|       |  //       this function clears the array in some cases. This should be corrected.
 1810|       |
 1811|    193|  for (const auto& extent : item->extents) {
  ------------------
  |  Branch (1811:27): [True: 193, False: 103]
  ------------------
 1812|    193|    if (item->construction_method == 0) {
  ------------------
  |  Branch (1812:9): [True: 193, False: 0]
  ------------------
 1813|       |
 1814|       |      // --- make sure that all data is available
 1815|       |
 1816|    193|      if (extent.offset > MAX_FILE_POS ||
  ------------------
  |  Branch (1816:11): [True: 0, False: 193]
  ------------------
 1817|    193|          item->base_offset > MAX_FILE_POS ||
  ------------------
  |  Branch (1817:11): [True: 0, False: 193]
  ------------------
 1818|    193|          extent.length > MAX_FILE_POS) {
  ------------------
  |  Branch (1818:11): [True: 0, False: 193]
  ------------------
 1819|      0|        return {heif_error_Invalid_input,
 1820|      0|                heif_suberror_Security_limit_exceeded,
 1821|      0|                "iloc data pointers out of allowed range"};
 1822|      0|      }
 1823|       |
 1824|    193|      StreamReader::grow_status status = istr->wait_for_file_size(extent.offset + item->base_offset + extent.length);
 1825|    193|      if (status == StreamReader::grow_status::size_beyond_eof) {
  ------------------
  |  Branch (1825:11): [True: 40, False: 153]
  ------------------
 1826|       |        // Out-of-bounds
 1827|       |        // TODO: I think we should not clear this. Maybe we want to try reading again later and
 1828|       |        // hence should not lose the data already read.
 1829|     40|        dest->clear();
 1830|       |
 1831|     40|        std::stringstream sstr;
 1832|     40|        sstr << "Extent in iloc box references data outside of file bounds "
 1833|     40|             << "(points to file position " << extent.offset + item->base_offset << ")\n";
 1834|       |
 1835|     40|        return {heif_error_Invalid_input,
 1836|     40|                heif_suberror_End_of_data,
 1837|     40|                sstr.str()};
 1838|     40|      }
 1839|    153|      else if (status == StreamReader::grow_status::timeout) {
  ------------------
  |  Branch (1839:16): [True: 0, False: 153]
  ------------------
 1840|       |        // TODO: maybe we should introduce some 'Recoverable error' instead of 'Invalid input'
 1841|      0|        return {heif_error_Invalid_input,
 1842|      0|                heif_suberror_End_of_data};
 1843|      0|      }
 1844|       |
 1845|       |
 1846|       |      // skip to reading offset
 1847|       |
 1848|    153|      uint64_t skip_len = std::min(offset, extent.length);
 1849|    153|      offset -= skip_len;
 1850|       |
 1851|    153|      uint64_t read_len = std::min(extent.length - skip_len, size);
 1852|       |
 1853|    153|      if (offset > 0) {
  ------------------
  |  Branch (1853:11): [True: 0, False: 153]
  ------------------
 1854|      0|        continue;
 1855|      0|      }
 1856|       |
 1857|    153|      if (read_len == 0) {
  ------------------
  |  Branch (1857:11): [True: 4, False: 149]
  ------------------
 1858|      4|        continue;
 1859|      4|      }
 1860|       |
 1861|    149|      size_t old_size = dest->size();
 1862|       |
 1863|       |      // --- security check that we do not allocate too much memory
 1864|       |
 1865|    149|      auto max_memory_block_size = limits->max_memory_block_size;
 1866|    149|      if (max_memory_block_size && max_memory_block_size - old_size < read_len) {
  ------------------
  |  Branch (1866:11): [True: 149, False: 0]
  |  Branch (1866:36): [True: 0, False: 149]
  ------------------
 1867|      0|        std::stringstream sstr;
 1868|      0|        sstr << "iloc box contained " << extent.length << " bytes, total memory size would be "
 1869|      0|             << (old_size + extent.length) << " bytes, exceeding the security limit of "
 1870|      0|             << max_memory_block_size << " bytes";
 1871|       |
 1872|      0|        return {heif_error_Memory_allocation_error,
 1873|      0|                heif_suberror_Security_limit_exceeded,
 1874|      0|                sstr.str()};
 1875|      0|      }
 1876|       |
 1877|       |
 1878|       |      // --- request file range
 1879|       |
 1880|    149|      uint64_t data_start_pos = extent.offset + item->base_offset + skip_len;
 1881|    149|      uint64_t rangeRequestEndPos = istr->request_range(data_start_pos, data_start_pos + read_len);
 1882|    149|      if (rangeRequestEndPos == 0) {
  ------------------
  |  Branch (1882:11): [True: 0, False: 149]
  ------------------
 1883|      0|        return istr->get_error();
 1884|      0|      }
 1885|       |
 1886|       |      // --- move file pointer to start of data
 1887|       |
 1888|    149|      bool success = istr->seek(data_start_pos);
 1889|    149|      if (!success) {
  ------------------
  |  Branch (1889:11): [True: 0, False: 149]
  ------------------
 1890|      0|        return {heif_error_Invalid_input,
 1891|      0|                heif_suberror_Unspecified,
 1892|      0|                "Error setting input file position"};
 1893|      0|      }
 1894|       |
 1895|       |
 1896|       |      // --- read data
 1897|       |
 1898|    149|      dest->resize(static_cast<size_t>(old_size + read_len));
 1899|    149|      success = istr->read((char*) dest->data() + old_size, static_cast<size_t>(read_len));
 1900|    149|      if (!success) {
  ------------------
  |  Branch (1900:11): [True: 0, False: 149]
  ------------------
 1901|      0|        return {heif_error_Invalid_input,
 1902|      0|                heif_suberror_Unspecified,
 1903|      0|                "Error reading input file"};
 1904|      0|      }
 1905|       |
 1906|    149|      size -= read_len;
 1907|    149|    }
 1908|      0|    else if (item->construction_method == 1) {
  ------------------
  |  Branch (1908:14): [True: 0, False: 0]
  ------------------
 1909|      0|      if (!idat) {
  ------------------
  |  Branch (1909:11): [True: 0, False: 0]
  ------------------
 1910|      0|        return {heif_error_Invalid_input,
 1911|      0|                heif_suberror_No_idat_box,
 1912|      0|                "idat box referenced in iref box is not present in file"};
 1913|      0|      }
 1914|       |
 1915|      0|      idat->read_data(istr,
 1916|      0|                      extent.offset + item->base_offset,
 1917|      0|                      extent.length,
 1918|      0|                      *dest, limits);
 1919|       |
 1920|      0|      size -= extent.length;
 1921|      0|    }
 1922|      0|    else {
 1923|      0|      std::stringstream sstr;
 1924|      0|      sstr << "Item construction method " << (int) item->construction_method << " not implemented";
 1925|      0|      return {heif_error_Unsupported_feature,
 1926|      0|              heif_suberror_Unsupported_item_construction_method,
 1927|      0|              sstr.str()};
 1928|      0|    }
 1929|    193|  }
 1930|       |
 1931|       |  // --- we could not read all data
 1932|       |
 1933|    103|  if (limited_size && size > 0) {
  ------------------
  |  Branch (1933:7): [True: 0, False: 103]
  |  Branch (1933:23): [True: 0, False: 0]
  ------------------
 1934|      0|    return {heif_error_Invalid_input,
 1935|      0|            heif_suberror_End_of_data,
 1936|      0|            "Not enough data present in 'iloc' to satisfy request."};
 1937|      0|  }
 1938|       |
 1939|    103|  return Error::Ok;
 1940|    103|}
_ZN8Box_infe5parseER14BitstreamRangePK20heif_security_limits:
 2380|  1.14k|{
 2381|  1.14k|  parse_full_box_header(range);
 2382|       |
 2383|       |  // only versions 2,3 are required by HEIF
 2384|  1.14k|  if (get_version() > 3) {
  ------------------
  |  Branch (2384:7): [True: 0, False: 1.14k]
  ------------------
 2385|      0|    return unsupported_version_error("infe");
 2386|      0|  }
 2387|       |
 2388|  1.14k|  if (get_version() <= 1) {
  ------------------
  |  Branch (2388:7): [True: 0, False: 1.14k]
  ------------------
 2389|      0|    m_item_ID = range.read16();
 2390|      0|    m_item_protection_index = range.read16();
 2391|       |
 2392|      0|    m_item_name = range.read_string();
 2393|      0|    m_content_type = range.read_string();
 2394|      0|    m_content_encoding = range.read_string();
 2395|      0|  }
 2396|       |
 2397|  1.14k|  m_item_type_4cc = 0;
 2398|       |
 2399|  1.14k|  if (get_version() >= 2) {
  ------------------
  |  Branch (2399:7): [True: 1.14k, False: 0]
  ------------------
 2400|  1.14k|    m_hidden_item = (get_flags() & 1);
 2401|       |
 2402|  1.14k|    if (get_version() == 2) {
  ------------------
  |  Branch (2402:9): [True: 1.14k, False: 0]
  ------------------
 2403|  1.14k|      m_item_ID = range.read16();
 2404|  1.14k|    }
 2405|      0|    else {
 2406|      0|      m_item_ID = range.read32();
 2407|      0|    }
 2408|       |
 2409|  1.14k|    m_item_protection_index = range.read16();
 2410|  1.14k|    m_item_type_4cc = range.read32();
 2411|       |
 2412|  1.14k|    m_item_name = range.read_string();
 2413|  1.14k|    if (m_item_type_4cc == fourcc("mime")) {
  ------------------
  |  Branch (2413:9): [True: 0, False: 1.14k]
  ------------------
 2414|      0|      m_content_type = range.read_string();
 2415|      0|      m_content_encoding = range.read_string();
 2416|      0|    }
 2417|  1.14k|    else if (m_item_type_4cc == fourcc("uri ")) {
  ------------------
  |  Branch (2417:14): [True: 0, False: 1.14k]
  ------------------
 2418|      0|      m_item_uri_type = range.read_string();
 2419|      0|    }
 2420|  1.14k|  }
 2421|       |
 2422|  1.14k|  return range.get_error();
 2423|  1.14k|}
_ZN8Box_iinf5parseER14BitstreamRangePK20heif_security_limits:
 2526|    159|{
 2527|    159|  parse_full_box_header(range);
 2528|       |
 2529|       |  // TODO: there are several images in circulation that have an iinf version=2. We should not enforce this with a hard error.
 2530|    159|  if (false && get_version() > 1) {
  ------------------
  |  Branch (2530:7): [Folded, False: 159]
  |  Branch (2530:16): [True: 0, False: 0]
  ------------------
 2531|      0|    return unsupported_version_error("iinf");
 2532|      0|  }
 2533|       |
 2534|    159|  int nEntries_size = (get_version() > 0) ? 4 : 2;
  ------------------
  |  Branch (2534:23): [True: 0, False: 159]
  ------------------
 2535|       |
 2536|    159|  uint32_t item_count;
 2537|    159|  if (nEntries_size == 2) {
  ------------------
  |  Branch (2537:7): [True: 159, False: 0]
  ------------------
 2538|    159|    item_count = range.read16();
 2539|    159|  }
 2540|      0|  else {
 2541|      0|    item_count = range.read32();
 2542|      0|  }
 2543|       |
 2544|    159|  if (item_count == 0) {
  ------------------
  |  Branch (2544:7): [True: 0, False: 159]
  ------------------
 2545|      0|    return Error::Ok;
 2546|      0|  }
 2547|       |
 2548|    159|  return read_children(range, item_count, limits);
 2549|    159|}
_ZN8Box_iprp5parseER14BitstreamRangePK20heif_security_limits:
 2564|    159|{
 2565|       |  //parse_full_box_header(range);
 2566|       |
 2567|    159|  return read_children(range, READ_CHILDREN_ALL, limits);
 2568|    159|}
_ZN8Box_ipco24find_or_append_child_boxERKNSt3__110shared_ptrI3BoxEE:
 2611|    178|{
 2612|    193|  for (uint32_t i = 0; i < (uint32_t) m_children.size(); i++) {
  ------------------
  |  Branch (2612:24): [True: 193, False: 0]
  ------------------
 2613|    193|    if (Box::equal(m_children[i], box)) {
  ------------------
  |  Branch (2613:9): [True: 178, False: 15]
  ------------------
 2614|    178|      return i;
 2615|    178|    }
 2616|    193|  }
 2617|      0|  return append_child_box(box);
 2618|    178|}
_ZN8Box_ipco5parseER14BitstreamRangePK20heif_security_limits:
 2622|    159|{
 2623|       |  //parse_full_box_header(range);
 2624|       |
 2625|    159|  return read_children(range, READ_CHILDREN_ALL, limits);
 2626|    159|}
_ZN8Box_pixi5parseER14BitstreamRangePK20heif_security_limits:
 2641|     51|{
 2642|     51|  parse_full_box_header(range);
 2643|       |
 2644|     51|  if (get_version() != 0) {
  ------------------
  |  Branch (2644:7): [True: 49, False: 2]
  ------------------
 2645|     49|    return unsupported_version_error("pixi");
 2646|     49|  }
 2647|       |
 2648|      2|  StreamReader::grow_status status;
 2649|      2|  uint8_t num_channels = range.read8();
 2650|      2|  status = range.wait_for_available_bytes(num_channels);
 2651|      2|  if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (2651:7): [True: 0, False: 2]
  ------------------
 2652|       |    // TODO: return recoverable error at timeout
 2653|      0|    return Error(heif_error_Invalid_input,
 2654|      0|                 heif_suberror_End_of_data);
 2655|      0|  }
 2656|       |
 2657|      2|  m_bits_per_channel.resize(num_channels);
 2658|    486|  for (int i = 0; i < num_channels; i++) {
  ------------------
  |  Branch (2658:19): [True: 484, False: 2]
  ------------------
 2659|    484|    m_bits_per_channel[i] = range.read8();
 2660|    484|  }
 2661|       |
 2662|      2|  return range.get_error();
 2663|      2|}
_ZNK8Box_ipco26get_properties_for_item_IDEjRKNSt3__110shared_ptrI8Box_ipmaEERNS0_6vectorINS1_I3BoxEENS0_9allocatorIS8_EEEE:
 3044|    477|{
 3045|    477|  const std::vector<Box_ipma::PropertyAssociation>* property_assoc = ipma->get_properties_for_item_ID(itemID);
 3046|    477|  if (property_assoc == nullptr) {
  ------------------
  |  Branch (3046:7): [True: 35, False: 442]
  ------------------
 3047|     35|    std::stringstream sstr;
 3048|     35|    sstr << "Item (ID=" << itemID << ") has no properties assigned to it in ipma box";
 3049|       |
 3050|     35|    return Error(heif_error_Invalid_input,
 3051|     35|                 heif_suberror_No_properties_assigned_to_item,
 3052|     35|                 sstr.str());
 3053|     35|  }
 3054|       |
 3055|    442|  const auto& allProperties = get_all_child_boxes();
 3056|  1.46k|  for (const Box_ipma::PropertyAssociation& assoc : *property_assoc) {
  ------------------
  |  Branch (3056:51): [True: 1.46k, False: 431]
  ------------------
 3057|  1.46k|    if (assoc.property_index > allProperties.size()) {
  ------------------
  |  Branch (3057:9): [True: 11, False: 1.45k]
  ------------------
 3058|     11|      std::stringstream sstr;
 3059|     11|      sstr << "Nonexisting property (index=" << assoc.property_index << ") for item "
 3060|     11|           << " ID=" << itemID << " referenced in ipma box";
 3061|       |
 3062|     11|      return Error(heif_error_Invalid_input,
 3063|     11|                   heif_suberror_Ipma_box_references_nonexisting_property,
 3064|     11|                   sstr.str());
 3065|     11|    }
 3066|       |
 3067|  1.45k|    if (assoc.property_index > 0) {
  ------------------
  |  Branch (3067:9): [True: 1.39k, False: 63]
  ------------------
 3068|  1.39k|      out_properties.push_back(allProperties[assoc.property_index - 1]);
 3069|  1.39k|    }
 3070|  1.45k|  }
 3071|       |
 3072|    431|  return Error::Ok;
 3073|    442|}
_ZNK8Box_ipco24get_property_for_item_IDEjRKNSt3__110shared_ptrI8Box_ipmaEEj:
 3079|    184|{
 3080|    184|  const std::vector<Box_ipma::PropertyAssociation>* property_assoc = ipma->get_properties_for_item_ID(itemID);
 3081|    184|  if (property_assoc == nullptr) {
  ------------------
  |  Branch (3081:7): [True: 0, False: 184]
  ------------------
 3082|      0|    return nullptr;
 3083|      0|  }
 3084|       |
 3085|    184|  const auto& allProperties = get_all_child_boxes();
 3086|    541|  for (const Box_ipma::PropertyAssociation& assoc : *property_assoc) {
  ------------------
  |  Branch (3086:51): [True: 541, False: 0]
  ------------------
 3087|    541|    if (assoc.property_index > allProperties.size() ||
  ------------------
  |  Branch (3087:9): [True: 0, False: 541]
  ------------------
 3088|    541|        assoc.property_index == 0) {
  ------------------
  |  Branch (3088:9): [True: 0, False: 541]
  ------------------
 3089|      0|      return nullptr;
 3090|      0|    }
 3091|       |
 3092|    541|    const auto& property = allProperties[assoc.property_index - 1];
 3093|    541|    if (property->get_short_type() == box_type) {
  ------------------
  |  Branch (3093:9): [True: 184, False: 357]
  ------------------
 3094|    184|      return property;
 3095|    184|    }
 3096|    541|  }
 3097|       |
 3098|      0|  return nullptr;
 3099|    184|}
_ZNK8Box_ipco30is_property_essential_for_itemEjRKNSt3__110shared_ptrIK3BoxEERKNS1_I8Box_ipmaEE:
 3105|     20|{
 3106|       |  // find property index
 3107|       |
 3108|     63|  for (int i = 0; i < (int) m_children.size(); i++) {
  ------------------
  |  Branch (3108:19): [True: 63, False: 0]
  ------------------
 3109|     63|    if (m_children[i] == property) {
  ------------------
  |  Branch (3109:9): [True: 20, False: 43]
  ------------------
 3110|     20|      return ipma->is_property_essential_for_item(itemId, i + 1);
 3111|     20|    }
 3112|     63|  }
 3113|       |
 3114|     20|  assert(false); // non-existing property
  ------------------
  |  Branch (3114:3): [Folded, False: 0]
  ------------------
 3115|      0|  return false;
 3116|      0|}
_ZN8Box_ispe5parseER14BitstreamRangePK20heif_security_limits:
 3120|     57|{
 3121|     57|  parse_full_box_header(range);
 3122|       |
 3123|     57|  if (get_version() != 0) {
  ------------------
  |  Branch (3123:7): [True: 0, False: 57]
  ------------------
 3124|      0|    return unsupported_version_error("ispe");
 3125|      0|  }
 3126|       |
 3127|     57|  m_image_width = range.read32();
 3128|     57|  m_image_height = range.read32();
 3129|       |
 3130|     57|  return range.get_error();
 3131|     57|}
_ZN8Box_ipma5parseER14BitstreamRangePK20heif_security_limits:
 3172|    158|{
 3173|    158|  parse_full_box_header(range);
 3174|       |
 3175|       |  // TODO: is there any specification of allowed values for the ipma version in the HEIF standards?
 3176|       |
 3177|    158|  if (get_version() > 1) {
  ------------------
  |  Branch (3177:7): [True: 0, False: 158]
  ------------------
 3178|      0|    return unsupported_version_error("ipma");
 3179|      0|  }
 3180|       |
 3181|    158|  uint32_t entry_cnt = range.read32();
 3182|       |
 3183|    158|  if (limits->max_items && entry_cnt > limits->max_items) {
  ------------------
  |  Branch (3183:7): [True: 158, False: 0]
  |  Branch (3183:28): [True: 0, False: 158]
  ------------------
 3184|      0|    std::stringstream sstr;
 3185|      0|    sstr << "ipma box wants to define properties for " << entry_cnt
 3186|      0|         << " items, but the security limit has been set to " << limits->max_items << " items";
 3187|      0|    return {heif_error_Invalid_input,
 3188|      0|            heif_suberror_Security_limit_exceeded,
 3189|      0|            sstr.str()};
 3190|      0|  }
 3191|       |
 3192|  1.86k|  for (uint32_t i = 0; i < entry_cnt && !range.error() && !range.eof(); i++) {
  ------------------
  |  Branch (3192:24): [True: 1.70k, False: 158]
  |  Branch (3192:41): [True: 1.70k, False: 0]
  |  Branch (3192:59): [True: 1.70k, False: 0]
  ------------------
 3193|  1.70k|    Entry entry;
 3194|  1.70k|    if (get_version() < 1) {
  ------------------
  |  Branch (3194:9): [True: 1.70k, False: 0]
  ------------------
 3195|  1.70k|      entry.item_ID = range.read16();
 3196|  1.70k|    }
 3197|      0|    else {
 3198|      0|      entry.item_ID = range.read32();
 3199|      0|    }
 3200|       |
 3201|  1.70k|    int assoc_cnt = range.read8();
 3202|  7.68k|    for (int k = 0; k < assoc_cnt; k++) {
  ------------------
  |  Branch (3202:21): [True: 5.97k, False: 1.70k]
  ------------------
 3203|  5.97k|      PropertyAssociation association{};
 3204|       |
 3205|  5.97k|      uint16_t index;
 3206|  5.97k|      if (get_flags() & 1) {
  ------------------
  |  Branch (3206:11): [True: 0, False: 5.97k]
  ------------------
 3207|      0|        index = range.read16();
 3208|      0|        association.essential = !!(index & 0x8000);
 3209|      0|        association.property_index = (index & 0x7fff);
 3210|      0|      }
 3211|  5.97k|      else {
 3212|  5.97k|        index = range.read8();
 3213|  5.97k|        association.essential = !!(index & 0x80);
 3214|  5.97k|        association.property_index = (index & 0x7f);
 3215|  5.97k|      }
 3216|       |
 3217|  5.97k|      entry.associations.push_back(association);
 3218|  5.97k|    }
 3219|       |
 3220|  1.70k|    m_entries.push_back(entry);
 3221|  1.70k|  }
 3222|       |
 3223|    158|  return range.get_error();
 3224|    158|}
_ZNK8Box_ipma26get_properties_for_item_IDEj:
 3228|    661|{
 3229|  17.3k|  for (const auto& entry : m_entries) {
  ------------------
  |  Branch (3229:26): [True: 17.3k, False: 35]
  ------------------
 3230|  17.3k|    if (entry.item_ID == itemID) {
  ------------------
  |  Branch (3230:9): [True: 626, False: 16.7k]
  ------------------
 3231|    626|      return &entry.associations;
 3232|    626|    }
 3233|  17.3k|  }
 3234|       |
 3235|     35|  return nullptr;
 3236|    661|}
_ZNK8Box_ipma30is_property_essential_for_itemEji:
 3240|     20|{
 3241|     29|  for (const auto& entry : m_entries) {
  ------------------
  |  Branch (3241:26): [True: 29, False: 0]
  ------------------
 3242|     29|    if (entry.item_ID == itemId) {
  ------------------
  |  Branch (3242:9): [True: 20, False: 9]
  ------------------
 3243|    102|      for (const auto& assoc : entry.associations) {
  ------------------
  |  Branch (3243:30): [True: 102, False: 0]
  ------------------
 3244|    102|        if (assoc.property_index == propertyIndex) {
  ------------------
  |  Branch (3244:13): [True: 20, False: 82]
  ------------------
 3245|     20|          return assoc.essential;
 3246|     20|        }
 3247|    102|      }
 3248|     20|    }
 3249|     29|  }
 3250|       |
 3251|     20|  assert(false);
  ------------------
  |  Branch (3251:3): [Folded, False: 0]
  ------------------
 3252|      0|  return false;
 3253|      0|}
_ZN8Box_ipma24add_property_for_item_IDEjNS_19PropertyAssociationE:
 3258|    178|{
 3259|    178|  size_t idx;
 3260|  4.33k|  for (idx = 0; idx < m_entries.size(); idx++) {
  ------------------
  |  Branch (3260:17): [True: 4.33k, False: 0]
  ------------------
 3261|  4.33k|    if (m_entries[idx].item_ID == itemID) {
  ------------------
  |  Branch (3261:9): [True: 178, False: 4.16k]
  ------------------
 3262|    178|      break;
 3263|    178|    }
 3264|  4.33k|  }
 3265|       |
 3266|       |  // if itemID does not exist, add a new entry
 3267|    178|  if (idx == m_entries.size()) {
  ------------------
  |  Branch (3267:7): [True: 0, False: 178]
  ------------------
 3268|      0|    Entry entry;
 3269|      0|    entry.item_ID = itemID;
 3270|      0|    m_entries.push_back(entry);
 3271|      0|  }
 3272|       |
 3273|       |  // If the property is already associated with the item, skip.
 3274|    362|  for (auto const& a : m_entries[idx].associations) {
  ------------------
  |  Branch (3274:22): [True: 362, False: 0]
  ------------------
 3275|    362|    if (a.property_index == assoc.property_index) {
  ------------------
  |  Branch (3275:9): [True: 178, False: 184]
  ------------------
 3276|    178|      return;
 3277|    178|    }
 3278|       |
 3279|       |    // TODO: should we check that the essential flag matches and return an internal error if not?
 3280|    362|  }
 3281|       |
 3282|       |  // add the property association
 3283|      0|  m_entries[idx].associations.push_back(assoc);
 3284|      0|}
_ZN8Box_auxC5parseER14BitstreamRangePK20heif_security_limits:
 3398|    141|{
 3399|    141|  parse_full_box_header(range);
 3400|       |
 3401|    141|  if (get_version() != 0) {
  ------------------
  |  Branch (3401:7): [True: 0, False: 141]
  ------------------
 3402|      0|    return unsupported_version_error("auxC");
 3403|      0|  }
 3404|       |
 3405|    141|  m_aux_type = range.read_string();
 3406|       |
 3407|  3.11k|  while (!range.eof()) {
  ------------------
  |  Branch (3407:10): [True: 2.97k, False: 141]
  ------------------
 3408|  2.97k|    m_aux_subtypes.push_back(range.read8());
 3409|  2.97k|  }
 3410|       |
 3411|    141|  return range.get_error();
 3412|    141|}
_ZN8Box_irot5parseER14BitstreamRangePK20heif_security_limits:
 3449|      3|{
 3450|       |  //parse_full_box_header(range);
 3451|       |
 3452|      3|  uint16_t rotation = range.read8();
 3453|      3|  rotation &= 0x03;
 3454|       |
 3455|      3|  m_rotation = rotation * 90;
 3456|       |
 3457|      3|  return range.get_error();
 3458|      3|}
_ZN8Box_clap5parseER14BitstreamRangePK20heif_security_limits:
 3535|    403|{
 3536|       |  //parse_full_box_header(range);
 3537|       |
 3538|    403|  uint32_t clean_aperture_width_num = range.read32();
 3539|    403|  uint32_t clean_aperture_width_den = range.read32();
 3540|    403|  uint32_t clean_aperture_height_num = range.read32();
 3541|    403|  uint32_t clean_aperture_height_den = range.read32();
 3542|       |
 3543|       |  // Note: in the standard document 14496-12(2015), it says that the offset values should also be unsigned integers,
 3544|       |  // but this is obviously an error. Even the accompanying standard text says that offsets may be negative.
 3545|    403|  int32_t horizontal_offset_num = (int32_t) range.read32();
 3546|    403|  uint32_t horizontal_offset_den = (uint32_t) range.read32();
 3547|    403|  int32_t vertical_offset_num = (int32_t) range.read32();
 3548|    403|  uint32_t vertical_offset_den = (uint32_t) range.read32();
 3549|       |
 3550|    403|  if (clean_aperture_width_num > (uint32_t) std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (3550:7): [True: 0, False: 403]
  ------------------
 3551|    403|      clean_aperture_width_den > (uint32_t) std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (3551:7): [True: 3, False: 400]
  ------------------
 3552|    400|      clean_aperture_height_num > (uint32_t) std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (3552:7): [True: 38, False: 362]
  ------------------
 3553|    362|      clean_aperture_height_den > (uint32_t) std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (3553:7): [True: 181, False: 181]
  ------------------
 3554|    181|      horizontal_offset_den > (uint32_t) std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (3554:7): [True: 32, False: 149]
  ------------------
 3555|    254|      vertical_offset_den > (uint32_t) std::numeric_limits<int32_t>::max()) {
  ------------------
  |  Branch (3555:7): [True: 0, False: 149]
  ------------------
 3556|    254|    return Error(heif_error_Invalid_input,
 3557|    254|                 heif_suberror_Invalid_fractional_number,
 3558|    254|                 "Exceeded supported value range.");
 3559|    254|  }
 3560|       |
 3561|    149|  m_clean_aperture_width = Fraction(clean_aperture_width_num,
 3562|    149|                                    clean_aperture_width_den);
 3563|    149|  m_clean_aperture_height = Fraction(clean_aperture_height_num,
 3564|    149|                                     clean_aperture_height_den);
 3565|    149|  m_horizontal_offset = Fraction(horizontal_offset_num, (int32_t) horizontal_offset_den);
 3566|    149|  m_vertical_offset = Fraction(vertical_offset_num, (int32_t) vertical_offset_den);
 3567|    149|  if (!m_clean_aperture_width.is_valid() || !m_clean_aperture_height.is_valid() ||
  ------------------
  |  Branch (3567:7): [True: 4, False: 145]
  |  Branch (3567:45): [True: 0, False: 145]
  ------------------
 3568|    148|      !m_horizontal_offset.is_valid() || !m_vertical_offset.is_valid()) {
  ------------------
  |  Branch (3568:7): [True: 144, False: 1]
  |  Branch (3568:42): [True: 0, False: 1]
  ------------------
 3569|    148|    return Error(heif_error_Invalid_input,
 3570|    148|                 heif_suberror_Invalid_fractional_number);
 3571|    148|  }
 3572|       |
 3573|      1|  return range.get_error();
 3574|    149|}
_ZN8Box_iref5parseER14BitstreamRangePK20heif_security_limits:
 3689|    155|{
 3690|    155|  parse_full_box_header(range);
 3691|       |
 3692|    155|  if (get_version() > 1) {
  ------------------
  |  Branch (3692:7): [True: 0, False: 155]
  ------------------
 3693|      0|    return unsupported_version_error("iref");
 3694|      0|  }
 3695|       |
 3696|    478|  while (!range.eof()) {
  ------------------
  |  Branch (3696:10): [True: 323, False: 155]
  ------------------
 3697|    323|    Reference ref;
 3698|       |
 3699|    323|    Error err = ref.header.parse_header(range);
 3700|    323|    if (err != Error::Ok) {
  ------------------
  |  Branch (3700:9): [True: 0, False: 323]
  ------------------
 3701|      0|      return err;
 3702|      0|    }
 3703|       |
 3704|    323|    int read_len = (get_version() == 0) ? 16 : 32;
  ------------------
  |  Branch (3704:20): [True: 323, False: 0]
  ------------------
 3705|       |
 3706|    323|    ref.from_item_ID = static_cast<uint32_t>(range.read_uint(read_len));
 3707|    323|    uint16_t nRefs = range.read16();
 3708|       |
 3709|    323|    if (nRefs==0) {
  ------------------
  |  Branch (3709:9): [True: 0, False: 323]
  ------------------
 3710|      0|      return {heif_error_Invalid_input,
 3711|      0|              heif_suberror_Unspecified,
 3712|      0|              "Input file has an 'iref' box with no references."};
 3713|      0|    }
 3714|       |
 3715|    323|    if (limits->max_items && nRefs > limits->max_items) {
  ------------------
  |  Branch (3715:9): [True: 323, False: 0]
  |  Branch (3715:30): [True: 0, False: 323]
  ------------------
 3716|      0|      std::stringstream sstr;
 3717|      0|      sstr << "Number of references in iref box (" << nRefs << ") exceeds the security limits of " << limits->max_items << " references.";
 3718|       |
 3719|      0|      return {heif_error_Invalid_input,
 3720|      0|              heif_suberror_Security_limit_exceeded,
 3721|      0|              sstr.str()};
 3722|      0|    }
 3723|       |
 3724|  1.30k|    for (int i = 0; i < nRefs; i++) {
  ------------------
  |  Branch (3724:21): [True: 982, False: 323]
  ------------------
 3725|    982|      if (range.eof()) {
  ------------------
  |  Branch (3725:11): [True: 0, False: 982]
  ------------------
 3726|      0|        std::stringstream sstr;
 3727|      0|        sstr << "iref box should contain " << nRefs << " references, but we can only read " << i << " references.";
 3728|       |
 3729|      0|        return {heif_error_Invalid_input,
 3730|      0|                heif_suberror_End_of_data,
 3731|      0|                sstr.str()};
 3732|      0|      }
 3733|       |
 3734|    982|      ref.to_item_ID.push_back(static_cast<uint32_t>(range.read_uint(read_len)));
 3735|    982|    }
 3736|       |
 3737|    323|    m_references.push_back(ref);
 3738|    323|  }
 3739|       |
 3740|       |
 3741|       |  // --- check for duplicate references
 3742|       |
 3743|    155|  if (auto error = check_for_double_references()) {
  ------------------
  |  Branch (3743:12): [True: 0, False: 155]
  ------------------
 3744|      0|    return error;
 3745|      0|  }
 3746|       |
 3747|       |
 3748|       |#if 0
 3749|       |  // Note: This input sanity check first did not work as expected.
 3750|       |  // Its idea was to prevent infinite recursions while decoding when the input file
 3751|       |  // contains cyclic references. However, apparently there are cases where cyclic
 3752|       |  // references are actually allowed, like with images that have premultiplied alpha channels:
 3753|       |  // | Box: iref -----
 3754|       |  // | size: 40   (header size: 12)
 3755|       |  // | reference with type 'auxl' from ID: 2 to IDs: 1
 3756|       |  // | reference with type 'prem' from ID: 1 to IDs: 2
 3757|       |  //
 3758|       |  // We now test for cyclic references during the image decoding.
 3759|       |  // We pass down the item IDs that have already been seen during the decoding process.
 3760|       |  // If we try to decode an image IDs that has already been seen previously, we throw an error.
 3761|       |  // The advantage is that the error only occurs when we are trying to decode the faulty image.
 3762|       |
 3763|       |  // --- check for cyclic references
 3764|       |
 3765|       |  for (const auto& ref : m_references) {
 3766|       |    if (ref.header.get_short_type() != fourcc("dimg") &&
 3767|       |        ref.header.get_short_type() != fourcc("auxl")) {
 3768|       |      continue;
 3769|       |    }
 3770|       |
 3771|       |    std::set<heif_item_id> reached_ids; // IDs that we have already reached in the DAG
 3772|       |    std::set<heif_item_id> todo;    // IDs that still need to be followed
 3773|       |
 3774|       |    bool reverse = (ref.header.get_short_type() != fourcc("auxl"));
 3775|       |
 3776|       |    if (!reverse) {
 3777|       |      todo.insert(ref.from_item_ID);  // start at base item
 3778|       |    }
 3779|       |    else {
 3780|       |      if (ref.to_item_ID.empty()) {
 3781|       |        continue;
 3782|       |      }
 3783|       |
 3784|       |      // TODO: what if aux image is assigned to multiple images?
 3785|       |      todo.insert(ref.to_item_ID[0]);  // start at base item
 3786|       |    }
 3787|       |
 3788|       |    while (!todo.empty()) {
 3789|       |      // transfer ID into set of reached IDs
 3790|       |      auto id = *todo.begin();
 3791|       |      todo.erase(id);
 3792|       |      reached_ids.insert(id);
 3793|       |
 3794|       |      // if this ID refers to another 'iref', follow it
 3795|       |
 3796|       |      for (const auto& succ_ref : m_references) {
 3797|       |        if (succ_ref.header.get_short_type() != fourcc("dimg") &&
 3798|       |            succ_ref.header.get_short_type() != fourcc("auxl")) {
 3799|       |          continue;
 3800|       |        }
 3801|       |
 3802|       |        heif_item_id from;
 3803|       |        std::vector<heif_item_id> to;
 3804|       |
 3805|       |        if (succ_ref.header.get_short_type() == fourcc("auxl")) {
 3806|       |          if (succ_ref.to_item_ID.empty()) {
 3807|       |            continue;
 3808|       |          }
 3809|       |
 3810|       |          from = succ_ref.to_item_ID[0];
 3811|       |          to = {succ_ref.from_item_ID};
 3812|       |        }
 3813|       |        else {
 3814|       |          from = succ_ref.from_item_ID;
 3815|       |          to = succ_ref.to_item_ID;
 3816|       |        }
 3817|       |
 3818|       |        if (from == id) {
 3819|       |
 3820|       |          // Check whether any successor IDs has been visited yet, which would be an error.
 3821|       |          // Otherwise, put that ID into the 'todo' set.
 3822|       |
 3823|       |          for (const auto& succ_ref_id : to) {
 3824|       |            if (reached_ids.find(succ_ref_id) != reached_ids.end()) {
 3825|       |              return Error(heif_error_Invalid_input,
 3826|       |                           heif_suberror_Unspecified,
 3827|       |                           "'iref' has cyclic references");
 3828|       |            }
 3829|       |
 3830|       |            todo.insert(succ_ref_id);
 3831|       |          }
 3832|       |        }
 3833|       |      }
 3834|       |    }
 3835|       |  }
 3836|       |#endif
 3837|       |
 3838|    155|  return range.get_error();
 3839|    155|}
_ZNK8Box_iref27check_for_double_referencesEv:
 3843|    155|{
 3844|    323|  for (const auto& ref : m_references) {
  ------------------
  |  Branch (3844:24): [True: 323, False: 155]
  ------------------
 3845|    323|    std::set<heif_item_id> to_ids;
 3846|    982|    for (const auto to_id : ref.to_item_ID) {
  ------------------
  |  Branch (3846:27): [True: 982, False: 323]
  ------------------
 3847|    982|      if (to_ids.find(to_id) == to_ids.end()) {
  ------------------
  |  Branch (3847:11): [True: 982, False: 0]
  ------------------
 3848|    982|        to_ids.insert(to_id);
 3849|    982|      }
 3850|      0|      else {
 3851|      0|        return {heif_error_Invalid_input,
 3852|      0|                heif_suberror_Unspecified,
 3853|      0|                "'iref' has double references"};
 3854|      0|      }
 3855|    982|    }
 3856|    323|  }
 3857|       |
 3858|    155|  return Error::Ok;
 3859|    155|}
_ZNK8Box_iref19get_references_fromEj:
 3947|    267|{
 3948|    267|  std::vector<Reference> references;
 3949|       |
 3950|    790|  for (const Reference& ref : m_references) {
  ------------------
  |  Branch (3950:29): [True: 790, False: 267]
  ------------------
 3951|    790|    if (ref.from_item_ID == itemID) {
  ------------------
  |  Branch (3951:9): [True: 23, False: 767]
  ------------------
 3952|     23|      references.push_back(ref);
 3953|     23|    }
 3954|    790|  }
 3955|       |
 3956|    267|  return references;
 3957|    267|}
_ZNK8Box_iref14get_referencesEjj:
 3961|    564|{
 3962|  1.66k|  for (const Reference& ref : m_references) {
  ------------------
  |  Branch (3962:29): [True: 1.66k, False: 561]
  ------------------
 3963|  1.66k|    if (ref.from_item_ID == itemID &&
  ------------------
  |  Branch (3963:9): [True: 55, False: 1.61k]
  ------------------
 3964|     55|        ref.header.get_short_type() == ref_type) {
  ------------------
  |  Branch (3964:9): [True: 3, False: 52]
  ------------------
 3965|      3|      return ref.to_item_ID;
 3966|      3|    }
 3967|  1.66k|  }
 3968|       |
 3969|    561|  return std::vector<uint32_t>();
 3970|    564|}
_ZN8Box_idat5parseER14BitstreamRangePK20heif_security_limits:
 4002|     11|{
 4003|       |  //parse_full_box_header(range);
 4004|       |
 4005|     11|  m_data_start_pos = range.get_istream()->get_position();
 4006|       |
 4007|     11|  return range.get_error();
 4008|     11|}
_ZN17Box_EntityToGroup5parseER14BitstreamRangePK20heif_security_limits:
 4115|    136|{
 4116|    136|  Error err = parse_full_box_header(range);
 4117|    136|  if (err != Error::Ok) {
  ------------------
  |  Branch (4117:7): [True: 0, False: 136]
  ------------------
 4118|      0|    return err;
 4119|      0|  }
 4120|       |
 4121|    136|  group_id = range.read32();
 4122|    136|  uint32_t nEntities = range.read32();
 4123|       |
 4124|    136|  if (nEntities > range.get_remaining_bytes() / 4) {
  ------------------
  |  Branch (4124:7): [True: 0, False: 136]
  ------------------
 4125|      0|    std::stringstream sstr;
 4126|      0|    size_t maxEntries = range.get_remaining_bytes() / 4;
 4127|      0|    sstr << "entity group box should contain " << nEntities << " entities, but we can only read " << maxEntries << " entities.";
 4128|       |
 4129|      0|    return {heif_error_Invalid_input,
 4130|      0|            heif_suberror_End_of_data,
 4131|      0|            sstr.str()};
 4132|      0|  }
 4133|       |
 4134|    136|  if (limits->max_size_entity_group && nEntities > limits->max_size_entity_group) {
  ------------------
  |  Branch (4134:7): [True: 136, False: 0]
  |  Branch (4134:40): [True: 136, False: 0]
  ------------------
 4135|    136|    std::stringstream sstr;
 4136|    136|    sstr << "entity group box contains " << nEntities << " entities, but the security limit is set to " << limits->max_size_entity_group << " entities.";
 4137|       |
 4138|    136|    return {heif_error_Invalid_input,
 4139|    136|            heif_suberror_Security_limit_exceeded,
 4140|    136|            sstr.str()};
 4141|    136|  }
 4142|       |
 4143|      0|  entity_ids.resize(nEntities);
 4144|      0|  for (uint32_t i = 0; i < nEntities; i++) {
  ------------------
  |  Branch (4144:24): [True: 0, False: 0]
  ------------------
 4145|      0|    entity_ids[i] = range.read32();
 4146|      0|  }
 4147|       |
 4148|      0|  return Error::Ok;
 4149|    136|}
_ZN8Box_pymd5parseER14BitstreamRangePK20heif_security_limits:
 4235|    136|{
 4236|    136|  Error err = Box_EntityToGroup::parse(range, limits);
 4237|    136|  if (err) {
  ------------------
  |  Branch (4237:7): [True: 136, False: 0]
  ------------------
 4238|    136|    return err;
 4239|    136|  }
 4240|       |
 4241|      0|  tile_size_x = range.read16();
 4242|      0|  tile_size_y = range.read16();
 4243|       |
 4244|      0|  for (size_t i = 0; i < entity_ids.size(); i++) {
  ------------------
  |  Branch (4244:22): [True: 0, False: 0]
  ------------------
 4245|      0|    LayerInfo layer{};
 4246|      0|    layer.layer_binning = range.read16();
 4247|      0|    layer.tiles_in_layer_row_minus1 = range.read16();
 4248|      0|    layer.tiles_in_layer_column_minus1 = range.read16();
 4249|       |
 4250|      0|    m_layer_infos.push_back(layer);
 4251|      0|  }
 4252|       |
 4253|      0|  return Error::Ok;
 4254|    136|}
_ZN8Box_dinf5parseER14BitstreamRangePK20heif_security_limits:
 4301|     11|{
 4302|       |  //parse_full_box_header(range);
 4303|       |
 4304|     11|  return read_children(range, READ_CHILDREN_ALL, limits);
 4305|     11|}
_ZN8Box_udes5parseER14BitstreamRangePK20heif_security_limits:
 4435|  1.74k|{
 4436|  1.74k|  parse_full_box_header(range);
 4437|       |
 4438|  1.74k|  if (get_version() > 0) {
  ------------------
  |  Branch (4438:7): [True: 157, False: 1.59k]
  ------------------
 4439|    157|    return unsupported_version_error("udes");
 4440|    157|  }
 4441|       |
 4442|  1.59k|  m_lang = range.read_string();
 4443|  1.59k|  m_name = range.read_string();
 4444|  1.59k|  m_description = range.read_string();
 4445|  1.59k|  m_tags = range.read_string();
 4446|  1.59k|  return range.get_error();
 4447|  1.74k|}
_ZN8Box_cmex5parseER14BitstreamRangePK20heif_security_limits:
 4711|     11|{
 4712|     11|  parse_full_box_header(range);
 4713|       |
 4714|     11|  if (get_version() > 0) {
  ------------------
  |  Branch (4714:7): [True: 11, False: 0]
  ------------------
 4715|     11|    return unsupported_version_error("cmex");
 4716|     11|  }
 4717|       |
 4718|      0|  m_matrix = ExtrinsicMatrix{};
 4719|       |
 4720|      0|  if (get_flags() & pos_x_present) {
  ------------------
  |  Branch (4720:7): [True: 0, False: 0]
  ------------------
 4721|      0|    m_has_pos_x = true;
 4722|      0|    m_matrix.pos_x = range.read32s();
 4723|      0|  }
 4724|       |
 4725|      0|  if (get_flags() & pos_y_present) {
  ------------------
  |  Branch (4725:7): [True: 0, False: 0]
  ------------------
 4726|      0|    m_has_pos_y = true;
 4727|      0|    m_matrix.pos_y = range.read32s();
 4728|      0|  }
 4729|       |
 4730|      0|  if (get_flags() & pos_z_present) {
  ------------------
  |  Branch (4730:7): [True: 0, False: 0]
  ------------------
 4731|      0|    m_has_pos_z = true;
 4732|      0|    m_matrix.pos_z = range.read32s();
 4733|      0|  }
 4734|       |
 4735|      0|  if (get_flags() & orientation_present) {
  ------------------
  |  Branch (4735:7): [True: 0, False: 0]
  ------------------
 4736|      0|    m_has_orientation = true;
 4737|       |
 4738|      0|    if (get_version() == 0) {
  ------------------
  |  Branch (4738:9): [True: 0, False: 0]
  ------------------
 4739|      0|      bool use32bit = (get_flags() & rot_large_field_size);
 4740|      0|      int32_t quat_x = use32bit ? range.read32s() : range.read16s();
  ------------------
  |  Branch (4740:24): [True: 0, False: 0]
  ------------------
 4741|      0|      int32_t quat_y = use32bit ? range.read32s() : range.read16s();
  ------------------
  |  Branch (4741:24): [True: 0, False: 0]
  ------------------
 4742|      0|      int32_t quat_z = use32bit ? range.read32s() : range.read16s();
  ------------------
  |  Branch (4742:24): [True: 0, False: 0]
  ------------------
 4743|       |
 4744|      0|      uint32_t div = 1U << (14 + (use32bit ? 16 : 0));
  ------------------
  |  Branch (4744:35): [True: 0, False: 0]
  ------------------
 4745|       |
 4746|      0|      m_matrix.rotation_as_quaternions = true;
 4747|      0|      m_matrix.quaternion_x = quat_x / (double)div;
 4748|      0|      m_matrix.quaternion_y = quat_y / (double)div;
 4749|      0|      m_matrix.quaternion_z = quat_z / (double)div;
 4750|       |
 4751|      0|      double q_sum = (m_matrix.quaternion_x * m_matrix.quaternion_x +
 4752|      0|                      m_matrix.quaternion_y * m_matrix.quaternion_y +
 4753|      0|                      m_matrix.quaternion_z * m_matrix.quaternion_z);
 4754|       |
 4755|      0|      if (q_sum > 1.0) {
  ------------------
  |  Branch (4755:11): [True: 0, False: 0]
  ------------------
 4756|      0|        return Error(heif_error_Invalid_input,
 4757|      0|                     heif_suberror_Unspecified,
 4758|      0|                     "Invalid quaternion in extrinsic rotation matrix");
 4759|      0|      }
 4760|       |
 4761|      0|      m_matrix.quaternion_w = sqrt(1 - q_sum);
 4762|       |
 4763|      0|    } else if (get_version() == 1) {
  ------------------
  |  Branch (4763:16): [True: 0, False: 0]
  ------------------
 4764|      0|      uint32_t div = 1<<16;
 4765|      0|      m_matrix.rotation_yaw = range.read32s() / (double)div;
 4766|      0|      m_matrix.rotation_pitch = range.read32s() / (double)div;
 4767|      0|      m_matrix.rotation_roll = range.read32s() / (double)div;
 4768|      0|    }
 4769|      0|  }
 4770|       |
 4771|      0|  if (get_flags() & id_present) {
  ------------------
  |  Branch (4771:7): [True: 0, False: 0]
  ------------------
 4772|      0|    m_has_world_coordinate_system_id = true;
 4773|      0|    m_matrix.world_coordinate_system_id = range.read32();
 4774|      0|  }
 4775|       |
 4776|      0|  return range.get_error();
 4777|      0|}

_ZNK9BoxHeader12get_box_sizeEv:
  119|  51.8k|  uint64_t get_box_size() const { return m_size; }
_ZNK9BoxHeader18has_fixed_box_sizeEv:
  121|  25.8k|  bool has_fixed_box_size() const { return m_size != 0; }
_ZNK9BoxHeader15get_header_sizeEv:
  123|  29.2k|  uint32_t get_header_size() const { return m_header_size; }
_ZNK9BoxHeader14get_short_typeEv:
  125|  33.8k|  uint32_t get_short_type() const { return m_type; }
_ZN9BoxHeader14set_short_typeEj:
  133|  12.6k|  void set_short_type(uint32_t type) { m_type = type; }
_ZN3Box16set_short_headerERK9BoxHeader:
  183|  11.5k|  {
  184|  11.5k|    *(BoxHeader*) this = hdr;
  185|  11.5k|  }
_ZNK3Box19get_all_child_boxesEv:
  244|    626|  const std::vector<std::shared_ptr<Box>>& get_all_child_boxes() const { return m_children; }
_ZNK3Box15has_child_boxesEv:
  252|    386|  bool has_child_boxes() const { return !m_children.empty(); }
_ZN3Box19set_output_positionEm:
  262|     68|  void set_output_position(uint64_t pos) { m_output_position = pos; }
_ZNK3Box24get_parse_error_fatalityEv:
  264|     15|  virtual parse_error_fatality get_parse_error_fatality() const { return parse_error_fatality::fatal; }
_ZNK7FullBox11get_versionEv:
  322|  11.8k|  uint8_t get_version() const { return m_version; }
_ZNK7FullBox9get_flagsEv:
  326|  7.12k|  uint32_t get_flags() const { return m_flags; }
_ZN9Box_otherC2Ej:
  350|  2.43k|  {
  351|  2.43k|    set_short_type(short_type);
  352|  2.43k|  }
_ZN9Box_ErrorC2Ej5Error20parse_error_fatality:
  374|    772|  {
  375|    772|    set_short_type(fourcc("ERR "));
  376|       |
  377|    772|    m_box_type_with_parse_error = box4cc;
  378|    772|    m_error = std::move(err);
  379|    772|    m_fatality = fatality;
  380|    772|  }
_ZNK9Box_Error9get_errorEv:
  388|    189|  [[nodiscard]] Error get_error() const { return m_error; }
_ZN8Box_ftypC2Ev:
  405|    134|  {
  406|    134|    set_short_type(fourcc("ftyp"));
  407|    134|  }
_ZN8Box_metaC2Ev:
  464|    551|  {
  465|    551|    set_short_type(fourcc("meta"));
  466|    551|  }
_ZN8Box_hdlrC2Ev:
  481|    160|  {
  482|    160|    set_short_type(fourcc("hdlr"));
  483|    160|  }
_ZNK8Box_hdlr16get_handler_typeEv:
  489|     40|  uint32_t get_handler_type() const { return m_handler_type; }
_ZN8Box_pitmC2Ev:
  512|    516|  {
  513|    516|    set_short_type(fourcc("pitm"));
  514|    516|  }
_ZNK8Box_pitm11get_item_IDEv:
  520|     82|  heif_item_id get_item_ID() const { return m_item_ID; }
_ZNK8Box_iloc9get_itemsEv:
  568|     48|  const std::vector<Item>& get_items() const { return m_items; }
_ZN8Box_infeC2Ev:
  642|  1.14k|  {
  643|  1.14k|    set_short_type(fourcc("infe"));
  644|  1.14k|  }
_ZNK8Box_infe14is_hidden_itemEv:
  650|    272|  bool is_hidden_item() const { return m_hidden_item; }
_ZNK8Box_infe11get_item_IDEv:
  654|  1.45k|  heif_item_id get_item_ID() const { return m_item_ID; }
_ZNK8Box_infe17get_item_type_4ccEv:
  658|  2.71k|  uint32_t get_item_type_4cc() const { return m_item_type_4cc; }
_ZNK8Box_infe16get_content_typeEv:
  666|    689|  const std::string& get_content_type() const { return m_content_type; }
_ZNK8Box_infe17get_item_uri_typeEv:
  678|    204|  const std::string& get_item_uri_type() const { return m_item_uri_type; }
_ZN8Box_iinfC2Ev:
  704|    159|  {
  705|    159|    set_short_type(fourcc("iinf"));
  706|    159|  }
_ZN8Box_iprpC2Ev:
  728|    159|  {
  729|    159|    set_short_type(fourcc("iprp"));
  730|    159|  }
_ZN8Box_ipcoC2Ev:
  745|    159|  {
  746|    159|    set_short_type(fourcc("ipco"));
  747|    159|  }
_ZN8Box_ispeC2Ev:
  776|     57|  {
  777|     57|    set_short_type(fourcc("ispe"));
  778|     57|  }
_ZNK8Box_ispe9get_widthEv:
  780|     18|  uint32_t get_width() const { return m_image_width; }
_ZNK8Box_ispe10get_heightEv:
  782|     18|  uint32_t get_height() const { return m_image_height; }
_ZN8Box_ipmaC2Ev:
  814|    158|  {
  815|    158|    set_short_type(fourcc("ipma"));
  816|    158|  }
_ZN8Box_auxCC2Ev:
  861|    141|  {
  862|    141|    set_short_type(fourcc("auxC"));
  863|    141|  }
_ZNK8Box_auxC12get_aux_typeEv:
  865|      6|  const std::string& get_aux_type() const { return m_aux_type; }
_ZN8Box_irotC2Ev:
  892|      3|  {
  893|      3|    set_short_type(fourcc("irot"));
  894|      3|  }
_ZNK8Box_irot16get_rotation_ccwEv:
  904|    126|  int get_rotation_ccw() const { return m_rotation; }
_ZN8Box_clapC2Ev:
  957|    403|  {
  958|    403|    set_short_type(fourcc("clap"));
  959|    403|  }
_ZNK8Box_clap24get_parse_error_fatalityEv:
  984|    402|  [[nodiscard]] parse_error_fatality get_parse_error_fatality() const override { return parse_error_fatality::ignorable; }
_ZN8Box_irefC2Ev:
 1003|    155|  {
 1004|    155|    set_short_type(fourcc("iref"));
 1005|    155|  }
_ZN8Box_pymdC2Ev:
 1145|    136|  {
 1146|    136|    set_short_type(fourcc("pymd"));
 1147|    136|  }
_ZNK8Box_pymd24get_parse_error_fatalityEv:
 1174|    136|  [[nodiscard]] parse_error_fatality get_parse_error_fatality() const override { return parse_error_fatality::ignorable; }
_ZN8Box_dinfC2Ev:
 1192|     11|  {
 1193|     11|    set_short_type(fourcc("dinf"));
 1194|     11|  }
_ZN8Box_pixiC2Ev:
 1255|     51|  {
 1256|     51|    set_short_type(fourcc("pixi"));
 1257|     51|  }
_ZNK8Box_pixi24get_parse_error_fatalityEv:
 1280|     51|  [[nodiscard]] parse_error_fatality get_parse_error_fatality() const override { return parse_error_fatality::optional; }
_ZN8Box_cmexC2Ev:
 1537|     11|  {
 1538|     11|    set_short_type(fourcc("cmex"));
 1539|     11|  }
_ZNK8Box_cmex24get_parse_error_fatalityEv:
 1575|     11|  [[nodiscard]] parse_error_fatality get_parse_error_fatality() const override { return parse_error_fatality::optional; }
_ZN8Box_udesC2Ev:
 1617|  1.74k|  {
 1618|  1.74k|    set_short_type(fourcc("udes"));
 1619|  1.74k|  }
_ZNK8Box_udes24get_parse_error_fatalityEv:
 1689|    157|  [[nodiscard]] parse_error_fatality get_parse_error_fatality() const override { return parse_error_fatality::optional; }
_ZN9BoxHeaderD2Ev:
  115|  30.0k|  virtual ~BoxHeader() = default;
_ZN3BoxC2Ev:
  180|  12.6k|  Box() = default;
_ZN8FractionC2Ev:
   66|  1.61k|  Fraction() = default;
_ZNK3Box13get_child_boxI8Box_hdlrEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|     20|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 20, False: 0]
  ------------------
  210|     20|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 0]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|     20|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_iinfEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|     79|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 79, False: 0]
  ------------------
  210|     79|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 59]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|     79|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box15get_child_boxesI8Box_infeEENSt3__16vectorINS2_10shared_ptrIT_EENS2_9allocatorIS6_EEEEv:
  233|     20|  {
  234|     20|    std::vector<std::shared_ptr<T>> result;
  235|    600|    for (auto& box : m_children) {
  ------------------
  |  Branch (235:20): [True: 600, False: 20]
  ------------------
  236|    600|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (236:16): [True: 498, False: 102]
  ------------------
  237|    498|        result.push_back(typed_box);
  238|    498|      }
  239|    600|    }
  240|       |
  241|     20|    return result;
  242|     20|  }
_ZNK3Box13get_child_boxI8Box_pitmEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|     53|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 53, False: 0]
  ------------------
  210|     53|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 33]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|     53|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_iprpEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|    122|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 122, False: 0]
  ------------------
  210|    122|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 102]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|    122|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_ipcoEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|     20|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 20, False: 0]
  ------------------
  210|     20|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 0]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|     20|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box15get_child_boxesI8Box_ipmaEENSt3__16vectorINS2_10shared_ptrIT_EENS2_9allocatorIS6_EEEEv:
  233|     20|  {
  234|     20|    std::vector<std::shared_ptr<T>> result;
  235|     40|    for (auto& box : m_children) {
  ------------------
  |  Branch (235:20): [True: 40, False: 20]
  ------------------
  236|     40|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (236:16): [True: 20, False: 20]
  ------------------
  237|     20|        result.push_back(typed_box);
  238|     20|      }
  239|     40|    }
  240|       |
  241|     20|    return result;
  242|     20|  }
_ZNK3Box13get_child_boxI8Box_ilocEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|    120|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 120, False: 0]
  ------------------
  210|    120|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 20, False: 100]
  ------------------
  211|     20|        return typed_box;
  212|     20|      }
  213|    120|    }
  214|       |
  215|      0|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_idatEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|    139|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 139, False: 9]
  ------------------
  210|    139|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 11, False: 128]
  ------------------
  211|     11|        return typed_box;
  212|     11|      }
  213|    139|    }
  214|       |
  215|      9|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_irefEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|    108|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 108, False: 4]
  ------------------
  210|    108|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 16, False: 92]
  ------------------
  211|     16|        return typed_box;
  212|     16|      }
  213|    108|    }
  214|       |
  215|      4|    return nullptr;
  216|     20|  }
_ZNK3Box13get_child_boxI8Box_grplEENSt3__110shared_ptrIT_EEv:
  206|     20|  {
  207|       |    // TODO: we could remove the dynamic_cast<> by adding the fourcc type of each Box
  208|       |    //       as a "constexpr uint32_t Box::short_type", compare to that and use static_cast<>
  209|    151|    for (auto& box : m_children) {
  ------------------
  |  Branch (209:20): [True: 151, False: 20]
  ------------------
  210|    151|      if (auto typed_box = std::dynamic_pointer_cast<T>(box)) {
  ------------------
  |  Branch (210:16): [True: 0, False: 151]
  ------------------
  211|      0|        return typed_box;
  212|      0|      }
  213|    151|    }
  214|       |
  215|     20|    return nullptr;
  216|     20|  }

_ZN8Box_av1C5parseER14BitstreamRangePK20heif_security_limits:
   37|    144|{
   38|       |  //parse_full_box_header(range);
   39|       |
   40|    144|  if (!has_fixed_box_size()) {
  ------------------
  |  Branch (40:7): [True: 0, False: 144]
  ------------------
   41|       |    // Note: in theory, it is allowed to have an av1C box with unspecified size (until the end of the file),
   42|       |    // but that would be very uncommon and give us problems in the calculation of `configOBUs_bytes` below.
   43|       |    // It's better to error on this case than to open a DoS vulnerability.
   44|      0|    return Error{heif_error_Invalid_input, heif_suberror_Unspecified, "av1C with unspecified box size"};
   45|      0|  }
   46|       |
   47|    144|  uint8_t byte;
   48|       |
   49|    144|  auto& c = m_configuration; // abbreviation
   50|       |
   51|    144|  byte = range.read8();
   52|    144|  if ((byte & 0x80) == 0) {
  ------------------
  |  Branch (52:7): [True: 0, False: 144]
  ------------------
   53|       |    // error: marker bit not set
   54|      0|  }
   55|       |
   56|    144|  c.version = byte & 0x7F;
   57|       |
   58|    144|  byte = range.read8();
   59|    144|  c.seq_profile = (byte >> 5) & 0x7;
   60|    144|  c.seq_level_idx_0 = byte & 0x1f;
   61|       |
   62|    144|  byte = range.read8();
   63|    144|  c.seq_tier_0 = (byte >> 7) & 1;
   64|    144|  c.high_bitdepth = (byte >> 6) & 1;
   65|    144|  c.twelve_bit = (byte >> 5) & 1;
   66|    144|  c.monochrome = (byte >> 4) & 1;
   67|    144|  c.chroma_subsampling_x = (byte >> 3) & 1;
   68|    144|  c.chroma_subsampling_y = (byte >> 2) & 1;
   69|    144|  c.chroma_sample_position = byte & 3;
   70|       |
   71|    144|  byte = range.read8();
   72|    144|  c.initial_presentation_delay_present = (byte >> 4) & 1;
   73|    144|  if (c.initial_presentation_delay_present) {
  ------------------
  |  Branch (73:7): [True: 1, False: 143]
  ------------------
   74|      1|    c.initial_presentation_delay_minus_one = byte & 0x0F;
   75|      1|  }
   76|       |
   77|    144|  const size_t configOBUs_bytes = range.get_remaining_bytes();
   78|    144|  m_config_OBUs.resize(configOBUs_bytes);
   79|       |
   80|    144|  if (!range.read(m_config_OBUs.data(), configOBUs_bytes)) {
  ------------------
  |  Branch (80:7): [True: 0, False: 144]
  ------------------
   81|       |    // error
   82|      0|  }
   83|       |
   84|    144|  return range.get_error();
   85|    144|}

_ZN8Box_av1CC2Ev:
   45|    144|  {
   46|    144|    set_short_type(fourcc("av1C"));
   47|    144|  }
_ZNK8Box_av1C13configuration15get_heif_chromaEv:
   71|      6|    heif_chroma get_heif_chroma() const {
   72|      6|      if (monochrome) {
  ------------------
  |  Branch (72:11): [True: 0, False: 6]
  ------------------
   73|      0|        return heif_chroma_monochrome;
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
   74|      0|      }
   75|      6|      else if (chroma_subsampling_x==1 && chroma_subsampling_y==1) {
  ------------------
  |  Branch (75:16): [True: 5, False: 1]
  |  Branch (75:43): [True: 5, False: 0]
  ------------------
   76|      5|        return heif_chroma_420;
   77|      5|      }
   78|      1|      else if (chroma_subsampling_x==1 && chroma_subsampling_y==0) {
  ------------------
  |  Branch (78:16): [True: 0, False: 1]
  |  Branch (78:43): [True: 0, False: 0]
  ------------------
   79|      0|        return heif_chroma_422;
   80|      0|      }
   81|      1|      else if (chroma_subsampling_x==0 && chroma_subsampling_y==0) {
  ------------------
  |  Branch (81:16): [True: 1, False: 0]
  |  Branch (81:43): [True: 1, False: 0]
  ------------------
   82|      1|        return heif_chroma_444;
   83|      1|      }
   84|      0|      else {
   85|      0|        return heif_chroma_undefined;
   86|      0|      }
   87|      6|    }
_ZNK8Box_av1C11get_headersEPNSt3__16vectorIhNS0_9allocatorIhEEEE:
   94|      9|  {
   95|      9|    *dest = m_config_OBUs;
   96|      9|    return true;
   97|      9|  }
_ZNK8Box_av1C17get_configurationEv:
  101|     18|  const configuration& get_configuration() const { return m_configuration; }

_ZNK12Decoder_AVIF33read_bitstream_configuration_dataEv:
   30|      9|{
   31|      9|  std::vector<uint8_t> data;
   32|      9|  if (!m_av1C->get_headers(&data)) {
  ------------------
  |  Branch (32:7): [True: 0, False: 9]
  ------------------
   33|      0|    return Error{heif_error_Invalid_input,
   34|      0|                 heif_suberror_No_item_data};
   35|      0|  }
   36|       |
   37|      9|  return data;
   38|      9|}
_ZNK12Decoder_AVIF23get_luma_bits_per_pixelEv:
   42|     12|{
   43|     12|  Box_av1C::configuration config = m_av1C->get_configuration();
   44|     12|  if (!config.high_bitdepth) {
  ------------------
  |  Branch (44:7): [True: 12, False: 0]
  ------------------
   45|     12|    return 8;
   46|     12|  }
   47|      0|  else if (config.twelve_bit) {
  ------------------
  |  Branch (47:12): [True: 0, False: 0]
  ------------------
   48|      0|    return 12;
   49|      0|  }
   50|      0|  else {
   51|      0|    return 10;
   52|      0|  }
   53|     12|}
_ZNK12Decoder_AVIF25get_chroma_bits_per_pixelEv:
   57|      6|{
   58|      6|  return get_luma_bits_per_pixel();
   59|      6|}
_ZNK12Decoder_AVIF26get_coded_image_colorspaceEP15heif_colorspaceP11heif_chroma:
   63|      6|{
   64|      6|  *out_chroma = m_av1C->get_configuration().get_heif_chroma();
   65|       |
   66|      6|  if (*out_chroma == heif_chroma_monochrome) {
  ------------------
  |  |   75|      6|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (66:7): [True: 0, False: 6]
  ------------------
   67|      0|    *out_colorspace = heif_colorspace_monochrome;
   68|      0|  }
   69|      6|  else {
   70|      6|    *out_colorspace = heif_colorspace_YCbCr;
   71|      6|  }
   72|       |
   73|      6|  return Error::Ok;
   74|      6|}

_ZN12Decoder_AVIFC2ERKNSt3__110shared_ptrIK8Box_av1CEE:
   37|      6|  explicit Decoder_AVIF(const std::shared_ptr<const Box_av1C>& av1C) : m_av1C(av1C) {}
_ZNK12Decoder_AVIF22get_compression_formatEv:
   39|     15|  heif_compression_format get_compression_format() const override { return heif_compression_AV1; }

_ZN10DataExtent19set_from_image_itemENSt3__110shared_ptrI8HeifFileEEj:
   49|    232|{
   50|    232|  m_file = std::move(file);
   51|    232|  m_item_id = item;
   52|    232|  m_source = Source::Image;
   53|    232|}
_ZNK10DataExtent9read_dataEv:
   66|     42|{
   67|     42|  if (!m_raw.empty()) {
  ------------------
  |  Branch (67:7): [True: 0, False: 42]
  ------------------
   68|      0|    return &m_raw;
   69|      0|  }
   70|     42|  else if (m_source == Source::Image) {
  ------------------
  |  Branch (70:12): [True: 42, False: 0]
  ------------------
   71|     42|    assert(m_file);
  ------------------
  |  Branch (71:5): [True: 42, False: 0]
  ------------------
   72|       |
   73|       |    // image
   74|     42|    Error err = m_file->append_data_from_iloc(m_item_id, m_raw);
   75|     42|    if (err) {
  ------------------
  |  Branch (75:9): [True: 15, False: 27]
  ------------------
   76|     15|      return err;
   77|     15|    }
   78|     42|  }
   79|      0|  else {
   80|       |    // file range
   81|      0|    Error err = m_file->append_data_from_file_range(m_raw, m_offset, m_size);
   82|      0|    if (err) {
  ------------------
  |  Branch (82:9): [True: 0, False: 0]
  ------------------
   83|      0|      return err;
   84|      0|    }
   85|      0|  }
   86|       |
   87|     27|  return &m_raw;
   88|     42|}
_ZNK7Decoder19get_compressed_dataEb:
  237|     42|{
  238|       |  // --- get the compressed image data
  239|       |
  240|     42|  if (with_configuration_NALs) {
  ------------------
  |  Branch (240:7): [True: 42, False: 0]
  ------------------
  241|       |    // data from configuration blocks
  242|       |
  243|     42|    Result<std::vector<uint8_t>> confData = read_bitstream_configuration_data();
  244|     42|    if (!confData) {
  ------------------
  |  Branch (244:9): [True: 0, False: 42]
  ------------------
  245|      0|      return confData.error();
  246|      0|    }
  247|       |
  248|     42|    std::vector<uint8_t> data = *confData;
  249|       |
  250|       |    // append image data
  251|       |
  252|     42|    auto dataResult = m_data_extent.read_data();
  253|     42|    if (!dataResult) {
  ------------------
  |  Branch (253:9): [True: 15, False: 27]
  ------------------
  254|     15|      return dataResult.error();
  255|     15|    }
  256|       |
  257|     27|    data.insert(data.end(), (*dataResult)->begin(), (*dataResult)->end());
  258|       |
  259|     27|    return data;
  260|     42|  }
  261|      0|  else {
  262|      0|    auto dataResult = m_data_extent.read_data();
  263|      0|    if (!dataResult) {
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  ------------------
  264|      0|      return dataResult.error();
  265|      0|    }
  266|       |
  267|      0|    return {*(*dataResult)};
  268|      0|  }
  269|     42|}
_ZN7DecoderD2Ev:
  273|    190|{
  274|    190|  release_decoder();
  275|    190|}
_ZN7Decoder15release_decoderEv:
  279|    232|{
  280|    232|  if (m_decoder) {
  ------------------
  |  Branch (280:7): [True: 42, False: 190]
  ------------------
  281|     42|    assert(m_decoder_plugin);
  ------------------
  |  Branch (281:5): [True: 42, False: 0]
  ------------------
  282|     42|    m_decoder_plugin->free_decoder(m_decoder);
  283|     42|    m_decoder = nullptr;
  284|     42|  }
  285|    232|}
_ZN7Decoder22require_decoder_pluginERK21heif_decoding_options:
  289|    150|{
  290|    150|  if (!m_decoder_plugin) {
  ------------------
  |  Branch (290:7): [True: 39, False: 111]
  ------------------
  291|     39|    if (options.decoder_id && !has_decoder(get_compression_format(), options.decoder_id)) {
  ------------------
  |  Branch (291:9): [True: 0, False: 39]
  |  Branch (291:31): [True: 0, False: 0]
  ------------------
  292|      0|      return {
  293|      0|        heif_error_Plugin_loading_error,
  294|      0|        heif_suberror_Unspecified,
  295|      0|        "No decoder with that ID found."
  296|      0|      };
  297|      0|    }
  298|       |
  299|     39|    m_decoder_plugin = get_decoder(get_compression_format(), options.decoder_id);
  300|     39|    if (!m_decoder_plugin) {
  ------------------
  |  Branch (300:9): [True: 0, False: 39]
  ------------------
  301|      0|      return Error(heif_error_Plugin_loading_error, heif_suberror_No_matching_decoder_installed);
  302|      0|    }
  303|       |
  304|     39|    if (m_decoder_plugin->plugin_api_version < 5) {
  ------------------
  |  Branch (304:9): [True: 0, False: 39]
  ------------------
  305|      0|      return Error{
  306|      0|        heif_error_Plugin_loading_error, heif_suberror_No_matching_decoder_installed,
  307|      0|        "Decoder plugin needs to be at least version 5."
  308|      0|      };
  309|      0|    }
  310|     39|  }
  311|       |
  312|    150|  return {};
  313|    150|}
_ZN7Decoder42decode_sequence_frame_from_compressed_dataEbRK21heif_decoding_optionsmPK20heif_security_limits:
  320|     42|{
  321|     42|  auto pluginErr = require_decoder_plugin(options);
  322|     42|  if (pluginErr) {
  ------------------
  |  Branch (322:7): [True: 0, False: 42]
  ------------------
  323|      0|    return pluginErr;
  324|      0|  }
  325|       |
  326|       |  // Reject memory-bomb inputs whose codec configuration record (SPS) declares
  327|       |  // a coded picture size beyond libheif's security limits, before handing any
  328|       |  // bytes to the decoder plugin. Codecs whose configuration record does not
  329|       |  // carry dimensions (e.g. AV1's av1C) return nullopt and skip the check.
  330|       |  //
  331|       |  // TODO: check this also in the decoder plugin since SPS packets may be
  332|       |  //       found within the actual image bitstream.
  333|     42|  auto codedSize = get_coded_image_size_from_config();
  334|     42|  if (codedSize.is_error()) {
  ------------------
  |  Branch (334:7): [True: 0, False: 42]
  ------------------
  335|      0|    return codedSize.error();
  336|      0|  }
  337|       |
  338|     42|  if (codedSize->has_value()) {
  ------------------
  |  Branch (338:7): [True: 33, False: 9]
  ------------------
  339|     33|    Error sizeErr = check_for_valid_image_size(limits, (*codedSize)->width, (*codedSize)->height);
  340|     33|    if (sizeErr) {
  ------------------
  |  Branch (340:9): [True: 0, False: 33]
  ------------------
  341|      0|      return sizeErr;
  342|      0|    }
  343|     33|  }
  344|       |
  345|       |  // --- decode image with the plugin
  346|       |
  347|     42|  heif_error err;
  348|       |
  349|     42|  if (!m_decoder) {
  ------------------
  |  Branch (349:7): [True: 42, False: 0]
  ------------------
  350|     42|    if (m_decoder_plugin->new_decoder == nullptr) {
  ------------------
  |  Branch (350:9): [True: 0, False: 42]
  ------------------
  351|      0|      return Error(heif_error_Plugin_loading_error, heif_suberror_No_matching_decoder_installed,
  352|      0|                   "Cannot decode with a dummy decoder plugin.");
  353|      0|    }
  354|       |
  355|     42|    if (m_decoder_plugin->plugin_api_version >= 5) {
  ------------------
  |  Branch (355:9): [True: 42, False: 0]
  ------------------
  356|     42|      heif_decoder_plugin_options plugin_options;
  357|     42|      plugin_options.format = get_compression_format();
  358|     42|      plugin_options.num_threads = options.num_codec_threads;
  359|     42|      plugin_options.strict_decoding = options.strict_decoding;
  360|     42|      plugin_options.limits = limits;
  361|       |
  362|     42|      err = m_decoder_plugin->new_decoder2(&m_decoder, &plugin_options);
  363|     42|      if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (363:11): [True: 0, False: 42]
  ------------------
  364|      0|        return Error(err.code, err.subcode, err.message);
  365|      0|      }
  366|     42|    }
  367|      0|    else {
  368|      0|      err = m_decoder_plugin->new_decoder(&m_decoder);
  369|      0|      if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (369:11): [True: 0, False: 0]
  ------------------
  370|      0|        return Error(err.code, err.subcode, err.message);
  371|      0|      }
  372|       |
  373|       |      // automatically delete decoder plugin when we leave the scope
  374|       |      //std::unique_ptr<void, void (*)(void*)> decoderSmartPtr(m_decoder, m_decoder_plugin->free_decoder);
  375|       |
  376|      0|      if (m_decoder_plugin->plugin_api_version >= 2) {
  ------------------
  |  Branch (376:11): [True: 0, False: 0]
  ------------------
  377|      0|        if (m_decoder_plugin->set_strict_decoding) {
  ------------------
  |  Branch (377:13): [True: 0, False: 0]
  ------------------
  378|      0|          m_decoder_plugin->set_strict_decoding(m_decoder, options.strict_decoding);
  379|      0|        }
  380|      0|      }
  381|      0|    }
  382|     42|  }
  383|       |
  384|     42|  auto dataResult = get_compressed_data(upload_configuration_NALs);
  385|     42|  if (!dataResult) {
  ------------------
  |  Branch (385:7): [True: 15, False: 27]
  ------------------
  386|     15|    return dataResult.error();
  387|     15|  }
  388|       |
  389|       |  // Check that we are pushing at least some data into the decoder.
  390|       |  // Some decoders (e.g. aom) do not complain when the input data is empty and we might
  391|       |  // get stuck in an endless decoding loop, waiting for the decompressed image.
  392|       |
  393|     27|  if (dataResult->size() == 0) {
  ------------------
  |  Branch (393:7): [True: 0, False: 27]
  ------------------
  394|      0|    return Error{
  395|      0|      heif_error_Invalid_input,
  396|      0|      heif_suberror_Unspecified,
  397|      0|      "Input with empty data extent."
  398|      0|    };
  399|      0|  }
  400|       |
  401|       |  //std::cout << "Decoder::decode_sequence_frame_from_compressed_data push " << dataResult->size() << "\n";
  402|     27|  if (m_decoder_plugin->plugin_api_version >= 5 && m_decoder_plugin->push_data2) {
  ------------------
  |  Branch (402:7): [True: 27, False: 0]
  |  Branch (402:52): [True: 27, False: 0]
  ------------------
  403|     27|    err = m_decoder_plugin->push_data2(m_decoder, dataResult->data(), dataResult->size(), user_data);
  404|     27|  }
  405|      0|  else {
  406|      0|    err = m_decoder_plugin->push_data(m_decoder, dataResult->data(), dataResult->size());
  407|      0|  }
  408|     27|  if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (408:7): [True: 21, False: 6]
  ------------------
  409|     21|    return Error(err.code, err.subcode, err.message);
  410|     21|  }
  411|       |
  412|      6|  return {};
  413|     27|}
_ZN7Decoder13flush_decoderEv:
  416|      6|{
  417|      6|  assert(m_decoder_plugin);
  ------------------
  |  Branch (417:3): [True: 6, False: 0]
  ------------------
  418|       |
  419|      6|  if (m_decoder_plugin->plugin_api_version >= 5) {
  ------------------
  |  Branch (419:7): [True: 6, False: 0]
  ------------------
  420|      6|    heif_error err = m_decoder_plugin->flush_data(m_decoder);
  421|      6|    return Error::from_heif_error(err);
  422|      6|  }
  423|       |
  424|      0|  return {};
  425|      6|}
_ZN7Decoder17get_decoded_frameERK21heif_decoding_optionsPmPK20heif_security_limits:
  430|    108|{
  431|    108|  auto pluginErr = require_decoder_plugin(options);
  432|    108|  if (pluginErr) {
  ------------------
  |  Branch (432:7): [True: 0, False: 108]
  ------------------
  433|      0|    return pluginErr;
  434|      0|  }
  435|       |
  436|    108|  heif_image* decoded_img = nullptr;
  437|       |
  438|    108|  heif_error err;
  439|       |
  440|    108|  if (m_decoder_plugin->plugin_api_version >= 5 &&
  ------------------
  |  Branch (440:7): [True: 108, False: 0]
  ------------------
  441|    108|      m_decoder_plugin->decode_next_image2 != nullptr) {
  ------------------
  |  Branch (441:7): [True: 108, False: 0]
  ------------------
  442|       |
  443|    108|    err = m_decoder_plugin->decode_next_image2(m_decoder, &decoded_img, out_user_data, limits);
  444|    108|    if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (444:9): [True: 4, False: 104]
  ------------------
  445|      4|      return Error::from_heif_error(err);
  446|      4|    }
  447|    108|  }
  448|      0|  else if (m_decoder_plugin->plugin_api_version >= 4 &&
  ------------------
  |  Branch (448:12): [True: 0, False: 0]
  ------------------
  449|      0|           m_decoder_plugin->decode_next_image != nullptr) {
  ------------------
  |  Branch (449:12): [True: 0, False: 0]
  ------------------
  450|       |
  451|      0|    err = m_decoder_plugin->decode_next_image(m_decoder, &decoded_img, limits);
  452|      0|    if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (452:9): [True: 0, False: 0]
  ------------------
  453|      0|      return Error::from_heif_error(err);
  454|      0|    }
  455|      0|  }
  456|      0|  else {
  457|      0|    err = m_decoder_plugin->decode_image(m_decoder, &decoded_img);
  458|      0|    if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (458:9): [True: 0, False: 0]
  ------------------
  459|      0|      return Error::from_heif_error(err);
  460|      0|    }
  461|      0|  }
  462|       |
  463|    104|  if (!decoded_img) {
  ------------------
  |  Branch (463:7): [True: 104, False: 0]
  ------------------
  464|    104|    return {nullptr};
  465|    104|  }
  466|       |
  467|       |  // -- cleanup
  468|       |
  469|      0|  std::shared_ptr<HeifPixelImage> img = std::move(decoded_img->image);
  470|      0|  heif_image_release(decoded_img);
  471|       |
  472|      0|  return img;
  473|    104|}
_ZN7Decoder40decode_single_frame_from_compressed_dataERK21heif_decoding_optionsPK20heif_security_limits:
  479|     42|{
  480|     42|  Error decodeError = decode_sequence_frame_from_compressed_data(true, options, 0, limits);
  481|     42|  if (decodeError) {
  ------------------
  |  Branch (481:7): [True: 36, False: 6]
  ------------------
  482|     36|    release_decoder();
  483|     36|    return decodeError;
  484|     36|  }
  485|       |
  486|      6|  flush_decoder();
  487|       |
  488|       |  // We might have to try several times to get an image out of the decoder.
  489|       |  // However, we stop after a maximum number of tries because the decoder might not
  490|       |  // give any image when the input data is incomplete.
  491|      6|  const int max_decoding_tries = 50; // hardcoded value, should be large enough
  492|       |
  493|    110|  for (int i = 0; i < max_decoding_tries; i++) {
  ------------------
  |  Branch (493:19): [True: 108, False: 2]
  ------------------
  494|    108|    Result<std::shared_ptr<HeifPixelImage>> imgResult;
  495|    108|    imgResult = get_decoded_frame(options, nullptr, limits);
  496|    108|    if (imgResult.error()) {
  ------------------
  |  Branch (496:9): [True: 4, False: 104]
  ------------------
  497|      4|      release_decoder();
  498|      4|      return imgResult.error();
  499|      4|    }
  500|       |
  501|    104|    if (*imgResult != nullptr) {
  ------------------
  |  Branch (501:9): [True: 0, False: 104]
  ------------------
  502|      0|      release_decoder();
  503|      0|      return imgResult;
  504|      0|    }
  505|    104|  }
  506|       |
  507|       |  // We did not receive an image from the decoder. We give up.
  508|       |
  509|      2|  release_decoder();
  510|       |
  511|      2|  return Error{
  512|      2|    heif_error_Decoder_plugin_error,
  513|      2|    heif_suberror_Unspecified,
  514|      2|    "Decoding the input data did not give a decompressed image."
  515|      2|  };
  516|      6|}

_ZN7Decoder15set_data_extentE10DataExtent:
   87|    232|  void set_data_extent(DataExtent extent) { m_data_extent = std::move(extent); }
_ZNK7Decoder32get_coded_image_size_from_configEv:
  117|      9|  {
  118|      9|    return std::optional<ImageSize>{};
  119|      9|  }

_ZN7EncoderD2Ev:
   41|    258|  virtual ~Encoder() = default;

_ZN30HEVCDecoderConfigurationRecord5parseER14BitstreamRangePK20heif_security_limits:
   38|     11|{
   39|     11|  uint8_t byte;
   40|       |
   41|     11|  configuration_version = range.read8();
   42|     11|  byte = range.read8();
   43|     11|  general_profile_space = (byte >> 6) & 3;
   44|     11|  general_tier_flag = (byte >> 5) & 1;
   45|     11|  general_profile_idc = (byte & 0x1F);
   46|       |
   47|     11|  general_profile_compatibility_flags = range.read32();
   48|       |
   49|     77|  for (int i = 0; i < 6; i++) {
  ------------------
  |  Branch (49:19): [True: 66, False: 11]
  ------------------
   50|     66|    byte = range.read8();
   51|       |
   52|    594|    for (int b = 0; b < 8; b++) {
  ------------------
  |  Branch (52:21): [True: 528, False: 66]
  ------------------
   53|    528|      general_constraint_indicator_flags[i * 8 + b] = (byte >> (7 - b)) & 1;
   54|    528|    }
   55|     66|  }
   56|       |
   57|     11|  general_level_idc = range.read8();
   58|     11|  min_spatial_segmentation_idc = range.read16() & 0x0FFF;
   59|     11|  parallelism_type = range.read8() & 0x03;
   60|     11|  chroma_format = range.read8() & 0x03;
   61|     11|  bit_depth_luma = static_cast<uint8_t>((range.read8() & 0x07) + 8);
   62|     11|  bit_depth_chroma = static_cast<uint8_t>((range.read8() & 0x07) + 8);
   63|     11|  avg_frame_rate = range.read16();
   64|       |
   65|     11|  byte = range.read8();
   66|     11|  constant_frame_rate = (byte >> 6) & 0x03;
   67|     11|  num_temporal_layers = (byte >> 3) & 0x07;
   68|     11|  temporal_id_nested = (byte >> 2) & 1;
   69|       |
   70|     11|  m_length_size = static_cast<uint8_t>((byte & 0x03) + 1);
   71|       |
   72|     11|  int nArrays = range.read8();
   73|       |
   74|     44|  for (int i = 0; i < nArrays && !range.error(); i++) {
  ------------------
  |  Branch (74:19): [True: 33, False: 11]
  |  Branch (74:34): [True: 33, False: 0]
  ------------------
   75|     33|    byte = range.read8();
   76|       |
   77|     33|    NalArray array;
   78|       |
   79|     33|    array.m_array_completeness = (byte >> 6) & 1;
   80|     33|    array.m_NAL_unit_type = (byte & 0x3F);
   81|       |
   82|     33|    int nUnits = range.read16();
   83|     66|    for (int u = 0; u < nUnits && !range.error(); u++) {
  ------------------
  |  Branch (83:21): [True: 33, False: 33]
  |  Branch (83:35): [True: 33, False: 0]
  ------------------
   84|       |
   85|     33|      std::vector<uint8_t> nal_unit;
   86|     33|      int size = range.read16();
   87|     33|      if (!size) {
  ------------------
  |  Branch (87:11): [True: 0, False: 33]
  ------------------
   88|       |        // Ignore empty NAL units.
   89|      0|        continue;
   90|      0|      }
   91|       |
   92|     33|      if (range.prepare_read(size)) {
  ------------------
  |  Branch (92:11): [True: 33, False: 0]
  ------------------
   93|     33|        nal_unit.resize(size);
   94|     33|        bool success = range.get_istream()->read((char*) nal_unit.data(), size);
   95|     33|        if (!success) {
  ------------------
  |  Branch (95:13): [True: 0, False: 33]
  ------------------
   96|      0|          return Error{heif_error_Invalid_input, heif_suberror_End_of_data, "error while reading hvcC box"};
   97|      0|        }
   98|     33|      }
   99|       |
  100|     33|      array.m_nal_units.push_back(std::move(nal_unit));
  101|     33|    }
  102|       |
  103|     33|    m_nal_array.push_back(std::move(array));
  104|     33|  }
  105|       |
  106|     11|  range.skip_to_end_of_box();
  107|       |
  108|     11|  return range.get_error();
  109|     11|}
_ZN8Box_hvcC5parseER14BitstreamRangePK20heif_security_limits:
  195|     11|{
  196|     11|  return m_configuration.parse(range, limits);
  197|     11|}
_ZNK8Box_hvcC15get_header_nalsEPNSt3__16vectorIhNS0_9allocatorIhEEEE:
  289|     33|{
  290|       |  // Concatenate all header NALs, each prefixed by a 4-byte size.
  291|       |
  292|     99|  for (const auto& array : m_configuration.m_nal_array) {
  ------------------
  |  Branch (292:26): [True: 99, False: 33]
  ------------------
  293|     99|    for (const auto& unit : array.m_nal_units) {
  ------------------
  |  Branch (293:27): [True: 99, False: 99]
  ------------------
  294|       |
  295|       |      // Write 4-byte NALs size
  296|       |
  297|     99|      dest->push_back((unit.size() >> 24) & 0xFF);
  298|     99|      dest->push_back((unit.size() >> 16) & 0xFF);
  299|     99|      dest->push_back((unit.size() >> 8) & 0xFF);
  300|     99|      dest->push_back((unit.size() >> 0) & 0xFF);
  301|       |
  302|       |      // Copy NAL data
  303|       |
  304|     99|      dest->insert(dest->end(), unit.begin(), unit.end());
  305|     99|    }
  306|     99|  }
  307|       |
  308|     33|  return true;
  309|     33|}
_Z27remove_start_code_emulationPKhm:
  573|     33|{
  574|     33|  std::vector<uint8_t> out_data;
  575|       |
  576|  16.3k|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (576:22): [True: 16.3k, False: 33]
  ------------------
  577|  16.3k|    if (i + 2 < size &&
  ------------------
  |  Branch (577:9): [True: 16.2k, False: 66]
  ------------------
  578|  16.2k|        sps[i] == 0 &&
  ------------------
  |  Branch (578:9): [True: 297, False: 15.9k]
  ------------------
  579|    297|        sps[i + 1] == 0 &&
  ------------------
  |  Branch (579:9): [True: 99, False: 198]
  ------------------
  580|     99|        sps[i + 2] == 3) {
  ------------------
  |  Branch (580:9): [True: 99, False: 0]
  ------------------
  581|     99|      out_data.push_back(0);
  582|     99|      out_data.push_back(0);
  583|     99|      i += 2;
  584|     99|    }
  585|  16.2k|    else {
  586|  16.2k|      out_data.push_back(sps[i]);
  587|  16.2k|    }
  588|  16.3k|  }
  589|       |
  590|     33|  return out_data;
  591|     33|}
_Z32parse_sps_for_hvcC_configurationPKhmP30HEVCDecoderConfigurationRecordPjS3_P9ImageSize:
  598|     33|{
  599|       |  // remove start-code emulation bytes from SPS header stream
  600|       |
  601|     33|  std::vector<uint8_t> sps_no_emul = remove_start_code_emulation(sps, size);
  602|       |
  603|     33|  sps = sps_no_emul.data();
  604|     33|  size = sps_no_emul.size();
  605|       |
  606|       |
  607|     33|  BitReader reader(sps, (int) size);
  608|       |
  609|       |  // skip NAL header
  610|     33|  reader.skip_bits(2 * 8);
  611|       |
  612|       |  // skip VPS ID
  613|     33|  reader.skip_bits(4);
  614|       |
  615|     33|  uint8_t nMaxSubLayersMinus1 = reader.get_bits8(3);
  616|       |
  617|     33|  config->temporal_id_nested = reader.get_bits8(1);
  618|       |
  619|       |  // --- profile_tier_level ---
  620|       |
  621|     33|  config->general_profile_space = reader.get_bits8(2);
  622|     33|  config->general_tier_flag = reader.get_bits8(1);
  623|     33|  config->general_profile_idc = reader.get_bits8(5);
  624|     33|  config->general_profile_compatibility_flags = reader.get_bits32(32);
  625|       |
  626|     33|  reader.skip_bits(16); // skip reserved bits
  627|     33|  reader.skip_bits(16); // skip reserved bits
  628|     33|  reader.skip_bits(16); // skip reserved bits
  629|       |
  630|     33|  config->general_level_idc = reader.get_bits8(8);
  631|       |
  632|     33|  std::vector<bool> layer_profile_present(nMaxSubLayersMinus1);
  633|     33|  std::vector<bool> layer_level_present(nMaxSubLayersMinus1);
  634|       |
  635|     33|  for (int i = 0; i < nMaxSubLayersMinus1; i++) {
  ------------------
  |  Branch (635:19): [True: 0, False: 33]
  ------------------
  636|      0|    layer_profile_present[i] = reader.get_bits(1);
  637|      0|    layer_level_present[i] = reader.get_bits(1);
  638|      0|  }
  639|       |
  640|     33|  if (nMaxSubLayersMinus1 > 0) {
  ------------------
  |  Branch (640:7): [True: 0, False: 33]
  ------------------
  641|      0|    for (int i = nMaxSubLayersMinus1; i < 8; i++) {
  ------------------
  |  Branch (641:39): [True: 0, False: 0]
  ------------------
  642|      0|      reader.skip_bits(2);
  643|      0|    }
  644|      0|  }
  645|       |
  646|     33|  for (int i = 0; i < nMaxSubLayersMinus1; i++) {
  ------------------
  |  Branch (646:19): [True: 0, False: 33]
  ------------------
  647|      0|    if (layer_profile_present[i]) {
  ------------------
  |  Branch (647:9): [True: 0, False: 0]
  ------------------
  648|      0|      reader.skip_bits(2 + 1 + 5);
  649|      0|      reader.skip_bits(32);
  650|      0|      reader.skip_bits(16);
  651|      0|    }
  652|       |
  653|      0|    if (layer_level_present[i]) {
  ------------------
  |  Branch (653:9): [True: 0, False: 0]
  ------------------
  654|      0|      reader.skip_bits(8);
  655|      0|    }
  656|      0|  }
  657|       |
  658|       |
  659|       |  // --- SPS continued ---
  660|       |
  661|     33|  Error invalidUVLC{
  662|     33|    heif_error_Invalid_input,
  663|     33|    heif_suberror_Invalid_parameter_value,
  664|     33|    "Invalid variable length code in HEVC SPS header"
  665|     33|  };
  666|       |
  667|     33|  uint32_t dummy, value;
  668|     33|  if (!reader.get_uvlc(&dummy) || // skip seq_parameter_seq_id
  ------------------
  |  Branch (668:7): [True: 0, False: 33]
  ------------------
  669|     33|      !reader.get_uvlc(&value)) {
  ------------------
  |  Branch (669:7): [True: 0, False: 33]
  ------------------
  670|      0|    return invalidUVLC;
  671|      0|  }
  672|     33|  config->chroma_format = (uint8_t) value;
  673|       |
  674|     33|  if (config->chroma_format == 3) {
  ------------------
  |  Branch (674:7): [True: 0, False: 33]
  ------------------
  675|      0|    reader.skip_bits(1);
  676|      0|  }
  677|       |
  678|     33|  if (!reader.get_uvlc(width) ||
  ------------------
  |  Branch (678:7): [True: 0, False: 33]
  ------------------
  679|     33|      !reader.get_uvlc(height)) {
  ------------------
  |  Branch (679:7): [True: 0, False: 33]
  ------------------
  680|      0|    return invalidUVLC;
  681|      0|  }
  682|       |
  683|     33|  if (coded_size) {
  ------------------
  |  Branch (683:7): [True: 33, False: 0]
  ------------------
  684|     33|    coded_size->width = *width;
  685|     33|    coded_size->height = *height;
  686|     33|  }
  687|       |
  688|     33|  bool conformance_window = reader.get_bits(1);
  689|     33|  if (conformance_window) {
  ------------------
  |  Branch (689:7): [True: 0, False: 33]
  ------------------
  690|      0|    uint32_t left, right, top, bottom;
  691|      0|    if (!reader.get_uvlc(&left) ||
  ------------------
  |  Branch (691:9): [True: 0, False: 0]
  ------------------
  692|      0|        !reader.get_uvlc(&right) ||
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      0|        !reader.get_uvlc(&top) ||
  ------------------
  |  Branch (693:9): [True: 0, False: 0]
  ------------------
  694|      0|        !reader.get_uvlc(&bottom)) {
  ------------------
  |  Branch (694:9): [True: 0, False: 0]
  ------------------
  695|      0|      return invalidUVLC;
  696|      0|    }
  697|       |
  698|       |    //printf("conformance borders: %u %u %u %u\n",left,right,top,bottom);
  699|       |
  700|      0|    uint32_t subH = 1, subV = 1;
  701|      0|    if (config->chroma_format == 1) {
  ------------------
  |  Branch (701:9): [True: 0, False: 0]
  ------------------
  702|      0|      subV = 2;
  703|      0|      subH = 2;
  704|      0|    }
  705|      0|    if (config->chroma_format == 2) { subH = 2; }
  ------------------
  |  Branch (705:9): [True: 0, False: 0]
  ------------------
  706|       |
  707|      0|    const uint64_t crop_w = (uint64_t)subH * ((uint64_t)left + (uint64_t)right);
  708|      0|    const uint64_t crop_h = (uint64_t)subV * ((uint64_t)top + (uint64_t)bottom);
  709|      0|    if (crop_w > *width || crop_h > *height) {
  ------------------
  |  Branch (709:9): [True: 0, False: 0]
  |  Branch (709:28): [True: 0, False: 0]
  ------------------
  710|      0|      return Error{heif_error_Invalid_input,
  711|      0|                   heif_suberror_Invalid_parameter_value,
  712|      0|                   "SPS conformance window exceeds image dimensions"};
  713|      0|    }
  714|      0|    *width  -= (uint32_t)crop_w;
  715|      0|    *height -= (uint32_t)crop_h;
  716|      0|  }
  717|       |
  718|     33|  if (!reader.get_uvlc(&value)) {
  ------------------
  |  Branch (718:7): [True: 0, False: 33]
  ------------------
  719|      0|    return invalidUVLC;
  720|      0|  }
  721|     33|  if (value > 8) {
  ------------------
  |  Branch (721:7): [True: 0, False: 33]
  ------------------
  722|      0|    return Error{heif_error_Invalid_input,
  723|      0|                 heif_suberror_Invalid_parameter_value,
  724|      0|                 "SPS bit_depth_luma_minus8 out of range"};
  725|      0|  }
  726|     33|  config->bit_depth_luma = (uint8_t) (value + 8);
  727|       |
  728|     33|  if (!reader.get_uvlc(&value)) {
  ------------------
  |  Branch (728:7): [True: 0, False: 33]
  ------------------
  729|      0|    return invalidUVLC;
  730|      0|  }
  731|     33|  if (value > 8) {
  ------------------
  |  Branch (731:7): [True: 0, False: 33]
  ------------------
  732|      0|    return Error{heif_error_Invalid_input,
  733|      0|                 heif_suberror_Invalid_parameter_value,
  734|      0|                 "SPS bit_depth_chroma_minus8 out of range"};
  735|      0|  }
  736|     33|  config->bit_depth_chroma = (uint8_t) (value + 8);
  737|       |
  738|       |
  739|       |
  740|       |  // --- init static configuration fields ---
  741|       |
  742|     33|  config->configuration_version = 1;
  743|     33|  config->min_spatial_segmentation_idc = 0; // TODO: get this value from the VUI, 0 should be safe
  744|     33|  config->parallelism_type = 0; // TODO, 0 should be safe
  745|     33|  config->avg_frame_rate = 0; // makes no sense for HEIF (TODO)
  746|     33|  config->constant_frame_rate = 0; // makes no sense for HEIF (TODO)
  747|     33|  config->num_temporal_layers = 1; // makes no sense for HEIF
  748|       |
  749|     33|  return Error::Ok;
  750|     33|}

_ZN8Box_hvcCC2Ev:
   97|     11|  {
   98|     11|    set_short_type(fourcc("hvcC"));
   99|     11|  }
_ZNK8Box_hvcC17get_configurationEv:
  112|    618|  const HEVCDecoderConfigurationRecord& get_configuration() const { return m_configuration; }

_ZNK12Decoder_HEVC33read_bitstream_configuration_dataEv:
   31|     33|{
   32|     33|  std::vector<uint8_t> data;
   33|     33|  if (!m_hvcC->get_header_nals(&data)) {
  ------------------
  |  Branch (33:7): [True: 0, False: 33]
  ------------------
   34|      0|    return Error{heif_error_Invalid_input,
   35|      0|                 heif_suberror_No_item_data};
   36|      0|  }
   37|       |
   38|     33|  return data;
   39|     33|}
_ZNK12Decoder_HEVC23get_luma_bits_per_pixelEv:
   43|    184|{
   44|    184|  return m_hvcC->get_configuration().bit_depth_luma;
   45|    184|}
_ZNK12Decoder_HEVC25get_chroma_bits_per_pixelEv:
   49|    184|{
   50|    184|  return m_hvcC->get_configuration().bit_depth_chroma;
   51|    184|}
_ZNK12Decoder_HEVC32get_coded_image_size_from_configEv:
   55|     33|{
   56|     33|  const auto& nal_arrays = m_hvcC->get_configuration().m_nal_array;
   57|       |
   58|     66|  for (const auto& arr : nal_arrays) {
  ------------------
  |  Branch (58:24): [True: 66, False: 0]
  ------------------
   59|     66|    if (arr.m_NAL_unit_type != HEVC_NAL_UNIT_SPS_NUT || arr.m_nal_units.empty()) {
  ------------------
  |  Branch (59:9): [True: 33, False: 33]
  |  Branch (59:57): [True: 0, False: 33]
  ------------------
   60|     33|      continue;
   61|     33|    }
   62|       |
   63|     33|    const std::vector<uint8_t>& sps = arr.m_nal_units[0];
   64|     33|    HEVCDecoderConfigurationRecord scratch = m_hvcC->get_configuration();
   65|     33|    uint32_t cropped_w = 0, cropped_h = 0;
   66|     33|    ImageSize coded{};
   67|     33|    Error e = parse_sps_for_hvcC_configuration(sps.data(), sps.size(), &scratch,
   68|     33|                                               &cropped_w, &cropped_h, &coded);
   69|     33|    if (e) {
  ------------------
  |  Branch (69:9): [True: 0, False: 33]
  ------------------
   70|      0|      return e;
   71|      0|    }
   72|       |
   73|     33|    return std::optional<ImageSize>{coded};
   74|     33|  }
   75|       |
   76|      0|  return std::optional<ImageSize>{};
   77|     33|}
_ZNK12Decoder_HEVC26get_coded_image_colorspaceEP15heif_colorspaceP11heif_chroma:
   81|    184|{
   82|    184|  *out_chroma = (heif_chroma) (m_hvcC->get_configuration().chroma_format);
   83|       |
   84|    184|  if (*out_chroma == heif_chroma_monochrome) {
  ------------------
  |  |   75|    184|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (84:7): [True: 0, False: 184]
  ------------------
   85|      0|    *out_colorspace = heif_colorspace_monochrome;
   86|      0|  }
   87|    184|  else {
   88|    184|    *out_colorspace = heif_colorspace_YCbCr;
   89|    184|  }
   90|       |
   91|    184|  return Error::Ok;
   92|    184|}

_ZN12Decoder_HEVCC2ERKNSt3__110shared_ptrIK8Box_hvcCEE:
   38|    184|  explicit Decoder_HEVC(const std::shared_ptr<const Box_hvcC>& hvcC) : m_hvcC(hvcC) {}
_ZNK12Decoder_HEVC22get_compression_formatEv:
   40|     66|  heif_compression_format get_compression_format() const override { return heif_compression_HEVC; }

_ZNK19Op_drop_alpha_plane22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   30|     10|{
   31|       |  // only drop alpha plane if it is not needed in output
   32|       |
   33|     10|  if ((input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|     20|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (33:8): [True: 10, False: 0]
  ------------------
   34|     10|       input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (34:8): [True: 10, False: 0]
  ------------------
   35|     10|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (35:8): [True: 10, False: 0]
  ------------------
   36|     10|       input_state.chroma != heif_chroma_444) ||
  ------------------
  |  Branch (36:8): [True: 5, False: 5]
  ------------------
   37|      5|      input_state.has_alpha == false ||
  ------------------
  |  Branch (37:7): [True: 5, False: 0]
  ------------------
   38|     10|      target_state.has_alpha == true) {
  ------------------
  |  Branch (38:7): [True: 0, False: 0]
  ------------------
   39|     10|    return {};
   40|     10|  }
   41|       |
   42|      0|  if (options_ext.alpha_composition_mode != heif_alpha_composition_mode_none) {
  ------------------
  |  Branch (42:7): [True: 0, False: 0]
  ------------------
   43|      0|    return {};
   44|      0|  }
   45|       |
   46|      0|  std::vector<ColorStateWithCost> states;
   47|       |
   48|      0|  ColorState output_state;
   49|       |
   50|       |  // --- drop alpha plane
   51|       |
   52|      0|  output_state = input_state;
   53|      0|  output_state.has_alpha = false;
   54|       |
   55|      0|  states.emplace_back(output_state, SpeedCosts_Trivial);
   56|       |
   57|      0|  return states;
   58|      0|}
_ZNK22Op_flatten_alpha_planeIhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   99|     10|{
  100|     10|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  101|       |
  102|       |  // TODO: this Op only works when all channels are either HDR or all are SDR.
  103|       |  //       But there is currently no easy way to check that.
  104|       |
  105|     10|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (105:7): [True: 0, False: 10]
  ------------------
  106|      0|    return {};
  107|      0|  }
  108|       |
  109|     10|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (109:7): [True: 5, False: 5]
  |  Branch (109:32): [True: 0, False: 5]
  ------------------
  110|      0|    return {};
  111|      0|  }
  112|       |
  113|       |  // only drop alpha plane if it is not needed in output
  114|       |
  115|     10|  if ((input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|     20|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (115:8): [True: 10, False: 0]
  ------------------
  116|     10|       input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (116:8): [True: 10, False: 0]
  ------------------
  117|     10|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (117:8): [True: 10, False: 0]
  ------------------
  118|     10|       input_state.chroma != heif_chroma_444) ||
  ------------------
  |  Branch (118:8): [True: 5, False: 5]
  ------------------
  119|      5|      input_state.has_alpha == false ||
  ------------------
  |  Branch (119:7): [True: 5, False: 0]
  ------------------
  120|     10|      target_state.has_alpha == true) {
  ------------------
  |  Branch (120:7): [True: 0, False: 0]
  ------------------
  121|     10|    return {};
  122|     10|  }
  123|       |
  124|      0|  if (options_ext.alpha_composition_mode == heif_alpha_composition_mode_none) {
  ------------------
  |  Branch (124:7): [True: 0, False: 0]
  ------------------
  125|      0|    return {};
  126|      0|  }
  127|       |
  128|      0|  std::vector<ColorStateWithCost> states;
  129|       |
  130|      0|  ColorState output_state;
  131|       |
  132|       |  // --- drop alpha plane
  133|       |
  134|      0|  output_state = input_state;
  135|      0|  output_state.has_alpha = false;
  136|       |
  137|      0|  states.emplace_back(output_state, SpeedCosts_Trivial);
  138|       |
  139|      0|  return states;
  140|      0|}
_ZNK22Op_flatten_alpha_planeItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   99|     10|{
  100|     10|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  101|       |
  102|       |  // TODO: this Op only works when all channels are either HDR or all are SDR.
  103|       |  //       But there is currently no easy way to check that.
  104|       |
  105|     10|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (105:7): [True: 10, False: 0]
  ------------------
  106|     10|    return {};
  107|     10|  }
  108|       |
  109|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (109:7): [True: 0, False: 0]
  |  Branch (109:32): [True: 0, False: 0]
  ------------------
  110|      0|    return {};
  111|      0|  }
  112|       |
  113|       |  // only drop alpha plane if it is not needed in output
  114|       |
  115|      0|  if ((input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (115:8): [True: 0, False: 0]
  ------------------
  116|      0|       input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (116:8): [True: 0, False: 0]
  ------------------
  117|      0|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (117:8): [True: 0, False: 0]
  ------------------
  118|      0|       input_state.chroma != heif_chroma_444) ||
  ------------------
  |  Branch (118:8): [True: 0, False: 0]
  ------------------
  119|      0|      input_state.has_alpha == false ||
  ------------------
  |  Branch (119:7): [True: 0, False: 0]
  ------------------
  120|      0|      target_state.has_alpha == true) {
  ------------------
  |  Branch (120:7): [True: 0, False: 0]
  ------------------
  121|      0|    return {};
  122|      0|  }
  123|       |
  124|      0|  if (options_ext.alpha_composition_mode == heif_alpha_composition_mode_none) {
  ------------------
  |  Branch (124:7): [True: 0, False: 0]
  ------------------
  125|      0|    return {};
  126|      0|  }
  127|       |
  128|      0|  std::vector<ColorStateWithCost> states;
  129|       |
  130|      0|  ColorState output_state;
  131|       |
  132|       |  // --- drop alpha plane
  133|       |
  134|      0|  output_state = input_state;
  135|      0|  output_state.has_alpha = false;
  136|       |
  137|      0|  states.emplace_back(output_state, SpeedCosts_Trivial);
  138|       |
  139|      0|  return states;
  140|      0|}
_ZNK25Op_adjust_alpha_bit_depth22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  299|     10|{
  300|       |  // Only applicable when alpha BPP differs from color BPP
  301|     10|  if (!input_state.has_alpha ||
  ------------------
  |  Branch (301:7): [True: 5, False: 5]
  ------------------
  302|     10|      input_state.get_alpha_bits_per_pixel() == input_state.bits_per_pixel) {
  ------------------
  |  Branch (302:7): [True: 5, False: 0]
  ------------------
  303|     10|    return {};
  304|     10|  }
  305|       |
  306|       |  // Only for planar formats with alpha
  307|      0|  if (input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (307:7): [True: 0, False: 0]
  ------------------
  308|      0|      input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (308:7): [True: 0, False: 0]
  ------------------
  309|      0|      input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (309:7): [True: 0, False: 0]
  ------------------
  310|      0|      input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (310:7): [True: 0, False: 0]
  ------------------
  311|      0|    return {};
  312|      0|  }
  313|       |
  314|      0|  std::vector<ColorStateWithCost> states;
  315|       |
  316|      0|  ColorState output_state = input_state;
  317|      0|  output_state.alpha_bits_per_pixel = input_state.bits_per_pixel;
  318|       |
  319|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  320|       |
  321|      0|  return states;
  322|      0|}

_ZNK29Op_bayer_bilinear_to_RGB24_3222state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   33|     10|{
   34|     10|  if (input_state.colorspace != heif_colorspace_filter_array ||
  ------------------
  |  Branch (34:7): [True: 10, False: 0]
  ------------------
   35|     10|      input_state.chroma != heif_chroma_planar) {
  ------------------
  |  Branch (35:7): [True: 0, False: 0]
  ------------------
   36|     10|    return {};
   37|     10|  }
   38|       |
   39|      0|  std::vector<ColorStateWithCost> states;
   40|       |
   41|      0|  ColorState output_state;
   42|      0|  output_state.colorspace = heif_colorspace_RGB;
   43|      0|  output_state.has_alpha = false;
   44|       |
   45|      0|  if (input_state.bits_per_pixel == 8) {
  ------------------
  |  Branch (45:7): [True: 0, False: 0]
  ------------------
   46|      0|    output_state.chroma = heif_chroma_interleaved_RGB;
   47|      0|    output_state.bits_per_pixel = 8;
   48|      0|  }
   49|      0|  else if (input_state.bits_per_pixel > 8 && input_state.bits_per_pixel <= 16) {
  ------------------
  |  Branch (49:12): [True: 0, False: 0]
  |  Branch (49:46): [True: 0, False: 0]
  ------------------
   50|      0|    output_state.chroma = heif_chroma_interleaved_RRGGBB_LE;
   51|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
   52|      0|  }
   53|      0|  else {
   54|      0|    return {};
   55|      0|  }
   56|       |
   57|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   58|       |
   59|      0|  return states;
   60|      0|}

_ZNK31Op_YCbCr444_to_YCbCr420_averageIhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   31|     10|{
   32|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (32:7): [True: 10, False: 0]
  ------------------
   33|     10|    return {};
   34|     10|  }
   35|       |
   36|      0|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (36:7): [True: 0, False: 0]
  ------------------
   37|      0|    return {};
   38|      0|  }
   39|       |
   40|       |  // this Op only implements the averaging algorithm
   41|       |
   42|      0|  if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_average) {
  ------------------
  |  Branch (42:7): [True: 0, False: 0]
  ------------------
   43|      0|    return {};
   44|      0|  }
   45|       |
   46|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   47|       |
   48|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  ------------------
   49|      0|    return {};
   50|      0|  }
   51|       |
   52|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (52:7): [True: 0, False: 0]
  ------------------
   53|      0|    return {};
   54|      0|  }
   55|       |
   56|      0|  if (target_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (56:7): [True: 0, False: 0]
  ------------------
   57|      0|    return {};
   58|      0|  }
   59|       |
   60|      0|  std::vector<ColorStateWithCost> states;
   61|       |
   62|      0|  ColorState output_state;
   63|       |
   64|       |  // --- convert to 4:2:0
   65|       |
   66|      0|  output_state.colorspace = heif_colorspace_YCbCr;
   67|      0|  output_state.chroma = heif_chroma_420;
   68|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   69|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
   70|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
   71|      0|  output_state.nclx = input_state.nclx;
   72|       |
   73|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   74|       |
   75|      0|  return states;
   76|      0|}
_ZNK31Op_YCbCr444_to_YCbCr420_averageItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   31|     10|{
   32|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (32:7): [True: 10, False: 0]
  ------------------
   33|     10|    return {};
   34|     10|  }
   35|       |
   36|      0|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (36:7): [True: 0, False: 0]
  ------------------
   37|      0|    return {};
   38|      0|  }
   39|       |
   40|       |  // this Op only implements the averaging algorithm
   41|       |
   42|      0|  if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_average) {
  ------------------
  |  Branch (42:7): [True: 0, False: 0]
  ------------------
   43|      0|    return {};
   44|      0|  }
   45|       |
   46|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   47|       |
   48|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  ------------------
   49|      0|    return {};
   50|      0|  }
   51|       |
   52|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (52:7): [True: 0, False: 0]
  ------------------
   53|      0|    return {};
   54|      0|  }
   55|       |
   56|      0|  if (target_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (56:7): [True: 0, False: 0]
  ------------------
   57|      0|    return {};
   58|      0|  }
   59|       |
   60|      0|  std::vector<ColorStateWithCost> states;
   61|       |
   62|      0|  ColorState output_state;
   63|       |
   64|       |  // --- convert to 4:2:0
   65|       |
   66|      0|  output_state.colorspace = heif_colorspace_YCbCr;
   67|      0|  output_state.chroma = heif_chroma_420;
   68|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   69|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
   70|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
   71|      0|  output_state.nclx = input_state.nclx;
   72|       |
   73|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   74|       |
   75|      0|  return states;
   76|      0|}
_ZNK31Op_YCbCr444_to_YCbCr422_averageIhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  255|     10|{
  256|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (256:7): [True: 10, False: 0]
  ------------------
  257|     10|    return {};
  258|     10|  }
  259|       |
  260|      0|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (260:7): [True: 0, False: 0]
  ------------------
  261|      0|    return {};
  262|      0|  }
  263|       |
  264|       |  // this Op only implements the averaging algorithm
  265|       |
  266|      0|  if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_average) {
  ------------------
  |  Branch (266:7): [True: 0, False: 0]
  ------------------
  267|      0|    return {};
  268|      0|  }
  269|       |
  270|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  271|       |
  272|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (272:7): [True: 0, False: 0]
  ------------------
  273|      0|    return {};
  274|      0|  }
  275|       |
  276|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (276:7): [True: 0, False: 0]
  ------------------
  277|      0|    return {};
  278|      0|  }
  279|       |
  280|      0|  if (target_state.chroma != heif_chroma_422) {
  ------------------
  |  Branch (280:7): [True: 0, False: 0]
  ------------------
  281|      0|    return {};
  282|      0|  }
  283|       |
  284|      0|  std::vector<ColorStateWithCost> states;
  285|       |
  286|      0|  ColorState output_state;
  287|       |
  288|       |  // --- convert to 4:2:0
  289|       |
  290|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  291|      0|  output_state.chroma = heif_chroma_422;
  292|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  293|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  294|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  295|      0|  output_state.nclx = input_state.nclx;
  296|       |
  297|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  298|       |
  299|      0|  return states;
  300|      0|}
_ZNK31Op_YCbCr444_to_YCbCr422_averageItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  255|     10|{
  256|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (256:7): [True: 10, False: 0]
  ------------------
  257|     10|    return {};
  258|     10|  }
  259|       |
  260|      0|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (260:7): [True: 0, False: 0]
  ------------------
  261|      0|    return {};
  262|      0|  }
  263|       |
  264|       |  // this Op only implements the averaging algorithm
  265|       |
  266|      0|  if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_average) {
  ------------------
  |  Branch (266:7): [True: 0, False: 0]
  ------------------
  267|      0|    return {};
  268|      0|  }
  269|       |
  270|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  271|       |
  272|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (272:7): [True: 0, False: 0]
  ------------------
  273|      0|    return {};
  274|      0|  }
  275|       |
  276|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (276:7): [True: 0, False: 0]
  ------------------
  277|      0|    return {};
  278|      0|  }
  279|       |
  280|      0|  if (target_state.chroma != heif_chroma_422) {
  ------------------
  |  Branch (280:7): [True: 0, False: 0]
  ------------------
  281|      0|    return {};
  282|      0|  }
  283|       |
  284|      0|  std::vector<ColorStateWithCost> states;
  285|       |
  286|      0|  ColorState output_state;
  287|       |
  288|       |  // --- convert to 4:2:0
  289|       |
  290|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  291|      0|  output_state.chroma = heif_chroma_422;
  292|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  293|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  294|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  295|      0|  output_state.nclx = input_state.nclx;
  296|       |
  297|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  298|       |
  299|      0|  return states;
  300|      0|}
_ZNK32Op_YCbCr420_bilinear_to_YCbCr444IhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  457|     10|{
  458|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (458:7): [True: 10, False: 0]
  ------------------
  459|     10|    return {};
  460|     10|  }
  461|       |
  462|      0|  if (input_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (462:7): [True: 0, False: 0]
  ------------------
  463|      0|    return {};
  464|      0|  }
  465|       |
  466|       |  // this Op only implements the bilinear algorithm
  467|       |
  468|      0|  if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_bilinear) {
  ------------------
  |  Branch (468:7): [True: 0, False: 0]
  ------------------
  469|      0|    return {};
  470|      0|  }
  471|       |
  472|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  473|       |
  474|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (474:7): [True: 0, False: 0]
  ------------------
  475|      0|    return {};
  476|      0|  }
  477|       |
  478|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (478:7): [True: 0, False: 0]
  ------------------
  479|      0|    return {};
  480|      0|  }
  481|       |
  482|      0|  std::vector<ColorStateWithCost> states;
  483|       |
  484|      0|  ColorState output_state;
  485|       |
  486|       |  // --- convert to 4:4:4
  487|       |
  488|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  489|      0|  output_state.chroma = heif_chroma_444;
  490|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  491|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  492|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  493|      0|  output_state.nclx = input_state.nclx;
  494|       |
  495|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  496|       |
  497|      0|  return states;
  498|      0|}
_ZNK32Op_YCbCr420_bilinear_to_YCbCr444ItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  457|     10|{
  458|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (458:7): [True: 10, False: 0]
  ------------------
  459|     10|    return {};
  460|     10|  }
  461|       |
  462|      0|  if (input_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (462:7): [True: 0, False: 0]
  ------------------
  463|      0|    return {};
  464|      0|  }
  465|       |
  466|       |  // this Op only implements the bilinear algorithm
  467|       |
  468|      0|  if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_bilinear) {
  ------------------
  |  Branch (468:7): [True: 0, False: 0]
  ------------------
  469|      0|    return {};
  470|      0|  }
  471|       |
  472|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  473|       |
  474|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (474:7): [True: 0, False: 0]
  ------------------
  475|      0|    return {};
  476|      0|  }
  477|       |
  478|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (478:7): [True: 0, False: 0]
  ------------------
  479|      0|    return {};
  480|      0|  }
  481|       |
  482|      0|  std::vector<ColorStateWithCost> states;
  483|       |
  484|      0|  ColorState output_state;
  485|       |
  486|       |  // --- convert to 4:4:4
  487|       |
  488|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  489|      0|  output_state.chroma = heif_chroma_444;
  490|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  491|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  492|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  493|      0|  output_state.nclx = input_state.nclx;
  494|       |
  495|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  496|       |
  497|      0|  return states;
  498|      0|}
_ZNK32Op_YCbCr422_bilinear_to_YCbCr444IhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  738|     10|{
  739|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (739:7): [True: 10, False: 0]
  ------------------
  740|     10|    return {};
  741|     10|  }
  742|       |
  743|      0|  if (input_state.chroma != heif_chroma_422) {
  ------------------
  |  Branch (743:7): [True: 0, False: 0]
  ------------------
  744|      0|    return {};
  745|      0|  }
  746|       |
  747|       |  // this Op only implements the bilinear algorithm
  748|       |
  749|      0|  if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_bilinear) {
  ------------------
  |  Branch (749:7): [True: 0, False: 0]
  ------------------
  750|      0|    return {};
  751|      0|  }
  752|       |
  753|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  754|       |
  755|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (755:7): [True: 0, False: 0]
  ------------------
  756|      0|    return {};
  757|      0|  }
  758|       |
  759|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (759:7): [True: 0, False: 0]
  ------------------
  760|      0|    return {};
  761|      0|  }
  762|       |
  763|      0|  std::vector<ColorStateWithCost> states;
  764|       |
  765|      0|  ColorState output_state;
  766|       |
  767|       |  // --- convert to 4:4:4
  768|       |
  769|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  770|      0|  output_state.chroma = heif_chroma_444;
  771|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  772|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  773|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  774|      0|  output_state.nclx = input_state.nclx;
  775|       |
  776|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  777|       |
  778|      0|  return states;
  779|      0|}
_ZNK32Op_YCbCr422_bilinear_to_YCbCr444ItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  738|     10|{
  739|     10|  if (input_state.colorspace != heif_colorspace_YCbCr) {
  ------------------
  |  Branch (739:7): [True: 10, False: 0]
  ------------------
  740|     10|    return {};
  741|     10|  }
  742|       |
  743|      0|  if (input_state.chroma != heif_chroma_422) {
  ------------------
  |  Branch (743:7): [True: 0, False: 0]
  ------------------
  744|      0|    return {};
  745|      0|  }
  746|       |
  747|       |  // this Op only implements the bilinear algorithm
  748|       |
  749|      0|  if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_bilinear) {
  ------------------
  |  Branch (749:7): [True: 0, False: 0]
  ------------------
  750|      0|    return {};
  751|      0|  }
  752|       |
  753|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  754|       |
  755|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (755:7): [True: 0, False: 0]
  ------------------
  756|      0|    return {};
  757|      0|  }
  758|       |
  759|      0|  if (input_state.nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (759:7): [True: 0, False: 0]
  ------------------
  760|      0|    return {};
  761|      0|  }
  762|       |
  763|      0|  std::vector<ColorStateWithCost> states;
  764|       |
  765|      0|  ColorState output_state;
  766|       |
  767|       |  // --- convert to 4:4:4
  768|       |
  769|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  770|      0|  output_state.chroma = heif_chroma_444;
  771|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
  772|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  773|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
  774|      0|  output_state.nclx = input_state.nclx;
  775|       |
  776|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  777|       |
  778|      0|  return states;
  779|      0|}

_ZNK10ColorStateeqERKS_:
  151|    170|{
  152|    170|  bool mainParamsMatch = (colorspace == b.colorspace &&
  ------------------
  |  Branch (152:27): [True: 85, False: 85]
  ------------------
  153|     85|                          chroma == b.chroma &&
  ------------------
  |  Branch (153:27): [True: 35, False: 50]
  ------------------
  154|     35|                          has_alpha == b.has_alpha &&
  ------------------
  |  Branch (154:27): [True: 35, False: 0]
  ------------------
  155|     35|                          bits_per_pixel == b.bits_per_pixel);
  ------------------
  |  Branch (155:27): [True: 35, False: 0]
  ------------------
  156|       |
  157|    170|  if (!mainParamsMatch) {
  ------------------
  |  Branch (157:7): [True: 135, False: 35]
  ------------------
  158|    135|    return false;
  159|    135|  }
  160|       |
  161|     35|  if (has_alpha && b.has_alpha) {
  ------------------
  |  Branch (161:7): [True: 0, False: 35]
  |  Branch (161:20): [True: 0, False: 0]
  ------------------
  162|      0|    if (get_alpha_bits_per_pixel() != b.get_alpha_bits_per_pixel()) {
  ------------------
  |  Branch (162:9): [True: 0, False: 0]
  ------------------
  163|      0|      return false;
  164|      0|    }
  165|      0|  }
  166|       |
  167|     35|  if (colorspace == heif_colorspace_YCbCr) {
  ------------------
  |  Branch (167:7): [True: 25, False: 10]
  ------------------
  168|     25|    bool ycbcr_parameters_match = nclx.equal_except_transfer_curve(b.nclx);
  169|       |
  170|     25|    if (!ycbcr_parameters_match) {
  ------------------
  |  Branch (170:9): [True: 0, False: 25]
  ------------------
  171|      0|      return false;
  172|      0|    }
  173|     25|  }
  174|       |
  175|     35|  return true;
  176|     35|}
_ZN23ColorConversionPipeline8init_opsEv:
  226|      6|{
  227|      6|#if ENABLE_MULTITHREADING_SUPPORT
  228|      6|  static std::mutex init_ops_mutex;
  229|      6|  std::lock_guard<std::mutex> lock(init_ops_mutex);
  230|      6|#endif
  231|      6|  if (!m_operation_pool.empty()) {
  ------------------
  |  Branch (231:7): [True: 5, False: 1]
  ------------------
  232|      5|    return;
  233|      5|  }
  234|       |
  235|      1|  std::vector<std::shared_ptr<ColorConversionOperation>>& ops = m_operation_pool;
  236|      1|  ops.emplace_back(std::make_shared<Op_RGB_to_RGB24_32>());
  237|      1|  ops.emplace_back(std::make_shared<Op_RGB24_32_to_RGB>());
  238|      1|  ops.emplace_back(std::make_shared<Op_YCbCr_to_RGB<uint16_t>>());
  239|      1|  ops.emplace_back(std::make_shared<Op_YCbCr_to_RGB<uint8_t>>());
  240|      1|  ops.emplace_back(std::make_shared<Op_YCbCr420_to_RGB24>());
  241|      1|  ops.emplace_back(std::make_shared<Op_YCbCr420_to_RGB32>());
  242|      1|  ops.emplace_back(std::make_shared<Op_YCbCr420_to_RRGGBBaa>());
  243|      1|  ops.emplace_back(std::make_shared<Op_RGB_HDR_to_RRGGBBaa_BE>());
  244|      1|  ops.emplace_back(std::make_shared<Op_RGB_to_RRGGBBaa_BE>());
  245|      1|  ops.emplace_back(std::make_shared<Op_mono_to_YCbCr420>());
  246|      1|  ops.emplace_back(std::make_shared<Op_mono_to_RGB24_32>());
  247|      1|  ops.emplace_back(std::make_shared<Op_bayer_bilinear_to_RGB24_32>());
  248|      1|  ops.emplace_back(std::make_shared<Op_RRGGBBaa_swap_endianness>());
  249|      1|  ops.emplace_back(std::make_shared<Op_RRGGBBaa_BE_to_RGB_HDR>());
  250|      1|  ops.emplace_back(std::make_shared<Op_RGB24_32_to_YCbCr>());
  251|      1|  ops.emplace_back(std::make_shared<Op_RGB_to_YCbCr<uint8_t>>());
  252|      1|  ops.emplace_back(std::make_shared<Op_RGB_to_YCbCr<uint16_t>>());
  253|      1|  ops.emplace_back(std::make_shared<Op_RRGGBBxx_HDR_to_YCbCr420>());
  254|      1|  ops.emplace_back(std::make_shared<Op_RGB24_32_to_YCbCr444_GBR>());
  255|      1|  ops.emplace_back(std::make_shared<Op_drop_alpha_plane>());
  256|      1|  ops.emplace_back(std::make_shared<Op_flatten_alpha_plane<uint8_t>>());
  257|      1|  ops.emplace_back(std::make_shared<Op_flatten_alpha_plane<uint16_t>>());
  258|      1|  ops.emplace_back(std::make_shared<Op_adjust_alpha_bit_depth>());
  259|      1|  ops.emplace_back(std::make_shared<Op_to_hdr_planes>());
  260|      1|  ops.emplace_back(std::make_shared<Op_to_sdr_planes>());
  261|      1|  ops.emplace_back(std::make_shared<Op_YCbCr420_bilinear_to_YCbCr444<uint8_t>>());
  262|      1|  ops.emplace_back(std::make_shared<Op_YCbCr420_bilinear_to_YCbCr444<uint16_t>>());
  263|      1|  ops.emplace_back(std::make_shared<Op_YCbCr422_bilinear_to_YCbCr444<uint8_t>>());
  264|      1|  ops.emplace_back(std::make_shared<Op_YCbCr422_bilinear_to_YCbCr444<uint16_t>>());
  265|      1|  ops.emplace_back(std::make_shared<Op_YCbCr444_to_YCbCr420_average<uint8_t>>());
  266|      1|  ops.emplace_back(std::make_shared<Op_YCbCr444_to_YCbCr420_average<uint16_t>>());
  267|      1|  ops.emplace_back(std::make_shared<Op_YCbCr444_to_YCbCr422_average<uint8_t>>());
  268|      1|  ops.emplace_back(std::make_shared<Op_YCbCr444_to_YCbCr422_average<uint16_t>>());
  269|      1|  ops.emplace_back(std::make_shared<Op_Any_RGB_to_YCbCr_420_Sharp>());
  270|      1|}
_ZN23ColorConversionPipeline18construct_pipelineERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  283|      5|{
  284|      5|  m_conversion_steps.clear();
  285|       |
  286|      5|  m_options = options;
  287|      5|  m_options_ext = options_ext;
  288|       |
  289|      5|  if (input_state == target_state) {
  ------------------
  |  Branch (289:7): [True: 0, False: 5]
  ------------------
  290|      0|    return true;
  291|      0|  }
  292|       |
  293|       |#if DEBUG_ME
  294|       |  std::cerr << "--- construct_pipeline\n";
  295|       |  std::cerr << "from: " << input_state << "\nto: " << target_state << "\n";
  296|       |#endif
  297|       |
  298|      5|  init_ops(); // to be sure these are initialized even without heif_init()
  299|       |
  300|      5|  std::vector<std::shared_ptr<ColorConversionOperation>>& ops = m_operation_pool;
  301|       |
  302|       |  // --- Dijkstra search for the minimum-cost conversion pipeline
  303|       |
  304|      5|  std::vector<Node> processed_states;
  305|      5|  std::vector<Node> border_states;
  306|      5|  border_states.emplace_back(-1, nullptr, input_state, 0);
  307|       |
  308|     15|  while (!border_states.empty()) {
  ------------------
  |  Branch (308:10): [True: 15, False: 0]
  ------------------
  309|     15|    int minIdx = -1;
  310|     15|    int minCost = std::numeric_limits<int>::max();
  311|     65|    for (int i = 0; i < (int) border_states.size(); i++) {
  ------------------
  |  Branch (311:21): [True: 50, False: 15]
  ------------------
  312|     50|      int cost = border_states[i].speed_costs;
  313|     50|      if (cost < minCost) {
  ------------------
  |  Branch (313:11): [True: 15, False: 35]
  ------------------
  314|     15|        minIdx = i;
  315|     15|        minCost = cost;
  316|     15|      }
  317|     50|    }
  318|       |
  319|     15|    assert(minIdx >= 0);
  ------------------
  |  Branch (319:5): [True: 15, False: 0]
  ------------------
  320|       |
  321|       |
  322|       |    // move minimum-cost border_state into processed_states
  323|       |
  324|     15|    processed_states.push_back(border_states[minIdx]);
  325|       |
  326|     15|    border_states[minIdx] = border_states.back();
  327|     15|    border_states.pop_back();
  328|       |
  329|       |#if DEBUG_PIPELINE_CREATION
  330|       |    std::cerr << "- expand node: " << processed_states.back().output_state
  331|       |        << " with cost " << processed_states.back().speed_costs << " \n";
  332|       |#endif
  333|       |
  334|     15|    if (processed_states.back().output_state == target_state) {
  ------------------
  |  Branch (334:9): [True: 5, False: 10]
  ------------------
  335|       |      // end-state found, backtrack path to find conversion pipeline
  336|       |
  337|      5|      size_t idx = processed_states.size() - 1;
  338|      5|      int len = 0;
  339|     10|      while (idx > 0) {
  ------------------
  |  Branch (339:14): [True: 5, False: 5]
  ------------------
  340|      5|        idx = processed_states[idx].prev_processed_idx;
  341|      5|        len++;
  342|      5|      }
  343|       |
  344|      5|      m_conversion_steps.resize(len);
  345|       |
  346|      5|      idx = processed_states.size() - 1;
  347|      5|      int step = 0;
  348|     10|      while (idx > 0) {
  ------------------
  |  Branch (348:14): [True: 5, False: 5]
  ------------------
  349|      5|        m_conversion_steps[len - 1 - step].operation = processed_states[idx].op;
  350|      5|        m_conversion_steps[len - 1 - step].output_state = processed_states[idx].output_state;
  351|      5|        if (step > 0) {
  ------------------
  |  Branch (351:13): [True: 0, False: 5]
  ------------------
  352|      0|          m_conversion_steps[len - step].input_state = m_conversion_steps[len - 1 - step].output_state;
  353|      0|        }
  354|       |
  355|       |        //printf("cost: %f\n",processed_states[idx].color_state.costs.total(options.criterion));
  356|      5|        idx = processed_states[idx].prev_processed_idx;
  357|      5|        step++;
  358|      5|      }
  359|       |
  360|      5|      m_conversion_steps[0].input_state = input_state;
  361|       |
  362|      5|      assert(m_conversion_steps.back().output_state == target_state);
  ------------------
  |  Branch (362:7): [True: 5, False: 0]
  ------------------
  363|       |
  364|       |#if DEBUG_ME
  365|       |      std::cerr << debug_dump_pipeline();
  366|       |#endif
  367|       |
  368|      5|      return true;
  369|      5|    }
  370|       |
  371|       |
  372|       |    // expand the node with minimum cost
  373|       |
  374|    340|    for (const auto& op_ptr : ops) {
  ------------------
  |  Branch (374:29): [True: 340, False: 10]
  ------------------
  375|       |
  376|       |#if DEBUG_PIPELINE_CREATION
  377|       |      auto& op = *op_ptr;
  378|       |      std::cerr << "-- apply op: " << typeid(op).name() << "\n";
  379|       |#endif
  380|       |
  381|    340|      auto out_states = op_ptr->state_after_conversion(processed_states.back().output_state,
  382|    340|                                                       target_state,
  383|    340|                                                       options, options_ext);
  384|    340|      for (const auto& out_state : out_states) {
  ------------------
  |  Branch (384:34): [True: 50, False: 340]
  ------------------
  385|     50|        int new_op_costs = out_state.speed_costs + processed_states.back().speed_costs;
  386|       |#if DEBUG_PIPELINE_CREATION
  387|       |        std::cerr << "--- " << out_state.color_state << " with cost " << new_op_costs << "\n";
  388|       |#endif
  389|       |
  390|     50|        bool state_exists = false;
  391|     60|        for (const auto& s : processed_states) {
  ------------------
  |  Branch (391:28): [True: 60, False: 40]
  ------------------
  392|     60|          if (s.output_state == out_state.color_state) {
  ------------------
  |  Branch (392:15): [True: 10, False: 50]
  ------------------
  393|     10|            state_exists = true;
  394|     10|            break;
  395|     10|          }
  396|     60|        }
  397|       |
  398|     50|        if (!state_exists) {
  ------------------
  |  Branch (398:13): [True: 40, False: 10]
  ------------------
  399|     85|          for (auto& s : border_states) {
  ------------------
  |  Branch (399:24): [True: 85, False: 25]
  ------------------
  400|     85|            if (s.output_state == out_state.color_state) {
  ------------------
  |  Branch (400:17): [True: 15, False: 70]
  ------------------
  401|     15|              state_exists = true;
  402|       |
  403|       |              // if we reached the same border node with a lower cost, replace the border node
  404|       |
  405|     15|              if (s.speed_costs > new_op_costs) {
  ------------------
  |  Branch (405:19): [True: 0, False: 15]
  ------------------
  406|      0|                s = {(int) (processed_states.size() - 1),
  407|      0|                     op_ptr,
  408|      0|                     out_state.color_state,
  409|      0|                     out_state.speed_costs};
  410|       |
  411|      0|                s.speed_costs = new_op_costs;
  412|      0|              }
  413|     15|              break;
  414|     15|            }
  415|     85|          }
  416|     40|        }
  417|       |
  418|       |
  419|       |        // enter the new output state into the list of border states
  420|       |
  421|     50|        if (!state_exists) {
  ------------------
  |  Branch (421:13): [True: 25, False: 25]
  ------------------
  422|     25|          ColorStateWithCost s = out_state;
  423|     25|          s.speed_costs = s.speed_costs + processed_states.back().speed_costs;
  424|       |
  425|     25|          border_states.emplace_back((int) (processed_states.size() - 1),
  426|     25|                                     op_ptr,
  427|     25|                                     s.color_state,
  428|     25|                                     s.speed_costs);
  429|     25|        }
  430|     50|      }
  431|    340|    }
  432|     10|  }
  433|       |
  434|      0|  return false;
  435|      5|}
_ZN23ColorConversionPipeline13convert_imageERKNSt3__110shared_ptrI14HeifPixelImageEEPK20heif_security_limits:
  452|      5|{
  453|      5|  std::shared_ptr<HeifPixelImage> in = input;
  454|      5|  std::shared_ptr<HeifPixelImage> out = in;
  455|       |
  456|      5|  for (const auto& step : m_conversion_steps) {
  ------------------
  |  Branch (456:25): [True: 5, False: 5]
  ------------------
  457|       |
  458|       |#if DEBUG_ME
  459|       |    std::cerr << "input spec: ";
  460|       |    print_spec(std::cerr, in);
  461|       |#endif
  462|       |
  463|      5|    auto outResult = step.operation->convert_colorspace(in, step.input_state, step.output_state, m_options, m_options_ext, limits);
  464|      5|    if (!outResult) {
  ------------------
  |  Branch (464:9): [True: 0, False: 5]
  ------------------
  465|      0|      return outResult.error();
  466|      0|    }
  467|      5|    else {
  468|      5|      out = *outResult;
  469|      5|    }
  470|       |
  471|       |    // copy metadata over to new image
  472|      5|    out->copy_metadata_from(*in);
  473|       |
  474|       |    // overwrite color profile nclx from color conversion
  475|      5|    out->set_color_profile_nclx(step.output_state.nclx);
  476|       |
  477|       |
  478|      5|    const auto& warnings = in->get_warnings();
  479|      5|    for (const auto& warning : warnings) {
  ------------------
  |  Branch (479:30): [True: 0, False: 5]
  ------------------
  480|      0|      out->add_warning(warning);
  481|      0|    }
  482|       |
  483|      5|    in = out;
  484|      5|  }
  485|       |
  486|      5|  return out;
  487|      5|}
_Z18convert_colorspaceRKNSt3__110shared_ptrI14HeifPixelImageEE15heif_colorspace11heif_chromaRK12nclx_profileiRK29heif_color_conversion_optionsPK33heif_color_conversion_options_extPK20heif_security_limits:
  498|      5|{
  499|      5|  std::unique_ptr<heif_color_conversion_options_ext, void(*)(heif_color_conversion_options_ext*)>
  500|      5|      options_ext(heif_color_conversion_options_ext_alloc(), heif_color_conversion_options_ext_free);
  501|       |
  502|      5|  heif_color_conversion_options_ext_copy(options_ext.get(), options_ext_optional);
  503|       |
  504|       |
  505|       |  // --- check that input image is valid
  506|       |
  507|      5|  uint32_t width = input->get_width();
  508|      5|  uint32_t height = input->get_height();
  509|       |
  510|       |  // alpha image should have full image resolution
  511|       |
  512|      5|  if (input->has_channel(heif_channel_Alpha)) {
  ------------------
  |  Branch (512:7): [True: 0, False: 5]
  ------------------
  513|      0|    if (input->get_width(heif_channel_Alpha) != width ||
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|        input->get_height(heif_channel_Alpha) != height) {
  ------------------
  |  Branch (514:9): [True: 0, False: 0]
  ------------------
  515|      0|      return Error::InternalError;
  516|      0|    }
  517|      0|  }
  518|       |
  519|       |  // check for valid target YCbCr chroma formats
  520|       |
  521|      5|  if (target_colorspace == heif_colorspace_YCbCr) {
  ------------------
  |  Branch (521:7): [True: 5, False: 0]
  ------------------
  522|      5|    if (target_chroma != heif_chroma_420 &&
  ------------------
  |  Branch (522:9): [True: 0, False: 5]
  ------------------
  523|      0|        target_chroma != heif_chroma_422 &&
  ------------------
  |  Branch (523:9): [True: 0, False: 0]
  ------------------
  524|      0|        target_chroma != heif_chroma_444) {
  ------------------
  |  Branch (524:9): [True: 0, False: 0]
  ------------------
  525|      0|      return Error::InternalError;
  526|      0|    }
  527|      5|  }
  528|       |
  529|       |  // --- prepare conversion
  530|       |
  531|      5|  ColorState input_state;
  532|      5|  input_state.colorspace = input->get_colorspace();
  533|      5|  input_state.chroma = input->get_chroma_format();
  534|      5|  input_state.has_alpha = input->has_channel(heif_channel_Alpha) || is_interleaved_with_alpha(input->get_chroma_format());
  ------------------
  |  Branch (534:27): [True: 0, False: 5]
  |  Branch (534:69): [True: 0, False: 5]
  ------------------
  535|      5|  if (input->has_nclx_color_profile()) {
  ------------------
  |  Branch (535:7): [True: 1, False: 4]
  ------------------
  536|      1|    input_state.nclx = input->get_color_profile_nclx();
  537|      1|  }
  538|       |
  539|      5|  input_state.nclx.replace_undefined_values_with_sRGB_defaults();
  540|       |
  541|      5|  std::set<enum heif_channel> channels = input->get_channel_set();
  542|      5|  assert(!channels.empty());
  ------------------
  |  Branch (542:3): [True: 5, False: 0]
  ------------------
  543|      5|  input_state.bits_per_pixel = input->get_bits_per_pixel(*(channels.begin()));
  544|       |
  545|      5|  if (input_state.has_alpha && input->has_channel(heif_channel_Alpha)) {
  ------------------
  |  Branch (545:7): [True: 0, False: 5]
  |  Branch (545:32): [True: 0, False: 0]
  ------------------
  546|      0|    input_state.alpha_bits_per_pixel = input->get_bits_per_pixel(heif_channel_Alpha);
  547|      0|  }
  548|       |
  549|      5|  ColorState output_state = input_state;
  550|      5|  output_state.colorspace = target_colorspace;
  551|      5|  output_state.chroma = target_chroma;
  552|      5|  output_state.nclx = target_profile;
  553|       |
  554|       |  // If some output nclx values are unspecified, set them to the same as the input.
  555|       |
  556|      5|  if (output_state.nclx.get_matrix_coefficients() == heif_matrix_coefficients_unspecified) {
  ------------------
  |  Branch (556:7): [True: 0, False: 5]
  ------------------
  557|      0|    output_state.nclx.set_matrix_coefficients(input_state.nclx.get_matrix_coefficients());
  558|      0|  }
  559|       |
  560|      5|  if (output_state.nclx.get_colour_primaries() == heif_color_primaries_unspecified) {
  ------------------
  |  Branch (560:7): [True: 0, False: 5]
  ------------------
  561|      0|    output_state.nclx.set_colour_primaries(input_state.nclx.get_colour_primaries());
  562|      0|  }
  563|       |
  564|      5|  if (output_state.nclx.get_transfer_characteristics() == heif_transfer_characteristic_unspecified) {
  ------------------
  |  Branch (564:7): [True: 0, False: 5]
  ------------------
  565|      0|    output_state.nclx.set_transfer_characteristics(input_state.nclx.get_transfer_characteristics());
  566|      0|  }
  567|       |
  568|       |  // If we convert to an interleaved format, we want alpha only if present in the
  569|       |  // interleaved output format.
  570|       |  // For planar formats, we include an alpha plane when included in the input.
  571|       |
  572|      5|  if (num_interleaved_components_per_plane(target_chroma) > 1) {
  ------------------
  |  Branch (572:7): [True: 0, False: 5]
  ------------------
  573|      0|    output_state.has_alpha = is_interleaved_with_alpha(target_chroma);
  574|      0|  }
  575|      5|  else {
  576|      5|    if (options_ext->alpha_composition_mode != heif_alpha_composition_mode_none) {
  ------------------
  |  Branch (576:9): [True: 0, False: 5]
  ------------------
  577|      0|      output_state.has_alpha = false;
  578|      0|    }
  579|      5|    else {
  580|      5|      output_state.has_alpha = input_state.has_alpha;
  581|      5|    }
  582|      5|  }
  583|       |
  584|      5|  if (output_bpp) {
  ------------------
  |  Branch (584:7): [True: 0, False: 5]
  ------------------
  585|      0|    output_state.bits_per_pixel = output_bpp;
  586|      0|  }
  587|       |
  588|       |
  589|       |  // interleaved RGB formats always have to be 8-bit
  590|       |
  591|      5|  if (target_chroma == heif_chroma_interleaved_RGB ||
  ------------------
  |  Branch (591:7): [True: 0, False: 5]
  ------------------
  592|      5|      target_chroma == heif_chroma_interleaved_RGBA) {
  ------------------
  |  Branch (592:7): [True: 0, False: 5]
  ------------------
  593|      0|    output_state.bits_per_pixel = 8;
  594|      0|  }
  595|       |
  596|       |  // interleaved RRGGBB formats have to be >8-bit.
  597|       |  // If we don't know a target bit-depth, use 10 bit.
  598|       |
  599|      5|  if ((target_chroma == heif_chroma_interleaved_RRGGBB_LE ||
  ------------------
  |  Branch (599:8): [True: 0, False: 5]
  ------------------
  600|      5|       target_chroma == heif_chroma_interleaved_RRGGBB_BE ||
  ------------------
  |  Branch (600:8): [True: 0, False: 5]
  ------------------
  601|      5|       target_chroma == heif_chroma_interleaved_RRGGBBAA_LE ||
  ------------------
  |  Branch (601:8): [True: 0, False: 5]
  ------------------
  602|      5|       target_chroma == heif_chroma_interleaved_RRGGBBAA_BE) &&
  ------------------
  |  Branch (602:8): [True: 0, False: 5]
  ------------------
  603|      0|      output_state.bits_per_pixel <= 8) {
  ------------------
  |  Branch (603:7): [True: 0, False: 0]
  ------------------
  604|      0|    output_state.bits_per_pixel = 10;
  605|      0|  }
  606|       |
  607|       |  // Output alpha should always match the output color BPP
  608|      5|  output_state.alpha_bits_per_pixel = output_state.bits_per_pixel;
  609|       |
  610|      5|  ColorConversionPipeline pipeline;
  611|      5|  bool success = pipeline.construct_pipeline(input_state, output_state, options, *options_ext);
  612|      5|  if (!success) {
  ------------------
  |  Branch (612:7): [True: 0, False: 5]
  ------------------
  613|      0|    return Error{heif_error_Unsupported_feature,
  614|      0|                 heif_suberror_Unsupported_color_conversion};
  615|      0|  }
  616|       |
  617|      5|  if (pipeline.is_nop()) {
  ------------------
  |  Branch (617:7): [True: 0, False: 5]
  ------------------
  618|      0|    return input;
  619|      0|  }
  620|      5|  else {
  621|      5|    return pipeline.convert_image(input, limits);
  622|      5|  }
  623|      5|}
_ZN4NodeC2EiRKNSt3__110shared_ptrI24ColorConversionOperationEERK10ColorStatei:
  188|     30|  {
  189|     30|    prev_processed_idx = prev;
  190|     30|    op = _op;
  191|       |    //input_state = _input_state;
  192|     30|    output_state = _output_state;
  193|     30|    speed_costs = _speed_cost;
  194|     30|  }

_ZNK10ColorState24get_alpha_bits_per_pixelEv:
   49|     10|  int get_alpha_bits_per_pixel() const { return alpha_bits_per_pixel ? alpha_bits_per_pixel : bits_per_pixel; }
  ------------------
  |  Branch (49:49): [True: 0, False: 10]
  ------------------
_ZN18ColorStateWithCostC2E10ColorStatei:
   70|     50|  ColorStateWithCost(ColorState c, int s) : color_state(std::move(c)), speed_costs(s) {}
_ZNK23ColorConversionPipeline6is_nopEv:
  109|      5|  bool is_nop() const { return m_conversion_steps.empty(); }
_ZN10ColorStateC2Ev:
   43|     85|  ColorState() = default;

_ZNK16Op_to_hdr_planes22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   30|     10|{
   31|     10|  if ((input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|     20|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (31:8): [True: 10, False: 0]
  ------------------
   32|     10|       input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (32:8): [True: 10, False: 0]
  ------------------
   33|     10|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (33:8): [True: 10, False: 0]
  ------------------
   34|     10|       input_state.chroma != heif_chroma_444) ||
  ------------------
  |  Branch (34:8): [True: 5, False: 5]
  ------------------
   35|      5|      input_state.bits_per_pixel != 8) { // TODO: support for <8 bpp
  ------------------
  |  Branch (35:7): [True: 0, False: 5]
  ------------------
   36|      5|    return {};
   37|      5|  }
   38|       |
   39|      5|  std::vector<ColorStateWithCost> states;
   40|       |
   41|      5|  ColorState output_state;
   42|       |
   43|       |  // --- increase bit depth
   44|       |
   45|      5|  output_state = input_state;
   46|      5|  output_state.bits_per_pixel = target_state.bits_per_pixel;
   47|      5|  output_state.alpha_bits_per_pixel = target_state.bits_per_pixel;
   48|       |
   49|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   50|       |
   51|      5|  return states;
   52|     10|}
_ZNK16Op_to_sdr_planes22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  117|     10|{
  118|     10|  if ((input_state.chroma != heif_chroma_monochrome &&
  ------------------
  |  |   75|     20|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (118:8): [True: 10, False: 0]
  ------------------
  119|     10|       input_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (119:8): [True: 10, False: 0]
  ------------------
  120|     10|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (120:8): [True: 10, False: 0]
  ------------------
  121|     10|       input_state.chroma != heif_chroma_444) ||
  ------------------
  |  Branch (121:8): [True: 5, False: 5]
  ------------------
  122|     10|      input_state.bits_per_pixel == 8) {
  ------------------
  |  Branch (122:7): [True: 5, False: 0]
  ------------------
  123|     10|    return {};
  124|     10|  }
  125|       |
  126|      0|  if (target_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (126:7): [True: 0, False: 0]
  ------------------
  127|      0|    return {};
  128|      0|  }
  129|       |
  130|      0|  std::vector<ColorStateWithCost> states;
  131|       |
  132|      0|  ColorState output_state;
  133|       |
  134|       |  // --- output bit depth = 8
  135|       |
  136|      0|  output_state = input_state;
  137|      0|  output_state.bits_per_pixel = 8;
  138|      0|  output_state.alpha_bits_per_pixel = 8;
  139|       |
  140|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  141|       |
  142|      0|  return states;
  143|      0|}

_ZNK19Op_mono_to_YCbCr42022state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   30|     10|{
   31|     10|  if (input_state.colorspace != heif_colorspace_monochrome ||
  ------------------
  |  Branch (31:7): [True: 10, False: 0]
  ------------------
   32|     10|      input_state.chroma != heif_chroma_monochrome) {
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (32:7): [True: 0, False: 0]
  ------------------
   33|     10|    return {};
   34|     10|  }
   35|       |
   36|      0|  std::vector<ColorStateWithCost> states;
   37|       |
   38|      0|  ColorState output_state;
   39|       |
   40|       |  // --- convert to YCbCr420
   41|       |
   42|      0|  output_state.colorspace = heif_colorspace_YCbCr;
   43|      0|  output_state.chroma = heif_chroma_420;
   44|      0|  output_state.has_alpha = input_state.has_alpha;
   45|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
   46|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
   47|       |
   48|      0|  states.emplace_back(output_state, SpeedCosts_OptimizedSoftware);
   49|       |
   50|      0|  return states;
   51|     10|}
_ZNK19Op_mono_to_RGB24_3222state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  170|     10|{
  171|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  172|       |
  173|     10|  if (input_state.colorspace != heif_colorspace_monochrome ||
  ------------------
  |  Branch (173:7): [True: 10, False: 0]
  ------------------
  174|      0|      input_state.chroma != heif_chroma_monochrome ||
  ------------------
  |  |   75|     10|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (174:7): [True: 0, False: 0]
  ------------------
  175|     10|      input_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (175:7): [True: 0, False: 0]
  ------------------
  176|     10|    return {};
  177|     10|  }
  178|       |
  179|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (179:7): [True: 0, False: 0]
  |  Branch (179:32): [True: 0, False: 0]
  ------------------
  180|      0|    return {};
  181|      0|  }
  182|       |
  183|      0|  std::vector<ColorStateWithCost> states;
  184|       |
  185|      0|  ColorState output_state;
  186|       |
  187|       |  // --- convert to RGB24
  188|       |
  189|      0|  if (input_state.has_alpha == false) {
  ------------------
  |  Branch (189:7): [True: 0, False: 0]
  ------------------
  190|      0|    output_state.colorspace = heif_colorspace_RGB;
  191|      0|    output_state.chroma = heif_chroma_interleaved_RGB;
  192|      0|    output_state.has_alpha = false;
  193|      0|    output_state.bits_per_pixel = 8;
  194|       |
  195|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
  196|      0|  }
  197|       |
  198|       |
  199|       |  // --- convert to RGB32
  200|       |
  201|      0|  output_state.colorspace = heif_colorspace_RGB;
  202|      0|  output_state.chroma = heif_chroma_interleaved_RGBA;
  203|      0|  output_state.has_alpha = true;
  204|      0|  output_state.bits_per_pixel = 8;
  205|       |
  206|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  207|       |
  208|      0|  return states;
  209|      0|}

_ZNK18Op_RGB_to_RGB24_3222state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   33|     10|{
   34|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (34:7): [True: 0, False: 10]
  ------------------
   35|     10|      input_state.chroma != heif_chroma_444 ||
  ------------------
  |  Branch (35:7): [True: 5, False: 5]
  ------------------
   36|      5|      input_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (36:7): [True: 0, False: 5]
  ------------------
   37|      5|    return {};
   38|      5|  }
   39|       |
   40|      5|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (40:7): [True: 0, False: 5]
  |  Branch (40:32): [True: 0, False: 0]
  ------------------
   41|      0|    return {};
   42|      0|  }
   43|       |
   44|      5|  std::vector<ColorStateWithCost> states;
   45|       |
   46|      5|  ColorState output_state;
   47|       |  //ColorConversionCosts costs;
   48|       |
   49|       |  // --- convert to RGBA (with alpha)
   50|       |
   51|      5|  output_state.colorspace = heif_colorspace_RGB;
   52|      5|  output_state.chroma = heif_chroma_interleaved_RGBA;
   53|      5|  output_state.has_alpha = true;
   54|      5|  output_state.bits_per_pixel = 8;
   55|       |
   56|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   57|       |
   58|       |  // --- convert to RGB (without alpha)
   59|       |
   60|      5|  output_state.colorspace = heif_colorspace_RGB;
   61|      5|  output_state.chroma = heif_chroma_interleaved_RGB;
   62|      5|  output_state.has_alpha = false;
   63|      5|  output_state.bits_per_pixel = 8;
   64|       |
   65|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   66|       |
   67|      5|  return states;
   68|      5|}
_ZNK25Op_RGB_HDR_to_RRGGBBaa_BE22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  158|     10|{
  159|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  160|       |
  161|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (161:7): [True: 0, False: 10]
  ------------------
  162|     10|      input_state.chroma != heif_chroma_444 ||
  ------------------
  |  Branch (162:7): [True: 5, False: 5]
  ------------------
  163|     10|      input_state.bits_per_pixel <= 8) {
  ------------------
  |  Branch (163:7): [True: 5, False: 0]
  ------------------
  164|     10|    return {};
  165|     10|  }
  166|       |
  167|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (167:7): [True: 0, False: 0]
  |  Branch (167:32): [True: 0, False: 0]
  ------------------
  168|      0|    return {};
  169|      0|  }
  170|       |
  171|      0|  std::vector<ColorStateWithCost> states;
  172|       |
  173|      0|  ColorState output_state;
  174|       |
  175|       |  // --- convert to RRGGBB_BE
  176|       |
  177|      0|  if (input_state.has_alpha == false) {
  ------------------
  |  Branch (177:7): [True: 0, False: 0]
  ------------------
  178|      0|    output_state.colorspace = heif_colorspace_RGB;
  179|      0|    output_state.chroma = heif_chroma_interleaved_RRGGBB_BE;
  180|      0|    output_state.has_alpha = false;
  181|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
  182|       |
  183|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
  184|      0|  }
  185|       |
  186|       |
  187|       |  // --- convert to RRGGBBAA_BE
  188|       |
  189|      0|  output_state.colorspace = heif_colorspace_RGB;
  190|      0|  output_state.chroma = heif_chroma_interleaved_RRGGBBAA_BE;
  191|      0|  output_state.has_alpha = true;
  192|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  193|       |
  194|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  195|       |
  196|       |
  197|      0|  return states;
  198|      0|}
_ZNK21Op_RGB_to_RRGGBBaa_BE22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  300|     10|{
  301|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  302|       |
  303|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (303:7): [True: 0, False: 10]
  ------------------
  304|     10|      input_state.chroma != heif_chroma_444 ||
  ------------------
  |  Branch (304:7): [True: 5, False: 5]
  ------------------
  305|      5|      input_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (305:7): [True: 0, False: 5]
  ------------------
  306|      5|    return {};
  307|      5|  }
  308|       |
  309|      5|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (309:7): [True: 0, False: 5]
  |  Branch (309:32): [True: 0, False: 0]
  ------------------
  310|      0|    return {};
  311|      0|  }
  312|       |
  313|      5|  std::vector<ColorStateWithCost> states;
  314|       |
  315|      5|  ColorState output_state;
  316|       |
  317|       |  // --- convert to RRGGBB_BE
  318|       |
  319|      5|  if (input_state.has_alpha == false) {
  ------------------
  |  Branch (319:7): [True: 5, False: 0]
  ------------------
  320|      5|    output_state.colorspace = heif_colorspace_RGB;
  321|      5|    output_state.chroma = heif_chroma_interleaved_RRGGBB_BE;
  322|      5|    output_state.has_alpha = false;
  323|      5|    output_state.bits_per_pixel = input_state.bits_per_pixel;
  324|       |
  325|      5|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
  326|      5|  }
  327|       |
  328|       |
  329|       |  // --- convert to RRGGBBAA_BE
  330|       |
  331|      5|  output_state.colorspace = heif_colorspace_RGB;
  332|      5|  output_state.chroma = heif_chroma_interleaved_RRGGBBAA_BE;
  333|      5|  output_state.has_alpha = true;
  334|      5|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  335|       |
  336|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  337|       |
  338|      5|  return states;
  339|      5|}
_ZNK25Op_RRGGBBaa_BE_to_RGB_HDR22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  435|     10|{
  436|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  437|       |
  438|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (438:7): [True: 0, False: 10]
  ------------------
  439|     10|      (input_state.chroma != heif_chroma_interleaved_RRGGBB_BE &&
  ------------------
  |  Branch (439:8): [True: 10, False: 0]
  ------------------
  440|     10|       input_state.chroma != heif_chroma_interleaved_RRGGBBAA_BE) ||
  ------------------
  |  Branch (440:8): [True: 10, False: 0]
  ------------------
  441|     10|      input_state.bits_per_pixel <= 8) {
  ------------------
  |  Branch (441:7): [True: 0, False: 0]
  ------------------
  442|     10|    return {};
  443|     10|  }
  444|       |
  445|      0|  std::vector<ColorStateWithCost> states;
  446|       |
  447|      0|  ColorState output_state;
  448|       |
  449|       |  // --- convert to RRGGBB_BE
  450|       |
  451|      0|  output_state.colorspace = heif_colorspace_RGB;
  452|      0|  output_state.chroma = heif_chroma_444;
  453|      0|  output_state.has_alpha = target_state.has_alpha;
  454|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  455|      0|  output_state.alpha_bits_per_pixel = input_state.bits_per_pixel;
  456|       |
  457|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  458|       |
  459|      0|  return states;
  460|     10|}
_ZNK18Op_RGB24_32_to_RGB22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  552|     10|{
  553|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  554|       |
  555|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (555:7): [True: 0, False: 10]
  ------------------
  556|     10|      (input_state.chroma != heif_chroma_interleaved_RGB &&
  ------------------
  |  Branch (556:8): [True: 10, False: 0]
  ------------------
  557|     10|       input_state.chroma != heif_chroma_interleaved_RGBA) ||
  ------------------
  |  Branch (557:8): [True: 5, False: 5]
  ------------------
  558|      5|      input_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (558:7): [True: 0, False: 5]
  ------------------
  559|      5|    return {};
  560|      5|  }
  561|       |
  562|      5|  std::vector<ColorStateWithCost> states;
  563|       |
  564|      5|  ColorState output_state;
  565|       |
  566|       |  // --- convert to planar RGB
  567|       |
  568|      5|  output_state.colorspace = heif_colorspace_RGB;
  569|      5|  output_state.chroma = heif_chroma_444;
  570|      5|  output_state.has_alpha = target_state.has_alpha;
  571|      5|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  572|      5|  output_state.alpha_bits_per_pixel = input_state.bits_per_pixel;
  573|       |
  574|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  575|       |
  576|      5|  return states;
  577|     10|}
_ZNK27Op_RRGGBBaa_swap_endianness22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  651|     10|{
  652|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  653|       |
  654|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (654:7): [True: 0, False: 10]
  ------------------
  655|     10|      (input_state.chroma != heif_chroma_interleaved_RRGGBB_LE &&
  ------------------
  |  Branch (655:8): [True: 10, False: 0]
  ------------------
  656|     10|       input_state.chroma != heif_chroma_interleaved_RRGGBB_BE &&
  ------------------
  |  Branch (656:8): [True: 10, False: 0]
  ------------------
  657|     10|       input_state.chroma != heif_chroma_interleaved_RRGGBBAA_LE &&
  ------------------
  |  Branch (657:8): [True: 10, False: 0]
  ------------------
  658|     10|       input_state.chroma != heif_chroma_interleaved_RRGGBBAA_BE)) {
  ------------------
  |  Branch (658:8): [True: 10, False: 0]
  ------------------
  659|     10|    return {};
  660|     10|  }
  661|       |
  662|      0|  std::vector<ColorStateWithCost> states;
  663|       |
  664|      0|  ColorState output_state;
  665|       |
  666|       |  // --- swap RRGGBB
  667|       |
  668|      0|  if (input_state.chroma == heif_chroma_interleaved_RRGGBB_LE ||
  ------------------
  |  Branch (668:7): [True: 0, False: 0]
  ------------------
  669|      0|      input_state.chroma == heif_chroma_interleaved_RRGGBB_BE) {
  ------------------
  |  Branch (669:7): [True: 0, False: 0]
  ------------------
  670|      0|    output_state.colorspace = heif_colorspace_RGB;
  671|       |
  672|      0|    if (input_state.chroma == heif_chroma_interleaved_RRGGBB_LE) {
  ------------------
  |  Branch (672:9): [True: 0, False: 0]
  ------------------
  673|      0|      output_state.chroma = heif_chroma_interleaved_RRGGBB_BE;
  674|      0|    }
  675|      0|    else {
  676|      0|      output_state.chroma = heif_chroma_interleaved_RRGGBB_LE;
  677|      0|    }
  678|       |
  679|      0|    output_state.has_alpha = false;
  680|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
  681|       |
  682|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
  683|      0|  }
  684|       |
  685|       |
  686|       |  // --- swap RRGGBBAA
  687|       |
  688|      0|  if (input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE ||
  ------------------
  |  Branch (688:7): [True: 0, False: 0]
  ------------------
  689|      0|      input_state.chroma == heif_chroma_interleaved_RRGGBBAA_BE) {
  ------------------
  |  Branch (689:7): [True: 0, False: 0]
  ------------------
  690|      0|    output_state.colorspace = heif_colorspace_RGB;
  691|       |
  692|      0|    if (input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      0|      output_state.chroma = heif_chroma_interleaved_RRGGBBAA_BE;
  694|      0|    }
  695|      0|    else {
  696|      0|      output_state.chroma = heif_chroma_interleaved_RRGGBBAA_LE;
  697|      0|    }
  698|       |
  699|      0|    output_state.has_alpha = true;
  700|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
  701|       |
  702|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
  703|      0|  }
  704|       |
  705|      0|  return states;
  706|     10|}

_ZNK15Op_RGB_to_YCbCrIhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   36|     10|{
   37|     10|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   38|       |
   39|     10|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (39:7): [True: 0, False: 10]
  ------------------
   40|      0|    return {};
   41|      0|  }
   42|       |
   43|       |  // TODO: add support for <8 bpp
   44|     10|  if (input_state.bits_per_pixel < 8) {
  ------------------
  |  Branch (44:7): [True: 0, False: 10]
  ------------------
   45|      0|    return {};
   46|      0|  }
   47|       |
   48|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (48:7): [True: 0, False: 10]
  ------------------
   49|     10|      input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (49:7): [True: 5, False: 5]
  ------------------
   50|      5|    return {};
   51|      5|  }
   52|       |
   53|      5|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (53:7): [True: 0, False: 5]
  |  Branch (53:32): [True: 0, False: 0]
  ------------------
   54|      0|    return {};
   55|      0|  }
   56|       |
   57|      5|  int matrix = target_state.nclx.get_matrix_coefficients();
   58|      5|  if (matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (58:7): [True: 0, False: 5]
  |  Branch (58:23): [True: 0, False: 5]
  ------------------
   59|      0|    return {};
   60|      0|  }
   61|       |  // TODO: matrix == 10 (BT.2020 CL) currently falls through and is encoded as if it were
   62|       |  //   BT.2020 NCL. A correct CL path needs OETF application before deriving Y'C, not the
   63|       |  //   linear matrix below.
   64|       |
   65|      5|  std::vector<ColorStateWithCost> states;
   66|       |
   67|      5|  ColorState output_state;
   68|       |
   69|       |  // --- convert to YCbCr
   70|       |
   71|       |  // This Op only implements the nearest-neighbor downsampling algorithm, but it can still convert to 4:4:4.
   72|       |
   73|      5|  if (target_state.chroma != heif_chroma_444 &&
  ------------------
  |  Branch (73:7): [True: 5, False: 0]
  ------------------
   74|      5|      (options.preferred_chroma_downsampling_algorithm == heif_chroma_downsampling_nearest_neighbor ||
  ------------------
  |  Branch (74:8): [True: 0, False: 5]
  ------------------
   75|      5|       !options.only_use_preferred_chroma_algorithm)) {
  ------------------
  |  Branch (75:8): [True: 5, False: 0]
  ------------------
   76|       |
   77|      5|    output_state.colorspace = heif_colorspace_YCbCr;
   78|      5|    output_state.chroma = target_state.chroma;
   79|      5|    output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   80|      5|    output_state.bits_per_pixel = input_state.bits_per_pixel;
   81|      5|    output_state.nclx = target_state.nclx;
   82|       |
   83|      5|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
   84|      5|  }
   85|      0|  else {
   86|       |    // --- convert to YCbCr 4:4:4
   87|       |
   88|      0|    output_state.colorspace = heif_colorspace_YCbCr;
   89|      0|    output_state.chroma = heif_chroma_444;
   90|      0|    output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   91|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
   92|      0|    output_state.nclx = target_state.nclx;
   93|       |
   94|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
   95|      0|  }
   96|       |
   97|      5|  return states;
   98|      5|}
_ZNK15Op_RGB_to_YCbCrIhE18convert_colorspaceERKNSt3__110shared_ptrIK14HeifPixelImageEERK10ColorStateSA_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_extPK20heif_security_limits:
  108|      5|{
  109|      5|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
  110|       |
  111|      5|  uint32_t width = input->get_width();
  112|      5|  uint32_t height = input->get_height();
  113|       |
  114|      5|  heif_chroma chroma = target_state.chroma;
  115|      5|  int subH = chroma_h_subsampling(chroma);
  116|      5|  int subV = chroma_v_subsampling(chroma);
  117|       |
  118|      5|  int bpp = input->get_bits_per_pixel(heif_channel_R);
  119|      5|  if (bpp < 8 || (bpp > 8) != hdr) {
  ------------------
  |  Branch (119:7): [True: 0, False: 5]
  |  Branch (119:18): [True: 0, False: 5]
  ------------------
  120|      0|    return Error::InternalError;
  121|      0|  }
  122|       |
  123|      5|  bool has_alpha = input->has_channel(heif_channel_Alpha);
  124|       |
  125|      5|  if (has_alpha && input->get_bits_per_pixel(heif_channel_Alpha) != bpp) {
  ------------------
  |  Branch (125:7): [True: 0, False: 5]
  |  Branch (125:20): [True: 0, False: 0]
  ------------------
  126|      0|    return Error::InternalError;
  127|      0|  }
  128|       |
  129|      5|  auto outimg = std::make_shared<HeifPixelImage>();
  130|       |
  131|      5|  outimg->create(width, height, heif_colorspace_YCbCr, chroma);
  132|       |
  133|      5|  uint32_t cwidth = (width + subH - 1) / subH;
  134|      5|  uint32_t cheight = (height + subV - 1) / subV;
  135|       |
  136|      5|  if (auto err = outimg->add_channel(heif_channel_Y, width, height, bpp, limits) ||
  ------------------
  |  Branch (136:12): [True: 0, False: 5]
  ------------------
  137|      5|                 outimg->add_channel(heif_channel_Cb, cwidth, cheight, bpp, limits) ||
  138|      5|                 outimg->add_channel(heif_channel_Cr, cwidth, cheight, bpp, limits)) {
  139|      0|    return err;
  140|      0|  }
  141|       |
  142|      5|  if (has_alpha) {
  ------------------
  |  Branch (142:7): [True: 0, False: 5]
  ------------------
  143|      0|    if (auto err = outimg->add_channel(heif_channel_Alpha, width, height, bpp, limits)) {
  ------------------
  |  Branch (143:14): [True: 0, False: 0]
  ------------------
  144|      0|      return err;
  145|      0|    }
  146|      0|  }
  147|       |
  148|      5|  const Pixel* in_r, * in_g, * in_b;
  149|      5|  size_t in_r_stride = 0, in_g_stride = 0, in_b_stride = 0, in_a_stride = 0;
  150|       |
  151|      5|  Pixel* out_y, * out_cb, * out_cr;
  152|      5|  size_t out_y_stride = 0, out_cb_stride = 0, out_cr_stride = 0, out_a_stride = 0;
  153|       |
  154|      5|  in_r = (const Pixel*) input->get_channel_memory(heif_channel_R, &in_r_stride);
  155|      5|  in_g = (const Pixel*) input->get_channel_memory(heif_channel_G, &in_g_stride);
  156|      5|  in_b = (const Pixel*) input->get_channel_memory(heif_channel_B, &in_b_stride);
  157|      5|  out_y = (Pixel*) outimg->get_channel_memory(heif_channel_Y, &out_y_stride);
  158|      5|  out_cb = (Pixel*) outimg->get_channel_memory(heif_channel_Cb, &out_cb_stride);
  159|      5|  out_cr = (Pixel*) outimg->get_channel_memory(heif_channel_Cr, &out_cr_stride);
  160|       |
  161|      5|  const uint8_t* in_a;
  162|      5|  uint8_t* out_a;
  163|       |
  164|      5|  if (has_alpha) {
  ------------------
  |  Branch (164:7): [True: 0, False: 5]
  ------------------
  165|      0|    in_a = input->get_channel_memory(heif_channel_Alpha, &in_a_stride);
  166|      0|    out_a = outimg->get_channel_memory(heif_channel_Alpha, &out_a_stride);
  167|      0|  }
  168|      5|  else {
  169|      5|    in_a = nullptr;
  170|      5|    out_a = nullptr;
  171|      5|  }
  172|       |
  173|      5|  if (hdr) {
  ------------------
  |  Branch (173:7): [True: 0, False: 5]
  ------------------
  174|      0|    in_r_stride /= 2;
  175|      0|    in_g_stride /= 2;
  176|      0|    in_b_stride /= 2;
  177|      0|    out_y_stride /= 2;
  178|      0|    out_cb_stride /= 2;
  179|      0|    out_cr_stride /= 2;
  180|      0|  }
  181|       |
  182|      5|  uint16_t halfRange = (uint16_t) (1 << (bpp - 1));
  183|      5|  int32_t fullRange = (1 << bpp) - 1;
  184|      5|  float limited_range_offset = static_cast<float>(16 << (bpp - 8));
  185|       |
  186|      5|  int matrix_coeffs = 2;
  187|      5|  RGB_to_YCbCr_coefficients coeffs = RGB_to_YCbCr_coefficients::defaults();
  188|      5|  bool full_range_flag = true;
  189|      5|  full_range_flag = target_state.nclx.get_full_range_flag();
  190|      5|  matrix_coeffs = target_state.nclx.get_matrix_coefficients();
  191|      5|  coeffs = get_RGB_to_YCbCr_coefficients(target_state.nclx.get_matrix_coefficients(),
  192|      5|                                         target_state.nclx.get_colour_primaries());
  193|       |
  194|      5|  uint32_t x, y;
  195|       |
  196|  1.12k|  for (y = 0; y < height; y++) {
  ------------------
  |  Branch (196:15): [True: 1.12k, False: 5]
  ------------------
  197|  3.14M|    for (x = 0; x < width; x++) {
  ------------------
  |  Branch (197:17): [True: 3.14M, False: 1.12k]
  ------------------
  198|  3.14M|      if (matrix_coeffs == 0) {
  ------------------
  |  Branch (198:11): [True: 0, False: 3.14M]
  ------------------
  199|      0|        if (full_range_flag) {
  ------------------
  |  Branch (199:13): [True: 0, False: 0]
  ------------------
  200|      0|          out_y[y * out_y_stride + x] = in_g[y * in_g_stride + x];
  201|      0|        }
  202|      0|        else {
  203|      0|          float v = (((in_g[y * in_g_stride + x] * 219.0f) / 256) + limited_range_offset);
  204|      0|          out_y[y * out_y_stride + x] = (Pixel) clip_f_u16(v, fullRange);
  205|      0|        }
  206|      0|      }
  207|  3.14M|      else if (matrix_coeffs == 8) {
  ------------------
  |  Branch (207:16): [True: 0, False: 3.14M]
  ------------------
  208|       |        // Note: this is the YCgCo transform for equal Y/C bit depths, H.273(2024) Eq.51-57.
  209|       |        // To avoid a loss in accuracy, input bit-depth must be extended by two bits.
  210|      0|        out_y[y * out_y_stride + x] = static_cast<Pixel>(in_g[y * in_g_stride + x] / 2 + (in_r[y * in_r_stride + x] + in_b[y * in_b_stride + x]) / 4);
  211|      0|      }
  212|  3.14M|      else {
  213|  3.14M|        float r = in_r[y * in_r_stride + x];
  214|  3.14M|        float g = in_g[y * in_g_stride + x];
  215|  3.14M|        float b = in_b[y * in_b_stride + x];
  216|       |
  217|  3.14M|        float v = r * coeffs.c[0][0] + g * coeffs.c[0][1] + b * coeffs.c[0][2];
  218|  3.14M|        if (!full_range_flag) {
  ------------------
  |  Branch (218:13): [True: 0, False: 3.14M]
  ------------------
  219|      0|          v = (((v * 219) / 256) + limited_range_offset);
  220|      0|        }
  221|       |
  222|  3.14M|        Pixel pix = (Pixel) clip_f_u16(v, fullRange);
  223|       |
  224|  3.14M|        out_y[y * out_y_stride + x] = pix;
  225|  3.14M|      }
  226|  3.14M|    }
  227|  1.12k|  }
  228|       |
  229|    565|  for (y = 0; y < height; y += subV) {
  ------------------
  |  Branch (229:15): [True: 560, False: 5]
  ------------------
  230|   787k|    for (x = 0; x < width; x += subH) {
  ------------------
  |  Branch (230:17): [True: 786k, False: 560]
  ------------------
  231|   786k|      if (matrix_coeffs == 0) {
  ------------------
  |  Branch (231:11): [True: 0, False: 786k]
  ------------------
  232|      0|        if (full_range_flag) {
  ------------------
  |  Branch (232:13): [True: 0, False: 0]
  ------------------
  233|      0|          out_cb[(y / subV) * out_cb_stride + (x / subH)] = in_b[y * in_b_stride + x];
  234|      0|          out_cr[(y / subV) * out_cb_stride + (x / subH)] = in_r[y * in_b_stride + x];
  235|      0|        }
  236|      0|        else {
  237|      0|          out_cb[(y / subV) * out_cb_stride + (x / subH)] = (Pixel) clip_f_u16(
  238|      0|              ((in_b[y * in_b_stride + x] * 224.0f) / 256) + limited_range_offset, fullRange);
  239|      0|          out_cr[(y / subV) * out_cb_stride + (x / subH)] = (Pixel) clip_f_u16(
  240|      0|              ((in_r[y * in_b_stride + x] * 224.0f) / 256) + limited_range_offset, fullRange);
  241|      0|        }
  242|      0|      }
  243|   786k|      else if (matrix_coeffs == 8) {
  ------------------
  |  Branch (243:16): [True: 0, False: 786k]
  ------------------
  244|       |        // Note: this is the YCgCo transform for equal Y/C bit depths, H.273(2024) Eq.51-57.
  245|       |        // To avoid a loss in accuracy, input bit-depth must be extended by two bits.
  246|      0|        out_cb[(y / subV) * out_cb_stride + (x / subH)] = static_cast<Pixel>(clip_int_u16(in_g[y * in_g_stride + x] / 2
  247|      0|                                                                                          - (in_r[y * in_r_stride + x] + in_b[y * in_b_stride + x]) / 4
  248|      0|                                                                                          + halfRange, (uint16_t) fullRange));
  249|      0|        out_cr[(y / subV) * out_cr_stride + (x / subH)] = static_cast<Pixel>(clip_int_u16((in_r[y * in_r_stride + x] - in_b[y * in_b_stride + x]) / 2
  250|      0|                                                                                          + halfRange, (uint16_t) fullRange));
  251|      0|      }
  252|   786k|      else {
  253|   786k|        float r = in_r[y * in_r_stride + x];
  254|   786k|        float g = in_g[y * in_g_stride + x];
  255|   786k|        float b = in_b[y * in_b_stride + x];
  256|       |
  257|   786k|        if (subH > 1 || subV > 1) {
  ------------------
  |  Branch (257:13): [True: 786k, False: 0]
  |  Branch (257:25): [True: 0, False: 0]
  ------------------
  258|   786k|          uint32_t x2 = (x + 1 < width && subH == 2 && subV == 2) ? x + 1 : x;  // subV==2 -> Do not center for 4:2:2 (see comment in Op_RGB24_32_to_YCbCr, github issue #521)
  ------------------
  |  Branch (258:26): [True: 786k, False: 512]
  |  Branch (258:43): [True: 786k, False: 0]
  |  Branch (258:56): [True: 786k, False: 0]
  ------------------
  259|   786k|          uint32_t y2 = (y + 1 < height && subV == 2) ? y + 1 : y;
  ------------------
  |  Branch (259:26): [True: 786k, False: 0]
  |  Branch (259:44): [True: 786k, False: 0]
  ------------------
  260|       |
  261|   786k|          r += in_r[y * in_r_stride + x2];
  262|   786k|          g += in_g[y * in_g_stride + x2];
  263|   786k|          b += in_b[y * in_b_stride + x2];
  264|       |
  265|   786k|          r += in_r[y2 * in_r_stride + x];
  266|   786k|          g += in_g[y2 * in_g_stride + x];
  267|   786k|          b += in_b[y2 * in_b_stride + x];
  268|       |
  269|   786k|          r += in_r[y2 * in_r_stride + x2];
  270|   786k|          g += in_g[y2 * in_g_stride + x2];
  271|   786k|          b += in_b[y2 * in_b_stride + x2];
  272|       |
  273|   786k|          r *= 0.25f;
  274|   786k|          g *= 0.25f;
  275|   786k|          b *= 0.25f;
  276|   786k|        }
  277|       |
  278|   786k|        float cb, cr;
  279|       |
  280|   786k|        cb = r * coeffs.c[1][0] + g * coeffs.c[1][1] + b * coeffs.c[1][2];
  281|   786k|        cr = r * coeffs.c[2][0] + g * coeffs.c[2][1] + b * coeffs.c[2][2];
  282|       |
  283|   786k|        if (!full_range_flag) {
  ------------------
  |  Branch (283:13): [True: 0, False: 786k]
  ------------------
  284|      0|          cb = (cb * 224) / 256;
  285|      0|          cr = (cr * 224) / 256;
  286|      0|        }
  287|       |
  288|   786k|        out_cb[(y / subV) * out_cb_stride + (x / subH)] = (Pixel) clip_f_u16(cb + halfRange, fullRange);
  289|   786k|        out_cr[(y / subV) * out_cr_stride + (x / subH)] = (Pixel) clip_f_u16(cr + halfRange, fullRange);
  290|   786k|      }
  291|   786k|    }
  292|    560|  }
  293|       |
  294|       |
  295|      5|  if (has_alpha) {
  ------------------
  |  Branch (295:7): [True: 0, False: 5]
  ------------------
  296|      0|    int bpp_a = input->get_bits_per_pixel(heif_channel_Alpha);
  297|      0|    int alphaCopyWidth = (bpp_a > 8 ? width * 2 : width);
  ------------------
  |  Branch (297:27): [True: 0, False: 0]
  ------------------
  298|       |
  299|      0|    for (y = 0; y < height; y++) {
  ------------------
  |  Branch (299:17): [True: 0, False: 0]
  ------------------
  300|      0|      memcpy(&out_a[y * out_a_stride], &in_a[y * in_a_stride], alphaCopyWidth);
  301|      0|    }
  302|      0|  }
  303|       |
  304|      5|  return outimg;
  305|      5|}
_ZNK15Op_RGB_to_YCbCrItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   36|     10|{
   37|     10|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   38|       |
   39|     10|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (39:7): [True: 10, False: 0]
  ------------------
   40|     10|    return {};
   41|     10|  }
   42|       |
   43|       |  // TODO: add support for <8 bpp
   44|      0|  if (input_state.bits_per_pixel < 8) {
  ------------------
  |  Branch (44:7): [True: 0, False: 0]
  ------------------
   45|      0|    return {};
   46|      0|  }
   47|       |
   48|      0|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  ------------------
   49|      0|      input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (49:7): [True: 0, False: 0]
  ------------------
   50|      0|    return {};
   51|      0|  }
   52|       |
   53|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (53:7): [True: 0, False: 0]
  |  Branch (53:32): [True: 0, False: 0]
  ------------------
   54|      0|    return {};
   55|      0|  }
   56|       |
   57|      0|  int matrix = target_state.nclx.get_matrix_coefficients();
   58|      0|  if (matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (58:7): [True: 0, False: 0]
  |  Branch (58:23): [True: 0, False: 0]
  ------------------
   59|      0|    return {};
   60|      0|  }
   61|       |  // TODO: matrix == 10 (BT.2020 CL) currently falls through and is encoded as if it were
   62|       |  //   BT.2020 NCL. A correct CL path needs OETF application before deriving Y'C, not the
   63|       |  //   linear matrix below.
   64|       |
   65|      0|  std::vector<ColorStateWithCost> states;
   66|       |
   67|      0|  ColorState output_state;
   68|       |
   69|       |  // --- convert to YCbCr
   70|       |
   71|       |  // This Op only implements the nearest-neighbor downsampling algorithm, but it can still convert to 4:4:4.
   72|       |
   73|      0|  if (target_state.chroma != heif_chroma_444 &&
  ------------------
  |  Branch (73:7): [True: 0, False: 0]
  ------------------
   74|      0|      (options.preferred_chroma_downsampling_algorithm == heif_chroma_downsampling_nearest_neighbor ||
  ------------------
  |  Branch (74:8): [True: 0, False: 0]
  ------------------
   75|      0|       !options.only_use_preferred_chroma_algorithm)) {
  ------------------
  |  Branch (75:8): [True: 0, False: 0]
  ------------------
   76|       |
   77|      0|    output_state.colorspace = heif_colorspace_YCbCr;
   78|      0|    output_state.chroma = target_state.chroma;
   79|      0|    output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   80|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
   81|      0|    output_state.nclx = target_state.nclx;
   82|       |
   83|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
   84|      0|  }
   85|      0|  else {
   86|       |    // --- convert to YCbCr 4:4:4
   87|       |
   88|      0|    output_state.colorspace = heif_colorspace_YCbCr;
   89|      0|    output_state.chroma = heif_chroma_444;
   90|      0|    output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   91|      0|    output_state.bits_per_pixel = input_state.bits_per_pixel;
   92|      0|    output_state.nclx = target_state.nclx;
   93|       |
   94|      0|    states.emplace_back(output_state, SpeedCosts_Unoptimized);
   95|      0|  }
   96|       |
   97|      0|  return states;
   98|      0|}
_ZNK27Op_RRGGBBxx_HDR_to_YCbCr42022state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  316|     10|{
  317|       |  // this Op only implements the nearest-neighbor algorithm
  318|       |
  319|     10|  if (target_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (319:7): [True: 10, False: 0]
  ------------------
  320|     10|    if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_nearest_neighbor &&
  ------------------
  |  Branch (320:9): [True: 10, False: 0]
  ------------------
  321|     10|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (321:9): [True: 0, False: 10]
  ------------------
  322|      0|      return {};
  323|      0|    }
  324|     10|  }
  325|       |
  326|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (326:7): [True: 0, False: 10]
  ------------------
  327|     10|      !(input_state.chroma == heif_chroma_interleaved_RRGGBB_BE ||
  ------------------
  |  Branch (327:9): [True: 0, False: 10]
  ------------------
  328|     10|        input_state.chroma == heif_chroma_interleaved_RRGGBB_LE ||
  ------------------
  |  Branch (328:9): [True: 0, False: 10]
  ------------------
  329|     10|        input_state.chroma == heif_chroma_interleaved_RRGGBBAA_BE ||
  ------------------
  |  Branch (329:9): [True: 0, False: 10]
  ------------------
  330|     10|        input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE) ||
  ------------------
  |  Branch (330:9): [True: 0, False: 10]
  ------------------
  331|     10|      input_state.bits_per_pixel <= 8) {
  ------------------
  |  Branch (331:7): [True: 0, False: 0]
  ------------------
  332|     10|    return {};
  333|     10|  }
  334|       |
  335|      0|  int matrix = target_state.nclx.get_matrix_coefficients();
  336|      0|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (336:7): [True: 0, False: 0]
  |  Branch (336:22): [True: 0, False: 0]
  |  Branch (336:37): [True: 0, False: 0]
  |  Branch (336:53): [True: 0, False: 0]
  ------------------
  337|      0|    return {};
  338|      0|  }
  339|      0|  if (!target_state.nclx.get_full_range_flag()) {
  ------------------
  |  Branch (339:7): [True: 0, False: 0]
  ------------------
  340|      0|    return {};
  341|      0|  }
  342|       |
  343|      0|  if (target_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (343:7): [True: 0, False: 0]
  ------------------
  344|      0|    return {};
  345|      0|  }
  346|       |
  347|       |
  348|      0|  std::vector<ColorStateWithCost> states;
  349|       |
  350|      0|  ColorState output_state;
  351|       |
  352|       |  // --- convert to YCbCr
  353|       |
  354|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  355|      0|  output_state.chroma = heif_chroma_420;
  356|      0|  output_state.has_alpha = input_state.has_alpha;  // we generate an alpha plane if the source contains data
  357|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  358|      0|  output_state.nclx = target_state.nclx;
  359|       |
  360|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  361|       |
  362|      0|  return states;
  363|      0|}
_ZNK20Op_RGB24_32_to_YCbCr22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  511|     10|{
  512|       |  // this Op only implements the nearest-neighbor algorithm
  513|       |
  514|     10|  if (target_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (514:7): [True: 10, False: 0]
  ------------------
  515|     10|    if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_nearest_neighbor &&
  ------------------
  |  Branch (515:9): [True: 10, False: 0]
  ------------------
  516|     10|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (516:9): [True: 0, False: 10]
  ------------------
  517|      0|      return {};
  518|      0|    }
  519|     10|  }
  520|       |
  521|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  522|       |
  523|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (523:7): [True: 0, False: 10]
  ------------------
  524|     10|      (input_state.chroma != heif_chroma_interleaved_RGB &&
  ------------------
  |  Branch (524:8): [True: 10, False: 0]
  ------------------
  525|     10|       input_state.chroma != heif_chroma_interleaved_RGBA)) {
  ------------------
  |  Branch (525:8): [True: 5, False: 5]
  ------------------
  526|      5|    return {};
  527|      5|  }
  528|       |
  529|      5|  if (target_state.chroma != heif_chroma_420 &&
  ------------------
  |  Branch (529:7): [True: 0, False: 5]
  ------------------
  530|      0|      target_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (530:7): [True: 0, False: 0]
  ------------------
  531|      0|      target_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (531:7): [True: 0, False: 0]
  ------------------
  532|      0|    return {};
  533|      0|  }
  534|       |
  535|      5|  int matrix = target_state.nclx.get_matrix_coefficients();
  536|      5|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (536:7): [True: 0, False: 5]
  |  Branch (536:22): [True: 0, False: 5]
  |  Branch (536:37): [True: 0, False: 5]
  |  Branch (536:53): [True: 0, False: 5]
  ------------------
  537|      0|    return {};
  538|      0|  }
  539|       |
  540|      5|  std::vector<ColorStateWithCost> states;
  541|       |
  542|      5|  ColorState output_state;
  543|       |
  544|      5|  output_state.colorspace = heif_colorspace_YCbCr;
  545|      5|  output_state.chroma = target_state.chroma;
  546|      5|  output_state.has_alpha = target_state.has_alpha;
  547|      5|  output_state.bits_per_pixel = 8;
  548|      5|  output_state.nclx = target_state.nclx;
  549|       |
  550|      5|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  551|       |
  552|      5|  return states;
  553|      5|}
_ZNK27Op_RGB24_32_to_YCbCr444_GBR22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  817|     10|{
  818|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  819|       |
  820|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (820:7): [True: 0, False: 10]
  ------------------
  821|     10|      (input_state.chroma != heif_chroma_interleaved_RGB &&
  ------------------
  |  Branch (821:8): [True: 10, False: 0]
  ------------------
  822|     10|       input_state.chroma != heif_chroma_interleaved_RGBA)) {
  ------------------
  |  Branch (822:8): [True: 5, False: 5]
  ------------------
  823|      5|    return {};
  824|      5|  }
  825|       |
  826|      5|  if (target_state.nclx.get_matrix_coefficients() != 0) {
  ------------------
  |  Branch (826:7): [True: 5, False: 0]
  ------------------
  827|      5|    return {};
  828|      5|  }
  829|       |
  830|      0|  if (!target_state.nclx.get_full_range_flag()) {
  ------------------
  |  Branch (830:7): [True: 0, False: 0]
  ------------------
  831|      0|    return {};
  832|      0|  }
  833|       |
  834|      0|  std::vector<ColorStateWithCost> states;
  835|       |
  836|      0|  ColorState output_state;
  837|       |
  838|      0|  output_state.colorspace = heif_colorspace_YCbCr;
  839|      0|  output_state.chroma = heif_chroma_444;
  840|      0|  output_state.has_alpha = target_state.has_alpha;
  841|      0|  output_state.bits_per_pixel = 8;
  842|      0|  output_state.nclx = target_state.nclx;
  843|       |
  844|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  845|       |
  846|      0|  return states;
  847|      0|}

_ZNK29Op_Any_RGB_to_YCbCr_420_Sharp22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   60|     10|{
   61|     10|#ifdef HAVE_LIBSHARPYUV
   62|       |  // this Op only implements the sharp_yuv algorithm
   63|       |
   64|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
   65|       |
   66|     10|  if (options.preferred_chroma_downsampling_algorithm != heif_chroma_downsampling_sharp_yuv &&
  ------------------
  |  Branch (66:7): [True: 10, False: 0]
  ------------------
   67|     10|      options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (67:7): [True: 0, False: 10]
  ------------------
   68|      0|    return {};
   69|      0|  }
   70|       |
   71|       |  // Only endianness matching the platform's is supported.
   72|     10|  const bool big_endian = PlatformIsBigEndian();
   73|     10|  const heif_chroma hdr_chroma = big_endian ? heif_chroma_interleaved_RRGGBB_BE
  ------------------
  |  Branch (73:34): [True: 0, False: 10]
  ------------------
   74|     10|                                            : heif_chroma_interleaved_RRGGBB_LE;
   75|     10|  const heif_chroma hdr_with_alpha_chroma =
   76|     10|      big_endian ? heif_chroma_interleaved_RRGGBBAA_BE
  ------------------
  |  Branch (76:7): [True: 0, False: 10]
  ------------------
   77|     10|                 : heif_chroma_interleaved_RRGGBBAA_LE;
   78|       |
   79|     10|  if (input_state.colorspace != heif_colorspace_RGB ||
  ------------------
  |  Branch (79:7): [True: 0, False: 10]
  ------------------
   80|     10|      (
   81|     10|          input_state.chroma != heif_chroma_444 &&  // Planar input.
  ------------------
  |  Branch (81:11): [True: 5, False: 5]
  ------------------
   82|      5|          input_state.chroma != heif_chroma_interleaved_RGB &&
  ------------------
  |  Branch (82:11): [True: 5, False: 0]
  ------------------
   83|      5|          input_state.chroma != heif_chroma_interleaved_RGBA &&
  ------------------
  |  Branch (83:11): [True: 0, False: 5]
  ------------------
   84|      0|          input_state.chroma != hdr_chroma &&
  ------------------
  |  Branch (84:11): [True: 0, False: 0]
  ------------------
   85|      0|          input_state.chroma != hdr_with_alpha_chroma)) {
  ------------------
  |  Branch (85:11): [True: 0, False: 0]
  ------------------
   86|      0|    return {};
   87|      0|  }
   88|       |
   89|     10|  if (input_state.bits_per_pixel != 8 && input_state.bits_per_pixel != 10 &&
  ------------------
  |  Branch (89:7): [True: 0, False: 10]
  |  Branch (89:42): [True: 0, False: 0]
  ------------------
   90|      0|      input_state.bits_per_pixel != 12 && input_state.bits_per_pixel != 16) {
  ------------------
  |  Branch (90:7): [True: 0, False: 0]
  |  Branch (90:43): [True: 0, False: 0]
  ------------------
   91|      0|    return {};
   92|      0|  }
   93|       |
   94|     10|  if (target_state.bits_per_pixel != 8 && target_state.bits_per_pixel != 10 &&
  ------------------
  |  Branch (94:7): [True: 0, False: 10]
  |  Branch (94:43): [True: 0, False: 0]
  ------------------
   95|      0|      target_state.bits_per_pixel != 12) {
  ------------------
  |  Branch (95:7): [True: 0, False: 0]
  ------------------
   96|      0|    return {};
   97|      0|  }
   98|       |
   99|     10|  if (target_state.chroma != heif_chroma_420) {
  ------------------
  |  Branch (99:7): [True: 0, False: 10]
  ------------------
  100|      0|    return {};
  101|      0|  }
  102|       |
  103|     10|  int matrix = target_state.nclx.get_matrix_coefficients();
  104|     10|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (104:7): [True: 0, False: 10]
  |  Branch (104:22): [True: 0, False: 10]
  |  Branch (104:37): [True: 0, False: 10]
  |  Branch (104:53): [True: 0, False: 10]
  ------------------
  105|      0|    return {};
  106|      0|  }
  107|       |
  108|     10|  std::vector<ColorStateWithCost> states;
  109|       |
  110|     10|  ColorState output_state;
  111|       |
  112|     10|  output_state.colorspace = heif_colorspace_YCbCr;
  113|     10|  output_state.chroma = heif_chroma_420;
  114|     10|  output_state.has_alpha = target_state.has_alpha;
  115|     10|  output_state.bits_per_pixel = target_state.bits_per_pixel;
  116|     10|  output_state.nclx = target_state.nclx;
  117|     10|  states.emplace_back(output_state, SpeedCosts_Slow);
  118|       |
  119|     10|  return states;
  120|       |#else
  121|       |  return {};
  122|       |#endif
  123|     10|}
rgb2yuv_sharp.cc:_ZL19PlatformIsBigEndianv:
   34|     10|{
   35|     10|  int i = 1;
   36|     10|  return !*((char*) &i);
   37|     10|}

_ZNK15Op_YCbCr_to_RGBIhE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   34|     10|{
   35|       |  // this Op only implements the nearest-neighbor algorithm
   36|       |
   37|     10|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (37:7): [True: 5, False: 5]
  ------------------
   38|      5|    if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_nearest_neighbor &&
  ------------------
  |  Branch (38:9): [True: 5, False: 0]
  ------------------
   39|      5|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (39:9): [True: 0, False: 5]
  ------------------
   40|      0|      return {};
   41|      0|    }
   42|      5|  }
   43|       |
   44|     10|  if (input_state.colorspace != heif_colorspace_YCbCr ||
  ------------------
  |  Branch (44:7): [True: 10, False: 0]
  ------------------
   45|      0|      (input_state.chroma != heif_chroma_444 &&
  ------------------
  |  Branch (45:8): [True: 0, False: 0]
  ------------------
   46|      0|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (46:8): [True: 0, False: 0]
  ------------------
   47|     10|       input_state.chroma != heif_chroma_420)) {
  ------------------
  |  Branch (47:8): [True: 0, False: 0]
  ------------------
   48|     10|    return {};
   49|     10|  }
   50|       |
   51|      0|  int matrix = input_state.nclx.get_matrix_coefficients();
   52|      0|  if (matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (52:7): [True: 0, False: 0]
  |  Branch (52:23): [True: 0, False: 0]
  ------------------
   53|      0|    return {};
   54|      0|  }
   55|       |  // TODO: matrix == 10 (BT.2020 CL) currently falls through and is decoded as if it were
   56|       |  //   BT.2020 NCL. A correct CL path needs EOTF inversion on Cb/Cr, not the linear matrix below.
   57|       |
   58|       |
   59|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   60|       |
   61|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (61:7): [True: 0, False: 0]
  ------------------
   62|      0|    return {};
   63|      0|  }
   64|       |
   65|       |  // TODO: add support for <8 bpp
   66|      0|  if (input_state.bits_per_pixel < 8) {
  ------------------
  |  Branch (66:7): [True: 0, False: 0]
  ------------------
   67|      0|    return {};
   68|      0|  }
   69|       |
   70|      0|  if (input_state.bits_per_pixel > 14) {
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  ------------------
   71|      0|    return {};
   72|      0|  }
   73|       |
   74|      0|  std::vector<ColorStateWithCost> states;
   75|       |
   76|      0|  ColorState output_state;
   77|       |
   78|       |  // --- convert to RGB
   79|       |
   80|      0|  output_state.colorspace = heif_colorspace_RGB;
   81|      0|  output_state.chroma = heif_chroma_444;
   82|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   83|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
   84|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
   85|       |
   86|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   87|       |
   88|      0|  return states;
   89|      0|}
_ZNK15Op_YCbCr_to_RGBItE22state_after_conversionERK10ColorStateS3_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
   34|     10|{
   35|       |  // this Op only implements the nearest-neighbor algorithm
   36|       |
   37|     10|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (37:7): [True: 5, False: 5]
  ------------------
   38|      5|    if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_nearest_neighbor &&
  ------------------
  |  Branch (38:9): [True: 5, False: 0]
  ------------------
   39|      5|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (39:9): [True: 0, False: 5]
  ------------------
   40|      0|      return {};
   41|      0|    }
   42|      5|  }
   43|       |
   44|     10|  if (input_state.colorspace != heif_colorspace_YCbCr ||
  ------------------
  |  Branch (44:7): [True: 10, False: 0]
  ------------------
   45|      0|      (input_state.chroma != heif_chroma_444 &&
  ------------------
  |  Branch (45:8): [True: 0, False: 0]
  ------------------
   46|      0|       input_state.chroma != heif_chroma_422 &&
  ------------------
  |  Branch (46:8): [True: 0, False: 0]
  ------------------
   47|     10|       input_state.chroma != heif_chroma_420)) {
  ------------------
  |  Branch (47:8): [True: 0, False: 0]
  ------------------
   48|     10|    return {};
   49|     10|  }
   50|       |
   51|      0|  int matrix = input_state.nclx.get_matrix_coefficients();
   52|      0|  if (matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (52:7): [True: 0, False: 0]
  |  Branch (52:23): [True: 0, False: 0]
  ------------------
   53|      0|    return {};
   54|      0|  }
   55|       |  // TODO: matrix == 10 (BT.2020 CL) currently falls through and is decoded as if it were
   56|       |  //   BT.2020 NCL. A correct CL path needs EOTF inversion on Cb/Cr, not the linear matrix below.
   57|       |
   58|       |
   59|      0|  bool hdr = !std::is_same<Pixel, uint8_t>::value;
   60|       |
   61|      0|  if ((input_state.bits_per_pixel > 8) != hdr) {
  ------------------
  |  Branch (61:7): [True: 0, False: 0]
  ------------------
   62|      0|    return {};
   63|      0|  }
   64|       |
   65|       |  // TODO: add support for <8 bpp
   66|      0|  if (input_state.bits_per_pixel < 8) {
  ------------------
  |  Branch (66:7): [True: 0, False: 0]
  ------------------
   67|      0|    return {};
   68|      0|  }
   69|       |
   70|      0|  if (input_state.bits_per_pixel > 14) {
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  ------------------
   71|      0|    return {};
   72|      0|  }
   73|       |
   74|      0|  std::vector<ColorStateWithCost> states;
   75|       |
   76|      0|  ColorState output_state;
   77|       |
   78|       |  // --- convert to RGB
   79|       |
   80|      0|  output_state.colorspace = heif_colorspace_RGB;
   81|      0|  output_state.chroma = heif_chroma_444;
   82|      0|  output_state.has_alpha = input_state.has_alpha;  // we simply keep the old alpha plane
   83|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
   84|      0|  output_state.alpha_bits_per_pixel = input_state.alpha_bits_per_pixel;
   85|       |
   86|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
   87|       |
   88|      0|  return states;
   89|      0|}
_ZNK20Op_YCbCr420_to_RGB2422state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  303|     10|{
  304|       |  // this Op only implements the nearest-neighbor algorithm
  305|       |
  306|     10|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (306:7): [True: 5, False: 5]
  ------------------
  307|      5|    if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_nearest_neighbor &&
  ------------------
  |  Branch (307:9): [True: 5, False: 0]
  ------------------
  308|      5|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (308:9): [True: 0, False: 5]
  ------------------
  309|      0|      return {};
  310|      0|    }
  311|      5|  }
  312|       |
  313|     10|  if (input_state.colorspace != heif_colorspace_YCbCr ||
  ------------------
  |  Branch (313:7): [True: 10, False: 0]
  ------------------
  314|      0|      input_state.chroma != heif_chroma_420 ||
  ------------------
  |  Branch (314:7): [True: 0, False: 0]
  ------------------
  315|      0|      input_state.bits_per_pixel != 8 ||
  ------------------
  |  Branch (315:7): [True: 0, False: 0]
  ------------------
  316|     10|      input_state.has_alpha == true) {
  ------------------
  |  Branch (316:7): [True: 0, False: 0]
  ------------------
  317|     10|    return {};
  318|     10|  }
  319|       |
  320|      0|  int matrix = input_state.nclx.get_matrix_coefficients();
  321|      0|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (321:7): [True: 0, False: 0]
  |  Branch (321:22): [True: 0, False: 0]
  |  Branch (321:37): [True: 0, False: 0]
  |  Branch (321:53): [True: 0, False: 0]
  ------------------
  322|      0|    return {};
  323|      0|  }
  324|      0|  if (!input_state.nclx.get_full_range_flag()) {
  ------------------
  |  Branch (324:7): [True: 0, False: 0]
  ------------------
  325|      0|    return {};
  326|      0|  }
  327|       |
  328|      0|  std::vector<ColorStateWithCost> states;
  329|       |
  330|      0|  ColorState output_state;
  331|       |
  332|       |  // --- convert to RGB
  333|       |
  334|      0|  output_state.colorspace = heif_colorspace_RGB;
  335|      0|  output_state.chroma = heif_chroma_interleaved_RGB;
  336|      0|  output_state.has_alpha = false;
  337|      0|  output_state.bits_per_pixel = 8;
  338|       |
  339|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  340|       |
  341|      0|  return states;
  342|      0|}
_ZNK20Op_YCbCr420_to_RGB3222state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  434|     10|{
  435|       |  // this Op only implements the nearest-neighbor algorithm
  436|       |
  437|     10|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (437:7): [True: 5, False: 5]
  ------------------
  438|      5|    if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_nearest_neighbor &&
  ------------------
  |  Branch (438:9): [True: 5, False: 0]
  ------------------
  439|      5|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (439:9): [True: 0, False: 5]
  ------------------
  440|      0|      return {};
  441|      0|    }
  442|      5|  }
  443|       |
  444|       |  // Note: no input alpha channel required. It will be filled up with 0xFF.
  445|       |
  446|     10|  if (input_state.colorspace != heif_colorspace_YCbCr ||
  ------------------
  |  Branch (446:7): [True: 10, False: 0]
  ------------------
  447|      0|      input_state.chroma != heif_chroma_420 ||
  ------------------
  |  Branch (447:7): [True: 0, False: 0]
  ------------------
  448|     10|      input_state.bits_per_pixel != 8) {
  ------------------
  |  Branch (448:7): [True: 0, False: 0]
  ------------------
  449|     10|    return {};
  450|     10|  }
  451|       |
  452|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (452:7): [True: 0, False: 0]
  |  Branch (452:32): [True: 0, False: 0]
  ------------------
  453|      0|    return {};
  454|      0|  }
  455|       |
  456|      0|  int matrix = input_state.nclx.get_matrix_coefficients();
  457|      0|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (457:7): [True: 0, False: 0]
  |  Branch (457:22): [True: 0, False: 0]
  |  Branch (457:37): [True: 0, False: 0]
  |  Branch (457:53): [True: 0, False: 0]
  ------------------
  458|      0|    return {};
  459|      0|  }
  460|      0|  if (!input_state.nclx.get_full_range_flag()) {
  ------------------
  |  Branch (460:7): [True: 0, False: 0]
  ------------------
  461|      0|    return {};
  462|      0|  }
  463|       |
  464|      0|  std::vector<ColorStateWithCost> states;
  465|       |
  466|      0|  ColorState output_state;
  467|       |
  468|       |  // --- convert to RGB
  469|       |
  470|      0|  output_state.colorspace = heif_colorspace_RGB;
  471|      0|  output_state.chroma = heif_chroma_interleaved_RGBA;
  472|      0|  output_state.has_alpha = true;
  473|      0|  output_state.bits_per_pixel = 8;
  474|       |
  475|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  476|       |
  477|      0|  return states;
  478|      0|}
_ZNK23Op_YCbCr420_to_RRGGBBaa22state_after_conversionERK10ColorStateS2_RK29heif_color_conversion_optionsRK33heif_color_conversion_options_ext:
  570|     10|{
  571|       |  // this Op only implements the nearest-neighbor algorithm
  572|       |
  573|     10|  if (input_state.chroma != heif_chroma_444) {
  ------------------
  |  Branch (573:7): [True: 5, False: 5]
  ------------------
  574|      5|    if (options.preferred_chroma_upsampling_algorithm != heif_chroma_upsampling_nearest_neighbor &&
  ------------------
  |  Branch (574:9): [True: 5, False: 0]
  ------------------
  575|      5|        options.only_use_preferred_chroma_algorithm) {
  ------------------
  |  Branch (575:9): [True: 0, False: 5]
  ------------------
  576|      0|      return {};
  577|      0|    }
  578|      5|  }
  579|       |
  580|     10|  if (input_state.colorspace != heif_colorspace_YCbCr ||
  ------------------
  |  Branch (580:7): [True: 10, False: 0]
  ------------------
  581|      0|      input_state.chroma != heif_chroma_420 ||
  ------------------
  |  Branch (581:7): [True: 0, False: 0]
  ------------------
  582|     10|      input_state.bits_per_pixel <= 8) {
  ------------------
  |  Branch (582:7): [True: 0, False: 0]
  ------------------
  583|     10|    return {};
  584|     10|  }
  585|       |
  586|      0|  if (input_state.has_alpha && input_state.get_alpha_bits_per_pixel() != input_state.bits_per_pixel) {
  ------------------
  |  Branch (586:7): [True: 0, False: 0]
  |  Branch (586:32): [True: 0, False: 0]
  ------------------
  587|      0|    return {};
  588|      0|  }
  589|       |
  590|      0|  int matrix = input_state.nclx.get_matrix_coefficients();
  591|      0|  if (matrix == 0 || matrix == 8 || matrix == 11 || matrix == 14) {
  ------------------
  |  Branch (591:7): [True: 0, False: 0]
  |  Branch (591:22): [True: 0, False: 0]
  |  Branch (591:37): [True: 0, False: 0]
  |  Branch (591:53): [True: 0, False: 0]
  ------------------
  592|      0|    return {};
  593|      0|  }
  594|       |
  595|      0|  std::vector<ColorStateWithCost> states;
  596|       |
  597|      0|  ColorState output_state;
  598|       |
  599|       |  // --- convert to YCbCr
  600|       |
  601|      0|  output_state.colorspace = heif_colorspace_RGB;
  602|      0|  output_state.chroma = (input_state.has_alpha ?
  ------------------
  |  Branch (602:26): [True: 0, False: 0]
  ------------------
  603|      0|                         heif_chroma_interleaved_RRGGBBAA_LE : heif_chroma_interleaved_RRGGBB_LE);
  604|      0|  output_state.has_alpha = input_state.has_alpha;
  605|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  606|       |
  607|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  608|       |
  609|       |
  610|      0|  output_state.colorspace = heif_colorspace_RGB;
  611|      0|  output_state.chroma = (input_state.has_alpha ?
  ------------------
  |  Branch (611:26): [True: 0, False: 0]
  ------------------
  612|      0|                         heif_chroma_interleaved_RRGGBBAA_BE : heif_chroma_interleaved_RRGGBB_BE);
  613|      0|  output_state.has_alpha = input_state.has_alpha;
  614|      0|  output_state.bits_per_pixel = input_state.bits_per_pixel;
  615|       |
  616|      0|  states.emplace_back(output_state, SpeedCosts_Unoptimized);
  617|       |
  618|      0|  return states;
  619|      0|}

_Z20chroma_h_subsampling11heif_chroma:
   26|      5|{
   27|      5|  switch (c) {
   28|      0|    case heif_chroma_monochrome:
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (28:5): [True: 0, False: 5]
  ------------------
   29|      0|    case heif_chroma_444:
  ------------------
  |  Branch (29:5): [True: 0, False: 5]
  ------------------
   30|      0|      return 1;
   31|       |
   32|      5|    case heif_chroma_420:
  ------------------
  |  Branch (32:5): [True: 5, False: 0]
  ------------------
   33|      5|    case heif_chroma_422:
  ------------------
  |  Branch (33:5): [True: 0, False: 5]
  ------------------
   34|      5|      return 2;
   35|       |
   36|      0|    case heif_chroma_interleaved_RGB:
  ------------------
  |  Branch (36:5): [True: 0, False: 5]
  ------------------
   37|      0|    case heif_chroma_interleaved_RGBA:
  ------------------
  |  Branch (37:5): [True: 0, False: 5]
  ------------------
   38|      0|    default:
  ------------------
  |  Branch (38:5): [True: 0, False: 5]
  ------------------
   39|      0|      assert(false);
  ------------------
  |  Branch (39:7): [Folded, False: 0]
  ------------------
   40|      0|      return 0;
   41|      5|  }
   42|      5|}
_Z20chroma_v_subsampling11heif_chroma:
   46|      5|{
   47|      5|  switch (c) {
   48|      0|    case heif_chroma_monochrome:
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (48:5): [True: 0, False: 5]
  ------------------
   49|      0|    case heif_chroma_444:
  ------------------
  |  Branch (49:5): [True: 0, False: 5]
  ------------------
   50|      0|    case heif_chroma_422:
  ------------------
  |  Branch (50:5): [True: 0, False: 5]
  ------------------
   51|      0|      return 1;
   52|       |
   53|      5|    case heif_chroma_420:
  ------------------
  |  Branch (53:5): [True: 5, False: 0]
  ------------------
   54|      5|      return 2;
   55|       |
   56|      0|    case heif_chroma_interleaved_RGB:
  ------------------
  |  Branch (56:5): [True: 0, False: 5]
  ------------------
   57|      0|    case heif_chroma_interleaved_RGBA:
  ------------------
  |  Branch (57:5): [True: 0, False: 5]
  ------------------
   58|      0|    default:
  ------------------
  |  Branch (58:5): [True: 0, False: 5]
  ------------------
   59|      0|      assert(false);
  ------------------
  |  Branch (59:7): [Folded, False: 0]
  ------------------
   60|      0|      return 0;
   61|      5|  }
   62|      5|}
_Z16fourcc_to_stringj:
  152|  11.7k|{
  153|  11.7k|  std::string str("    ");
  154|  11.7k|  str[0] = static_cast<char>((code >> 24) & 0xFF);
  155|  11.7k|  str[1] = static_cast<char>((code >> 16) & 0xFF);
  156|  11.7k|  str[2] = static_cast<char>((code >> 8) & 0xFF);
  157|  11.7k|  str[3] = static_cast<char>((code >> 0) & 0xFF);
  158|       |
  159|  11.7k|  return str;
  160|  11.7k|}

_Z20four_bytes_to_uint32hhhh:
   39|   118k|{
   40|   118k|  return (static_cast<uint32_t>(msb << 24) |
   41|   118k|          static_cast<uint32_t>(b << 16) |
   42|   118k|          static_cast<uint32_t>(c << 8) |
   43|   118k|          static_cast<uint32_t>(lsb));
   44|   118k|}
_Z6fourccPKc:
   53|  69.1k|{
   54|  69.1k|  return four_bytes_to_uint32(static_cast<uint8_t>(id[0]),
   55|  69.1k|                              static_cast<uint8_t>(id[1]),
   56|  69.1k|                              static_cast<uint8_t>(id[2]),
   57|  69.1k|                              static_cast<uint8_t>(id[3]));
   58|  69.1k|}
_Z10clip_f_u16fi:
  109|  4.72M|{
  110|  4.72M|  int32_t x = (int32_t) (fx + 0.5f);
  111|  4.72M|  if (x < 0) return 0;
  ------------------
  |  Branch (111:7): [True: 0, False: 4.72M]
  ------------------
  112|  4.72M|  if (x > maxi) return (uint16_t) maxi;
  ------------------
  |  Branch (112:7): [True: 0, False: 4.72M]
  ------------------
  113|  4.72M|  return static_cast<uint16_t>(x);
  114|  4.72M|}

_ZN11HeifContextC2Ev:
  148|     34|    : m_memory_tracker(&m_limits)
  149|     34|{
  150|     34|  const char* security_limits_variable = getenv("LIBHEIF_SECURITY_LIMITS");
  151|       |
  152|     34|  if (security_limits_variable && (strcmp(security_limits_variable, "off") == 0 ||
  ------------------
  |  Branch (152:7): [True: 0, False: 34]
  |  Branch (152:36): [True: 0, False: 0]
  ------------------
  153|      0|                                   strcmp(security_limits_variable, "OFF") == 0)) {
  ------------------
  |  Branch (153:36): [True: 0, False: 0]
  ------------------
  154|      0|    m_limits = disabled_security_limits;
  155|      0|  }
  156|     34|  else {
  157|     34|    m_limits = global_security_limits;
  158|     34|  }
  159|       |
  160|     34|  reset_to_empty_heif();
  161|     34|}
_ZN11HeifContextD2Ev:
  165|     34|{
  166|       |  // Break circular references between Images (when a faulty input image has circular image references)
  167|    272|  for (auto& it : m_all_images) {
  ------------------
  |  Branch (167:17): [True: 272, False: 34]
  ------------------
  168|    272|    std::shared_ptr<ImageItem> image = it.second;
  169|    272|    image->clear();
  170|    272|  }
  171|     34|}
_ZN11HeifContext16read_from_memoryEPKvmb:
  263|     34|{
  264|     34|  m_heif_file = std::make_shared<HeifFile>();
  265|     34|  m_heif_file->set_security_limits(&m_limits);
  266|     34|  Error err = m_heif_file->read_from_memory(data, size, copy);
  267|     34|  if (err) {
  ------------------
  |  Branch (267:7): [True: 14, False: 20]
  ------------------
  268|     14|    return err;
  269|     14|  }
  270|       |
  271|     20|  return interpret_heif_file();
  272|     34|}
_ZN11HeifContext19reset_to_empty_heifEv:
  275|     34|{
  276|     34|  m_heif_file = std::make_shared<HeifFile>();
  277|     34|  m_heif_file->set_security_limits(&m_limits);
  278|     34|  m_heif_file->new_empty_file();
  279|       |
  280|     34|  m_all_images.clear();
  281|     34|  m_top_level_images.clear();
  282|     34|  m_primary_image.reset();
  283|     34|}
_ZN11HeifContext20get_top_level_imagesEb:
  287|     40|{
  288|     40|  if (return_error_images) {
  ------------------
  |  Branch (288:7): [True: 40, False: 0]
  ------------------
  289|     40|    return m_top_level_images;
  290|     40|  }
  291|      0|  else {
  292|      0|    std::vector<std::shared_ptr<ImageItem>> filtered;
  293|      0|    for (auto& item : m_top_level_images) {
  ------------------
  |  Branch (293:21): [True: 0, False: 0]
  ------------------
  294|      0|      if (!item->get_item_error()) {
  ------------------
  |  Branch (294:11): [True: 0, False: 0]
  ------------------
  295|      0|        filtered.push_back(item);
  296|      0|      }
  297|      0|    }
  298|       |
  299|      0|    return filtered;
  300|      0|  }
  301|     40|}
_ZN11HeifContext9get_imageEjb:
  305|     63|{
  306|     63|  auto iter = m_all_images.find(id);
  307|     63|  if (iter == m_all_images.end()) {
  ------------------
  |  Branch (307:7): [True: 0, False: 63]
  ------------------
  308|      0|    return nullptr;
  309|      0|  }
  310|     63|  else {
  311|     63|    if (iter->second->get_item_error() && !return_error_images) {
  ------------------
  |  Branch (311:9): [True: 15, False: 48]
  |  Branch (311:9): [True: 0, False: 63]
  |  Branch (311:43): [True: 0, False: 15]
  ------------------
  312|      0|      return nullptr;
  313|      0|    }
  314|     63|    else {
  315|     63|      return iter->second;
  316|     63|    }
  317|     63|  }
  318|     63|}
_ZN11HeifContext17get_primary_imageEb:
  322|     20|{
  323|     20|  if (m_primary_image == nullptr)
  ------------------
  |  Branch (323:7): [True: 0, False: 20]
  ------------------
  324|      0|    return nullptr;
  325|     20|  else if (!return_error_image && m_primary_image->get_item_error())
  ------------------
  |  Branch (325:12): [True: 0, False: 20]
  |  Branch (325:12): [True: 0, False: 20]
  |  Branch (325:35): [True: 0, False: 0]
  ------------------
  326|      0|    return nullptr;
  327|     20|  else
  328|     20|    return m_primary_image;
  329|     20|}
_ZN11HeifContext22remove_top_level_imageERKNSt3__110shared_ptrI9ImageItemEE:
  548|      4|{
  549|      4|  std::vector<std::shared_ptr<ImageItem>> new_list;
  550|       |
  551|     11|  for (const auto& img : m_top_level_images) {
  ------------------
  |  Branch (551:24): [True: 11, False: 4]
  ------------------
  552|     11|    if (img != image) {
  ------------------
  |  Branch (552:9): [True: 8, False: 3]
  ------------------
  553|      8|      new_list.push_back(img);
  554|      8|    }
  555|     11|  }
  556|       |
  557|      4|  m_top_level_images = std::move(new_list);
  558|      4|}
_ZN11HeifContext19interpret_heif_fileEv:
  562|     20|{
  563|     20|  if (m_heif_file->has_images()) {
  ------------------
  |  Branch (563:7): [True: 20, False: 0]
  ------------------
  564|     20|    Error err = interpret_heif_file_images();
  565|     20|    if (err) {
  ------------------
  |  Branch (565:9): [True: 0, False: 20]
  ------------------
  566|      0|      return err;
  567|      0|    }
  568|     20|  }
  569|       |
  570|     20|  if (m_heif_file->has_sequences()) {
  ------------------
  |  Branch (570:7): [True: 0, False: 20]
  ------------------
  571|      0|    Error err = interpret_heif_file_sequences();
  572|      0|    if (err) {
  ------------------
  |  Branch (572:9): [True: 0, False: 0]
  ------------------
  573|      0|      return err;
  574|      0|    }
  575|      0|  }
  576|       |
  577|     20|  return Error::Ok;
  578|     20|}
_ZN11HeifContext26interpret_heif_file_imagesEv:
  582|     20|{
  583|     20|  m_all_images.clear();
  584|     20|  m_top_level_images.clear();
  585|     20|  m_primary_image.reset();
  586|       |
  587|       |
  588|       |  // --- reference all non-hidden images
  589|       |
  590|     20|  std::vector<heif_item_id> image_IDs = m_heif_file->get_item_IDs();
  591|       |
  592|    476|  for (heif_item_id id : image_IDs) {
  ------------------
  |  Branch (592:24): [True: 476, False: 20]
  ------------------
  593|    476|    auto infe_box = m_heif_file->get_infe_box(id);
  594|    476|    if (!infe_box) {
  ------------------
  |  Branch (594:9): [True: 0, False: 476]
  ------------------
  595|       |      // TODO(farindk): Should we return an error instead of skipping the invalid id?
  596|      0|      continue;
  597|      0|    }
  598|       |
  599|    476|    auto imageItem = ImageItem::alloc_for_infe_box(this, infe_box);
  600|    476|    if (!imageItem) {
  ------------------
  |  Branch (600:9): [True: 204, False: 272]
  ------------------
  601|       |      // It is no imageItem item, skip it.
  602|    204|      continue;
  603|    204|    }
  604|       |
  605|    272|    std::vector<std::shared_ptr<Box>> properties;
  606|    272|    Error err = m_heif_file->get_properties(id, properties);
  607|    272|    if (err) {
  ------------------
  |  Branch (607:9): [True: 46, False: 226]
  ------------------
  608|     46|      imageItem = std::make_shared<ImageItem_Error>(imageItem->get_infe_type(), id, err);
  609|     46|    }
  610|       |
  611|    272|    imageItem->set_properties(properties);
  612|       |
  613|    272|    err = imageItem->initialize_decoder();
  614|    272|    if (err) {
  ------------------
  |  Branch (614:9): [True: 26, False: 246]
  ------------------
  615|     26|      imageItem = std::make_shared<ImageItem_Error>(imageItem->get_infe_type(), id, err);
  616|     26|      imageItem->set_properties(properties);
  617|    246|    } else {
  618|       |      // The decoder's input data extent must be set before any codec-config
  619|       |      // query: some decoders (e.g. JPEG, whose jpgC box is optional) read the
  620|       |      // actual bitstream to answer colorspace/bit-depth queries.
  621|    246|      imageItem->set_decoder_input_data();
  622|       |
  623|       |      // After initialize_decoder, codec-config queries (colorspace, bit depth)
  624|       |      // are available, so visual-codec items can now populate their component
  625|       |      // descriptions. Idempotent for items already populated by set_properties
  626|       |      // (e.g. unci items).
  627|    246|      imageItem->populate_component_descriptions();
  628|    246|    }
  629|       |
  630|    272|    m_all_images.insert(std::make_pair(id, imageItem));
  631|       |
  632|    272|    if (!infe_box->is_hidden_item()) {
  ------------------
  |  Branch (632:9): [True: 66, False: 206]
  ------------------
  633|     66|      if (id == m_heif_file->get_primary_image_ID()) {
  ------------------
  |  Branch (633:11): [True: 20, False: 46]
  ------------------
  634|     20|        imageItem->set_primary(true);
  635|     20|        m_primary_image = imageItem;
  636|     20|      }
  637|       |
  638|     66|      m_top_level_images.push_back(imageItem);
  639|     66|    }
  640|    272|  }
  641|       |
  642|     20|  if (!m_primary_image) {
  ------------------
  |  Branch (642:7): [True: 0, False: 20]
  ------------------
  643|      0|    return Error(heif_error_Invalid_input,
  644|      0|                 heif_suberror_Nonexisting_item_referenced,
  645|      0|                 "'pitm' box references an unsupported or non-existing image");
  646|      0|  }
  647|       |
  648|       |
  649|       |  // --- process image properties
  650|       |
  651|    272|  for (auto& pair : m_all_images) {
  ------------------
  |  Branch (651:19): [True: 272, False: 20]
  ------------------
  652|    272|    auto& image = pair.second;
  653|       |
  654|    272|    if (image->get_item_error()) {
  ------------------
  |  Branch (654:9): [True: 72, False: 200]
  ------------------
  655|     72|      continue;
  656|     72|    }
  657|       |
  658|    200|    std::vector<std::shared_ptr<Box>> properties;
  659|       |
  660|    200|    Error err = m_heif_file->get_properties(pair.first, properties);
  661|    200|    if (err) {
  ------------------
  |  Branch (661:9): [True: 0, False: 200]
  ------------------
  662|      0|      return err;
  663|      0|    }
  664|       |
  665|       |
  666|       |    // --- are there any 'essential' properties that we did not parse?
  667|       |
  668|    654|    for (const auto& prop : properties) {
  ------------------
  |  Branch (668:27): [True: 654, False: 200]
  ------------------
  669|    654|      if (std::dynamic_pointer_cast<Box_other>(prop) &&
  ------------------
  |  Branch (669:11): [True: 20, False: 634]
  |  Branch (669:11): [True: 0, False: 654]
  ------------------
  670|     20|          get_heif_file()->get_ipco_box()->is_property_essential_for_item(pair.first, prop, get_heif_file()->get_ipma_box())) {
  ------------------
  |  Branch (670:11): [True: 0, False: 20]
  ------------------
  671|       |
  672|      0|        std::stringstream sstr;
  673|      0|        sstr << "could not parse item property '" << prop->get_type_string() << "'";
  674|      0|        return {heif_error_Unsupported_feature, heif_suberror_Unsupported_essential_property, sstr.str()};
  675|      0|      }
  676|    654|    }
  677|       |
  678|       |
  679|       |    // --- Are there any parse errors in optional properties? Attach the errors as warnings to the images.
  680|       |
  681|    200|    bool ignore_nonfatal_parse_errors = false; // TODO: this should be a user option. Where should we put this (heif_decoding_options, or while creating the context) ?
  682|       |
  683|    654|    for (const auto& prop : properties) {
  ------------------
  |  Branch (683:27): [True: 654, False: 200]
  ------------------
  684|    654|      if (auto errorbox = std::dynamic_pointer_cast<Box_Error>(prop)) {
  ------------------
  |  Branch (684:16): [True: 189, False: 465]
  ------------------
  685|    189|        parse_error_fatality fatality = errorbox->get_parse_error_fatality();
  686|       |
  687|    189|        if (fatality == parse_error_fatality::optional ||
  ------------------
  |  Branch (687:13): [True: 189, False: 0]
  ------------------
  688|    189|            (fatality == parse_error_fatality::ignorable && ignore_nonfatal_parse_errors)) {
  ------------------
  |  Branch (688:14): [True: 0, False: 0]
  |  Branch (688:61): [True: 0, False: 0]
  ------------------
  689|    189|          image->add_decoding_warning(errorbox->get_error());
  690|    189|        }
  691|      0|        else {
  692|      0|          return errorbox->get_error();
  693|      0|        }
  694|    189|      }
  695|    654|    }
  696|       |
  697|       |
  698|       |    // --- extract image resolution
  699|       |
  700|    200|    bool ispe_read = false;
  701|    654|    for (const auto& prop : properties) {
  ------------------
  |  Branch (701:27): [True: 654, False: 200]
  ------------------
  702|    654|      auto ispe = std::dynamic_pointer_cast<Box_ispe>(prop);
  703|    654|      if (ispe) {
  ------------------
  |  Branch (703:11): [True: 5, False: 649]
  ------------------
  704|      5|        uint32_t width = ispe->get_width();
  705|      5|        uint32_t height = ispe->get_height();
  706|       |
  707|      5|        if (width == 0 || height == 0) {
  ------------------
  |  Branch (707:13): [True: 0, False: 5]
  |  Branch (707:27): [True: 0, False: 5]
  ------------------
  708|      0|          return {heif_error_Invalid_input,
  709|      0|                  heif_suberror_Invalid_image_size,
  710|      0|                  "Zero image width or height"};
  711|      0|        }
  712|       |
  713|      5|        image->set_resolution(width, height);
  714|      5|        ispe_read = true;
  715|      5|      }
  716|    654|    }
  717|       |
  718|       |    // Note: usually, we would like to check here if an `ispe` property exists as this is mandatory.
  719|       |    // We want to do this if decoding_options.strict_decoding is set, but we cannot because we have no decoding_options
  720|       |    // when parsing the file structure.
  721|       |
  722|    200|    if (!ispe_read) {
  ------------------
  |  Branch (722:9): [True: 195, False: 5]
  ------------------
  723|    195|      image->add_decoding_warning({heif_error_Invalid_input, heif_suberror_No_ispe_property});
  724|    195|    }
  725|       |
  726|       |
  727|    654|    for (const auto& prop : properties) {
  ------------------
  |  Branch (727:27): [True: 654, False: 200]
  ------------------
  728|    654|      auto colr = std::dynamic_pointer_cast<Box_colr>(prop);
  729|    654|      if (colr) {
  ------------------
  |  Branch (729:11): [True: 178, False: 476]
  ------------------
  730|    178|        auto profile = colr->get_color_profile();
  731|    178|        image->set_color_profile(profile);
  732|    178|        continue;
  733|    178|      }
  734|       |
  735|    476|      auto cmin = std::dynamic_pointer_cast<Box_cmin>(prop);
  736|    476|      if (cmin) {
  ------------------
  |  Branch (736:11): [True: 0, False: 476]
  ------------------
  737|      0|        if (!ispe_read) {
  ------------------
  |  Branch (737:13): [True: 0, False: 0]
  ------------------
  738|      0|          return {heif_error_Invalid_input, heif_suberror_No_ispe_property};
  739|      0|        }
  740|       |
  741|      0|        image->set_intrinsic_matrix(cmin->get_intrinsic_matrix());
  742|      0|      }
  743|       |
  744|    476|      auto cmex = std::dynamic_pointer_cast<Box_cmex>(prop);
  745|    476|      if (cmex) {
  ------------------
  |  Branch (745:11): [True: 0, False: 476]
  ------------------
  746|      0|        image->set_extrinsic_matrix(cmex->get_extrinsic_matrix());
  747|      0|      }
  748|    476|    }
  749|       |
  750|       |
  751|    654|    for (const auto& prop : properties) {
  ------------------
  |  Branch (751:27): [True: 654, False: 200]
  ------------------
  752|    654|      auto clap = std::dynamic_pointer_cast<Box_clap>(prop);
  753|    654|      if (clap) {
  ------------------
  |  Branch (753:11): [True: 0, False: 654]
  ------------------
  754|      0|        image->set_resolution(clap->get_width_rounded(),
  755|      0|                              clap->get_height_rounded());
  756|       |
  757|      0|        if (image->has_intrinsic_matrix()) {
  ------------------
  |  Branch (757:13): [True: 0, False: 0]
  ------------------
  758|      0|          image->get_intrinsic_matrix().apply_clap(clap.get(), image->get_width(), image->get_height());
  759|      0|        }
  760|      0|      }
  761|       |
  762|    654|      auto imir = std::dynamic_pointer_cast<Box_imir>(prop);
  763|    654|      if (imir) {
  ------------------
  |  Branch (763:11): [True: 0, False: 654]
  ------------------
  764|      0|        if (!ispe_read) {
  ------------------
  |  Branch (764:13): [True: 0, False: 0]
  ------------------
  765|      0|          return {heif_error_Invalid_input, heif_suberror_No_ispe_property};
  766|      0|        }
  767|       |
  768|      0|        image->get_intrinsic_matrix().apply_imir(imir.get(), image->get_width(), image->get_height());
  769|      0|      }
  770|       |
  771|    654|      auto irot = std::dynamic_pointer_cast<Box_irot>(prop);
  772|    654|      if (irot) {
  ------------------
  |  Branch (772:11): [True: 63, False: 591]
  ------------------
  773|     63|        if (irot->get_rotation_ccw() == 90 ||
  ------------------
  |  Branch (773:13): [True: 0, False: 63]
  ------------------
  774|     63|            irot->get_rotation_ccw() == 270) {
  ------------------
  |  Branch (774:13): [True: 0, False: 63]
  ------------------
  775|      0|          if (!ispe_read) {
  ------------------
  |  Branch (775:15): [True: 0, False: 0]
  ------------------
  776|      0|            return {heif_error_Invalid_input, heif_suberror_No_ispe_property};
  777|      0|          }
  778|       |
  779|       |          // swap width and height
  780|      0|          image->set_resolution(image->get_height(),
  781|      0|                                image->get_width());
  782|      0|        }
  783|       |
  784|       |        // TODO: apply irot to camera extrinsic matrix
  785|     63|      }
  786|    654|    }
  787|       |
  788|       |
  789|       |    // --- assign GIMI content-ID to image
  790|       |
  791|    200|    if (auto box_gimi_content_id = image->get_property<Box_gimi_content_id>()) {
  ------------------
  |  Branch (791:14): [True: 0, False: 200]
  ------------------
  792|      0|      image->set_gimi_sample_content_id(box_gimi_content_id->get_content_id());
  793|      0|    }
  794|       |
  795|    200|#if HEIF_WITH_OMAF
  796|       |    // add image projection information
  797|    200|    if (auto prfr = image->get_property<Box_prfr>()) {
  ------------------
  |  Branch (797:14): [True: 0, False: 200]
  ------------------
  798|      0|      image->ImageDescription::set_omaf_image_projection(prfr->get_omaf_image_projection());
  799|      0|    }
  800|    200|#endif
  801|    200|  }
  802|       |
  803|       |
  804|       |  // --- remove auxiliary from top-level images and assign to their respective image
  805|       |
  806|     20|  auto iref_box = m_heif_file->get_iref_box();
  807|     20|  if (iref_box) {
  ------------------
  |  Branch (807:7): [True: 16, False: 4]
  ------------------
  808|       |    // m_top_level_images.clear();
  809|       |
  810|    267|    for (auto& pair : m_all_images) {
  ------------------
  |  Branch (810:21): [True: 267, False: 16]
  ------------------
  811|    267|      auto& image = pair.second;
  812|       |
  813|    267|      std::vector<Box_iref::Reference> references = iref_box->get_references_from(image->get_id());
  814|       |
  815|    267|      for (const Box_iref::Reference& ref : references) {
  ------------------
  |  Branch (815:43): [True: 23, False: 267]
  ------------------
  816|     23|        uint32_t type = ref.header.get_short_type();
  817|       |
  818|     23|        if (type == fourcc("thmb")) {
  ------------------
  |  Branch (818:13): [True: 3, False: 20]
  ------------------
  819|       |          // --- this is a thumbnail image, attach to the main image
  820|       |
  821|      3|          std::vector<heif_item_id> refs = ref.to_item_ID;
  822|      3|          for (heif_item_id ref: refs) {
  ------------------
  |  Branch (822:32): [True: 3, False: 3]
  ------------------
  823|      3|            image->set_is_thumbnail();
  824|       |
  825|      3|            auto master_iter = m_all_images.find(ref);
  826|      3|            if (master_iter == m_all_images.end()) {
  ------------------
  |  Branch (826:17): [True: 0, False: 3]
  ------------------
  827|      0|              return Error(heif_error_Invalid_input,
  828|      0|                          heif_suberror_Nonexisting_item_referenced,
  829|      0|                          "Thumbnail references a non-existing image");
  830|      0|            }
  831|       |
  832|      3|            if (master_iter->second->is_thumbnail()) {
  ------------------
  |  Branch (832:17): [True: 0, False: 3]
  ------------------
  833|      0|              return Error(heif_error_Invalid_input,
  834|      0|                          heif_suberror_Nonexisting_item_referenced,
  835|      0|                          "Thumbnail references another thumbnail");
  836|      0|            }
  837|       |
  838|      3|            if (image.get() == master_iter->second.get()) {
  ------------------
  |  Branch (838:17): [True: 0, False: 3]
  ------------------
  839|      0|              return Error(heif_error_Invalid_input,
  840|      0|                          heif_suberror_Nonexisting_item_referenced,
  841|      0|                          "Recursive thumbnail image detected");
  842|      0|            }
  843|      3|            master_iter->second->add_thumbnail(image);
  844|      3|          }
  845|      3|          remove_top_level_image(image);
  846|      3|        }
  847|     20|        else if (type == fourcc("auxl")) {
  ------------------
  |  Branch (847:18): [True: 1, False: 19]
  ------------------
  848|       |
  849|       |          // --- this is an auxiliary image
  850|       |          //     check whether it is an alpha channel and attach to the main image if yes
  851|       |
  852|      1|          std::shared_ptr<Box_auxC> auxC_property = image->get_property<Box_auxC>();
  853|      1|          if (!auxC_property) {
  ------------------
  |  Branch (853:15): [True: 0, False: 1]
  ------------------
  854|      0|            std::stringstream sstr;
  855|      0|            sstr << "No auxC property for image " << image->get_id();
  856|      0|            return Error(heif_error_Invalid_input,
  857|      0|                         heif_suberror_Auxiliary_image_type_unspecified,
  858|      0|                         sstr.str());
  859|      0|          }
  860|       |
  861|      1|          std::vector<heif_item_id> refs = ref.to_item_ID;
  862|       |
  863|       |          // alpha channel
  864|       |
  865|      1|          if (auxC_property->get_aux_type() == "urn:mpeg:avc:2015:auxid:1" ||   // HEIF (avc)
  ------------------
  |  Branch (865:15): [True: 0, False: 1]
  ------------------
  866|      1|              auxC_property->get_aux_type() == "urn:mpeg:hevc:2015:auxid:1" ||  // HEIF (h265)
  ------------------
  |  Branch (866:15): [True: 0, False: 1]
  ------------------
  867|      1|              auxC_property->get_aux_type() == "urn:mpeg:mpegB:cicp:systems:auxiliary:alpha") { // MIAF
  ------------------
  |  Branch (867:15): [True: 1, False: 0]
  ------------------
  868|       |
  869|      1|            for (heif_item_id ref: refs) {
  ------------------
  |  Branch (869:34): [True: 1, False: 1]
  ------------------
  870|      1|              auto master_iter = m_all_images.find(ref);
  871|      1|              if (master_iter == m_all_images.end()) {
  ------------------
  |  Branch (871:19): [True: 0, False: 1]
  ------------------
  872|       |
  873|      0|                if (!m_heif_file->has_item_with_id(ref)) {
  ------------------
  |  Branch (873:21): [True: 0, False: 0]
  ------------------
  874|      0|                  return Error(heif_error_Invalid_input,
  875|      0|                               heif_suberror_Nonexisting_item_referenced,
  876|      0|                               "Non-existing alpha image referenced");
  877|      0|                }
  878|       |
  879|      0|                continue;
  880|      0|              }
  881|       |
  882|      1|              auto master_img = master_iter->second;
  883|       |
  884|      1|              if (image.get() == master_img.get()) {
  ------------------
  |  Branch (884:19): [True: 0, False: 1]
  ------------------
  885|      0|                return Error(heif_error_Invalid_input,
  886|      0|                            heif_suberror_Nonexisting_item_referenced,
  887|      0|                            "Recursive alpha image detected");
  888|      0|              }
  889|       |
  890|      1|              image->set_is_alpha_channel();
  891|      1|              master_img->set_alpha_channel(image);
  892|      1|            }
  893|      1|          }
  894|       |
  895|       |
  896|       |          // depth channel
  897|       |
  898|      1|          if (auxC_property->get_aux_type() == "urn:mpeg:hevc:2015:auxid:2" || // HEIF
  ------------------
  |  Branch (898:15): [True: 0, False: 1]
  ------------------
  899|      1|              auxC_property->get_aux_type() == "urn:mpeg:mpegB:cicp:systems:auxiliary:depth") { // AVIF
  ------------------
  |  Branch (899:15): [True: 0, False: 1]
  ------------------
  900|      0|            image->set_is_depth_channel();
  901|       |
  902|      0|            for (heif_item_id ref: refs) {
  ------------------
  |  Branch (902:34): [True: 0, False: 0]
  ------------------
  903|      0|              auto master_iter = m_all_images.find(ref);
  904|      0|              if (master_iter == m_all_images.end()) {
  ------------------
  |  Branch (904:19): [True: 0, False: 0]
  ------------------
  905|       |
  906|      0|                if (!m_heif_file->has_item_with_id(ref)) {
  ------------------
  |  Branch (906:21): [True: 0, False: 0]
  ------------------
  907|      0|                  return Error(heif_error_Invalid_input,
  908|      0|                               heif_suberror_Nonexisting_item_referenced,
  909|      0|                               "Non-existing depth image referenced");
  910|      0|                }
  911|       |
  912|      0|                continue;
  913|      0|              }
  914|      0|              if (image.get() == master_iter->second.get()) {
  ------------------
  |  Branch (914:19): [True: 0, False: 0]
  ------------------
  915|      0|                return Error(heif_error_Invalid_input,
  916|      0|                            heif_suberror_Nonexisting_item_referenced,
  917|      0|                            "Recursive depth image detected");
  918|      0|              }
  919|      0|              master_iter->second->set_depth_channel(image);
  920|       |
  921|      0|              const auto& subtypes = auxC_property->get_subtypes();
  922|       |
  923|      0|              if (!subtypes.empty()) {
  ------------------
  |  Branch (923:19): [True: 0, False: 0]
  ------------------
  924|      0|                std::vector<std::shared_ptr<SEIMessage>> sei_messages;
  925|      0|                Error err = decode_hevc_aux_sei_messages(subtypes, sei_messages);
  926|      0|                if (err) {
  ------------------
  |  Branch (926:21): [True: 0, False: 0]
  ------------------
  927|      0|                  return err;
  928|      0|                }
  929|       |
  930|      0|                for (auto& msg : sei_messages) {
  ------------------
  |  Branch (930:32): [True: 0, False: 0]
  ------------------
  931|      0|                  auto depth_msg = std::dynamic_pointer_cast<SEIMessage_depth_representation_info>(msg);
  932|      0|                  if (depth_msg) {
  ------------------
  |  Branch (932:23): [True: 0, False: 0]
  ------------------
  933|      0|                    image->set_depth_representation_info(*depth_msg);
  934|      0|                  }
  935|      0|                }
  936|      0|              }
  937|      0|            }
  938|      0|          }
  939|       |
  940|       |
  941|       |          // --- generic aux image
  942|       |
  943|      1|          image->set_is_aux_image(auxC_property->get_aux_type());
  944|       |
  945|      1|          for (heif_item_id ref: refs) {
  ------------------
  |  Branch (945:32): [True: 1, False: 1]
  ------------------
  946|      1|            auto master_iter = m_all_images.find(ref);
  947|      1|            if (master_iter == m_all_images.end()) {
  ------------------
  |  Branch (947:17): [True: 0, False: 1]
  ------------------
  948|       |
  949|      0|              if (!m_heif_file->has_item_with_id(ref)) {
  ------------------
  |  Branch (949:19): [True: 0, False: 0]
  ------------------
  950|      0|                return Error(heif_error_Invalid_input,
  951|      0|                             heif_suberror_Nonexisting_item_referenced,
  952|      0|                             "Non-existing aux image referenced");
  953|      0|              }
  954|       |
  955|      0|              continue;
  956|      0|            }
  957|      1|            if (image.get() == master_iter->second.get()) {
  ------------------
  |  Branch (957:17): [True: 0, False: 1]
  ------------------
  958|      0|              return Error(heif_error_Invalid_input,
  959|      0|                          heif_suberror_Nonexisting_item_referenced,
  960|      0|                          "Recursive aux image detected");
  961|      0|            }
  962|       |
  963|      1|            master_iter->second->add_aux_image(image);
  964|       |
  965|      1|            remove_top_level_image(image);
  966|      1|          }
  967|      1|        }
  968|     19|        else {
  969|       |          // 'image' is a normal image, keep it as a top-level image
  970|     19|        }
  971|     23|      }
  972|    267|    }
  973|     16|  }
  974|       |
  975|       |
  976|       |  // --- check that HEVC images have an hvcC property
  977|       |
  978|    272|  for (auto& pair : m_all_images) {
  ------------------
  |  Branch (978:19): [True: 272, False: 20]
  ------------------
  979|    272|    auto& image = pair.second;
  980|       |
  981|    272|    if (image->get_item_error()) {
  ------------------
  |  Branch (981:9): [True: 72, False: 200]
  ------------------
  982|     72|      continue;
  983|     72|    }
  984|       |
  985|    200|    std::shared_ptr<Box_infe> infe = m_heif_file->get_infe_box(image->get_id());
  986|    200|    if (infe->get_item_type_4cc() == fourcc("hvc1")) {
  ------------------
  |  Branch (986:9): [True: 184, False: 16]
  ------------------
  987|       |
  988|    184|      auto ipma = m_heif_file->get_ipma_box();
  989|    184|      auto ipco = m_heif_file->get_ipco_box();
  990|       |
  991|    184|      if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc("hvcC"))) {
  ------------------
  |  Branch (991:11): [True: 0, False: 184]
  ------------------
  992|      0|        return Error(heif_error_Invalid_input,
  993|      0|                     heif_suberror_No_hvcC_box,
  994|      0|                     "No hvcC property in hvc1 type image");
  995|      0|      }
  996|    184|    }
  997|    200|    if (infe->get_item_type_4cc() == fourcc("vvc1")) {
  ------------------
  |  Branch (997:9): [True: 0, False: 200]
  ------------------
  998|       |
  999|      0|      auto ipma = m_heif_file->get_ipma_box();
 1000|      0|      auto ipco = m_heif_file->get_ipco_box();
 1001|       |
 1002|      0|      if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc("vvcC"))) {
  ------------------
  |  Branch (1002:11): [True: 0, False: 0]
  ------------------
 1003|      0|        return Error(heif_error_Invalid_input,
 1004|      0|                     heif_suberror_No_vvcC_box,
 1005|      0|                     "No vvcC property in vvc1 type image");
 1006|      0|      }
 1007|      0|    }
 1008|       |    // TODO: check for AV1, AVC, JPEG, J2K
 1009|    200|  }
 1010|       |
 1011|       |
 1012|       |  // --- assign color profile from grid tiles to main image when main image has no profile assigned
 1013|       |
 1014|    271|  for (auto& pair : m_all_images) {
  ------------------
  |  Branch (1014:19): [True: 271, False: 16]
  ------------------
 1015|    271|    auto& image = pair.second;
 1016|    271|    auto id = pair.first;
 1017|       |
 1018|    271|    if (image->get_item_error()) {
  ------------------
  |  Branch (1018:9): [True: 72, False: 199]
  ------------------
 1019|     72|      continue;
 1020|     72|    }
 1021|       |
 1022|    199|    auto infe_box = m_heif_file->get_infe_box(id);
 1023|    199|    if (!infe_box) {
  ------------------
  |  Branch (1023:9): [True: 0, False: 199]
  ------------------
 1024|      0|      continue;
 1025|      0|    }
 1026|       |
 1027|    199|    if (!iref_box) {
  ------------------
  |  Branch (1027:9): [True: 4, False: 195]
  ------------------
 1028|      4|      break;
 1029|      4|    }
 1030|       |
 1031|    195|    if (infe_box->get_item_type_4cc() == fourcc("grid")) {
  ------------------
  |  Branch (1031:9): [True: 0, False: 195]
  ------------------
 1032|      0|      std::vector<heif_item_id> image_references = iref_box->get_references(id, fourcc("dimg"));
 1033|       |
 1034|      0|      if (image_references.empty()) {
  ------------------
  |  Branch (1034:11): [True: 0, False: 0]
  ------------------
 1035|      0|        continue; // TODO: can this every happen?
 1036|      0|      }
 1037|       |
 1038|      0|      auto tileId = image_references.front();
 1039|       |
 1040|      0|      auto iter = m_all_images.find(tileId);
 1041|      0|      if (iter == m_all_images.end()) {
  ------------------
  |  Branch (1041:11): [True: 0, False: 0]
  ------------------
 1042|      0|        continue; // invalid grid entry
 1043|      0|      }
 1044|       |
 1045|      0|      auto tile_img = iter->second;
 1046|      0|      if (image->get_color_profile_icc() == nullptr && tile_img->get_color_profile_icc()) {
  ------------------
  |  Branch (1046:11): [True: 0, False: 0]
  |  Branch (1046:56): [True: 0, False: 0]
  ------------------
 1047|      0|        image->set_color_profile(tile_img->get_color_profile_icc());
 1048|      0|      }
 1049|       |
 1050|      0|      if (!image->has_nclx_color_profile() && tile_img->has_nclx_color_profile()) {
  ------------------
  |  Branch (1050:11): [True: 0, False: 0]
  |  Branch (1050:47): [True: 0, False: 0]
  ------------------
 1051|      0|        image->set_color_profile_nclx(tile_img->get_color_profile_nclx());
 1052|      0|      }
 1053|      0|    }
 1054|    195|  }
 1055|       |
 1056|       |
 1057|       |  // --- read metadata and assign to image
 1058|       |
 1059|    476|  for (heif_item_id id : image_IDs) {
  ------------------
  |  Branch (1059:24): [True: 476, False: 20]
  ------------------
 1060|    476|    uint32_t item_type = m_heif_file->get_item_type_4cc(id);
 1061|    476|    std::string content_type = m_heif_file->get_content_type(id);
 1062|       |
 1063|       |    // 'rgan': skip region annotations, handled next
 1064|       |    // 'iden': iden images are no metadata
 1065|    476|    if (item_type_is_image(item_type, content_type) || item_type == fourcc("rgan")) {
  ------------------
  |  Branch (1065:9): [True: 272, False: 204]
  |  Branch (1065:56): [True: 0, False: 204]
  ------------------
 1066|    272|      continue;
 1067|    272|    }
 1068|       |
 1069|    204|    std::string item_uri_type = m_heif_file->get_item_uri_type(id);
 1070|       |
 1071|       |    // we now assign all kinds of metadata to the image, not only 'Exif' and 'XMP'
 1072|       |
 1073|    204|    std::shared_ptr<ImageMetadata> metadata = std::make_shared<ImageMetadata>();
 1074|    204|    metadata->item_id = id;
 1075|    204|    metadata->item_type = fourcc_to_string(item_type);
 1076|    204|    metadata->content_type = content_type;
 1077|    204|    metadata->item_uri_type = std::move(item_uri_type);
 1078|       |
 1079|    204|    auto metadataResult = m_heif_file->get_uncompressed_item_data(id);
 1080|    204|    if (!metadataResult) {
  ------------------
  |  Branch (1080:9): [True: 137, False: 67]
  ------------------
 1081|    137|      if (item_type == fourcc("Exif") || item_type == fourcc("mime")) {
  ------------------
  |  Branch (1081:11): [True: 0, False: 137]
  |  Branch (1081:42): [True: 0, False: 137]
  ------------------
 1082|       |        // these item types should have data
 1083|      0|        return metadataResult.error();
 1084|      0|      }
 1085|    137|      else {
 1086|       |        // anything else is probably something that we don't understand yet
 1087|    137|        continue;
 1088|    137|      }
 1089|    137|    }
 1090|     67|    else {
 1091|     67|      metadata->m_data = *metadataResult;
 1092|     67|    }
 1093|       |
 1094|       |    // --- assign metadata to the image
 1095|       |
 1096|     67|    if (iref_box) {
  ------------------
  |  Branch (1096:9): [True: 67, False: 0]
  ------------------
 1097|     67|      std::vector<heif_item_id> references = iref_box->get_references(id, fourcc("cdsc"));
 1098|     67|      for (heif_item_id exif_image_id : references) {
  ------------------
  |  Branch (1098:39): [True: 0, False: 67]
  ------------------
 1099|      0|        auto img_iter = m_all_images.find(exif_image_id);
 1100|      0|        if (img_iter == m_all_images.end()) {
  ------------------
  |  Branch (1100:13): [True: 0, False: 0]
  ------------------
 1101|      0|          if (!m_heif_file->has_item_with_id(exif_image_id)) {
  ------------------
  |  Branch (1101:15): [True: 0, False: 0]
  ------------------
 1102|      0|            return Error(heif_error_Invalid_input,
 1103|      0|                         heif_suberror_Nonexisting_item_referenced,
 1104|      0|                         "Metadata assigned to non-existing image");
 1105|      0|          }
 1106|       |
 1107|      0|          continue;
 1108|      0|        }
 1109|      0|        img_iter->second->add_metadata(metadata);
 1110|      0|      }
 1111|     67|    }
 1112|     67|  }
 1113|       |
 1114|       |  // --- set premultiplied alpha flag
 1115|       |
 1116|    476|  for (heif_item_id id : image_IDs) {
  ------------------
  |  Branch (1116:24): [True: 476, False: 20]
  ------------------
 1117|    476|    if (iref_box) {
  ------------------
  |  Branch (1117:9): [True: 471, False: 5]
  ------------------
 1118|    471|      std::vector<heif_item_id> references = iref_box->get_references(id, fourcc("prem"));
 1119|    471|      for (heif_item_id ref : references) {
  ------------------
  |  Branch (1119:29): [True: 0, False: 471]
  ------------------
 1120|      0|        (void)ref;
 1121|       |
 1122|      0|        heif_item_id color_image_id = id;
 1123|      0|        auto img_iter = m_all_images.find(color_image_id);
 1124|      0|        if (img_iter == m_all_images.end()) {
  ------------------
  |  Branch (1124:13): [True: 0, False: 0]
  ------------------
 1125|      0|          return Error(heif_error_Invalid_input,
 1126|      0|                       heif_suberror_Nonexisting_item_referenced,
 1127|      0|                       "`prem` link assigned to non-existing image");
 1128|      0|        }
 1129|       |
 1130|      0|        img_iter->second->set_is_premultiplied_alpha(true);
 1131|      0|      }
 1132|    471|    }
 1133|    476|  }
 1134|       |
 1135|       |  // --- read region item and assign to image(s)
 1136|       |
 1137|    476|  for (heif_item_id id : image_IDs) {
  ------------------
  |  Branch (1137:24): [True: 476, False: 20]
  ------------------
 1138|    476|    uint32_t item_type = m_heif_file->get_item_type_4cc(id);
 1139|    476|    if (item_type != fourcc("rgan")) {
  ------------------
  |  Branch (1139:9): [True: 476, False: 0]
  ------------------
 1140|    476|      continue;
 1141|    476|    }
 1142|       |
 1143|      0|    std::shared_ptr<RegionItem> region_item = std::make_shared<RegionItem>();
 1144|      0|    region_item->item_id = id;
 1145|       |
 1146|      0|    Result regionDataResult = m_heif_file->get_uncompressed_item_data(id);
 1147|      0|    if (!regionDataResult) {
  ------------------
  |  Branch (1147:9): [True: 0, False: 0]
  ------------------
 1148|      0|      return regionDataResult.error();
 1149|      0|    }
 1150|      0|    region_item->parse(*regionDataResult, get_security_limits());
 1151|       |
 1152|      0|    if (iref_box) {
  ------------------
  |  Branch (1152:9): [True: 0, False: 0]
  ------------------
 1153|      0|      std::vector<Box_iref::Reference> references = iref_box->get_references_from(id);
 1154|      0|      for (const auto& ref : references) {
  ------------------
  |  Branch (1154:28): [True: 0, False: 0]
  ------------------
 1155|      0|        if (ref.header.get_short_type() == fourcc("cdsc")) {
  ------------------
  |  Branch (1155:13): [True: 0, False: 0]
  ------------------
 1156|      0|          std::vector<uint32_t> refs = ref.to_item_ID;
 1157|      0|          for (uint32_t ref : refs) {
  ------------------
  |  Branch (1157:29): [True: 0, False: 0]
  ------------------
 1158|      0|            uint32_t image_id = ref;
 1159|      0|            auto img_iter = m_all_images.find(image_id);
 1160|      0|            if (img_iter == m_all_images.end()) {
  ------------------
  |  Branch (1160:17): [True: 0, False: 0]
  ------------------
 1161|      0|              return Error(heif_error_Invalid_input,
 1162|      0|                           heif_suberror_Nonexisting_item_referenced,
 1163|      0|                           "Region item assigned to non-existing image");
 1164|      0|            }
 1165|      0|            img_iter->second->add_region_item_id(id);
 1166|      0|            m_region_items.push_back(region_item);
 1167|      0|          }
 1168|      0|        }
 1169|       |
 1170|       |        /* When the geometry 'mask' of a region is represented by a mask stored in
 1171|       |        * another image item the image item containing the mask shall be identified
 1172|       |        * by an item reference of type 'mask' from the region item to the image item
 1173|       |        * containing the mask. */
 1174|      0|        if (ref.header.get_short_type() == fourcc("mask")) {
  ------------------
  |  Branch (1174:13): [True: 0, False: 0]
  ------------------
 1175|      0|          std::vector<uint32_t> refs = ref.to_item_ID;
 1176|      0|          size_t mask_index = 0;
 1177|      0|          for (int j = 0; j < region_item->get_number_of_regions(); j++) {
  ------------------
  |  Branch (1177:27): [True: 0, False: 0]
  ------------------
 1178|      0|            if (region_item->get_regions()[j]->getRegionType() == heif_region_type_referenced_mask) {
  ------------------
  |  Branch (1178:17): [True: 0, False: 0]
  ------------------
 1179|      0|              std::shared_ptr<RegionGeometry_ReferencedMask> mask_geometry = std::dynamic_pointer_cast<RegionGeometry_ReferencedMask>(region_item->get_regions()[j]);
 1180|       |
 1181|      0|              if (mask_index >= refs.size()) {
  ------------------
  |  Branch (1181:19): [True: 0, False: 0]
  ------------------
 1182|      0|                return Error(heif_error_Invalid_input,
 1183|      0|                             heif_suberror_Unspecified,
 1184|      0|                             "Region mask reference with non-existing mask image reference");
 1185|      0|              }
 1186|       |
 1187|      0|              uint32_t mask_image_id = refs[mask_index];
 1188|      0|              if (!is_image(mask_image_id)) {
  ------------------
  |  Branch (1188:19): [True: 0, False: 0]
  ------------------
 1189|      0|                return Error(heif_error_Invalid_input,
 1190|      0|                             heif_suberror_Unspecified,
 1191|      0|                             "Region mask referenced item is not an image");
 1192|      0|              }
 1193|       |
 1194|      0|              auto mask_image = get_image(mask_image_id, true);
 1195|      0|              if (auto error = mask_image->get_item_error()) {
  ------------------
  |  Branch (1195:24): [True: 0, False: 0]
  ------------------
 1196|      0|                return error;
 1197|      0|              }
 1198|       |
 1199|      0|              mask_geometry->referenced_item = mask_image_id;
 1200|      0|              if (mask_geometry->width == 0) {
  ------------------
  |  Branch (1200:19): [True: 0, False: 0]
  ------------------
 1201|      0|                mask_geometry->width = mask_image->get_ispe_width();
 1202|      0|              }
 1203|      0|              if (mask_geometry->height == 0) {
  ------------------
  |  Branch (1203:19): [True: 0, False: 0]
  ------------------
 1204|      0|                mask_geometry->height = mask_image->get_ispe_height();
 1205|      0|              }
 1206|      0|              mask_index += 1;
 1207|      0|              remove_top_level_image(mask_image);
 1208|      0|            }
 1209|      0|          }
 1210|      0|        }
 1211|      0|      }
 1212|      0|    }
 1213|      0|  }
 1214|       |
 1215|       |  // --- read text item and assign to image(s)
 1216|    476|  for (heif_item_id id : image_IDs) {
  ------------------
  |  Branch (1216:24): [True: 476, False: 20]
  ------------------
 1217|    476|    uint32_t item_type = m_heif_file->get_item_type_4cc(id);
 1218|    476|    if (item_type != fourcc("mime")) { // TODO: && content_type  starts with "text/" ?
  ------------------
  |  Branch (1218:9): [True: 476, False: 0]
  ------------------
 1219|    476|      continue;
 1220|    476|    }
 1221|      0|    std::shared_ptr<TextItem> text_item = std::make_shared<TextItem>();
 1222|      0|    text_item->set_item_id(id);
 1223|       |
 1224|      0|    auto textDataResult = m_heif_file->get_uncompressed_item_data(id);
 1225|      0|    if (!textDataResult) {
  ------------------
  |  Branch (1225:9): [True: 0, False: 0]
  ------------------
 1226|      0|      return textDataResult.error();
 1227|      0|    }
 1228|       |
 1229|      0|    text_item->parse(*textDataResult);
 1230|      0|    if (iref_box) {
  ------------------
  |  Branch (1230:9): [True: 0, False: 0]
  ------------------
 1231|      0|      std::vector<Box_iref::Reference> references = iref_box->get_references_from(id);
 1232|      0|      for (const auto& ref : references) {
  ------------------
  |  Branch (1232:28): [True: 0, False: 0]
  ------------------
 1233|      0|        if (ref.header.get_short_type() == fourcc("text")) {
  ------------------
  |  Branch (1233:13): [True: 0, False: 0]
  ------------------
 1234|      0|          std::vector<uint32_t> refs = ref.to_item_ID;
 1235|      0|          for (uint32_t ref : refs) {
  ------------------
  |  Branch (1235:29): [True: 0, False: 0]
  ------------------
 1236|      0|            uint32_t image_id = ref;
 1237|      0|            auto img_iter = m_all_images.find(image_id);
 1238|      0|            if (img_iter == m_all_images.end()) {
  ------------------
  |  Branch (1238:17): [True: 0, False: 0]
  ------------------
 1239|      0|              return Error(heif_error_Invalid_input,
 1240|      0|                           heif_suberror_Nonexisting_item_referenced,
 1241|      0|                           "Text item assigned to non-existing image");
 1242|      0|            }
 1243|      0|            img_iter->second->add_text_item_id(id);
 1244|      0|            m_text_items.push_back(text_item);
 1245|      0|          }
 1246|      0|        }
 1247|      0|      }
 1248|      0|    }
 1249|      0|  }
 1250|       |
 1251|     20|  return Error::Ok;
 1252|     20|}
_ZNK11HeifContext25find_first_coded_image_idEj:
 1352|      1|{
 1353|      1|  std::set<heif_item_id> visited;
 1354|       |
 1355|      1|  for (;;) {
 1356|      1|    if (!visited.insert(id).second) {
  ------------------
  |  Branch (1356:9): [True: 0, False: 1]
  ------------------
 1357|      0|      return Error(heif_error_Invalid_input,
 1358|      0|                   heif_suberror_No_item_data,
 1359|      0|                   "Derived image references form a cycle");
 1360|      0|    }
 1361|       |
 1362|      1|    uint32_t image_type = m_heif_file->get_item_type_4cc(id);
 1363|      1|    if (image_type == fourcc("grid") ||
  ------------------
  |  Branch (1363:9): [True: 0, False: 1]
  ------------------
 1364|      1|        image_type == fourcc("iden") ||
  ------------------
  |  Branch (1364:9): [True: 0, False: 1]
  ------------------
 1365|      1|        image_type == fourcc("iovl")) {
  ------------------
  |  Branch (1365:9): [True: 1, False: 0]
  ------------------
 1366|      1|      auto iref_box = m_heif_file->get_iref_box();
 1367|      1|      if (!iref_box) {
  ------------------
  |  Branch (1367:11): [True: 0, False: 1]
  ------------------
 1368|      0|        return Error(heif_error_Invalid_input,
 1369|      0|                     heif_suberror_No_item_data,
 1370|      0|                     "Derived image does not reference any other image items");
 1371|      0|      }
 1372|       |
 1373|      1|      std::vector<heif_item_id> image_references = iref_box->get_references(id, fourcc("dimg"));
 1374|       |
 1375|      1|      if (image_references.empty()) {
  ------------------
  |  Branch (1375:11): [True: 1, False: 0]
  ------------------
 1376|      1|        return Error(heif_error_Invalid_input,
 1377|      1|                     heif_suberror_No_item_data,
 1378|      1|                     "Derived image does not reference any other image items");
 1379|      1|      }
 1380|       |
 1381|       |      // follow the first reference
 1382|      0|      id = image_references[0];
 1383|      0|    }
 1384|      0|    else {
 1385|      0|      if (!m_all_images.contains(id)) {
  ------------------
  |  Branch (1385:11): [True: 0, False: 0]
  ------------------
 1386|      0|        std::stringstream sstr;
 1387|      0|        sstr << "Image item " << id << " referenced, but it does not exist\n";
 1388|       |
 1389|      0|        return Error(heif_error_Invalid_input,
 1390|      0|          heif_suberror_Nonexisting_item_referenced,
 1391|      0|          sstr.str());
 1392|      0|      }
 1393|      0|      else if (dynamic_cast<ImageItem_Error*>(m_all_images.find(id)->second.get())) {
  ------------------
  |  Branch (1393:16): [True: 0, False: 0]
  ------------------
 1394|       |        // Should we return an error here or leave it to the follow-up code to detect that?
 1395|      0|      }
 1396|       |
 1397|      0|      return id;
 1398|      0|    }
 1399|      1|  }
 1400|      1|}
_ZNK11HeifContext12decode_imageEj15heif_colorspace11heif_chromaRK21heif_decoding_optionsbjjNSt3__13setIjNS5_4lessIjEENS5_9allocatorIjEEEE:
 1409|     57|{
 1410|     57|  std::shared_ptr<ImageItem> imgitem;
 1411|     57|  if (m_all_images.contains(ID)) {
  ------------------
  |  Branch (1411:7): [True: 57, False: 0]
  ------------------
 1412|     57|    imgitem = m_all_images.find(ID)->second;
 1413|     57|  }
 1414|       |
 1415|       |  // Note: this may happen, for example when an 'iden' image references a non-existing image item.
 1416|     57|  if (imgitem == nullptr) {
  ------------------
  |  Branch (1416:7): [True: 0, False: 57]
  ------------------
 1417|      0|    return Error(heif_error_Invalid_input, heif_suberror_Nonexisting_item_referenced);
 1418|      0|  }
 1419|       |
 1420|       |
 1421|     57|  auto decodingResult = imgitem->decode_image(options, decode_only_tile, tx, ty, processed_ids);
 1422|     57|  if (!decodingResult) {
  ------------------
  |  Branch (1422:7): [True: 52, False: 5]
  ------------------
 1423|     52|    return decodingResult.error();
 1424|     52|  }
 1425|       |
 1426|      5|  std::shared_ptr<HeifPixelImage> img = *decodingResult;
 1427|       |
 1428|       |  // For visual codecs (HEVC/AVC/AVIF/JPEG/...) the decoder plugin builds the
 1429|       |  // returned image via the public C API (heif_image_add_plane_safe), which
 1430|       |  // auto-mints component ids. Reconcile those with the canonical description
 1431|       |  // list that ImageItem::populate_component_descriptions() produced, so
 1432|       |  // handle-side and decoded-image-side ids agree by construction.
 1433|       |  // No-op for unci (which already shares ids with the item) or for items
 1434|       |  // without a populated description list (grid/overlay/iden).
 1435|      5|  img->apply_descriptions_from(*imgitem);
 1436|       |
 1437|       |  // Note: the decoded image is validated against the signaled size inside
 1438|       |  // ImageItem::decode_image() (via the per-item check_decoded_image_size()).
 1439|       |
 1440|       |  // --- convert to output chroma format
 1441|       |
 1442|      5|  auto img_result = convert_to_output_colorspace(img, out_colorspace, out_chroma, options);
 1443|      5|  if (!img_result) {
  ------------------
  |  Branch (1443:7): [True: 0, False: 5]
  ------------------
 1444|      0|    return img_result.error();
 1445|      0|  }
 1446|      5|  else {
 1447|      5|    img = *img_result;
 1448|      5|  }
 1449|       |
 1450|      5|  img->add_warnings(imgitem->get_decoding_warnings());
 1451|       |
 1452|      5|  return img;
 1453|      5|}
_Z24nclx_color_profile_equalNSt3__18optionalI12nclx_profileEEPK23heif_color_profile_nclx:
 1458|      5|{
 1459|      5|  if (!a && b==nullptr) {
  ------------------
  |  Branch (1459:7): [True: 0, False: 5]
  |  Branch (1459:13): [True: 0, False: 0]
  ------------------
 1460|      0|    return true;
 1461|      0|  }
 1462|       |
 1463|      5|  heif_color_profile_nclx* default_nclx = nullptr;
 1464|       |
 1465|      5|  if (!a || b==nullptr) {
  ------------------
  |  Branch (1465:7): [True: 0, False: 5]
  |  Branch (1465:13): [True: 5, False: 0]
  ------------------
 1466|      5|    default_nclx = heif_nclx_color_profile_alloc();
 1467|       |
 1468|      5|    if (!a) {
  ------------------
  |  Branch (1468:9): [True: 0, False: 5]
  ------------------
 1469|      0|      a = nclx_profile::defaults();
 1470|      0|    }
 1471|       |
 1472|      5|    if (b==nullptr) {
  ------------------
  |  Branch (1472:9): [True: 5, False: 0]
  ------------------
 1473|      5|      b = default_nclx;
 1474|      5|    }
 1475|      5|  }
 1476|       |
 1477|      5|  bool equal = true;
 1478|      5|  if (a->m_matrix_coefficients != b->matrix_coefficients ||
  ------------------
  |  Branch (1478:7): [True: 1, False: 4]
  ------------------
 1479|      4|      a->m_colour_primaries != b->color_primaries ||
  ------------------
  |  Branch (1479:7): [True: 0, False: 4]
  ------------------
 1480|      4|      a->m_transfer_characteristics != b->transfer_characteristics ||
  ------------------
  |  Branch (1480:7): [True: 0, False: 4]
  ------------------
 1481|      4|      a->m_full_range_flag != b->full_range_flag) {
  ------------------
  |  Branch (1481:7): [True: 0, False: 4]
  ------------------
 1482|      1|    equal = false;
 1483|      1|  }
 1484|       |
 1485|      5|  if (default_nclx) {
  ------------------
  |  Branch (1485:7): [True: 5, False: 0]
  ------------------
 1486|      5|    heif_nclx_color_profile_free(default_nclx);
 1487|      5|  }
 1488|       |
 1489|      5|  return equal;
 1490|      5|}
_ZNK11HeifContext28convert_to_output_colorspaceENSt3__110shared_ptrI14HeifPixelImageEE15heif_colorspace11heif_chromaRK21heif_decoding_options:
 1497|      5|{
 1498|      5|  heif_colorspace target_colorspace = (out_colorspace == heif_colorspace_undefined ?
  ------------------
  |  Branch (1498:40): [True: 0, False: 5]
  ------------------
 1499|      0|                                       img->get_colorspace() :
 1500|      5|                                       out_colorspace);
 1501|       |
 1502|      5|  heif_chroma target_chroma = (out_chroma == heif_chroma_undefined ?
  ------------------
  |  Branch (1502:32): [True: 0, False: 5]
  ------------------
 1503|      5|                               img->get_chroma_format() : out_chroma);
 1504|       |
 1505|      5|  bool different_chroma = (target_chroma != img->get_chroma_format());
 1506|      5|  bool different_colorspace = (target_colorspace != img->get_colorspace());
 1507|       |
 1508|      5|  uint16_t img_bpp = img->get_visual_image_bits_per_pixel();
 1509|      5|  uint8_t converted_output_bpp = (options.convert_hdr_to_8bit && img_bpp > 8) ? 8 : 0 /* keep input depth */;
  ------------------
  |  Branch (1509:35): [True: 0, False: 5]
  |  Branch (1509:66): [True: 0, False: 0]
  ------------------
 1510|       |
 1511|      5|  nclx_profile img_nclx = img->get_color_profile_nclx_with_fallback();
 1512|      5|  bool different_nclx = !nclx_color_profile_equal(img_nclx, options.output_image_nclx_profile);
 1513|       |
 1514|      5|  if (different_chroma ||
  ------------------
  |  Branch (1514:7): [True: 5, False: 0]
  ------------------
 1515|      0|      different_colorspace ||
  ------------------
  |  Branch (1515:7): [True: 0, False: 0]
  ------------------
 1516|      0|      converted_output_bpp ||
  ------------------
  |  Branch (1516:7): [True: 0, False: 0]
  ------------------
 1517|      0|      different_nclx ||
  ------------------
  |  Branch (1517:7): [True: 0, False: 0]
  ------------------
 1518|      5|      (img->has_alpha() && options.color_conversion_options_ext && options.color_conversion_options_ext->alpha_composition_mode != heif_alpha_composition_mode_none)) {
  ------------------
  |  Branch (1518:8): [True: 0, False: 0]
  |  Branch (1518:28): [True: 0, False: 0]
  |  Branch (1518:68): [True: 0, False: 0]
  ------------------
 1519|       |
 1520|      5|    nclx_profile output_profile;
 1521|      5|    if (options.output_image_nclx_profile) {
  ------------------
  |  Branch (1521:9): [True: 0, False: 5]
  ------------------
 1522|      0|      output_profile.set_matrix_coefficients(options.output_image_nclx_profile->matrix_coefficients);
 1523|      0|      output_profile.set_colour_primaries(options.output_image_nclx_profile->color_primaries);
 1524|      0|      output_profile.set_full_range_flag(options.output_image_nclx_profile->full_range_flag);
 1525|      0|    }
 1526|      5|    else {
 1527|      5|      output_profile.set_sRGB_defaults();
 1528|      5|    }
 1529|       |
 1530|      5|    return convert_colorspace(img, target_colorspace, target_chroma, output_profile, converted_output_bpp,
 1531|      5|                                         options.color_conversion_options, options.color_conversion_options_ext,
 1532|      5|                                         get_security_limits());
 1533|      5|  }
 1534|      0|  else {
 1535|      0|    return img;
 1536|      0|  }
 1537|      5|}
context.cc:_ZL18item_type_is_imagejRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  530|    476|{
  531|    476|  return (item_type == fourcc("hvc1") ||
  ------------------
  |  Branch (531:11): [True: 250, False: 226]
  ------------------
  532|    226|          item_type == fourcc("av01") ||
  ------------------
  |  Branch (532:11): [True: 8, False: 218]
  ------------------
  533|    218|          item_type == fourcc("grid") ||
  ------------------
  |  Branch (533:11): [True: 0, False: 218]
  ------------------
  534|    218|          item_type == fourcc("tili") ||
  ------------------
  |  Branch (534:11): [True: 0, False: 218]
  ------------------
  535|    218|          item_type == fourcc("iden") ||
  ------------------
  |  Branch (535:11): [True: 0, False: 218]
  ------------------
  536|    218|          item_type == fourcc("iovl") ||
  ------------------
  |  Branch (536:11): [True: 9, False: 209]
  ------------------
  537|    209|          item_type == fourcc("avc1") ||
  ------------------
  |  Branch (537:11): [True: 0, False: 209]
  ------------------
  538|    209|          item_type == fourcc("unci") ||
  ------------------
  |  Branch (538:11): [True: 0, False: 209]
  ------------------
  539|    209|          item_type == fourcc("vvc1") ||
  ------------------
  |  Branch (539:11): [True: 0, False: 209]
  ------------------
  540|    209|          item_type == fourcc("jpeg") ||
  ------------------
  |  Branch (540:11): [True: 0, False: 209]
  ------------------
  541|    209|          (item_type == fourcc("mime") && content_type == "image/jpeg") ||
  ------------------
  |  Branch (541:12): [True: 0, False: 209]
  |  Branch (541:43): [True: 0, False: 0]
  ------------------
  542|    209|          item_type == fourcc("j2k1") ||
  ------------------
  |  Branch (542:11): [True: 0, False: 209]
  ------------------
  543|    209|          item_type == fourcc("mski"));
  ------------------
  |  Branch (543:11): [True: 5, False: 204]
  ------------------
  544|    476|}

_ZN11HeifContext19get_security_limitsEv:
   80|     68|  [[nodiscard]] heif_security_limits* get_security_limits() { return &m_limits; }
_ZNK11HeifContext19get_security_limitsEv:
   82|     81|  [[nodiscard]] const heif_security_limits* get_security_limits() const { return &m_limits; }
_ZNK11HeifContext13get_heif_fileEv:
   90|    480|  std::shared_ptr<HeifFile> get_heif_file() const { return m_heif_file; }

_ZN5ErrorC2Ev:
   46|  1.24k|Error::Error() = default;
_ZN5ErrorC2E15heif_error_code18heif_suberror_codeRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   52|  1.41k|    : error_code(c),
   53|  1.41k|      sub_error_code(sc),
   54|  1.41k|      message(msg)
   55|  1.41k|{
   56|  1.41k|}
_ZN5Error15from_heif_errorERK10heif_error:
   70|     10|{
   71|       |  // unpack the concatenated error message and extract the last part only
   72|       |
   73|     10|  const char* err_string = get_error_string(c_error.code);
   74|     10|  const char* sub_err_string = get_error_string(c_error.subcode);
   75|       |
   76|     10|  std::string msg = c_error.message;
   77|     10|  if (starts_with(msg, err_string)) {
  ------------------
  |  Branch (77:7): [True: 6, False: 4]
  ------------------
   78|      6|    msg = msg.substr(strlen(err_string));
   79|       |
   80|      6|    if (starts_with(msg, ": ")) {
  ------------------
  |  Branch (80:9): [True: 0, False: 6]
  ------------------
   81|      0|      msg = msg.substr(2);
   82|      0|    }
   83|       |
   84|      6|    if (starts_with(msg, sub_err_string)) {
  ------------------
  |  Branch (84:9): [True: 0, False: 6]
  ------------------
   85|      0|      msg = msg.substr(strlen(sub_err_string));
   86|       |
   87|      0|      if (starts_with(msg, ": ")) {
  ------------------
  |  Branch (87:11): [True: 0, False: 0]
  ------------------
   88|      0|        msg = msg.substr(2);
   89|      0|      }
   90|      0|    }
   91|      6|  }
   92|       |
   93|     10|  return {c_error.code, c_error.subcode, msg};
   94|     10|}
_ZN5Error16get_error_stringE15heif_error_code:
   98|    105|{
   99|    105|  switch (err) {
  ------------------
  |  Branch (99:11): [True: 105, False: 0]
  ------------------
  100|      6|    case heif_error_Ok:
  ------------------
  |  Branch (100:5): [True: 6, False: 99]
  ------------------
  101|      6|      return "Success";
  102|      0|    case heif_error_Input_does_not_exist:
  ------------------
  |  Branch (102:5): [True: 0, False: 105]
  ------------------
  103|      0|      return "Input file does not exist";
  104|     56|    case heif_error_Invalid_input:
  ------------------
  |  Branch (104:5): [True: 56, False: 49]
  ------------------
  105|     56|      return "Invalid input";
  106|      2|    case heif_error_Unsupported_filetype:
  ------------------
  |  Branch (106:5): [True: 2, False: 103]
  ------------------
  107|      2|      return "Unsupported file-type";
  108|      2|    case heif_error_Unsupported_feature:
  ------------------
  |  Branch (108:5): [True: 2, False: 103]
  ------------------
  109|      2|      return "Unsupported feature";
  110|      3|    case heif_error_Usage_error:
  ------------------
  |  Branch (110:5): [True: 3, False: 102]
  ------------------
  111|      3|      return "Usage error";
  112|      5|    case heif_error_Memory_allocation_error:
  ------------------
  |  Branch (112:5): [True: 5, False: 100]
  ------------------
  113|      5|      return "Memory allocation error";
  114|     31|    case heif_error_Decoder_plugin_error:
  ------------------
  |  Branch (114:5): [True: 31, False: 74]
  ------------------
  115|     31|      return "Decoder plugin generated an error";
  116|      0|    case heif_error_Encoder_plugin_error:
  ------------------
  |  Branch (116:5): [True: 0, False: 105]
  ------------------
  117|      0|      return "Encoder plugin generated an error";
  118|      0|    case heif_error_Encoding_error:
  ------------------
  |  Branch (118:5): [True: 0, False: 105]
  ------------------
  119|      0|      return "Error during encoding or writing output file";
  120|      0|    case heif_error_Color_profile_does_not_exist:
  ------------------
  |  Branch (120:5): [True: 0, False: 105]
  ------------------
  121|      0|      return "Color profile does not exist";
  122|      0|    case heif_error_Plugin_loading_error:
  ------------------
  |  Branch (122:5): [True: 0, False: 105]
  ------------------
  123|      0|      return "Error while loading plugin";
  124|      0|    case heif_error_Canceled:
  ------------------
  |  Branch (124:5): [True: 0, False: 105]
  ------------------
  125|      0|      return "Canceled by user";
  126|      0|    case heif_error_End_of_sequence:
  ------------------
  |  Branch (126:5): [True: 0, False: 105]
  ------------------
  127|      0|      return "End of sequence";
  128|    105|  }
  129|       |
  130|    105|  assert(false);
  ------------------
  |  Branch (130:3): [Folded, False: 0]
  ------------------
  131|      0|  return "Unknown error";
  132|      0|}
_ZN5Error16get_error_stringE18heif_suberror_code:
  135|    105|{
  136|    105|  switch (err) {
  ------------------
  |  Branch (136:11): [True: 105, False: 0]
  ------------------
  137|     21|    case heif_suberror_Unspecified:
  ------------------
  |  Branch (137:5): [True: 21, False: 84]
  ------------------
  138|     21|      return "Unspecified";
  139|       |
  140|       |      // --- Invalid_input ---
  141|       |
  142|     28|    case heif_suberror_End_of_data:
  ------------------
  |  Branch (142:5): [True: 28, False: 77]
  ------------------
  143|     28|      return "Unexpected end of file";
  144|      1|    case heif_suberror_Invalid_box_size:
  ------------------
  |  Branch (144:5): [True: 1, False: 104]
  ------------------
  145|      1|      return "Invalid box size";
  146|      0|    case heif_suberror_Invalid_grid_data:
  ------------------
  |  Branch (146:5): [True: 0, False: 105]
  ------------------
  147|      0|      return "Invalid grid data";
  148|      0|    case heif_suberror_Missing_grid_images:
  ------------------
  |  Branch (148:5): [True: 0, False: 105]
  ------------------
  149|      0|      return "Missing grid images";
  150|      7|    case heif_suberror_No_ftyp_box:
  ------------------
  |  Branch (150:5): [True: 7, False: 98]
  ------------------
  151|      7|      return "No 'ftyp' box";
  152|      0|    case heif_suberror_No_idat_box:
  ------------------
  |  Branch (152:5): [True: 0, False: 105]
  ------------------
  153|      0|      return "No 'idat' box";
  154|      0|    case heif_suberror_No_meta_box:
  ------------------
  |  Branch (154:5): [True: 0, False: 105]
  ------------------
  155|      0|      return "No 'meta' box";
  156|      0|    case heif_suberror_No_hdlr_box:
  ------------------
  |  Branch (156:5): [True: 0, False: 105]
  ------------------
  157|      0|      return "No 'hdlr' box";
  158|      0|    case heif_suberror_No_hvcC_box:
  ------------------
  |  Branch (158:5): [True: 0, False: 105]
  ------------------
  159|      0|      return "No 'hvcC' box";
  160|      0|    case heif_suberror_No_vvcC_box:
  ------------------
  |  Branch (160:5): [True: 0, False: 105]
  ------------------
  161|      0|      return "No 'vvcC' box";
  162|      0|    case heif_suberror_No_av1C_box:
  ------------------
  |  Branch (162:5): [True: 0, False: 105]
  ------------------
  163|      0|      return "No 'av1C' box";
  164|      0|    case heif_suberror_No_avcC_box:
  ------------------
  |  Branch (164:5): [True: 0, False: 105]
  ------------------
  165|      0|      return "No 'avcC' box";
  166|      0|    case heif_suberror_No_pitm_box:
  ------------------
  |  Branch (166:5): [True: 0, False: 105]
  ------------------
  167|      0|      return "No 'pitm' box";
  168|      0|    case heif_suberror_No_ipco_box:
  ------------------
  |  Branch (168:5): [True: 0, False: 105]
  ------------------
  169|      0|      return "No 'ipco' box";
  170|      0|    case heif_suberror_No_ipma_box:
  ------------------
  |  Branch (170:5): [True: 0, False: 105]
  ------------------
  171|      0|      return "No 'ipma' box";
  172|      0|    case heif_suberror_No_iloc_box:
  ------------------
  |  Branch (172:5): [True: 0, False: 105]
  ------------------
  173|      0|      return "No 'iloc' box";
  174|      0|    case heif_suberror_No_iinf_box:
  ------------------
  |  Branch (174:5): [True: 0, False: 105]
  ------------------
  175|      0|      return "No 'iinf' box";
  176|      0|    case heif_suberror_No_iprp_box:
  ------------------
  |  Branch (176:5): [True: 0, False: 105]
  ------------------
  177|      0|      return "No 'iprp' box";
  178|      0|    case heif_suberror_No_iref_box:
  ------------------
  |  Branch (178:5): [True: 0, False: 105]
  ------------------
  179|      0|      return "No 'iref' box";
  180|      0|    case heif_suberror_No_infe_box:
  ------------------
  |  Branch (180:5): [True: 0, False: 105]
  ------------------
  181|      0|      return "No 'infe' box";
  182|      0|    case heif_suberror_No_pict_handler:
  ------------------
  |  Branch (182:5): [True: 0, False: 105]
  ------------------
  183|      0|      return "Not a 'pict' handler";
  184|     22|    case heif_suberror_Ipma_box_references_nonexisting_property:
  ------------------
  |  Branch (184:5): [True: 22, False: 83]
  ------------------
  185|     22|      return "'ipma' box references a non-existing property";
  186|      2|    case heif_suberror_No_properties_assigned_to_item:
  ------------------
  |  Branch (186:5): [True: 2, False: 103]
  ------------------
  187|      2|      return "No properties assigned to item";
  188|     14|    case heif_suberror_No_item_data:
  ------------------
  |  Branch (188:5): [True: 14, False: 91]
  ------------------
  189|     14|      return "Item has no data";
  190|      0|    case heif_suberror_Invalid_clean_aperture:
  ------------------
  |  Branch (190:5): [True: 0, False: 105]
  ------------------
  191|      0|      return "Invalid clean-aperture specification";
  192|      0|    case heif_suberror_Invalid_overlay_data:
  ------------------
  |  Branch (192:5): [True: 0, False: 105]
  ------------------
  193|      0|      return "Invalid overlay data";
  194|      0|    case heif_suberror_Overlay_image_outside_of_canvas:
  ------------------
  |  Branch (194:5): [True: 0, False: 105]
  ------------------
  195|      0|      return "Overlay image outside of canvas area";
  196|      0|    case heif_suberror_Auxiliary_image_type_unspecified:
  ------------------
  |  Branch (196:5): [True: 0, False: 105]
  ------------------
  197|      0|      return "Type of auxiliary image unspecified";
  198|      0|    case heif_suberror_No_or_invalid_primary_item:
  ------------------
  |  Branch (198:5): [True: 0, False: 105]
  ------------------
  199|      0|      return "No or invalid primary item";
  200|      0|    case heif_suberror_Unknown_color_profile_type:
  ------------------
  |  Branch (200:5): [True: 0, False: 105]
  ------------------
  201|      0|      return "Unknown color profile type";
  202|      0|    case heif_suberror_Wrong_tile_image_chroma_format:
  ------------------
  |  Branch (202:5): [True: 0, False: 105]
  ------------------
  203|      0|      return "Wrong tile image chroma format";
  204|      0|    case heif_suberror_Invalid_fractional_number:
  ------------------
  |  Branch (204:5): [True: 0, False: 105]
  ------------------
  205|      0|      return "Invalid fractional number";
  206|      0|    case heif_suberror_Invalid_image_size:
  ------------------
  |  Branch (206:5): [True: 0, False: 105]
  ------------------
  207|      0|      return "Invalid image size";
  208|      0|    case heif_suberror_Invalid_pixi_box:
  ------------------
  |  Branch (208:5): [True: 0, False: 105]
  ------------------
  209|      0|      return "Invalid pixi box";
  210|      0|    case heif_suberror_Wrong_tile_image_pixel_depth:
  ------------------
  |  Branch (210:5): [True: 0, False: 105]
  ------------------
  211|      0|      return "Wrong tile image pixel depth";
  212|      0|    case heif_suberror_Unknown_NCLX_color_primaries:
  ------------------
  |  Branch (212:5): [True: 0, False: 105]
  ------------------
  213|      0|      return "Unknown NCLX color primaries";
  214|      0|    case heif_suberror_Unknown_NCLX_transfer_characteristics:
  ------------------
  |  Branch (214:5): [True: 0, False: 105]
  ------------------
  215|      0|      return "Unknown NCLX transfer characteristics";
  216|      0|    case heif_suberror_Unknown_NCLX_matrix_coefficients:
  ------------------
  |  Branch (216:5): [True: 0, False: 105]
  ------------------
  217|      0|      return "Unknown NCLX matrix coefficients";
  218|      0|    case heif_suberror_Invalid_region_data:
  ------------------
  |  Branch (218:5): [True: 0, False: 105]
  ------------------
  219|      0|      return "Invalid region item data";
  220|      0|    case heif_suberror_No_ispe_property:
  ------------------
  |  Branch (220:5): [True: 0, False: 105]
  ------------------
  221|      0|      return "Image has no 'ispe' property";
  222|      0|    case heif_suberror_Camera_intrinsic_matrix_undefined:
  ------------------
  |  Branch (222:5): [True: 0, False: 105]
  ------------------
  223|      0|      return "Camera intrinsic matrix undefined";
  224|      0|    case heif_suberror_Camera_extrinsic_matrix_undefined:
  ------------------
  |  Branch (224:5): [True: 0, False: 105]
  ------------------
  225|      0|      return "Camera extrinsic matrix undefined";
  226|      0|    case heif_suberror_Invalid_J2K_codestream:
  ------------------
  |  Branch (226:5): [True: 0, False: 105]
  ------------------
  227|      0|      return "Invalid JPEG 2000 codestream";
  228|      0|    case heif_suberror_Decompression_invalid_data:
  ------------------
  |  Branch (228:5): [True: 0, False: 105]
  ------------------
  229|      0|      return "Invalid data in generic compression inflation";
  230|      0|    case heif_suberror_No_moov_box:
  ------------------
  |  Branch (230:5): [True: 0, False: 105]
  ------------------
  231|      0|      return "No 'moov' box";
  232|      0|    case heif_suberror_NCLX_colr_VUI_mismatch:
  ------------------
  |  Branch (232:5): [True: 0, False: 105]
  ------------------
  233|      0|      return "colr box and bitstream colour signalling disagree";
  234|      0|    case heif_suberror_No_icbr_box:
  ------------------
  |  Branch (234:5): [True: 0, False: 105]
  ------------------
  235|      0|      return "No 'icbr' box";
  236|      0|    case heif_suberror_Invalid_mini_box:
  ------------------
  |  Branch (236:5): [True: 0, False: 105]
  ------------------
  237|      0|      return "Unsupported or invalid 'mini' box";
  238|       |
  239|       |
  240|       |      // --- Memory_allocation_error ---
  241|       |
  242|      5|    case heif_suberror_Security_limit_exceeded:
  ------------------
  |  Branch (242:5): [True: 5, False: 100]
  ------------------
  243|      5|      return "Security limit exceeded";
  244|      0|    case heif_suberror_Compression_initialisation_error:
  ------------------
  |  Branch (244:5): [True: 0, False: 105]
  ------------------
  245|      0|      return "Compression initialisation method error";
  246|       |
  247|       |      // --- Usage_error ---
  248|       |
  249|      3|    case heif_suberror_Nonexisting_item_referenced:
  ------------------
  |  Branch (249:5): [True: 3, False: 102]
  ------------------
  250|      3|      return "Non-existing item ID referenced";
  251|      0|    case heif_suberror_Null_pointer_argument:
  ------------------
  |  Branch (251:5): [True: 0, False: 105]
  ------------------
  252|      0|      return "NULL argument received";
  253|      0|    case heif_suberror_Nonexisting_image_channel_referenced:
  ------------------
  |  Branch (253:5): [True: 0, False: 105]
  ------------------
  254|      0|      return "Non-existing image channel referenced";
  255|      0|    case heif_suberror_Unsupported_plugin_version:
  ------------------
  |  Branch (255:5): [True: 0, False: 105]
  ------------------
  256|      0|      return "The version of the passed plugin is not supported";
  257|      0|    case heif_suberror_Unsupported_writer_version:
  ------------------
  |  Branch (257:5): [True: 0, False: 105]
  ------------------
  258|      0|      return "The version of the passed writer is not supported";
  259|      0|    case heif_suberror_Unsupported_parameter:
  ------------------
  |  Branch (259:5): [True: 0, False: 105]
  ------------------
  260|      0|      return "Unsupported parameter";
  261|      0|    case heif_suberror_Invalid_parameter_value:
  ------------------
  |  Branch (261:5): [True: 0, False: 105]
  ------------------
  262|      0|      return "Invalid parameter value";
  263|      0|    case heif_suberror_Invalid_property:
  ------------------
  |  Branch (263:5): [True: 0, False: 105]
  ------------------
  264|      0|      return "Invalid property";
  265|      0|    case heif_suberror_Item_reference_cycle:
  ------------------
  |  Branch (265:5): [True: 0, False: 105]
  ------------------
  266|      0|      return "Image reference cycle";
  267|       |
  268|       |      // --- Unsupported_feature ---
  269|       |
  270|      0|    case heif_suberror_Unsupported_codec:
  ------------------
  |  Branch (270:5): [True: 0, False: 105]
  ------------------
  271|      0|      return "Unsupported codec";
  272|      0|    case heif_suberror_Unsupported_image_type:
  ------------------
  |  Branch (272:5): [True: 0, False: 105]
  ------------------
  273|      0|      return "Unsupported image type";
  274|      2|    case heif_suberror_Unsupported_data_version:
  ------------------
  |  Branch (274:5): [True: 2, False: 103]
  ------------------
  275|      2|      return "Unsupported data version";
  276|      0|    case heif_suberror_Unsupported_color_conversion:
  ------------------
  |  Branch (276:5): [True: 0, False: 105]
  ------------------
  277|      0|      return "Unsupported color conversion";
  278|      0|    case heif_suberror_Unsupported_item_construction_method:
  ------------------
  |  Branch (278:5): [True: 0, False: 105]
  ------------------
  279|      0|      return "Unsupported item construction method";
  280|      0|    case heif_suberror_Unsupported_header_compression_method:
  ------------------
  |  Branch (280:5): [True: 0, False: 105]
  ------------------
  281|      0|      return "Unsupported header compression method";
  282|      0|    case heif_suberror_Unsupported_generic_compression_method:
  ------------------
  |  Branch (282:5): [True: 0, False: 105]
  ------------------
  283|      0|      return "Unsupported generic compression method";
  284|      0|    case heif_suberror_Unsupported_essential_property:
  ------------------
  |  Branch (284:5): [True: 0, False: 105]
  ------------------
  285|      0|      return "Unsupported essential item property";
  286|      0|    case heif_suberror_Unsupported_track_type:
  ------------------
  |  Branch (286:5): [True: 0, False: 105]
  ------------------
  287|      0|      return "Unsupported track type";
  288|       |
  289|       |      // --- Encoder_plugin_error --
  290|       |
  291|      0|    case heif_suberror_Unsupported_bit_depth:
  ------------------
  |  Branch (291:5): [True: 0, False: 105]
  ------------------
  292|      0|      return "Unsupported bit depth";
  293|       |
  294|       |      // --- Encoding_error --
  295|       |
  296|      0|    case heif_suberror_Cannot_write_output_data:
  ------------------
  |  Branch (296:5): [True: 0, False: 105]
  ------------------
  297|      0|      return "Cannot write output data";
  298|      0|    case heif_suberror_Encoder_initialization:
  ------------------
  |  Branch (298:5): [True: 0, False: 105]
  ------------------
  299|      0|      return "Initialization problem";
  300|      0|    case heif_suberror_Encoder_encoding:
  ------------------
  |  Branch (300:5): [True: 0, False: 105]
  ------------------
  301|      0|      return "Encoding problem";
  302|      0|    case heif_suberror_Encoder_cleanup:
  ------------------
  |  Branch (302:5): [True: 0, False: 105]
  ------------------
  303|      0|      return "Cleanup problem";
  304|      0|    case heif_suberror_Too_many_regions:
  ------------------
  |  Branch (304:5): [True: 0, False: 105]
  ------------------
  305|      0|      return "Too many regions (>255) in an 'rgan' item.";
  306|       |
  307|       |      // --- Plugin_loading_error ---
  308|       |
  309|      0|    case heif_suberror_Plugin_loading_error:
  ------------------
  |  Branch (309:5): [True: 0, False: 105]
  ------------------
  310|      0|      return "Plugin file cannot be loaded";
  311|      0|    case heif_suberror_Plugin_is_not_loaded:
  ------------------
  |  Branch (311:5): [True: 0, False: 105]
  ------------------
  312|      0|      return "Trying to remove a plugin that is not loaded";
  313|      0|    case heif_suberror_Cannot_read_plugin_directory:
  ------------------
  |  Branch (313:5): [True: 0, False: 105]
  ------------------
  314|      0|      return "Error while scanning the directory for plugins";
  315|      0|    case heif_suberror_No_matching_decoder_installed:
  ------------------
  |  Branch (315:5): [True: 0, False: 105]
  ------------------
  316|       |#if ENABLE_PLUGIN_LOADING
  317|       |      return "No decoding plugin installed for this compression format";
  318|       |#else
  319|      0|      return "Support for this compression format has not been built in";
  320|    105|#endif
  321|    105|  }
  322|       |
  323|    105|  assert(false);
  ------------------
  |  Branch (323:3): [Folded, False: 0]
  ------------------
  324|      0|  return cUnknownError;
  325|      0|}
_ZNK5Error12error_structEP11ErrorBuffer:
  329|    129|{
  330|    129|  if (error_buffer) {
  ------------------
  |  Branch (330:7): [True: 129, False: 0]
  ------------------
  331|    129|    if (error_code == heif_error_Ok) {
  ------------------
  |  Branch (331:9): [True: 34, False: 95]
  ------------------
  332|     34|      error_buffer->set_success();
  333|     34|    }
  334|     95|    else {
  335|     95|      std::stringstream sstr;
  336|     95|      sstr << get_error_string(error_code) << ": "
  337|     95|           << get_error_string(sub_error_code);
  338|     95|      if (!message.empty()) {
  ------------------
  |  Branch (338:11): [True: 59, False: 36]
  ------------------
  339|     59|        sstr << ": " << message;
  340|     59|      }
  341|       |
  342|     95|      error_buffer->set_error(sstr.str());
  343|     95|    }
  344|    129|  }
  345|       |
  346|    129|  heif_error err;
  347|    129|  err.code = error_code;
  348|    129|  err.subcode = sub_error_code;
  349|    129|  if (error_buffer) {
  ------------------
  |  Branch (349:7): [True: 129, False: 0]
  ------------------
  350|    129|    err.message = error_buffer->get_error();
  351|    129|  }
  352|      0|  else {
  353|      0|    err.message = cUnknownError;
  354|      0|  }
  355|    129|  return err;
  356|    129|}
error.cc:_ZL11starts_withRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_:
   60|     22|static bool starts_with(const std::string& str, const std::string& prefix) {
   61|     22|    if (str.length() < prefix.length()) {
  ------------------
  |  Branch (61:9): [True: 16, False: 6]
  ------------------
   62|     16|        return false;
   63|     16|    }
   64|       |
   65|      6|  return str.compare(0, prefix.size(), prefix) == 0;
   66|     22|}

_ZN11ErrorBuffer11set_successEv:
   50|     34|  {
   51|     34|    m_error_message = c_success;
   52|     34|  }
_ZN11ErrorBuffer9set_errorERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   55|     95|  {
   56|     95|    m_buffer = err;
   57|     95|    m_error_message = m_buffer.c_str();
   58|     95|  }
_ZNK11ErrorBuffer9get_errorEv:
   61|    129|  {
   62|    129|    return m_error_message;
   63|    129|  }
_ZNK5ErroreqERKS_:
   93|  20.5k|  bool operator==(const Error& other) const { return error_code == other.error_code; }
_ZNK5ErrorneERKS_:
   95|  8.99k|  bool operator!=(const Error& other) const { return !(*this == other); }
_ZNK5ErrorooERKS_:
   97|     10|  Error operator||(const Error& other) const {
   98|     10|    if (error_code != heif_error_Ok) {
  ------------------
  |  Branch (98:9): [True: 0, False: 10]
  ------------------
   99|      0|      return *this;
  100|      0|    }
  101|     10|    else {
  102|     10|      return other;
  103|     10|    }
  104|     10|  }
_ZNK5ErrorcvbEv:
  106|  23.3k|  operator bool() const { return error_code != heif_error_Ok; }
_ZNK6ResultINSt3__110shared_ptrI14HeifPixelImageEEEcvbEv:
  132|    578|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZNK6ResultINSt3__110shared_ptrI14HeifPixelImageEEE12error_structEP11ErrorBuffer:
  166|     52|  {
  167|     52|    if (*this) {
  ------------------
  |  Branch (167:9): [True: 0, False: 52]
  ------------------
  168|      0|      return heif_error_success;
  169|      0|    }
  170|       |
  171|     52|    return std::get<Error>(m_data).error_struct(error_buffer);
  172|     52|  }
_ZN6ResultINSt3__110shared_ptrI14HeifPixelImageEEEdeEv:
  145|    129|  {
  146|    129|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 129, False: 0]
  ------------------
  147|    129|    return std::get<T>(m_data);
  148|    129|  }
_ZN11ErrorBufferC2Ev:
   47|    390|  ErrorBuffer() = default;
_ZN6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEEC2ES4_:
  128|    145|  Result(T v) : m_data(std::move(v)) {}
_ZN6ResultINSt3__110shared_ptrI7DecoderEEEC2ERK5Error:
  130|    124|  Result(const Error& e) : m_data(e) {}
_ZN6ResultINSt3__110shared_ptrI14HeifPixelImageEEEC2ERK5Error:
  130|    160|  Result(const Error& e) : m_data(e) {}
_ZNK6ResultINSt3__110shared_ptrI7DecoderEEEcvbEv:
  132|  2.15k|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZN6ResultINSt3__110shared_ptrI7DecoderEEEdeEv:
  145|  1.01k|  {
  146|  1.01k|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 1.01k, False: 0]
  ------------------
  147|  1.01k|    return std::get<T>(m_data);
  148|  1.01k|  }
_ZNK6ResultINSt3__16vectorINS0_10shared_ptrI3BoxEENS0_9allocatorIS4_EEEEEcvbEv:
  132|     10|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZNK6ResultINSt3__110shared_ptrI14HeifPixelImageEEE5errorEv:
  156|    216|  {
  157|    216|    if (*this) {
  ------------------
  |  Branch (157:9): [True: 104, False: 112]
  ------------------
  158|    104|      return Error::Ok;
  159|    104|    }
  160|       |
  161|    112|    return std::get<Error>(m_data);
  162|    216|  }
_ZN6ResultINSt3__16vectorINS0_10shared_ptrI3BoxEENS0_9allocatorIS4_EEEEEdeEv:
  145|      5|  {
  146|      5|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 5, False: 0]
  ------------------
  147|      5|    return std::get<T>(m_data);
  148|      5|  }
_ZN6ResultINSt3__110shared_ptrI14HeifPixelImageEEEC2ES3_:
  128|    129|  Result(T v) : m_data(std::move(v)) {}
_ZN6ResultINSt3__16vectorINS0_10shared_ptrI3BoxEENS0_9allocatorIS4_EEEEEC2ES7_:
  128|      5|  Result(T v) : m_data(std::move(v)) {}
_ZNK6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEEcvbEv:
  132|    511|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZNK6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEE5errorEv:
  156|     15|  {
  157|     15|    if (*this) {
  ------------------
  |  Branch (157:9): [True: 0, False: 15]
  ------------------
  158|      0|      return Error::Ok;
  159|      0|    }
  160|       |
  161|     15|    return std::get<Error>(m_data);
  162|     15|  }
_ZN6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEEdeEv:
  145|    118|  {
  146|    118|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 118, False: 0]
  ------------------
  147|    118|    return std::get<T>(m_data);
  148|    118|  }
_ZNK6ResultIjE8is_errorEv:
  150|      1|  [[nodiscard]] bool is_error() const {
  151|      1|    return std::holds_alternative<Error>(m_data);
  152|      1|  }
_ZN6ResultINSt3__110shared_ptrI14HeifPixelImageEEEC2Ev:
  126|    108|  Result() = default;
_ZN6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEEC2ERK5Error:
  130|    152|  Result(const Error& e) : m_data(e) {}
_ZN6ResultINSt3__16vectorIhNS0_9allocatorIhEEEEEptEv:
  138|     81|  {
  139|     81|    assert(*this); // Uses the operator bool() above
  ------------------
  |  Branch (139:5): [True: 81, False: 0]
  ------------------
  140|     81|    return &std::get<T>(m_data);
  141|     81|  }
_ZN6ResultINSt3__110shared_ptrI7DecoderEEEC2ES3_:
  128|  1.01k|  Result(T v) : m_data(std::move(v)) {}
_ZN6ResultINSt3__18optionalI9ImageSizeEEEC2ES3_:
  128|     42|  Result(T v) : m_data(std::move(v)) {}
_ZNK6ResultIPNSt3__16vectorIhNS0_9allocatorIhEEEEEcvbEv:
  132|    111|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZNK6ResultIPNSt3__16vectorIhNS0_9allocatorIhEEEEE5errorEv:
  156|     15|  {
  157|     15|    if (*this) {
  ------------------
  |  Branch (157:9): [True: 0, False: 15]
  ------------------
  158|      0|      return Error::Ok;
  159|      0|    }
  160|       |
  161|     15|    return std::get<Error>(m_data);
  162|     15|  }
_ZN6ResultIPNSt3__16vectorIhNS0_9allocatorIhEEEEEdeEv:
  145|     54|  {
  146|     54|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 54, False: 0]
  ------------------
  147|     54|    return std::get<T>(m_data);
  148|     54|  }
_ZN6ResultIjEC2ERK5Error:
  130|      1|  Result(const Error& e) : m_data(e) {}
_ZN6ResultIPNSt3__16vectorIhNS0_9allocatorIhEEEEEC2ES5_:
  128|     27|  Result(T v) : m_data(std::move(v)) {}
_ZN6ResultIPNSt3__16vectorIhNS0_9allocatorIhEEEEEC2ERK5Error:
  130|     15|  Result(const Error& e) : m_data(e) {}
_ZNK6ResultINSt3__18optionalI9ImageSizeEEE8is_errorEv:
  150|     42|  [[nodiscard]] bool is_error() const {
  151|     42|    return std::holds_alternative<Error>(m_data);
  152|     42|  }
_ZNK6ResultINSt3__18optionalI9ImageSizeEEEcvbEv:
  132|    108|  operator bool() const { return std::holds_alternative<T>(m_data); }
_ZN6ResultINSt3__18optionalI9ImageSizeEEEptEv:
  138|     42|  {
  139|     42|    assert(*this); // Uses the operator bool() above
  ------------------
  |  Branch (139:5): [True: 42, False: 0]
  ------------------
  140|     42|    return &std::get<T>(m_data);
  141|     42|  }
_ZN6ResultINSt3__18optionalI9ImageSizeEEEdeEv:
  145|     66|  {
  146|     66|    assert(*this);
  ------------------
  |  Branch (146:5): [True: 66, False: 0]
  ------------------
  147|     66|    return std::get<T>(m_data);
  148|     66|  }

_ZN8HeifFileC2Ev:
   68|     68|{
   69|     68|  m_file_layout = std::make_shared<FileLayout>();
   70|     68|}
_ZN8HeifFileD2Ev:
   72|     68|HeifFile::~HeifFile() = default;
_ZNK8HeifFile12get_item_IDsEv:
   75|     20|{
   76|     20|  std::vector<heif_item_id> IDs;
   77|       |
   78|    476|  for (const auto& infe : m_infe_boxes) {
  ------------------
  |  Branch (78:25): [True: 476, False: 20]
  ------------------
   79|    476|    IDs.push_back(infe.second->get_item_ID());
   80|    476|  }
   81|       |
   82|     20|  return IDs;
   83|     20|}
_ZNK8HeifFile12get_infe_boxEj:
   87|  2.32k|{
   88|  2.32k|  auto iter = m_infe_boxes.find(ID);
   89|  2.32k|  if (iter == m_infe_boxes.end()) {
  ------------------
  |  Branch (89:7): [True: 0, False: 2.32k]
  ------------------
   90|      0|    return nullptr;
   91|      0|  }
   92|       |
   93|  2.32k|  return iter->second;
   94|  2.32k|}
_ZN8HeifFile12get_infe_boxEj:
   98|    875|{
   99|    875|  auto iter = m_infe_boxes.find(ID);
  100|    875|  if (iter == m_infe_boxes.end()) {
  ------------------
  |  Branch (100:7): [True: 0, False: 875]
  ------------------
  101|      0|    return nullptr;
  102|      0|  }
  103|       |
  104|    875|  return iter->second;
  105|    875|}
_ZN8HeifFile16read_from_memoryEPKvmb:
  127|     34|{
  128|     34|  auto input_stream = std::make_shared<StreamReader_memory>((const uint8_t*) data, size, copy);
  129|       |
  130|     34|  return read(input_stream);
  131|     34|}
_ZN8HeifFile4readERKNSt3__110shared_ptrI12StreamReaderEE:
  135|     34|{
  136|     34|  assert(m_limits);
  ------------------
  |  Branch (136:3): [True: 34, False: 0]
  ------------------
  137|       |
  138|     34|  m_input_stream = reader;
  139|       |
  140|     34|  Error err;
  141|     34|  err = m_file_layout->read(reader, m_limits);
  142|     34|  if (err) {
  ------------------
  |  Branch (142:7): [True: 7, False: 27]
  ------------------
  143|      7|    return err;
  144|      7|  }
  145|       |
  146|     27|  Error error = parse_heif_file();
  147|     27|  return error;
  148|     34|}
_ZNK8HeifFile10has_imagesEv:
  152|     40|{
  153|     40|  if (!m_meta_box) {
  ------------------
  |  Branch (153:7): [True: 0, False: 40]
  ------------------
  154|      0|    return false;
  155|      0|  }
  156|       |
  157|     40|  return m_hdlr_box && m_hdlr_box->get_handler_type() == fourcc("pict");
  ------------------
  |  Branch (157:10): [True: 40, False: 0]
  |  Branch (157:24): [True: 40, False: 0]
  ------------------
  158|     40|}
_ZN8HeifFile14new_empty_fileEv:
  162|     34|{
  163|       |  //m_input_stream.reset();
  164|     34|  m_top_level_boxes.clear();
  165|       |
  166|     34|  m_ftyp_box = std::make_shared<Box_ftyp>();
  167|     34|  m_top_level_boxes.push_back(m_ftyp_box);
  168|     34|}
_ZN8HeifFile15parse_heif_fileEv:
  423|     27|{
  424|       |  // --- read all top-level boxes
  425|       |
  426|       |#if 0
  427|       |  for (;;) {
  428|       |    std::shared_ptr<Box> box;
  429|       |    Error error = Box::read(range, &box);
  430|       |
  431|       |    if (range.error() || range.eof()) {
  432|       |      break;
  433|       |    }
  434|       |
  435|       |    // When an EOF error is returned, this is not really a fatal exception,
  436|       |    // but simply the indication that we reached the end of the file.
  437|       |    // TODO: this design should be cleaned up
  438|       |    if (error.error_code == heif_error_Invalid_input && error.sub_error_code == heif_suberror_End_of_data) {
  439|       |      break;
  440|       |    }
  441|       |
  442|       |    if (error != Error::Ok) {
  443|       |      return error;
  444|       |    }
  445|       |
  446|       |    m_top_level_boxes.push_back(box);
  447|       |
  448|       |
  449|       |    // extract relevant boxes (ftyp, meta)
  450|       |
  451|       |    if (box->get_short_type() == fourcc("meta")) {
  452|       |      m_meta_box = std::dynamic_pointer_cast<Box_meta>(box);
  453|       |    }
  454|       |
  455|       |    if (box->get_short_type() == fourcc("ftyp")) {
  456|       |      m_ftyp_box = std::dynamic_pointer_cast<Box_ftyp>(box);
  457|       |    }
  458|       |  }
  459|       |#endif
  460|       |
  461|     27|  m_ftyp_box = m_file_layout->get_ftyp_box();
  462|     27|  if (!m_ftyp_box) {
  ------------------
  |  Branch (462:7): [True: 5, False: 22]
  ------------------
  463|      5|    return Error(heif_error_Invalid_input,
  464|      5|                 heif_suberror_No_ftyp_box);
  465|      5|  }
  466|       |
  467|     22|  m_top_level_boxes.push_back(m_ftyp_box);
  468|       |
  469|     22|  bool is_sequence_brand = (m_ftyp_box->has_compatible_brand(heif_brand2_msf1) ||
  ------------------
  |  |  159|     22|#define heif_brand2_msf1   heif_fourcc('m','s','f','1')
  |  |  ------------------
  |  |  |  |   71|     22|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (469:29): [True: 0, False: 22]
  ------------------
  470|     22|                            m_ftyp_box->has_compatible_brand(heif_brand2_isom) ||
  ------------------
  |  |  263|     22|#define heif_brand2_isom   heif_fourcc('i','s','o','m')
  |  |  ------------------
  |  |  |  |   71|     22|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (470:29): [True: 0, False: 22]
  ------------------
  471|     22|                            m_ftyp_box->has_compatible_brand(heif_brand2_mp41) ||
  ------------------
  |  |  264|     22|#define heif_brand2_mp41   heif_fourcc('m','p','4','1')
  |  |  ------------------
  |  |  |  |   71|     22|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (471:29): [True: 0, False: 22]
  ------------------
  472|     22|                            m_ftyp_box->has_compatible_brand(heif_brand2_mp42));
  ------------------
  |  |  265|     22|#define heif_brand2_mp42   heif_fourcc('m','p','4','2')
  |  |  ------------------
  |  |  |  |   71|     22|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (472:29): [True: 0, False: 22]
  ------------------
  473|       |
  474|       |  // --- check whether this is a HEIF file and its structural format
  475|       |
  476|     22|  if (!m_ftyp_box->has_compatible_brand(heif_brand2_heic) &&
  ------------------
  |  |   44|     22|#define heif_brand2_heic   heif_fourcc('h','e','i','c')
  |  |  ------------------
  |  |  |  |   71|     22|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (476:7): [True: 12, False: 10]
  ------------------
  477|     12|      !m_ftyp_box->has_compatible_brand(heif_brand2_heix) &&
  ------------------
  |  |   53|     12|#define heif_brand2_heix   heif_fourcc('h','e','i','x')
  |  |  ------------------
  |  |  |  |   71|     12|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (477:7): [True: 12, False: 0]
  ------------------
  478|     12|      !m_ftyp_box->has_compatible_brand(heif_brand2_mif1) &&
  ------------------
  |  |  132|     12|#define heif_brand2_mif1   heif_fourcc('m','i','f','1')
  |  |  ------------------
  |  |  |  |   71|     12|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (478:7): [True: 2, False: 10]
  ------------------
  479|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_avif) &&
  ------------------
  |  |  116|      2|#define heif_brand2_avif   heif_fourcc('a','v','i','f')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (479:7): [True: 2, False: 0]
  ------------------
  480|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_1pic) &&
  ------------------
  |  |  247|      2|#define heif_brand2_1pic   heif_fourcc('1','p','i','c')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (480:7): [True: 2, False: 0]
  ------------------
  481|       |#if ENABLE_EXPERIMENTAL_MINI_FORMAT
  482|       |      !(m_ftyp_box->get_major_brand() == heif_brand2_mif3) &&
  483|       |#endif
  484|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_jpeg) &&
  ------------------
  |  |  208|      2|#define heif_brand2_jpeg   heif_fourcc('j','p','e','g')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (484:7): [True: 2, False: 0]
  ------------------
  485|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_isom) &&
  ------------------
  |  |  263|      2|#define heif_brand2_isom   heif_fourcc('i','s','o','m')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (485:7): [True: 2, False: 0]
  ------------------
  486|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_mp42) &&
  ------------------
  |  |  265|      2|#define heif_brand2_mp42   heif_fourcc('m','p','4','2')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (486:7): [True: 2, False: 0]
  ------------------
  487|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_mp41) &&
  ------------------
  |  |  264|      2|#define heif_brand2_mp41   heif_fourcc('m','p','4','1')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (487:7): [True: 2, False: 0]
  ------------------
  488|      2|      !m_ftyp_box->has_compatible_brand(heif_brand2_msf1)) {
  ------------------
  |  |  159|      2|#define heif_brand2_msf1   heif_fourcc('m','s','f','1')
  |  |  ------------------
  |  |  |  |   71|      2|#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
  |  |  ------------------
  ------------------
  |  Branch (488:7): [True: 2, False: 0]
  ------------------
  489|      2|    std::stringstream sstr;
  490|      2|    sstr << "File does not include any supported brands.\n";
  491|       |
  492|      2|    return Error(heif_error_Unsupported_filetype,
  493|      2|                 heif_suberror_Unspecified,
  494|      2|                 sstr.str());
  495|      2|      }
  496|       |
  497|       |#if ENABLE_EXPERIMENTAL_MINI_FORMAT
  498|       |  m_mini_box = m_file_layout->get_mini_box();
  499|       |  m_top_level_boxes.push_back(m_mini_box);
  500|       |
  501|       |  if (m_mini_box) {
  502|       |    Error err = m_mini_box->create_expanded_boxes(this);
  503|       |    if (err) {
  504|       |      return err;
  505|       |    }
  506|       |    return Error::Ok;
  507|       |  }
  508|       |#endif
  509|       |
  510|     20|  m_meta_box = m_file_layout->get_meta_box();
  511|     20|  if (m_meta_box) {
  ------------------
  |  Branch (511:7): [True: 20, False: 0]
  ------------------
  512|     20|    m_top_level_boxes.push_back(m_meta_box);
  513|     20|  }
  514|       |
  515|       |  // TODO: we are missing 'mdat' top level boxes
  516|       |
  517|     20|  m_moov_box = m_file_layout->get_moov_box();
  518|     20|  if (m_moov_box) {
  ------------------
  |  Branch (518:7): [True: 0, False: 20]
  ------------------
  519|      0|    m_top_level_boxes.push_back(m_moov_box);
  520|      0|  }
  521|       |
  522|       |  // if we didn't find the mini box, meta is required
  523|       |
  524|     20|  if (!m_meta_box && !is_sequence_brand) {
  ------------------
  |  Branch (524:7): [True: 0, False: 20]
  |  Branch (524:22): [True: 0, False: 0]
  ------------------
  525|      0|    return Error(heif_error_Invalid_input,
  526|      0|                 heif_suberror_No_meta_box);
  527|      0|  }
  528|       |
  529|     20|  if (!m_moov_box && is_sequence_brand) {
  ------------------
  |  Branch (529:7): [True: 20, False: 0]
  |  Branch (529:22): [True: 0, False: 20]
  ------------------
  530|      0|    return Error(heif_error_Invalid_input,
  531|      0|                 heif_suberror_No_moov_box);
  532|      0|  }
  533|       |
  534|     20|  if (m_meta_box) {
  ------------------
  |  Branch (534:7): [True: 20, False: 0]
  ------------------
  535|     20|    auto err = parse_heif_images();
  536|     20|    if (err) {
  ------------------
  |  Branch (536:9): [True: 0, False: 20]
  ------------------
  537|      0|      return err;
  538|      0|    }
  539|     20|  }
  540|       |
  541|     20|  if (m_moov_box) {
  ------------------
  |  Branch (541:7): [True: 0, False: 20]
  ------------------
  542|      0|    auto err = parse_heif_sequences();
  543|      0|    if (err) {
  ------------------
  |  Branch (543:9): [True: 0, False: 0]
  ------------------
  544|      0|      return err;
  545|      0|    }
  546|      0|  }
  547|       |
  548|     20|  return Error::Ok;
  549|     20|}
_ZN8HeifFile17parse_heif_imagesEv:
  553|     20|{
  554|     20|  m_hdlr_box = m_meta_box->get_child_box<Box_hdlr>();
  555|     20|  if (STRICT_PARSING && !m_hdlr_box) {
  ------------------
  |  |   64|     40|#define STRICT_PARSING false
  |  |  ------------------
  |  |  |  Branch (64:24): [Folded, False: 20]
  |  |  ------------------
  ------------------
  |  Branch (555:25): [True: 0, False: 0]
  ------------------
  556|      0|    return Error(heif_error_Invalid_input,
  557|      0|                 heif_suberror_No_hdlr_box);
  558|      0|  }
  559|       |
  560|       |  // --- assign item boxes
  561|       |
  562|     20|  m_iinf_box = m_meta_box->get_child_box<Box_iinf>();
  563|     20|  if (!m_iinf_box) {
  ------------------
  |  Branch (563:7): [True: 0, False: 20]
  ------------------
  564|      0|    return Error(heif_error_Invalid_input,
  565|      0|                 heif_suberror_No_iinf_box);
  566|      0|  }
  567|       |
  568|     20|  std::vector<std::shared_ptr<Box_infe>> infe_boxes = m_iinf_box->get_child_boxes<Box_infe>();
  569|       |
  570|    498|  for (auto& infe_box : infe_boxes) {
  ------------------
  |  Branch (570:23): [True: 498, False: 20]
  ------------------
  571|    498|    if (!infe_box) {
  ------------------
  |  Branch (571:9): [True: 0, False: 498]
  ------------------
  572|      0|      return Error(heif_error_Invalid_input,
  573|      0|                   heif_suberror_No_infe_box);
  574|      0|    }
  575|       |
  576|    498|    m_infe_boxes.insert(std::make_pair(infe_box->get_item_ID(), infe_box));
  577|    498|  }
  578|       |
  579|       |
  580|     20|  if (has_images()) {
  ------------------
  |  Branch (580:7): [True: 20, False: 0]
  ------------------
  581|       |    // --- find mandatory boxes needed for image decoding
  582|       |
  583|     20|    m_pitm_box = m_meta_box->get_child_box<Box_pitm>();
  584|     20|    if (!m_pitm_box) {
  ------------------
  |  Branch (584:9): [True: 0, False: 20]
  ------------------
  585|      0|      return Error(heif_error_Invalid_input,
  586|      0|                   heif_suberror_No_pitm_box);
  587|      0|    }
  588|       |
  589|     20|    m_iprp_box = m_meta_box->get_child_box<Box_iprp>();
  590|     20|    if (!m_iprp_box) {
  ------------------
  |  Branch (590:9): [True: 0, False: 20]
  ------------------
  591|      0|      return Error(heif_error_Invalid_input,
  592|      0|                   heif_suberror_No_iprp_box);
  593|      0|    }
  594|       |
  595|     20|    m_ipco_box = m_iprp_box->get_child_box<Box_ipco>();
  596|     20|    if (!m_ipco_box) {
  ------------------
  |  Branch (596:9): [True: 0, False: 20]
  ------------------
  597|      0|      return Error(heif_error_Invalid_input,
  598|      0|                   heif_suberror_No_ipco_box);
  599|      0|    }
  600|       |
  601|     20|    auto ipma_boxes = m_iprp_box->get_child_boxes<Box_ipma>();
  602|     20|    if (ipma_boxes.empty()) {
  ------------------
  |  Branch (602:9): [True: 0, False: 20]
  ------------------
  603|      0|      return Error(heif_error_Invalid_input,
  604|      0|                   heif_suberror_No_ipma_box);
  605|      0|    }
  606|     20|    for (size_t i=1;i<ipma_boxes.size();i++) {
  ------------------
  |  Branch (606:21): [True: 0, False: 20]
  ------------------
  607|      0|      ipma_boxes[0]->insert_entries_from_other_ipma_box(*ipma_boxes[i]);
  608|      0|    }
  609|     20|    m_ipma_box = ipma_boxes[0];
  610|     20|  }
  611|       |
  612|     20|  m_iloc_box = m_meta_box->get_child_box<Box_iloc>();
  613|     20|  if (!m_iloc_box) {
  ------------------
  |  Branch (613:7): [True: 0, False: 20]
  ------------------
  614|      0|    return Error(heif_error_Invalid_input,
  615|      0|                 heif_suberror_No_iloc_box);
  616|      0|  }
  617|       |
  618|     20|  m_idat_box = m_meta_box->get_child_box<Box_idat>();
  619|       |
  620|     20|  m_iref_box = m_meta_box->get_child_box<Box_iref>();
  621|     20|  if (m_iref_box && m_pitm_box) {
  ------------------
  |  Branch (621:7): [True: 16, False: 4]
  |  Branch (621:21): [True: 16, False: 0]
  ------------------
  622|     16|    Error error = check_for_ref_cycle(get_primary_image_ID(), m_iref_box);
  623|     16|    if (error) {
  ------------------
  |  Branch (623:9): [True: 0, False: 16]
  ------------------
  624|      0|      return error;
  625|      0|    }
  626|     16|  }
  627|       |
  628|     20|  m_grpl_box = m_meta_box->get_child_box<Box_grpl>();
  629|       |
  630|       |
  631|     20|  return Error::Ok;
  632|     20|}
_ZNK8HeifFile19check_for_ref_cycleEjRKNSt3__110shared_ptrI8Box_irefEE:
  650|     16|{
  651|     16|  std::unordered_set<heif_item_id> parent_items;
  652|     16|  return check_for_ref_cycle_recursion(ID, iref_box, parent_items);
  653|     16|}
_ZNK8HeifFile29check_for_ref_cycle_recursionEjRKNSt3__110shared_ptrI8Box_irefEERNS0_13unordered_setIjNS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorIjEEEE:
  658|     16|                                    std::unordered_set<heif_item_id>& parent_items) const {
  659|     16|  if (parent_items.find(ID) != parent_items.end()) {
  ------------------
  |  Branch (659:7): [True: 0, False: 16]
  ------------------
  660|      0|    return Error(heif_error_Invalid_input,
  661|      0|                 heif_suberror_Item_reference_cycle,
  662|      0|                 "Image reference cycle");
  663|      0|  }
  664|     16|  parent_items.insert(ID);
  665|       |
  666|     16|  std::vector<heif_item_id> image_references = iref_box->get_references(ID, fourcc("dimg"));
  667|     16|  for (heif_item_id reference_idx : image_references) {
  ------------------
  |  Branch (667:35): [True: 0, False: 16]
  ------------------
  668|      0|    Error error = check_for_ref_cycle_recursion(reference_idx, iref_box, parent_items);
  669|      0|    if (error) {
  ------------------
  |  Branch (669:9): [True: 0, False: 0]
  ------------------
  670|      0|      return error;
  671|      0|    }
  672|      0|  }
  673|       |
  674|     16|  parent_items.erase(ID);
  675|     16|  return Error::Ok;
  676|     16|}
_ZNK8HeifFile11item_existsEj:
  680|    213|{
  681|    213|  auto image_iter = m_infe_boxes.find(ID);
  682|    213|  return image_iter != m_infe_boxes.end();
  683|    213|}
_ZNK8HeifFile17get_item_type_4ccEj:
  694|  1.42k|{
  695|  1.42k|  auto infe_box = get_infe_box(ID);
  696|  1.42k|  if (!infe_box) {
  ------------------
  |  Branch (696:7): [True: 0, False: 1.42k]
  ------------------
  697|      0|    return 0;
  698|      0|  }
  699|       |
  700|  1.42k|  return infe_box->get_item_type_4cc();
  701|  1.42k|}
_ZNK8HeifFile16get_content_typeEj:
  705|    476|{
  706|    476|  auto infe_box = get_infe_box(ID);
  707|    476|  if (!infe_box) {
  ------------------
  |  Branch (707:7): [True: 0, False: 476]
  ------------------
  708|      0|    return "";
  709|      0|  }
  710|       |
  711|    476|  return infe_box->get_content_type();
  712|    476|}
_ZNK8HeifFile17get_item_uri_typeEj:
  715|    204|{
  716|    204|  auto infe_box = get_infe_box(ID);
  717|    204|  if (!infe_box) {
  ------------------
  |  Branch (717:7): [True: 0, False: 204]
  ------------------
  718|      0|    return "";
  719|      0|  }
  720|       |
  721|    204|  return infe_box->get_item_uri_type();
  722|    204|}
_ZNK8HeifFile14get_propertiesEjRNSt3__16vectorINS0_10shared_ptrI3BoxEENS0_9allocatorIS4_EEEE:
  727|    472|{
  728|    472|  if (!m_ipco_box) {
  ------------------
  |  Branch (728:7): [True: 0, False: 472]
  ------------------
  729|      0|    return Error(heif_error_Invalid_input,
  730|      0|                 heif_suberror_No_ipco_box);
  731|      0|  }
  732|    472|  else if (!m_ipma_box) {
  ------------------
  |  Branch (732:12): [True: 0, False: 472]
  ------------------
  733|      0|    return Error(heif_error_Invalid_input,
  734|      0|                 heif_suberror_No_ipma_box);
  735|      0|  }
  736|       |
  737|    472|  return m_ipco_box->get_properties_for_item_ID(imageID, m_ipma_box, properties);
  738|    472|}
_ZNK8HeifFile26get_uncompressed_item_dataEj:
  742|    213|{
  743|    213|  assert(m_limits);
  ------------------
  |  Branch (743:3): [True: 213, False: 0]
  ------------------
  744|       |
  745|    213|#if ENABLE_PARALLEL_TILE_DECODING
  746|       |  // std::lock_guard<std::mutex> guard(m_read_mutex);   // TODO: I think that this is not needed anymore because this function is not used for image data anymore.
  747|    213|#endif
  748|       |
  749|    213|  if (!m_iloc_box) {
  ------------------
  |  Branch (749:7): [True: 0, False: 213]
  ------------------
  750|      0|    return Error(heif_error_Invalid_input, heif_suberror_No_iloc_box);
  751|      0|  }
  752|       |
  753|    213|  if (!item_exists(ID)) {
  ------------------
  |  Branch (753:7): [True: 0, False: 213]
  ------------------
  754|      0|    return Error(heif_error_Usage_error,
  755|      0|                 heif_suberror_Nonexisting_item_referenced);
  756|      0|  }
  757|       |
  758|    213|  auto infe_box = get_infe_box(ID);
  759|    213|  if (!infe_box) {
  ------------------
  |  Branch (759:7): [True: 0, False: 213]
  ------------------
  760|      0|    return Error(heif_error_Usage_error,
  761|      0|                 heif_suberror_Nonexisting_item_referenced);
  762|      0|  }
  763|       |
  764|       |
  765|    213|  uint32_t item_type = infe_box->get_item_type_4cc();
  766|    213|  std::string content_type = infe_box->get_content_type();
  767|       |
  768|       |  // --- decompress data
  769|       |
  770|    213|  Error error;
  771|       |
  772|    213|  if (item_type == fourcc("mime")) {
  ------------------
  |  Branch (772:7): [True: 0, False: 213]
  ------------------
  773|      0|    std::string encoding = infe_box->get_content_encoding();
  774|      0|    if (encoding == "compress_zlib") {
  ------------------
  |  Branch (774:9): [True: 0, False: 0]
  ------------------
  775|      0|#if HAVE_ZLIB
  776|      0|      std::vector<uint8_t> compressed_data;
  777|      0|      error = m_iloc_box->read_data(ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
  778|      0|      if (error) {
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|      0|        return error;
  780|      0|      }
  781|       |
  782|      0|      return decompress_zlib(compressed_data);
  783|       |#else
  784|       |      return Error(heif_error_Unsupported_feature,
  785|       |                   heif_suberror_Unsupported_header_compression_method,
  786|       |                   encoding);
  787|       |#endif
  788|      0|    }
  789|      0|    else if (encoding == "deflate") {
  ------------------
  |  Branch (789:14): [True: 0, False: 0]
  ------------------
  790|      0|#if HAVE_ZLIB
  791|      0|      std::vector<uint8_t> compressed_data;
  792|      0|      error = m_iloc_box->read_data(ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
  793|      0|      if (error) {
  ------------------
  |  Branch (793:11): [True: 0, False: 0]
  ------------------
  794|      0|        return error;
  795|      0|      }
  796|      0|      return decompress_deflate(compressed_data);
  797|       |#else
  798|       |      return Error(heif_error_Unsupported_feature,
  799|       |                   heif_suberror_Unsupported_header_compression_method,
  800|       |                   encoding);
  801|       |#endif
  802|      0|    }
  803|      0|    else if (encoding == "br") {
  ------------------
  |  Branch (803:14): [True: 0, False: 0]
  ------------------
  804|      0|#if HAVE_BROTLI
  805|      0|      std::vector<uint8_t> compressed_data;
  806|      0|      error = m_iloc_box->read_data(ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
  807|      0|      if (error) {
  ------------------
  |  Branch (807:11): [True: 0, False: 0]
  ------------------
  808|      0|        return error;
  809|      0|      }
  810|      0|      return decompress_brotli(compressed_data);
  811|       |#else
  812|       |      return Error(heif_error_Unsupported_feature,
  813|       |                   heif_suberror_Unsupported_header_compression_method,
  814|       |                   encoding);
  815|       |#endif
  816|      0|    }
  817|      0|    else if (!encoding.empty()) {
  ------------------
  |  Branch (817:14): [True: 0, False: 0]
  ------------------
  818|      0|      return Error(heif_error_Unsupported_feature, heif_suberror_Unsupported_codec);
  819|      0|    }
  820|      0|  }
  821|       |
  822|       |
  823|       |  // --- read uncompressed
  824|       |
  825|    213|  std::vector<uint8_t> data;
  826|    213|  error = m_iloc_box->read_data(ID, m_input_stream, m_idat_box, &data, m_limits);
  827|    213|  if (error) {
  ------------------
  |  Branch (827:7): [True: 137, False: 76]
  ------------------
  828|    137|    return error;
  829|    137|  }
  830|     76|  else {
  831|     76|    return data;
  832|     76|  }
  833|    213|}
_ZNK8HeifFile21append_data_from_ilocEjRNSt3__16vectorIhNS0_9allocatorIhEEEEmm:
  856|     48|{
  857|     48|  if (!m_iloc_box) {
  ------------------
  |  Branch (857:7): [True: 0, False: 48]
  ------------------
  858|      0|    return Error(heif_error_Invalid_input, heif_suberror_No_iloc_box);
  859|      0|  }
  860|       |
  861|     48|  const auto& items = m_iloc_box->get_items();
  862|     48|  const Box_iloc::Item* item = nullptr;
  863|  1.60k|  for (const auto& i : items) {
  ------------------
  |  Branch (863:22): [True: 1.60k, False: 14]
  ------------------
  864|  1.60k|    if (i.item_ID == ID) {
  ------------------
  |  Branch (864:9): [True: 34, False: 1.57k]
  ------------------
  865|     34|      item = &i;
  866|     34|      break;
  867|     34|    }
  868|  1.60k|  }
  869|     48|  if (!item) {
  ------------------
  |  Branch (869:7): [True: 14, False: 34]
  ------------------
  870|     14|    std::stringstream sstr;
  871|     14|    sstr << "Item with ID " << ID << " has no compressed data";
  872|       |
  873|     14|    return {heif_error_Invalid_input,
  874|     14|            heif_suberror_No_item_data,
  875|     14|            sstr.str()};
  876|     14|  }
  877|       |
  878|     34|  return m_iloc_box->read_data(ID, m_input_stream, m_idat_box, &out_data, offset, size, m_limits);
  879|     48|}
_ZN8HeifFile12add_propertyEjRKNSt3__110shared_ptrI3BoxEEb:
 1062|    178|{
 1063|    178|  uint32_t index = m_ipco_box->find_or_append_child_box(property);
 1064|       |
 1065|    178|  m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{essential, uint16_t(index + 1)});
 1066|       |
 1067|    178|  return index + 1;
 1068|    178|}

_ZN8HeifFile19set_security_limitsEPK20heif_security_limits:
   69|     68|  void set_security_limits(const heif_security_limits* limits) { m_limits = limits; }
_ZNK8HeifFile13has_sequencesEv:
   79|     20|  bool has_sequences() const { return m_moov_box != nullptr; }
_ZNK8HeifFile20get_primary_image_IDEv:
  106|     82|  heif_item_id get_primary_image_ID() const { return m_pitm_box ? m_pitm_box->get_item_ID() : 0; }
  ------------------
  |  Branch (106:54): [True: 82, False: 0]
  ------------------
_ZNK8HeifFile21append_data_from_ilocEjRNSt3__16vectorIhNS0_9allocatorIhEEEE:
  128|     48|  Error append_data_from_iloc(heif_item_id ID, std::vector<uint8_t>& out_data) const {
  129|     48|    return append_data_from_iloc(ID, out_data, 0, std::numeric_limits<uint64_t>::max());
  130|     48|  }
_ZN8HeifFile12get_iref_boxEv:
  146|     30|  std::shared_ptr<Box_iref> get_iref_box() { return m_iref_box; }
_ZN8HeifFile12get_ipco_boxEv:
  150|    214|  std::shared_ptr<Box_ipco> get_ipco_box() { return m_ipco_box; }
_ZN8HeifFile12get_ipma_boxEv:
  158|    214|  std::shared_ptr<Box_ipma> get_ipma_box() { return m_ipma_box; }

_ZN10FileLayoutC2Ev:
   27|     68|{
   28|     68|  auto ftyp = std::make_shared<Box_ftyp>();
   29|     68|  ftyp->set_output_position(0);
   30|     68|  m_boxes.push_back(ftyp);
   31|       |
   32|       |  // TODO: these variables are not used yet
   33|     68|  (void)m_writeMode;
   34|     68|  (void)m_file_size;
   35|     68|}
_ZN10FileLayout4readERKNSt3__110shared_ptrI12StreamReaderEEPK20heif_security_limits:
   39|     34|{
   40|     34|  m_boxes.clear();
   41|       |
   42|     34|  m_stream_reader = stream;
   43|       |
   44|       |  // --- read initial range, large enough to cover 'ftyp' box
   45|       |
   46|     34|  m_max_length = stream->request_range(0, INITIAL_FTYP_REQUEST);
   47|       |
   48|     34|  if (m_max_length < MAXIMUM_BOX_HEADER_SIZE) {
  ------------------
  |  Branch (48:7): [True: 0, False: 34]
  ------------------
   49|      0|    return {heif_error_Invalid_input,
   50|      0|            heif_suberror_Unspecified,
   51|      0|            "File size too small."};
   52|      0|  }
   53|       |
   54|       |  // --- read 'ftyp' box header
   55|       |
   56|     34|  BitstreamRange ftyp_hdr_range(m_stream_reader, m_max_length);
   57|     34|  BoxHeader ftyp_header;
   58|     34|  Error err;
   59|     34|  err = ftyp_header.parse_header(ftyp_hdr_range);
   60|     34|  if (err) {
  ------------------
  |  Branch (60:7): [True: 0, False: 34]
  ------------------
   61|      0|    return err;
   62|      0|  }
   63|       |
   64|       |  // --- check whether it is a valid 'ftyp' box header
   65|       |
   66|     34|  if (ftyp_header.get_short_type() != fourcc("ftyp")) {
  ------------------
  |  Branch (66:7): [True: 2, False: 32]
  ------------------
   67|      2|    return {heif_error_Invalid_input,
   68|      2|            heif_suberror_No_ftyp_box,
   69|      2|            "File does not start with 'ftyp' box."};
   70|      2|  }
   71|       |
   72|     32|  uint64_t ftyp_size = ftyp_header.get_box_size();
   73|       |
   74|     32|  if (ftyp_size == 0) {
  ------------------
  |  Branch (74:7): [True: 0, False: 32]
  ------------------
   75|      0|    return {heif_error_Invalid_input,
   76|      0|            heif_suberror_No_ftyp_box,
   77|      0|            "ftyp box shall not be the only box in the file"};
   78|      0|  }
   79|       |
   80|     32|  if (ftyp_size > m_max_length) {
  ------------------
  |  Branch (80:7): [True: 0, False: 32]
  ------------------
   81|      0|    return {heif_error_Invalid_input,
   82|      0|            heif_suberror_No_ftyp_box,
   83|      0|            "ftyp box larger than initial read range"};
   84|      0|  }
   85|       |
   86|       |  // --- read the 'ftyp' box
   87|       |
   88|     32|  BitstreamRange ftyp_range(m_stream_reader, 0, ftyp_size);
   89|     32|  std::shared_ptr<Box> ftyp_box;
   90|     32|  err = Box::read(ftyp_range, &ftyp_box, limits);
   91|       |
   92|     32|  m_boxes.push_back(ftyp_box);
   93|     32|  m_ftyp_box = std::dynamic_pointer_cast<Box_ftyp>(ftyp_box);
   94|       |
   95|       |
   96|       |  // --- skip through box headers until we find the 'meta' box
   97|       |
   98|     32|  uint64_t next_box_start = ftyp_size;
   99|       |
  100|     32|  bool meta_found = false;
  101|     32|  bool mini_found = false;
  102|     32|  bool moov_found = false;
  103|       |
  104|  4.93k|  for (;;) {
  105|       |    // TODO: overflow
  106|  4.93k|    uint64_t next_box_header_end = next_box_start + MAXIMUM_BOX_HEADER_SIZE;
  107|  4.93k|    if (next_box_header_end > m_max_length) {
  ------------------
  |  Branch (107:9): [True: 9, False: 4.92k]
  ------------------
  108|      9|      m_max_length = stream->request_range(next_box_start, next_box_header_end);
  109|      9|    }
  110|       |
  111|  4.93k|    if (next_box_header_end > m_max_length) {
  ------------------
  |  Branch (111:9): [True: 9, False: 4.92k]
  ------------------
  112|      9|      if (meta_found || mini_found || moov_found) {
  ------------------
  |  Branch (112:11): [True: 6, False: 3]
  |  Branch (112:25): [True: 0, False: 3]
  |  Branch (112:39): [True: 3, False: 0]
  ------------------
  113|      9|        return Error::Ok;
  114|      9|      }
  115|      0|      else {
  116|      0|        return {heif_error_Invalid_input,
  117|      0|                heif_suberror_Unspecified,
  118|      0|                "Insufficient input data"};
  119|      0|      }
  120|      9|    }
  121|       |
  122|  4.92k|    BitstreamRange box_range(m_stream_reader, next_box_start, m_max_length);
  123|  4.92k|    BoxHeader box_header;
  124|  4.92k|    err = box_header.parse_header(box_range);
  125|  4.92k|    if (err) {
  ------------------
  |  Branch (125:9): [True: 0, False: 4.92k]
  ------------------
  126|      0|      return err;
  127|      0|    }
  128|       |
  129|  4.92k|    if (box_header.get_short_type() == fourcc("meta")) {
  ------------------
  |  Branch (129:9): [True: 551, False: 4.37k]
  ------------------
  130|    551|      const uint64_t meta_box_start = next_box_start;
  131|    551|      if (box_header.get_box_size() == 0) {
  ------------------
  |  Branch (131:11): [True: 0, False: 551]
  ------------------
  132|       |        // TODO: get file-size from stream and compute box size
  133|      0|        return {heif_error_Invalid_input,
  134|      0|                heif_suberror_No_meta_box,
  135|      0|                "Cannot read meta box with unspecified size"};
  136|      0|      }
  137|       |
  138|       |      // TODO: overflow
  139|    551|      uint64_t end_of_meta_box = meta_box_start + box_header.get_box_size();
  140|    551|      if (m_max_length < end_of_meta_box) {
  ------------------
  |  Branch (140:11): [True: 0, False: 551]
  ------------------
  141|      0|        m_max_length = m_stream_reader->request_range(meta_box_start, end_of_meta_box);
  142|      0|      }
  143|       |
  144|    551|      if (m_max_length < end_of_meta_box) {
  ------------------
  |  Branch (144:11): [True: 0, False: 551]
  ------------------
  145|      0|        return {heif_error_Invalid_input,
  146|      0|                heif_suberror_No_meta_box,
  147|      0|                "Cannot read full meta box"};
  148|      0|      }
  149|       |
  150|    551|      BitstreamRange meta_box_range(m_stream_reader, meta_box_start, end_of_meta_box);
  151|    551|      std::shared_ptr<Box> meta_box;
  152|    551|      err = Box::read(meta_box_range, &meta_box, limits);
  153|    551|      if (err) {
  ------------------
  |  Branch (153:11): [True: 3, False: 548]
  ------------------
  154|      3|        return err;
  155|      3|      }
  156|       |
  157|    548|      m_boxes.push_back(meta_box);
  158|    548|      m_meta_box = std::dynamic_pointer_cast<Box_meta>(meta_box);
  159|    548|      meta_found = true;
  160|    548|    }
  161|       |
  162|       |#if ENABLE_EXPERIMENTAL_MINI_FORMAT
  163|       |    // TODO: this is basically the same as the meta box case above, with different error handling.
  164|       |    if (box_header.get_short_type() == fourcc("mini")) {
  165|       |      const uint64_t mini_box_start = next_box_start;
  166|       |      if (box_header.get_box_size() == 0) {
  167|       |        // TODO: get file-size from stream and compute box size
  168|       |        return {heif_error_Invalid_input,
  169|       |                heif_suberror_Invalid_mini_box,
  170|       |                "Cannot read mini box with unspecified size"};
  171|       |      }
  172|       |      uint64_t end_of_mini_box = mini_box_start + box_header.get_box_size();
  173|       |      if (m_max_length < end_of_mini_box) {
  174|       |        m_max_length = m_stream_reader->request_range(mini_box_start, end_of_mini_box);
  175|       |      }
  176|       |
  177|       |      if (m_max_length < end_of_mini_box) {
  178|       |        return {heif_error_Invalid_input,
  179|       |                heif_suberror_Invalid_mini_box,
  180|       |                "Cannot read full mini box"};
  181|       |      }
  182|       |      BitstreamRange mini_box_range(m_stream_reader, mini_box_start, end_of_mini_box);
  183|       |      std::shared_ptr<Box> mini_box;
  184|       |      err = Box::read(mini_box_range, &mini_box, heif_get_global_security_limits());
  185|       |      if (err) {
  186|       |        std::cout << "error reading mini box" << std::endl;
  187|       |        return err;
  188|       |      }
  189|       |
  190|       |      m_boxes.push_back(mini_box);
  191|       |      m_mini_box = std::dynamic_pointer_cast<Box_mini>(mini_box);
  192|       |      if (m_mini_box == nullptr) {
  193|       |        std::cout << "error casting mini box" << std::endl;
  194|       |      }
  195|       |
  196|       |      mini_found = true;
  197|       |    }
  198|       |#endif
  199|       |
  200|  4.92k|    if (box_header.get_short_type() == fourcc("moov")) {
  ------------------
  |  Branch (200:9): [True: 2.46k, False: 2.46k]
  ------------------
  201|  2.46k|      const uint64_t moov_box_start = next_box_start;
  202|  2.46k|      if (box_header.get_box_size() == 0) {
  ------------------
  |  Branch (202:11): [True: 0, False: 2.46k]
  ------------------
  203|       |        // TODO: get file-size from stream and compute box size
  204|      0|        return {heif_error_Invalid_input,
  205|      0|                heif_suberror_No_moov_box,
  206|      0|                "Cannot read moov box with unspecified size"};
  207|      0|      }
  208|       |
  209|       |      // TODO: overflow
  210|  2.46k|      uint64_t end_of_moov_box = moov_box_start + box_header.get_box_size();
  211|  2.46k|      if (m_max_length < end_of_moov_box) {
  ------------------
  |  Branch (211:11): [True: 0, False: 2.46k]
  ------------------
  212|      0|        m_max_length = m_stream_reader->request_range(moov_box_start, end_of_moov_box);
  213|      0|      }
  214|       |
  215|  2.46k|      if (m_max_length < end_of_moov_box) {
  ------------------
  |  Branch (215:11): [True: 0, False: 2.46k]
  ------------------
  216|      0|        return {heif_error_Invalid_input,
  217|      0|                heif_suberror_No_moov_box,
  218|      0|                "Cannot read full moov box"};
  219|      0|      }
  220|       |
  221|  2.46k|      BitstreamRange moov_box_range(m_stream_reader, moov_box_start, end_of_moov_box);
  222|  2.46k|      std::shared_ptr<Box> moov_box;
  223|  2.46k|      err = Box::read(moov_box_range, &moov_box, limits);
  224|  2.46k|      if (err) {
  ------------------
  |  Branch (224:11): [True: 2, False: 2.46k]
  ------------------
  225|      2|        return err;
  226|      2|      }
  227|       |
  228|  2.46k|      m_boxes.push_back(moov_box);
  229|  2.46k|      m_moov_box = std::dynamic_pointer_cast<Box_moov>(moov_box);
  230|       |
  231|  2.46k|      moov_found = true;
  232|  2.46k|    }
  233|       |
  234|  4.92k|    uint64_t boxSize = box_header.get_box_size();
  235|  4.92k|    if (boxSize == Box::size_until_end_of_file) {
  ------------------
  |  Branch (235:9): [True: 18, False: 4.90k]
  ------------------
  236|     18|      if (meta_found || mini_found || moov_found) {
  ------------------
  |  Branch (236:11): [True: 17, False: 1]
  |  Branch (236:25): [True: 0, False: 1]
  |  Branch (236:39): [True: 1, False: 0]
  ------------------
  237|     18|        return Error::Ok;
  238|     18|      }
  239|      0|      else {
  240|      0|        return {heif_error_Invalid_input,
  241|      0|                heif_suberror_Unspecified,
  242|      0|                "No meta box found"};
  243|      0|      }
  244|     18|    }
  245|       |
  246|  4.90k|    if (std::numeric_limits<uint64_t>::max() - boxSize < next_box_start) {
  ------------------
  |  Branch (246:9): [True: 0, False: 4.90k]
  ------------------
  247|      0|      return {heif_error_Invalid_input,
  248|      0|              heif_suberror_Unspecified,
  249|      0|              "Box size too large, integer overflow"};
  250|      0|    }
  251|       |
  252|  4.90k|    next_box_start = next_box_start + boxSize;
  253|  4.90k|  }
  254|       |
  255|      0|  return Error::Ok;
  256|     32|}

_ZN10FileLayout12get_ftyp_boxEv:
   60|     27|  std::shared_ptr<Box_ftyp> get_ftyp_box() { return m_ftyp_box; }
_ZN10FileLayout12get_meta_boxEv:
   62|     20|  std::shared_ptr<Box_meta> get_meta_box() { return m_meta_box; }
_ZN10FileLayout12get_moov_boxEv:
   68|     20|  std::shared_ptr<Box_moov> get_moov_box() { return m_moov_box; }

_ZN14ImageItem_AVIFC2EP11HeifContextj:
   39|      8|ImageItem_AVIF::ImageItem_AVIF(HeifContext* ctx, heif_item_id id) : ImageItem(ctx, id)
   40|      8|{
   41|      8|  m_encoder = std::make_shared<Encoder_AVIF>();
   42|      8|}
_ZN14ImageItem_AVIF18initialize_decoderEv:
   51|      8|{
   52|      8|  auto av1C_box = get_property<Box_av1C>();
   53|      8|  if (!av1C_box) {
  ------------------
  |  Branch (53:7): [True: 2, False: 6]
  ------------------
   54|      2|    return Error{heif_error_Invalid_input,
   55|      2|                 heif_suberror_No_av1C_box};
   56|      2|  }
   57|       |
   58|      6|  m_decoder = std::make_shared<Decoder_AVIF>(av1C_box);
   59|       |
   60|      6|  return Error::Ok;
   61|      8|}
_ZN14ImageItem_AVIF22set_decoder_input_dataEv:
   64|      6|{
   65|      6|  DataExtent extent;
   66|      6|  extent.set_from_image_item(get_context()->get_heif_file(), get_id());
   67|       |
   68|      6|  m_decoder->set_data_extent(std::move(extent));
   69|      6|}
_ZNK14ImageItem_AVIF11get_decoderEv:
   79|     41|{
   80|     41|  return {m_decoder};
   81|     41|}

_ZNK14ImageItem_AVIF13get_infe_typeEv:
   43|      2|  uint32_t get_infe_type() const override { return fourcc("av01"); }
_ZNK14ImageItem_AVIF22get_compression_formatEv:
   47|      9|  heif_compression_format get_compression_format() const override { return heif_compression_AV1; }

_ZN14ImageItem_HEVCC2EP11HeifContextj:
   39|    250|    : ImageItem(ctx, id)
   40|    250|{
   41|    250|  m_encoder = std::make_shared<Encoder_HEVC>();
   42|    250|}
_ZN14ImageItem_HEVC18initialize_decoderEv:
   53|    206|{
   54|    206|  auto hvcC_box = get_property<Box_hvcC>();
   55|    206|  if (!hvcC_box) {
  ------------------
  |  Branch (55:7): [True: 22, False: 184]
  ------------------
   56|     22|    return Error{heif_error_Invalid_input,
   57|     22|                 heif_suberror_No_hvcC_box};
   58|     22|  }
   59|       |
   60|    184|  m_decoder = std::make_shared<Decoder_HEVC>(hvcC_box);
   61|       |
   62|    184|  return Error::Ok;
   63|    206|}
_ZN14ImageItem_HEVC22set_decoder_input_dataEv:
   67|    184|{
   68|    184|  DataExtent extent;
   69|    184|  extent.set_from_image_item(get_context()->get_heif_file(), get_id());
   70|       |
   71|    184|  m_decoder->set_data_extent(std::move(extent));
   72|    184|}
_ZNK14ImageItem_HEVC11get_decoderEv:
  110|    975|{
  111|    975|  return {m_decoder};
  112|    975|}

_ZNK14ImageItem_HEVC13get_infe_typeEv:
   41|     66|  uint32_t get_infe_type() const override { return fourcc("hvc1"); }
_ZNK14ImageItem_HEVC22get_compression_formatEv:
   46|     33|  heif_compression_format get_compression_format() const override { return heif_compression_HEVC; }

_ZN9ImageItemC2EP11HeifContext:
   52|    344|    : m_heif_context(context)
   53|    344|{
   54|    344|  memset(&m_depth_representation_info, 0, sizeof(m_depth_representation_info));
   55|    344|}
_ZN9ImageItemC2EP11HeifContextj:
   59|    344|    : ImageItem(context)
   60|    344|{
   61|    344|  m_id = id;
   62|    344|}
_ZNK9ImageItem8get_fileEv:
   77|    236|{
   78|    236|  return m_heif_context->get_heif_file();
   79|    236|}
_ZN9ImageItem12add_propertyENSt3__110shared_ptrI3BoxEEb:
   83|    178|{
   84|    178|  if (!property) {
  ------------------
  |  Branch (84:7): [True: 0, False: 178]
  ------------------
   85|      0|    return 0;
   86|      0|  }
   87|       |
   88|       |  // TODO: is this correct? What happens when add_property does deduplicate the property?
   89|    178|  m_properties.push_back(property);
   90|    178|  return get_file()->add_property(get_id(), property, essential);
   91|    178|}
_ZN9ImageItem18alloc_for_infe_boxEP11HeifContextRKNSt3__110shared_ptrI8Box_infeEE:
  151|    476|{
  152|    476|  uint32_t item_type = infe->get_item_type_4cc();
  153|    476|  heif_item_id id = infe->get_item_ID();
  154|       |
  155|    476|  if (item_type == fourcc("jpeg") ||
  ------------------
  |  Branch (155:7): [True: 0, False: 476]
  ------------------
  156|    476|      (item_type == fourcc("mime") && infe->get_content_type() == "image/jpeg")) {
  ------------------
  |  Branch (156:8): [True: 0, False: 476]
  |  Branch (156:39): [True: 0, False: 0]
  ------------------
  157|      0|    return std::make_shared<ImageItem_JPEG>(ctx, id);
  158|      0|  }
  159|    476|  else if (item_type == fourcc("hvc1")) {
  ------------------
  |  Branch (159:12): [True: 250, False: 226]
  ------------------
  160|    250|    return std::make_shared<ImageItem_HEVC>(ctx, id);
  161|    250|  }
  162|    226|  else if (item_type == fourcc("av01")) {
  ------------------
  |  Branch (162:12): [True: 8, False: 218]
  ------------------
  163|      8|    return std::make_shared<ImageItem_AVIF>(ctx, id);
  164|      8|  }
  165|    218|  else if (item_type == fourcc("vvc1")) {
  ------------------
  |  Branch (165:12): [True: 0, False: 218]
  ------------------
  166|      0|    return std::make_shared<ImageItem_VVC>(ctx, id);
  167|      0|  }
  168|    218|  else if (item_type == fourcc("avc1")) {
  ------------------
  |  Branch (168:12): [True: 0, False: 218]
  ------------------
  169|      0|    return std::make_shared<ImageItem_AVC>(ctx, id);
  170|      0|  }
  171|    218|  else if (item_type == fourcc("unci")) {
  ------------------
  |  Branch (171:12): [True: 0, False: 218]
  ------------------
  172|      0|#if WITH_UNCOMPRESSED_CODEC
  173|      0|    return std::make_shared<ImageItem_uncompressed>(ctx, id);
  174|       |#else
  175|       |    // It is an image item type that we do not support. Thus, generate an ImageItem_Error.
  176|       |
  177|       |    std::stringstream sstr;
  178|       |    sstr << "Image item of type '" << fourcc_to_string(item_type) << "' is not supported.";
  179|       |    Error err{ heif_error_Unsupported_feature, heif_suberror_Unsupported_image_type, sstr.str() };
  180|       |    return std::make_shared<ImageItem_Error>(item_type, id, err);
  181|       |#endif
  182|      0|  }
  183|    218|  else if (item_type == fourcc("j2k1")) {
  ------------------
  |  Branch (183:12): [True: 0, False: 218]
  ------------------
  184|      0|    return std::make_shared<ImageItem_JPEG2000>(ctx, id);
  185|      0|  }
  186|    218|  else if (item_type == fourcc("lhv1")) {
  ------------------
  |  Branch (186:12): [True: 0, False: 218]
  ------------------
  187|      0|    return std::make_shared<ImageItem_Error>(item_type, id,
  188|      0|                                             Error{heif_error_Unsupported_feature,
  189|      0|                                                   heif_suberror_Unsupported_image_type,
  190|      0|                                                   "Layered HEVC images (lhv1) are not supported yet"});
  191|      0|  }
  192|    218|  else if (item_type == fourcc("mski")) {
  ------------------
  |  Branch (192:12): [True: 5, False: 213]
  ------------------
  193|      5|    return std::make_shared<ImageItem_mask>(ctx, id);
  194|      5|  }
  195|    213|  else if (item_type == fourcc("grid")) {
  ------------------
  |  Branch (195:12): [True: 0, False: 213]
  ------------------
  196|      0|    return std::make_shared<ImageItem_Grid>(ctx, id);
  197|      0|  }
  198|    213|  else if (item_type == fourcc("iovl")) {
  ------------------
  |  Branch (198:12): [True: 9, False: 204]
  ------------------
  199|      9|    return std::make_shared<ImageItem_Overlay>(ctx, id);
  200|      9|  }
  201|    204|  else if (item_type == fourcc("iden")) {
  ------------------
  |  Branch (201:12): [True: 0, False: 204]
  ------------------
  202|      0|    return std::make_shared<ImageItem_iden>(ctx, id);
  203|      0|  }
  204|    204|  else if (item_type == fourcc("tili")) {
  ------------------
  |  Branch (204:12): [True: 0, False: 204]
  ------------------
  205|      0|    return std::make_shared<ImageItem_Tiled>(ctx, id);
  206|      0|  }
  207|    204|  else {
  208|       |    // This item has an unknown type. It could be an image or anything else.
  209|       |    // Do not process the item.
  210|       |
  211|    204|    return nullptr;
  212|    204|  }
  213|    476|}
_ZNK9ImageItem14get_ispe_widthEv:
  446|    212|{
  447|    212|  auto ispe = get_property<Box_ispe>();
  448|    212|  if (!ispe) {
  ------------------
  |  Branch (448:7): [True: 207, False: 5]
  ------------------
  449|    207|    return 0;
  450|    207|  }
  451|      5|  else {
  452|      5|    return ispe->get_width();
  453|      5|  }
  454|    212|}
_ZNK9ImageItem15get_ispe_heightEv:
  458|    212|{
  459|    212|  auto ispe = get_property<Box_ispe>();
  460|    212|  if (!ispe) {
  ------------------
  |  Branch (460:7): [True: 207, False: 5]
  ------------------
  461|    207|    return 0;
  462|    207|  }
  463|      5|  else {
  464|      5|    return ispe->get_height();
  465|      5|  }
  466|    212|}
_ZNK9ImageItem34postprocess_coded_image_colorspaceEP15heif_colorspaceP11heif_chroma:
  477|    190|{
  478|       |#if 0
  479|       |  auto pixi = m_heif_context->get_heif_file()->get_property<Box_pixi>(id);
  480|       |  if (pixi && pixi->get_num_channels() == 1) {
  481|       |    *out_colorspace = heif_colorspace_monochrome;
  482|       |    *out_chroma = heif_chroma_monochrome;
  483|       |  }
  484|       |#endif
  485|       |
  486|    190|  if (*inout_colorspace == heif_colorspace_YCbCr) {
  ------------------
  |  Branch (486:7): [True: 190, False: 0]
  ------------------
  487|    190|    auto nclx = get_color_profile_nclx();
  488|    190|    if (nclx.get_matrix_coefficients() == 0) {
  ------------------
  |  Branch (488:9): [True: 0, False: 190]
  ------------------
  489|      0|      *inout_colorspace = heif_colorspace_RGB;
  490|      0|      *inout_chroma = heif_chroma_444; // TODO: this or keep the original chroma?
  491|      0|    }
  492|    190|  }
  493|       |
  494|    190|  return Error::Ok;
  495|    190|}
_ZNK9ImageItem26get_coded_image_colorspaceEP15heif_colorspaceP11heif_chroma:
  499|    190|{
  500|    190|  auto decoderResult = get_decoder();
  501|    190|  if (!decoderResult) {
  ------------------
  |  Branch (501:7): [True: 0, False: 190]
  ------------------
  502|      0|    return decoderResult.error();
  503|      0|  }
  504|       |
  505|    190|  auto decoder = *decoderResult;
  506|       |
  507|    190|  Error err = decoder->get_coded_image_colorspace(out_colorspace, out_chroma);
  508|    190|  if (err) {
  ------------------
  |  Branch (508:7): [True: 0, False: 190]
  ------------------
  509|      0|    return err;
  510|      0|  }
  511|       |
  512|    190|  postprocess_coded_image_colorspace(out_colorspace, out_chroma);
  513|       |
  514|    190|  return Error::Ok;
  515|    190|}
_ZNK9ImageItem23get_luma_bits_per_pixelEv:
  519|    190|{
  520|    190|  auto decoderResult = get_decoder();
  521|    190|  if (!decoderResult) {
  ------------------
  |  Branch (521:7): [True: 0, False: 190]
  ------------------
  522|      0|    return decoderResult.error();
  523|      0|  }
  524|       |
  525|    190|  auto decoder = *decoderResult;
  526|       |
  527|    190|  return decoder->get_luma_bits_per_pixel();
  528|    190|}
_ZNK9ImageItem25get_chroma_bits_per_pixelEv:
  532|    190|{
  533|    190|  auto decoderResult = get_decoder();
  534|    190|  if (!decoderResult) {
  ------------------
  |  Branch (534:7): [True: 0, False: 190]
  ------------------
  535|      0|    return decoderResult.error();
  536|      0|  }
  537|       |
  538|    190|  auto decoder = *decoderResult;
  539|       |
  540|    190|  return decoder->get_chroma_bits_per_pixel();
  541|    190|}
_ZN9ImageItem17set_alpha_channelENSt3__110shared_ptrIS_EE:
  555|      1|{
  556|      1|  m_alpha_channel = std::move(img);
  557|      1|  if (!m_alpha_channel) {
  ------------------
  |  Branch (557:7): [True: 0, False: 1]
  ------------------
  558|      0|    return;
  559|      0|  }
  560|       |
  561|       |  // Avoid emitting a duplicate Alpha description if set_alpha_channel was
  562|       |  // called more than once.
  563|      1|  for (const auto& d : get_component_descriptions()) {
  ------------------
  |  Branch (563:22): [True: 0, False: 1]
  ------------------
  564|      0|    if (d.channel == heif_channel_Alpha) {
  ------------------
  |  Branch (564:9): [True: 0, False: 0]
  ------------------
  565|      0|      return;
  566|      0|    }
  567|      0|  }
  568|       |
  569|       |  // Bit depth of the alpha plane comes from the alpha aux item's coded
  570|       |  // image (typically a monochrome HEVC/AVIF channel). Fall back to 8 bpp
  571|       |  // if the decoder cannot tell us.
  572|      1|  int alpha_bpp = m_alpha_channel->get_luma_bits_per_pixel();
  573|      1|  if (alpha_bpp <= 0) {
  ------------------
  |  Branch (573:7): [True: 1, False: 0]
  ------------------
  574|      1|    alpha_bpp = 8;
  575|      1|  }
  576|       |
  577|      1|  ComponentDescription desc;
  578|      1|  desc.component_id = mint_component_id();
  579|      1|  desc.channel = heif_channel_Alpha;
  580|      1|  desc.component_type = heif_unci_component_type_alpha;
  581|      1|  desc.datatype = heif_component_datatype_unsigned_integer;
  582|      1|  desc.bit_depth = static_cast<uint16_t>(alpha_bpp);
  583|      1|  desc.width = get_ispe_width();
  584|      1|  desc.height = get_ispe_height();
  585|      1|  desc.has_data_plane = true;
  586|      1|  add_component_description(std::move(desc));
  587|      1|}
_ZN9ImageItem31populate_component_descriptionsEv:
  591|    528|{
  592|       |  // Idempotent: a subclass override (e.g. unci) may already have populated.
  593|    528|  if (!get_component_descriptions().empty()) {
  ------------------
  |  Branch (593:7): [True: 0, False: 528]
  ------------------
  594|      0|    return;
  595|      0|  }
  596|       |
  597|       |  // Visual codecs (HEVC/AVC/AVIF/JPEG/JPEG2000/VVC). Requires the decoder to
  598|       |  // be initialized so we can read colorspace / chroma / bit depths from the
  599|       |  // codec config. If the decoder isn't ready (e.g. on the encoder-output
  600|       |  // path that doesn't call initialize_decoder, or for items whose codec is
  601|       |  // not supported), bail out and leave m_components empty.
  602|    528|  auto decoderResult = get_decoder();
  603|    528|  if (!decoderResult || !*decoderResult) {
  ------------------
  |  Branch (603:7): [True: 124, False: 404]
  |  Branch (603:25): [True: 214, False: 190]
  ------------------
  604|    338|    return;
  605|    338|  }
  606|    190|  heif_colorspace colorspace = heif_colorspace_undefined;
  607|    190|  heif_chroma chroma = heif_chroma_undefined;
  608|    190|  if (Error err = get_coded_image_colorspace(&colorspace, &chroma); err) {
  ------------------
  |  Branch (608:69): [True: 0, False: 190]
  ------------------
  609|      0|    return;
  610|      0|  }
  611|       |
  612|    190|  uint32_t img_w = get_ispe_width();
  613|    190|  uint32_t img_h = get_ispe_height();
  614|    190|  int luma_bpp = get_luma_bits_per_pixel();
  615|    190|  int chroma_bpp = get_chroma_bits_per_pixel();
  616|    190|  if (luma_bpp <= 0) luma_bpp = 8;
  ------------------
  |  Branch (616:7): [True: 0, False: 190]
  ------------------
  617|    190|  if (chroma_bpp <= 0) chroma_bpp = luma_bpp;
  ------------------
  |  Branch (617:7): [True: 0, False: 190]
  ------------------
  618|       |
  619|    190|  auto emit = [this](heif_channel ch, uint16_t type, int bpp,
  620|    190|                     uint32_t w, uint32_t h) {
  621|    190|    ComponentDescription desc;
  622|    190|    desc.component_id = mint_component_id();
  623|    190|    desc.channel = ch;
  624|    190|    desc.component_type = type;
  625|    190|    desc.datatype = heif_component_datatype_unsigned_integer;
  626|    190|    desc.bit_depth = static_cast<uint16_t>(bpp);
  627|    190|    desc.width = w;
  628|    190|    desc.height = h;
  629|    190|    desc.has_data_plane = true;
  630|    190|    add_component_description(std::move(desc));
  631|    190|  };
  632|       |
  633|    190|  switch (colorspace) {
  634|      0|    case heif_colorspace_monochrome:
  ------------------
  |  Branch (634:5): [True: 0, False: 190]
  ------------------
  635|      0|      emit(heif_channel_Y, heif_unci_component_type_monochrome, luma_bpp, img_w, img_h);
  636|      0|      break;
  637|       |
  638|    190|    case heif_colorspace_YCbCr: {
  ------------------
  |  Branch (638:5): [True: 190, False: 0]
  ------------------
  639|    190|      uint32_t cw = channel_width(img_w, chroma, heif_channel_Cb);
  640|    190|      uint32_t ch_ = channel_height(img_h, chroma, heif_channel_Cb);
  641|    190|      emit(heif_channel_Y,  heif_unci_component_type_Y,  luma_bpp,   img_w, img_h);
  642|    190|      emit(heif_channel_Cb, heif_unci_component_type_Cb, chroma_bpp, cw,    ch_);
  643|    190|      emit(heif_channel_Cr, heif_unci_component_type_Cr, chroma_bpp, cw,    ch_);
  644|    190|      break;
  645|      0|    }
  646|       |
  647|      0|    case heif_colorspace_RGB:
  ------------------
  |  Branch (647:5): [True: 0, False: 190]
  ------------------
  648|      0|      emit(heif_channel_R, heif_unci_component_type_red,   luma_bpp, img_w, img_h);
  649|      0|      emit(heif_channel_G, heif_unci_component_type_green, luma_bpp, img_w, img_h);
  650|      0|      emit(heif_channel_B, heif_unci_component_type_blue,  luma_bpp, img_w, img_h);
  651|      0|      break;
  652|       |
  653|      0|    default:
  ------------------
  |  Branch (653:5): [True: 0, False: 190]
  ------------------
  654|       |      // Other colorspaces (filter_array, nonvisual) are unci-only and are
  655|       |      // populated by the unci override.
  656|      0|      break;
  657|    190|  }
  658|    190|}
_ZN9ImageItem22set_color_profile_nclxERK12nclx_profile:
  824|      3|{
  825|      3|  ImageDescription::set_color_profile_nclx(profile);
  826|      3|  add_property(create_colr_box_nclx(), false);
  827|      3|}
_ZN9ImageItem21set_color_profile_iccERKNSt3__110shared_ptrIK17color_profile_rawEE:
  831|    175|{
  832|    175|  ImageDescription::set_color_profile_icc(profile);
  833|    175|  add_property(create_colr_box_icc(), false);
  834|    175|}
_ZNK9ImageItem12decode_imageERK21heif_decoding_optionsbjjNSt3__13setIjNS3_4lessIjEENS3_9allocatorIjEEEE:
  848|     57|{
  849|       |  // Check for cycles before taking m_decode_mutex: a derived item that
  850|       |  // (transitively) references itself would otherwise re-enter decode_image()
  851|       |  // on the same ImageItem and self-deadlock on the non-recursive mutex.
  852|       |  // The matching insert lives inside decode_compressed_image() of derived
  853|       |  // items (grid/overlay/iden), so the current item is in processed_ids only
  854|       |  // when called from one of its own descendants.
  855|     57|  if (processed_ids.contains(m_id)) {
  ------------------
  |  Branch (855:7): [True: 0, False: 57]
  ------------------
  856|      0|    return Error{heif_error_Invalid_input,
  857|      0|                 heif_suberror_Unspecified,
  858|      0|                 "'iref' has cyclic references"};
  859|      0|  }
  860|       |
  861|     57|  std::lock_guard<std::mutex> lock(m_decode_mutex);
  862|       |
  863|       |  // --- check whether image size (according to 'ispe') exceeds maximum
  864|       |
  865|     57|  if (!decode_tile_only) {
  ------------------
  |  Branch (865:7): [True: 57, False: 0]
  ------------------
  866|     57|    auto ispe = get_property<Box_ispe>();
  867|     57|    if (ispe) {
  ------------------
  |  Branch (867:9): [True: 8, False: 49]
  ------------------
  868|      8|      Error err = check_for_valid_image_size(get_context()->get_security_limits(), ispe->get_width(), ispe->get_height());
  869|      8|      if (err) {
  ------------------
  |  Branch (869:11): [True: 0, False: 8]
  ------------------
  870|      0|        return err;
  871|      0|      }
  872|      8|    }
  873|     57|  }
  874|       |
  875|       |
  876|       |  // --- transform tile position
  877|       |
  878|     57|  if (decode_tile_only && options.ignore_transformations == false) {
  ------------------
  |  Branch (878:7): [True: 0, False: 57]
  |  Branch (878:27): [True: 0, False: 0]
  ------------------
  879|      0|    if (Error error = transform_requested_tile_position_to_original_tile_position(tile_x0, tile_y0)) {
  ------------------
  |  Branch (879:15): [True: 0, False: 0]
  ------------------
  880|      0|      return error;
  881|      0|    }
  882|      0|  }
  883|       |
  884|       |  // --- decode image
  885|       |
  886|     57|  Result<std::shared_ptr<HeifPixelImage>> decodingResult = decode_compressed_image(options, decode_tile_only, tile_x0, tile_y0, processed_ids);
  887|     57|  if (!decodingResult) {
  ------------------
  |  Branch (887:7): [True: 52, False: 5]
  ------------------
  888|     52|    return decodingResult.error();
  889|     52|  }
  890|       |
  891|      5|  auto img = *decodingResult;
  892|      5|  if (!img) {
  ------------------
  |  Branch (892:7): [True: 0, False: 5]
  ------------------
  893|       |    // Can happen if missing tiled image is decoded in non-strict mode.
  894|      0|    return Error(heif_error_Decoder_plugin_error, heif_suberror_Unspecified);
  895|      0|  }
  896|       |
  897|       |  // --- validate the decoded image against the signaled size (pre-transform)
  898|       |
  899|      5|  if (Error err = check_decoded_image_size(*img, decode_tile_only, tile_x0, tile_y0)) {
  ------------------
  |  Branch (899:13): [True: 0, False: 5]
  ------------------
  900|      0|    return err;
  901|      0|  }
  902|       |
  903|      5|  std::shared_ptr<HeifFile> file = m_heif_context->get_heif_file();
  904|       |
  905|       |
  906|       |  // --- apply image transformations
  907|       |
  908|      5|  if (options.ignore_transformations == false) {
  ------------------
  |  Branch (908:7): [True: 5, False: 0]
  ------------------
  909|      5|    Result<std::vector<std::shared_ptr<Box>>> propertiesResult = get_properties();
  910|      5|    if (!propertiesResult) {
  ------------------
  |  Branch (910:9): [True: 0, False: 5]
  ------------------
  911|      0|      return propertiesResult.error();
  912|      0|    }
  913|       |
  914|      5|    const std::vector<std::shared_ptr<Box>>& properties = *propertiesResult;
  915|       |
  916|     20|    for (const auto& property : properties) {
  ------------------
  |  Branch (916:31): [True: 20, False: 5]
  ------------------
  917|     20|      if (auto rot = std::dynamic_pointer_cast<Box_irot>(property)) {
  ------------------
  |  Branch (917:16): [True: 0, False: 20]
  ------------------
  918|      0|        auto rotateResult = img->rotate_ccw(rot->get_rotation_ccw(), m_heif_context->get_security_limits());
  919|      0|        if (!rotateResult) {
  ------------------
  |  Branch (919:13): [True: 0, False: 0]
  ------------------
  920|      0|          return rotateResult.error();
  921|      0|        }
  922|       |
  923|      0|        img = *rotateResult;
  924|      0|      }
  925|       |
  926|       |
  927|     20|      if (auto mirror = std::dynamic_pointer_cast<Box_imir>(property)) {
  ------------------
  |  Branch (927:16): [True: 0, False: 20]
  ------------------
  928|      0|        auto mirrorResult = img->mirror_inplace(mirror->get_mirror_direction(),
  929|      0|                                                get_context()->get_security_limits());
  930|      0|        if (!mirrorResult) {
  ------------------
  |  Branch (930:13): [True: 0, False: 0]
  ------------------
  931|      0|          return mirrorResult.error();
  932|      0|        }
  933|      0|        img = *mirrorResult;
  934|      0|      }
  935|       |
  936|       |
  937|     20|      if (!decode_tile_only) {
  ------------------
  |  Branch (937:11): [True: 20, False: 0]
  ------------------
  938|       |        // For tiles decoding, we do not process the 'clap' because this is handled by a shift of the tiling grid.
  939|       |
  940|     20|        if (auto clap = std::dynamic_pointer_cast<Box_clap>(property)) {
  ------------------
  |  Branch (940:18): [True: 0, False: 20]
  ------------------
  941|      0|          std::shared_ptr<HeifPixelImage> clap_img;
  942|       |
  943|      0|          uint32_t img_width = img->get_width();
  944|      0|          uint32_t img_height = img->get_height();
  945|       |
  946|      0|          int left = clap->left_rounded(img_width);
  947|      0|          int right = clap->right_rounded(img_width);
  948|      0|          int top = clap->top_rounded(img_height);
  949|      0|          int bottom = clap->bottom_rounded(img_height);
  950|       |
  951|      0|          if (left < 0) { left = 0; }
  ------------------
  |  Branch (951:15): [True: 0, False: 0]
  ------------------
  952|      0|          if (top < 0) { top = 0; }
  ------------------
  |  Branch (952:15): [True: 0, False: 0]
  ------------------
  953|       |
  954|      0|          if ((uint32_t) right >= img_width) { right = img_width - 1; }
  ------------------
  |  Branch (954:15): [True: 0, False: 0]
  ------------------
  955|      0|          if ((uint32_t) bottom >= img_height) { bottom = img_height - 1; }
  ------------------
  |  Branch (955:15): [True: 0, False: 0]
  ------------------
  956|       |
  957|      0|          if (left > right ||
  ------------------
  |  Branch (957:15): [True: 0, False: 0]
  ------------------
  958|      0|              top > bottom) {
  ------------------
  |  Branch (958:15): [True: 0, False: 0]
  ------------------
  959|      0|            return Error(heif_error_Invalid_input,
  960|      0|                         heif_suberror_Invalid_clean_aperture);
  961|      0|          }
  962|       |
  963|      0|          auto cropResult = img->crop(left, right, top, bottom, m_heif_context->get_security_limits());
  964|      0|          if (!cropResult) {
  ------------------
  |  Branch (964:15): [True: 0, False: 0]
  ------------------
  965|      0|            return cropResult.error();
  966|      0|          }
  967|       |
  968|      0|          img = *cropResult;
  969|      0|        }
  970|     20|      }
  971|     20|    }
  972|      5|  }
  973|       |
  974|       |
  975|       |  // --- add alpha channel, if available
  976|       |
  977|       |  // TODO: this if statement is probably wrong. When we have a tiled image with alpha
  978|       |  // channel, then the alpha images should be associated with their respective tiles.
  979|       |  // However, the tile images are not part of the m_all_images list.
  980|       |  // Fix this, when we have a test image available.
  981|       |
  982|      5|  std::shared_ptr<ImageItem> alpha_image = get_alpha_channel();
  983|      5|  if (alpha_image) {
  ------------------
  |  Branch (983:7): [True: 0, False: 5]
  ------------------
  984|      0|    if (alpha_image->get_item_error()) {
  ------------------
  |  Branch (984:9): [True: 0, False: 0]
  ------------------
  985|      0|      return alpha_image->get_item_error();
  986|      0|    }
  987|       |
  988|      0|    auto alphaDecodingResult = alpha_image->decode_image(options, decode_tile_only, tile_x0, tile_y0, processed_ids);
  989|      0|    if (!alphaDecodingResult) {
  ------------------
  |  Branch (989:9): [True: 0, False: 0]
  ------------------
  990|      0|      return alphaDecodingResult.error();
  991|      0|    }
  992|       |
  993|      0|    std::shared_ptr<HeifPixelImage> alpha = *alphaDecodingResult;
  994|       |
  995|       |    // TODO: check that sizes are the same and that we have an Y channel
  996|       |    // BUT: is there any indication in the standard that the alpha channel should have the same size?
  997|       |
  998|       |    // TODO: convert in case alpha is decoded as RGB interleaved
  999|       |
 1000|      0|    heif_channel channel;
 1001|      0|    switch (alpha->get_colorspace()) {
 1002|      0|      case heif_colorspace_YCbCr:
  ------------------
  |  Branch (1002:7): [True: 0, False: 0]
  ------------------
 1003|      0|      case heif_colorspace_monochrome:
  ------------------
  |  Branch (1003:7): [True: 0, False: 0]
  ------------------
 1004|      0|        channel = heif_channel_Y;
 1005|      0|        break;
 1006|      0|      case heif_colorspace_RGB:
  ------------------
  |  Branch (1006:7): [True: 0, False: 0]
  ------------------
 1007|      0|        channel = heif_channel_R;
 1008|      0|        break;
 1009|      0|      case heif_colorspace_undefined:
  ------------------
  |  Branch (1009:7): [True: 0, False: 0]
  ------------------
 1010|      0|      default:
  ------------------
  |  Branch (1010:7): [True: 0, False: 0]
  ------------------
 1011|      0|        return Error(heif_error_Invalid_input,
 1012|      0|                     heif_suberror_Unsupported_color_conversion);
 1013|      0|    }
 1014|       |
 1015|       |
 1016|       |    // TODO: we should include a decoding option to control whether libheif should automatically scale the alpha channel, and if so, which scaling filter (enum: Off, NN, Bilinear, ...).
 1017|       |    //       It might also be that a specific output format implies that alpha is scaled (RGBA32). That would favor an enum for the scaling filter option + a bool to switch auto-filtering on.
 1018|       |    //       But we can only do this when libheif itself doesn't assume anymore that the alpha channel has the same resolution.
 1019|       |
 1020|      0|    if ((alpha_image->get_width() != img->get_width()) || (alpha_image->get_height() != img->get_height())) {
  ------------------
  |  Branch (1020:9): [True: 0, False: 0]
  |  Branch (1020:59): [True: 0, False: 0]
  ------------------
 1021|      0|      std::shared_ptr<HeifPixelImage> scaled_alpha;
 1022|      0|      Error err = alpha->scale_nearest_neighbor(scaled_alpha, img->get_width(), img->get_height(), m_heif_context->get_security_limits());
 1023|      0|      if (err) {
  ------------------
  |  Branch (1023:11): [True: 0, False: 0]
  ------------------
 1024|      0|        return err;
 1025|      0|      }
 1026|      0|      alpha = std::move(scaled_alpha);
 1027|      0|    }
 1028|      0|    img->transfer_channel_from_image_as(alpha, channel, heif_channel_Alpha);
 1029|       |
 1030|      0|    if (is_premultiplied_alpha()) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 0]
  ------------------
 1031|      0|      img->set_premultiplied_alpha(true);
 1032|      0|    }
 1033|      0|  }
 1034|       |
 1035|       |
 1036|       |  // --- set color profile
 1037|       |
 1038|       |  // If there is an NCLX profile in the HEIF/AVIF metadata, use this for the color conversion.
 1039|       |  // Otherwise, use the profile that is stored in the image stream itself and then set the
 1040|       |  // (non-NCLX) profile later.
 1041|      5|  auto nclx = get_color_profile_nclx();
 1042|      5|  if (!nclx.is_undefined()) {
  ------------------
  |  Branch (1042:7): [True: 1, False: 4]
  ------------------
 1043|       |    // If the decoder plugin populated an NCLX profile from the bitstream's
 1044|       |    // color signalling (e.g. HEVC SPS VUI, AV1 sequence header), compare it
 1045|       |    // against the colr box. Per ISO/IEC 14496-12 and ISO/IEC 23000-22 (MIAF)
 1046|       |    // the colr box overrides the bitstream, but a mismatch is a strong
 1047|       |    // indication of a muxer bug (e.g. some Sony cameras mis-tag full_range_flag
 1048|       |    // in colr while the bitstream VUI is correct, see issue #1770) and is
 1049|       |    // worth surfacing as a warning.
 1050|      1|    auto bitstream_nclx = img->get_color_profile_nclx();
 1051|      1|    if (!bitstream_nclx.is_undefined()) {
  ------------------
  |  Branch (1051:9): [True: 0, False: 1]
  ------------------
 1052|      0|      auto cicp_mismatch = [](uint16_t bs, uint16_t cr) {
 1053|      0|        return bs != 2 /*unspecified*/ && cr != 2 && bs != cr;
 1054|      0|      };
 1055|      0|      if (cicp_mismatch(bitstream_nclx.m_colour_primaries,        nclx.m_colour_primaries)        ||
  ------------------
  |  Branch (1055:11): [True: 0, False: 0]
  ------------------
 1056|      0|          cicp_mismatch(bitstream_nclx.m_transfer_characteristics, nclx.m_transfer_characteristics) ||
  ------------------
  |  Branch (1056:11): [True: 0, False: 0]
  ------------------
 1057|      0|          cicp_mismatch(bitstream_nclx.m_matrix_coefficients,     nclx.m_matrix_coefficients)     ||
  ------------------
  |  Branch (1057:11): [True: 0, False: 0]
  ------------------
 1058|      0|          bitstream_nclx.m_full_range_flag != nclx.m_full_range_flag) {
  ------------------
  |  Branch (1058:11): [True: 0, False: 0]
  ------------------
 1059|      0|        std::stringstream msg;
 1060|      0|        msg << "colr box NCLX ("
 1061|      0|            << nclx.m_colour_primaries << "/"
 1062|      0|            << nclx.m_transfer_characteristics << "/"
 1063|      0|            << nclx.m_matrix_coefficients << "/"
 1064|      0|            << (nclx.m_full_range_flag ? "full" : "limited")
  ------------------
  |  Branch (1064:17): [True: 0, False: 0]
  ------------------
 1065|      0|            << ") disagrees with bitstream signalling ("
 1066|      0|            << bitstream_nclx.m_colour_primaries << "/"
 1067|      0|            << bitstream_nclx.m_transfer_characteristics << "/"
 1068|      0|            << bitstream_nclx.m_matrix_coefficients << "/"
 1069|      0|            << (bitstream_nclx.m_full_range_flag ? "full" : "limited")
  ------------------
  |  Branch (1069:17): [True: 0, False: 0]
  ------------------
 1070|      0|            << "); colr takes precedence per ISO/IEC 14496-12 and ISO/IEC 23000-22 (MIAF)";
 1071|      0|        add_decoding_warning({heif_error_Invalid_input,
 1072|      0|                              heif_suberror_NCLX_colr_VUI_mismatch,
 1073|      0|                              msg.str()});
 1074|      0|      }
 1075|      0|    }
 1076|      1|    img->set_color_profile_nclx(nclx);
 1077|      1|  }
 1078|       |
 1079|      5|  auto icc = get_color_profile_icc();
 1080|      5|  if (icc) {
  ------------------
  |  Branch (1080:7): [True: 4, False: 1]
  ------------------
 1081|      4|    img->set_color_profile_icc(icc);
 1082|      4|  }
 1083|       |
 1084|       |
 1085|       |  // --- attach metadata to image
 1086|       |
 1087|      5|  {
 1088|      5|    auto ipco_box = file->get_ipco_box();
 1089|      5|    auto ipma_box = file->get_ipma_box();
 1090|       |
 1091|       |    // CLLI
 1092|       |
 1093|      5|    auto clli = get_property<Box_clli>();
 1094|      5|    if (clli) {
  ------------------
  |  Branch (1094:9): [True: 0, False: 5]
  ------------------
 1095|      0|      img->set_clli(clli->clli);
 1096|      0|    }
 1097|       |
 1098|       |    // MDCV
 1099|       |
 1100|      5|    auto mdcv = get_property<Box_mdcv>();
 1101|      5|    if (mdcv) {
  ------------------
  |  Branch (1101:9): [True: 0, False: 5]
  ------------------
 1102|      0|      img->set_mdcv(mdcv->mdcv);
 1103|      0|    }
 1104|       |
 1105|       |    // PASP
 1106|       |
 1107|      5|    auto pasp = get_property<Box_pasp>();
 1108|      5|    if (pasp) {
  ------------------
  |  Branch (1108:9): [True: 0, False: 5]
  ------------------
 1109|      0|      img->set_pixel_ratio(pasp->hSpacing, pasp->vSpacing);
 1110|      0|    }
 1111|       |
 1112|       |    // TAI
 1113|       |
 1114|      5|    auto itai = get_property<Box_itai>();
 1115|      5|    if (itai) {
  ------------------
  |  Branch (1115:9): [True: 0, False: 5]
  ------------------
 1116|      0|      img->set_tai_timestamp(itai->get_tai_timestamp_packet());
 1117|      0|    }
 1118|       |
 1119|       |    // GIMI content ID
 1120|       |
 1121|      5|    auto gimi_content_id = get_property<Box_gimi_content_id>();
 1122|      5|    if (gimi_content_id) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 5]
  ------------------
 1123|      0|      img->set_gimi_sample_content_id(gimi_content_id->get_content_id());
 1124|      0|    }
 1125|       |
 1126|      5|#if HEIF_WITH_OMAF
 1127|       |    // Image projection (OMAF)
 1128|      5|    auto prfr = get_property<Box_prfr>();
 1129|      5|    if (prfr) {
  ------------------
  |  Branch (1129:9): [True: 0, False: 5]
  ------------------
 1130|      0|      img->set_omaf_image_projection(prfr->get_omaf_image_projection());
 1131|      0|    }
 1132|      5|#endif
 1133|      5|  }
 1134|       |
 1135|       |
 1136|      5|  return img;
 1137|      5|}
_ZNK9ImageItem23decode_compressed_imageERK21heif_decoding_optionsbjjNSt3__13setIjNS3_4lessIjEENS3_9allocatorIjEEEE:
 1157|     42|{
 1158|     42|  if (processed_ids.contains(m_id)) {
  ------------------
  |  Branch (1158:7): [True: 0, False: 42]
  ------------------
 1159|      0|    return Error{heif_error_Invalid_input,
 1160|      0|                 heif_suberror_Unspecified,
 1161|      0|                 "'iref' has cyclic references"};
 1162|      0|  }
 1163|       |
 1164|     42|  processed_ids.insert(m_id);
 1165|       |
 1166|       |
 1167|     42|  DataExtent extent;
 1168|     42|  extent.set_from_image_item(get_file(), get_id());
 1169|       |
 1170|     42|  auto decoderResult = get_decoder();
 1171|     42|  if (!decoderResult) {
  ------------------
  |  Branch (1171:7): [True: 0, False: 42]
  ------------------
 1172|      0|    return decoderResult.error();
 1173|      0|  }
 1174|       |
 1175|     42|  auto decoder = *decoderResult;
 1176|       |
 1177|     42|  decoder->set_data_extent(std::move(extent));
 1178|       |
 1179|       |  // Tighten max_image_size_pixels for this decode so a decoder plugin (e.g.
 1180|       |  // dav1d) cannot allocate buffers far larger than the ispe-declared size
 1181|       |  // when the codec bitstream lies about its dimensions.
 1182|     42|  heif_security_limits tightened = tighten_image_size_limit_for_ispe(
 1183|     42|      get_context()->get_security_limits(),
 1184|     42|      get_width(), get_height(),
 1185|     42|      max_coding_unit_size_for_codec(get_compression_format()));
 1186|       |
 1187|     42|  return decoder->decode_single_frame_from_compressed_data(options, &tightened);
 1188|     42|}
_ZNK9ImageItem24check_decoded_image_sizeERK14HeifPixelImagebjj:
 1194|      5|{
 1195|      5|  uint32_t expected_w, expected_h;
 1196|       |
 1197|      5|  if (decode_tile_only) {
  ------------------
  |  Branch (1197:7): [True: 0, False: 5]
  ------------------
 1198|       |    // The decoded buffer is a single tile, sized to the signaled tile size.
 1199|      0|    get_tile_size(expected_w, expected_h);
 1200|      0|  }
 1201|      5|  else {
 1202|       |    // Pre-transform coded size from the 'ispe' property.
 1203|      5|    expected_w = get_ispe_width();
 1204|      5|    expected_h = get_ispe_height();
 1205|      5|  }
 1206|       |
 1207|       |  // No 'ispe' / no tile size known -> cannot validate (a missing-'ispe' warning is
 1208|       |  // already emitted upstream). Skip rather than reject.
 1209|      5|  if (expected_w == 0 || expected_h == 0) {
  ------------------
  |  Branch (1209:7): [True: 5, False: 0]
  |  Branch (1209:26): [True: 0, False: 0]
  ------------------
 1210|      5|    return Error::Ok;
 1211|      5|  }
 1212|       |
 1213|      0|  if (!img.primary_planes_have_size(expected_w, expected_h)) {
  ------------------
  |  Branch (1213:7): [True: 0, False: 0]
  ------------------
 1214|      0|    return Error{heif_error_Invalid_input,
 1215|      0|                 heif_suberror_Invalid_image_size,
 1216|      0|                 "Decoded image does not have the size signaled in the file."};
 1217|      0|  }
 1218|       |
 1219|      0|  return Error::Ok;
 1220|      0|}
_ZNK9ImageItem14get_propertiesEv:
 1251|      5|{
 1252|      5|  std::vector<std::shared_ptr<Box>> properties;
 1253|      5|  auto ipco_box = get_file()->get_ipco_box();
 1254|      5|  auto ipma_box = get_file()->get_ipma_box();
 1255|      5|  Error error = ipco_box->get_properties_for_item_ID(m_id, ipma_box, properties);
 1256|      5|  if (error) {
  ------------------
  |  Branch (1256:7): [True: 0, False: 5]
  ------------------
 1257|      0|    return error;
 1258|      0|  }
 1259|       |
 1260|      5|  return properties;
 1261|      5|}
image_item.cc:_ZZN9ImageItem31populate_component_descriptionsEvENK3$_0clE12heif_channeltijj:
  620|    570|                     uint32_t w, uint32_t h) {
  621|    570|    ComponentDescription desc;
  622|    570|    desc.component_id = mint_component_id();
  623|    570|    desc.channel = ch;
  624|    570|    desc.component_type = type;
  625|    570|    desc.datatype = heif_component_datatype_unsigned_integer;
  626|    570|    desc.bit_depth = static_cast<uint16_t>(bpp);
  627|    570|    desc.width = w;
  628|    570|    desc.height = h;
  629|    570|    desc.has_data_plane = true;
  630|    570|    add_component_description(std::move(desc));
  631|    570|  };

_ZNK9ImageItem14get_item_errorEv:
   79|    647|  virtual Error get_item_error() const { return Error::Ok; }
_ZN9ImageItem5clearEv:
   86|    272|  {
   87|    272|    m_thumbnails.clear();
   88|    272|    m_alpha_channel.reset();
   89|    272|    m_depth_channel.reset();
   90|    272|    m_aux_images.clear();
   91|    272|  }
_ZN9ImageItem11get_contextEv:
   93|    199|  HeifContext* get_context() { return m_heif_context; }
_ZNK9ImageItem11get_contextEv:
   95|     77|  const HeifContext* get_context() const { return m_heif_context; }
_ZN9ImageItem14set_propertiesENSt3__16vectorINS0_10shared_ptrI3BoxEENS0_9allocatorIS4_EEEE:
   99|    298|  void set_properties(std::vector<std::shared_ptr<Box>> properties) {
  100|    298|    m_properties = std::move(properties);
  101|       |    // Codec-config-independent populate (e.g. unci, which reads cmpd/uncC
  102|       |    // directly off the just-set property boxes). Visual codecs leave
  103|       |    // m_components empty here; their populate runs after initialize_decoder()
  104|       |    // because they need codec config (colorspace, bit depth) which only the
  105|       |    // decoder can read.
  106|    298|    populate_component_descriptions();
  107|    298|  }
_ZN9ImageItem14set_resolutionEjj:
  160|      5|  {
  161|      5|    m_width = w;
  162|      5|    m_height = h;
  163|      5|  }
_ZNK9ImageItem6get_idEv:
  165|  1.22k|  heif_item_id get_id() const { return m_id; }
_ZN9ImageItem11set_primaryEb:
  169|     20|  void set_primary(bool flag = true) { m_is_primary = flag; }
_ZNK9ImageItem10is_primaryEv:
  171|     66|  bool is_primary() const { return m_is_primary; }
_ZNK9ImageItem9get_widthEv:
  174|     99|  uint32_t get_width() const { return m_width; }
_ZNK9ImageItem10get_heightEv:
  176|     99|  uint32_t get_height() const { return m_height; }
_ZN9ImageItem16set_is_thumbnailEv:
  207|      3|  {
  208|      3|    m_is_thumbnail = true;
  209|      3|  }
_ZN9ImageItem13add_thumbnailERKNSt3__110shared_ptrIS_EE:
  211|      3|  void add_thumbnail(const std::shared_ptr<ImageItem>& img) { m_thumbnails.push_back(img); }
_ZNK9ImageItem12is_thumbnailEv:
  213|      3|  bool is_thumbnail() const { return m_is_thumbnail; }
_ZNK9ImageItem14get_thumbnailsEv:
  215|     51|  const std::vector<std::shared_ptr<ImageItem>>& get_thumbnails() const { return m_thumbnails; }
_ZN9ImageItem20set_is_alpha_channelEv:
  221|      1|  {
  222|      1|    m_is_alpha_channel = true;
  223|      1|  }
_ZNK9ImageItem17get_alpha_channelEv:
  231|      5|  const std::shared_ptr<ImageItem>& get_alpha_channel() const { return m_alpha_channel; }
_ZN9ImageItem16set_is_aux_imageERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  274|      1|  {
  275|      1|    m_is_aux_image = true;
  276|      1|    m_aux_image_type = aux_type;
  277|      1|  }
_ZN9ImageItem13add_aux_imageENSt3__110shared_ptrIS_EE:
  279|      1|  void add_aux_image(std::shared_ptr<ImageItem> img) { m_aux_images.push_back(std::move(img)); }
_ZNK9ImageItem12get_metadataEv:
  317|    114|  const std::vector<std::shared_ptr<ImageMetadata>>& get_metadata() const { return m_metadata; }
_ZN9ImageItem18initialize_decoderEv:
  349|     49|  virtual Error initialize_decoder() { return Error::Ok; }
_ZN9ImageItem22set_decoder_input_dataEv:
  351|     56|  virtual void set_decoder_input_data() { }
_ZNK9ImageItem20add_decoding_warningE5Error:
  420|    384|  void add_decoding_warning(Error err) const { m_decoding_warnings.emplace_back(std::move(err)); }
_ZNK9ImageItem21get_decoding_warningsEv:
  422|      5|  const std::vector<Error>& get_decoding_warnings() const { return m_decoding_warnings; }
_ZNK9ImageItem11get_decoderEv:
  431|    124|  {
  432|    124|    return Error{
  433|    124|      heif_error_Unsupported_feature,
  434|    124|      heif_suberror_No_matching_decoder_installed,
  435|    124|      "No decoder for this image format"
  436|    124|    };
  437|    124|  }
_ZN15ImageItem_ErrorC2Ejj5Error:
  517|     72|    : ImageItem(nullptr, id), m_item_type(item_type), m_item_error(err) {}
_ZNK15ImageItem_Error14get_item_errorEv:
  524|    257|  Error get_item_error() const override { return m_item_error; }
_ZNK9ImageItem12get_propertyI8Box_paspEENSt3__110shared_ptrIT_EEv:
  133|      5|  {
  134|     25|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 25, False: 5]
  ------------------
  135|     25|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 25]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|     25|    }
  139|       |
  140|      5|    return nullptr;
  141|      5|  }
_ZNK9ImageItem12get_propertyI8Box_ispeEENSt3__110shared_ptrIT_EEv:
  133|    481|  {
  134|  1.57k|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 1.57k, False: 463]
  ------------------
  135|  1.57k|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 18, False: 1.55k]
  ------------------
  136|     18|        return box;
  137|     18|      }
  138|  1.57k|    }
  139|       |
  140|    463|    return nullptr;
  141|    481|  }
_ZNK9ImageItem12get_propertyI8Box_clliEENSt3__110shared_ptrIT_EEv:
  133|      5|  {
  134|     25|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 25, False: 5]
  ------------------
  135|     25|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 25]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|     25|    }
  139|       |
  140|      5|    return nullptr;
  141|      5|  }
_ZNK9ImageItem12get_propertyI8Box_mdcvEENSt3__110shared_ptrIT_EEv:
  133|      5|  {
  134|     25|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 25, False: 5]
  ------------------
  135|     25|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 25]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|     25|    }
  139|       |
  140|      5|    return nullptr;
  141|      5|  }
_ZNK9ImageItem12get_propertyI8Box_itaiEENSt3__110shared_ptrIT_EEv:
  133|      5|  {
  134|     25|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 25, False: 5]
  ------------------
  135|     25|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 25]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|     25|    }
  139|       |
  140|      5|    return nullptr;
  141|      5|  }
_ZNK9ImageItem12get_propertyI19Box_gimi_content_idEENSt3__110shared_ptrIT_EEv:
  133|    205|  {
  134|    857|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 857, False: 205]
  ------------------
  135|    857|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 857]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|    857|    }
  139|       |
  140|    205|    return nullptr;
  141|    205|  }
_ZNK9ImageItem12get_propertyI8Box_prfrEENSt3__110shared_ptrIT_EEv:
  133|    205|  {
  134|    857|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 857, False: 205]
  ------------------
  135|    857|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 0, False: 857]
  ------------------
  136|      0|        return box;
  137|      0|      }
  138|    857|    }
  139|       |
  140|    205|    return nullptr;
  141|    205|  }
_ZNK9ImageItem12get_propertyI8Box_auxCEENSt3__110shared_ptrIT_EEv:
  133|      1|  {
  134|      2|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 2, False: 0]
  ------------------
  135|      2|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 1, False: 1]
  ------------------
  136|      1|        return box;
  137|      1|      }
  138|      2|    }
  139|       |
  140|      0|    return nullptr;
  141|      1|  }
_ZNK9ImageItem12get_propertyI8Box_hvcCEENSt3__110shared_ptrIT_EEv:
  133|    206|  {
  134|    596|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 596, False: 22]
  ------------------
  135|    596|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 184, False: 412]
  ------------------
  136|    184|        return box;
  137|    184|      }
  138|    596|    }
  139|       |
  140|     22|    return nullptr;
  141|    206|  }
_ZNK9ImageItem12get_propertyI8Box_av1CEENSt3__110shared_ptrIT_EEv:
  133|      8|  {
  134|     18|    for (auto& property : m_properties) {
  ------------------
  |  Branch (134:25): [True: 18, False: 2]
  ------------------
  135|     18|      if (auto box = std::dynamic_pointer_cast<BoxType>(property)) {
  ------------------
  |  Branch (135:16): [True: 6, False: 12]
  ------------------
  136|      6|        return box;
  137|      6|      }
  138|     18|    }
  139|       |
  140|      2|    return nullptr;
  141|      8|  }

_ZNK14ImageItem_mask23decode_compressed_imageERK21heif_decoding_optionsbjjNSt3__13setIjNS3_4lessIjEENS3_9allocatorIjEEEE:
  130|      6|{
  131|      6|  std::shared_ptr<HeifPixelImage> img;
  132|       |
  133|      6|  std::vector<uint8_t> data;
  134|       |
  135|       |  // image data, usually from 'mdat'
  136|       |
  137|      6|  Error error = get_file()->append_data_from_iloc(get_id(), data);
  138|      6|  if (error) {
  ------------------
  |  Branch (138:7): [True: 6, False: 0]
  ------------------
  139|      6|    return error;
  140|      6|  }
  141|       |
  142|      0|  Error err = MaskImageCodec::decode_mask_image(get_context(),
  143|      0|                                                get_id(),
  144|      0|                                                img,
  145|      0|                                                data);
  146|      0|  if (err) {
  ------------------
  |  Branch (146:7): [True: 0, False: 0]
  ------------------
  147|      0|    return err;
  148|      0|  }
  149|      0|  else {
  150|      0|    return img;
  151|      0|  }
  152|      0|}

_ZN14ImageItem_maskC2EP11HeifContextj:
   87|      5|  ImageItem_mask(HeifContext* ctx, heif_item_id id) : ImageItem(ctx, id) {}
_ZNK14ImageItem_mask13get_infe_typeEv:
   91|      2|  uint32_t get_infe_type() const override { return fourcc("mski"); }

_ZN12ImageOverlay5parseEmRKNSt3__16vectorIhNS0_9allocatorIhEEEE:
   77|      9|{
   78|      9|  Error eofError(heif_error_Invalid_input,
   79|      9|                 heif_suberror_Invalid_overlay_data,
   80|      9|                 "Overlay image data incomplete");
   81|       |
   82|      9|  if (data.size() < 2 + 4 * 2) {
  ------------------
  |  Branch (82:7): [True: 0, False: 9]
  ------------------
   83|      0|    return eofError;
   84|      0|  }
   85|       |
   86|      9|  m_version = data[0];
   87|      9|  if (m_version != 0) {
  ------------------
  |  Branch (87:7): [True: 2, False: 7]
  ------------------
   88|      2|    std::stringstream sstr;
   89|      2|    sstr << "Overlay image data version " << ((int) m_version) << " is not implemented yet";
   90|       |
   91|      2|    return {heif_error_Unsupported_feature,
   92|      2|            heif_suberror_Unsupported_data_version,
   93|      2|            sstr.str()};
   94|      2|  }
   95|       |
   96|      7|  m_flags = data[1];
   97|       |
   98|      7|  int field_len = ((m_flags & 1) ? 4 : 2);
  ------------------
  |  Branch (98:20): [True: 2, False: 5]
  ------------------
   99|      7|  int ptr = 2;
  100|       |
  101|      7|  if (ptr + 4 * 2 + 2 * field_len + num_images * 2 * field_len > data.size()) {
  ------------------
  |  Branch (101:7): [True: 0, False: 7]
  ------------------
  102|      0|    return eofError;
  103|      0|  }
  104|       |
  105|     35|  for (int i = 0; i < 4; i++) {
  ------------------
  |  Branch (105:19): [True: 28, False: 7]
  ------------------
  106|     28|    uint16_t color = static_cast<uint16_t>(readvec(data, ptr, 2));
  107|     28|    m_background_color[i] = color;
  108|     28|  }
  109|       |
  110|      7|  m_width = readvec(data, ptr, field_len);
  111|      7|  m_height = readvec(data, ptr, field_len);
  112|       |
  113|      7|  if (m_width == 0 || m_height == 0) {
  ------------------
  |  Branch (113:7): [True: 0, False: 7]
  |  Branch (113:23): [True: 0, False: 7]
  ------------------
  114|      0|    return {heif_error_Invalid_input,
  115|      0|            heif_suberror_Invalid_overlay_data,
  116|      0|            "Overlay image with zero width or height."};
  117|      0|  }
  118|       |
  119|      7|  m_offsets.resize(num_images);
  120|       |
  121|      9|  for (size_t i = 0; i < num_images; i++) {
  ------------------
  |  Branch (121:22): [True: 2, False: 7]
  ------------------
  122|      2|    m_offsets[i].x = readvec_signed(data, ptr, field_len);
  123|      2|    m_offsets[i].y = readvec_signed(data, ptr, field_len);
  124|      2|  }
  125|       |
  126|      7|  return Error::Ok;
  127|      7|}
_ZNK12ImageOverlay20get_background_colorEPt:
  191|      5|{
  192|     25|  for (int i = 0; i < 4; i++) {
  ------------------
  |  Branch (192:19): [True: 20, False: 5]
  ------------------
  193|     20|    col[i] = m_background_color[i];
  194|     20|  }
  195|      5|}
_ZN17ImageItem_OverlayC2EP11HeifContextj:
  216|      9|    : ImageItem(ctx, id)
  217|      9|{
  218|      9|}
_ZN17ImageItem_Overlay18initialize_decoderEv:
  222|      9|{
  223|      9|  Error err = read_overlay_spec();
  224|      9|  if (err) {
  ------------------
  |  Branch (224:7): [True: 2, False: 7]
  ------------------
  225|      2|    return err;
  226|      2|  }
  227|       |
  228|      7|  return Error::Ok;
  229|      9|}
_ZN17ImageItem_Overlay17read_overlay_specEv:
  233|      9|{
  234|      9|  auto heif_file = get_context()->get_heif_file();
  235|       |
  236|      9|  auto iref_box = heif_file->get_iref_box();
  237|       |
  238|      9|  if (!iref_box) {
  ------------------
  |  Branch (238:7): [True: 0, False: 9]
  ------------------
  239|      0|    return {heif_error_Invalid_input,
  240|      0|            heif_suberror_No_iref_box,
  241|      0|            "No iref box available, but needed for iovl image"};
  242|      0|  }
  243|       |
  244|       |
  245|      9|  m_overlay_image_ids = iref_box->get_references(get_id(), fourcc("dimg"));
  246|       |
  247|       |  /* TODO: probably, it is valid that an iovl image has no references ?
  248|       |
  249|       |  if (image_references.empty()) {
  250|       |    return Error(heif_error_Invalid_input,
  251|       |                 heif_suberror_Missing_grid_images,
  252|       |                 "'iovl' image with more than one reference image");
  253|       |  }
  254|       |  */
  255|       |
  256|       |
  257|      9|  auto overlayDataResult = heif_file->get_uncompressed_item_data(get_id());
  258|      9|  if (!overlayDataResult) {
  ------------------
  |  Branch (258:7): [True: 0, False: 9]
  ------------------
  259|      0|    return overlayDataResult.error();
  260|      0|  }
  261|       |
  262|      9|  Error err = m_overlay_spec.parse(m_overlay_image_ids.size(), *overlayDataResult);
  263|      9|  if (err) {
  ------------------
  |  Branch (263:7): [True: 2, False: 7]
  ------------------
  264|      2|    return err;
  265|      2|  }
  266|       |
  267|      7|  if (m_overlay_image_ids.size() != m_overlay_spec.get_num_offsets()) {
  ------------------
  |  Branch (267:7): [True: 0, False: 7]
  ------------------
  268|      0|    return Error(heif_error_Invalid_input,
  269|      0|                 heif_suberror_Invalid_overlay_data,
  270|      0|                 "Number of image offsets does not match the number of image references");
  271|      0|  }
  272|       |
  273|      7|  return Error::Ok;
  274|      7|}
_ZNK17ImageItem_Overlay23decode_compressed_imageERK21heif_decoding_optionsbjjNSt3__13setIjNS3_4lessIjEENS3_9allocatorIjEEEE:
  280|      9|{
  281|      9|  return decode_overlay_image(options, processed_ids);
  282|      9|}
_ZNK17ImageItem_Overlay20decode_overlay_imageERK21heif_decoding_optionsNSt3__13setIjNS3_4lessIjEENS3_9allocatorIjEEEE:
  293|      9|{
  294|      9|  if (processed_ids.contains(get_id())) {
  ------------------
  |  Branch (294:7): [True: 0, False: 9]
  ------------------
  295|      0|    return Error{heif_error_Invalid_input,
  296|      0|                 heif_suberror_Unspecified,
  297|      0|                 "'iref' has cyclic references"};
  298|      0|  }
  299|       |
  300|      9|  processed_ids.insert(get_id());
  301|       |
  302|       |
  303|      9|  std::shared_ptr<HeifPixelImage> img;
  304|       |
  305|      9|  uint32_t w = m_overlay_spec.get_canvas_width();
  306|      9|  uint32_t h = m_overlay_spec.get_canvas_height();
  307|       |
  308|      9|  Error err = check_for_valid_image_size(get_context()->get_security_limits(), w, h);
  309|      9|  if (err) {
  ------------------
  |  Branch (309:7): [True: 2, False: 7]
  ------------------
  310|      2|    return err;
  311|      2|  }
  312|       |
  313|       |  // TODO: seems we always have to compose this in RGB since the background color is an RGB value
  314|      7|  img = std::make_shared<HeifPixelImage>();
  315|      7|  img->create(w, h,
  316|      7|              heif_colorspace_RGB,
  317|      7|              heif_chroma_444);
  318|      7|  if (auto error = img->add_channel(heif_channel_R, w, h, 8, get_context()->get_security_limits())) { // TODO: other bit depths
  ------------------
  |  Branch (318:12): [True: 2, False: 5]
  ------------------
  319|      2|    return error;
  320|      2|  }
  321|      5|  if (auto error = img->add_channel(heif_channel_G, w, h, 8, get_context()->get_security_limits())) { // TODO: other bit depths
  ------------------
  |  Branch (321:12): [True: 0, False: 5]
  ------------------
  322|      0|    return error;
  323|      0|  }
  324|      5|  if (auto error = img->add_channel(heif_channel_B, w, h, 8, get_context()->get_security_limits())) { // TODO: other bit depths
  ------------------
  |  Branch (324:12): [True: 0, False: 5]
  ------------------
  325|      0|    return error;
  326|      0|  }
  327|       |
  328|      5|  uint16_t bkg_color[4];
  329|      5|  m_overlay_spec.get_background_color(bkg_color);
  330|       |
  331|      5|  err = img->fill_RGB_16bit(bkg_color[0], bkg_color[1], bkg_color[2], bkg_color[3]);
  332|      5|  if (err) {
  ------------------
  |  Branch (332:7): [True: 0, False: 5]
  ------------------
  333|      0|    return err;
  334|      0|  }
  335|       |
  336|      5|  for (size_t i = 0; i < m_overlay_image_ids.size(); i++) {
  ------------------
  |  Branch (336:22): [True: 0, False: 5]
  ------------------
  337|       |
  338|       |    // detect if 'iovl' is referencing itself
  339|       |
  340|      0|    if (m_overlay_image_ids[i] == get_id()) {
  ------------------
  |  Branch (340:9): [True: 0, False: 0]
  ------------------
  341|      0|      return Error{heif_error_Invalid_input,
  342|      0|                   heif_suberror_Unspecified,
  343|      0|                   "Self-reference in 'iovl' image item."};
  344|      0|    }
  345|       |
  346|      0|    auto imgItem = get_context()->get_image(m_overlay_image_ids[i], true);
  347|      0|    if (!imgItem) {
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|      return Error(heif_error_Invalid_input, heif_suberror_Nonexisting_item_referenced, "'iovl' image references a non-existing item.");
  349|      0|    }
  350|      0|    if (auto error = imgItem->get_item_error()) {
  ------------------
  |  Branch (350:14): [True: 0, False: 0]
  ------------------
  351|      0|      return error;
  352|      0|    }
  353|       |
  354|      0|    auto decodeResult = imgItem->decode_image(options, false, 0,0, processed_ids);
  355|      0|    if (!decodeResult) {
  ------------------
  |  Branch (355:9): [True: 0, False: 0]
  ------------------
  356|      0|      return decodeResult.error();
  357|      0|    }
  358|       |
  359|      0|    std::shared_ptr<HeifPixelImage> overlay_img = *decodeResult;
  360|       |
  361|       |
  362|       |    // process overlay in RGB space
  363|       |
  364|      0|    if (overlay_img->get_colorspace() != heif_colorspace_RGB ||
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|        overlay_img->get_chroma_format() != heif_chroma_444) {
  ------------------
  |  Branch (365:9): [True: 0, False: 0]
  ------------------
  366|      0|      auto overlay_img_result = convert_colorspace(overlay_img, heif_colorspace_RGB, heif_chroma_444,
  367|      0|                                                   nclx_profile::undefined(),
  368|      0|                                                   0, options.color_conversion_options, options.color_conversion_options_ext,
  369|      0|                                                   get_context()->get_security_limits());
  370|      0|      if (!overlay_img_result) {
  ------------------
  |  Branch (370:11): [True: 0, False: 0]
  ------------------
  371|      0|        return overlay_img_result.error();
  372|      0|      }
  373|      0|      else {
  374|      0|        overlay_img = *overlay_img_result;
  375|      0|      }
  376|      0|    }
  377|       |
  378|      0|    int32_t dx, dy;
  379|      0|    m_overlay_spec.get_offset(i, &dx, &dy);
  380|       |
  381|      0|    err = img->overlay(overlay_img, dx, dy);
  382|      0|    if (err) {
  ------------------
  |  Branch (382:9): [True: 0, False: 0]
  ------------------
  383|      0|      if (err.error_code == heif_error_Invalid_input &&
  ------------------
  |  Branch (383:11): [True: 0, False: 0]
  ------------------
  384|      0|          err.sub_error_code == heif_suberror_Overlay_image_outside_of_canvas) {
  ------------------
  |  Branch (384:11): [True: 0, False: 0]
  ------------------
  385|       |        // NOP, ignore this error
  386|      0|      }
  387|      0|      else {
  388|      0|        return err;
  389|      0|      }
  390|      0|    }
  391|      0|  }
  392|       |
  393|      5|  return img;
  394|      5|}
_ZNK17ImageItem_Overlay23get_luma_bits_per_pixelEv:
  398|      1|{
  399|      1|  auto child_result = get_context()->find_first_coded_image_id(get_id());
  400|      1|  if (child_result.is_error()) {
  ------------------
  |  Branch (400:7): [True: 1, False: 0]
  ------------------
  401|      1|    return -1;
  402|      1|  }
  403|       |
  404|      0|  auto image = get_context()->get_image(*child_result, true);
  405|      0|  return image->get_luma_bits_per_pixel();
  406|      1|}
_ZN17ImageItem_Overlay31populate_component_descriptionsEv:
  431|     16|{
  432|     16|  if (!get_component_descriptions().empty()) {
  ------------------
  |  Branch (432:7): [True: 0, False: 16]
  ------------------
  433|      0|    return;
  434|      0|  }
  435|       |
  436|       |  // The overlay is always composed in RGB 8-bit 4:4:4 onto the canvas
  437|       |  // (decode_overlay_image converts each input child to RGB and uses an RGB
  438|       |  // background color). So the description we publish reflects that fixed
  439|       |  // output format, not the children's formats.
  440|     16|  uint32_t w = get_ispe_width();
  441|     16|  uint32_t h = get_ispe_height();
  442|     16|  if (w == 0 || h == 0) {
  ------------------
  |  Branch (442:7): [True: 16, False: 0]
  |  Branch (442:17): [True: 0, False: 0]
  ------------------
  443|     16|    return;
  444|     16|  }
  445|       |
  446|      0|  auto emit = [this, w, h](heif_channel ch, uint16_t type) {
  447|      0|    ComponentDescription d;
  448|      0|    d.component_id = mint_component_id();
  449|      0|    d.channel = ch;
  450|      0|    d.component_type = type;
  451|      0|    d.datatype = heif_component_datatype_unsigned_integer;
  452|      0|    d.bit_depth = 8;
  453|      0|    d.width = w;
  454|      0|    d.height = h;
  455|      0|    d.has_data_plane = true;
  456|      0|    add_component_description(std::move(d));
  457|      0|  };
  458|       |
  459|      0|  emit(heif_channel_R, heif_unci_component_type_red);
  460|      0|  emit(heif_channel_G, heif_unci_component_type_green);
  461|      0|  emit(heif_channel_B, heif_unci_component_type_blue);
  462|      0|}
overlay.cc:_ZL7readvecRKNSt3__16vectorIhNS_9allocatorIhEEEERii:
   65|     42|{
   66|     42|  uint32_t val = 0;
   67|    134|  while (len--) {
  ------------------
  |  Branch (67:10): [True: 92, False: 42]
  ------------------
   68|     92|    val <<= 8;
   69|     92|    val |= data[ptr++];
   70|     92|  }
   71|       |
   72|     42|  return val;
   73|     42|}
overlay.cc:_ZL14readvec_signedRKNSt3__16vectorIhNS_9allocatorIhEEEERii:
   42|      4|{
   43|      4|  const uint32_t high_bit = UINT32_C(0x80) << ((len - 1) * 8);
   44|       |
   45|      4|  uint32_t val = 0;
   46|     12|  while (len--) {
  ------------------
  |  Branch (46:10): [True: 8, False: 4]
  ------------------
   47|      8|    val <<= 8;
   48|      8|    val |= data[ptr++];
   49|      8|  }
   50|       |
   51|      4|  bool negative = (val & high_bit) != 0;
   52|       |
   53|      4|  if (negative) {
  ------------------
  |  Branch (53:7): [True: 0, False: 4]
  ------------------
   54|      0|    return -static_cast<int32_t>((~val) & 0x7fffffff) -1;
   55|      0|  }
   56|      4|  else {
   57|      4|    return static_cast<int32_t>(val);
   58|      4|  }
   59|       |
   60|      0|  return val;
   61|      4|}

_ZNK12ImageOverlay16get_canvas_widthEv:
   42|      9|  uint32_t get_canvas_width() const { return m_width; }
_ZNK12ImageOverlay17get_canvas_heightEv:
   44|      9|  uint32_t get_canvas_height() const { return m_height; }
_ZNK12ImageOverlay15get_num_offsetsEv:
   46|      7|  size_t get_num_offsets() const { return m_offsets.size(); }
_ZNK17ImageItem_Overlay13get_infe_typeEv:
   94|      2|  uint32_t get_infe_type() const override { return fourcc("iovl"); }

_ZN16ImageDescriptionD2Ev:
  117|    356|{
  118|    356|  heif_tai_timestamp_packet_release(m_tai_timestamp);
  119|    356|}
_ZN16ImageDescription18copy_metadata_fromERKS_:
  123|      5|{
  124|      5|  m_premultiplied_alpha = other.m_premultiplied_alpha;
  125|      5|  m_color_profile_nclx = other.m_color_profile_nclx;
  126|      5|  m_color_profile_icc = other.m_color_profile_icc;
  127|       |
  128|      5|  m_PixelAspectRatio_h = other.m_PixelAspectRatio_h;
  129|      5|  m_PixelAspectRatio_v = other.m_PixelAspectRatio_v;
  130|       |
  131|      5|  m_clli = other.m_clli;
  132|      5|  m_mdcv = other.m_mdcv;
  133|       |
  134|      5|  heif_tai_timestamp_packet_release(m_tai_timestamp);
  135|      5|  m_tai_timestamp = nullptr;
  136|      5|  if (other.m_tai_timestamp) {
  ------------------
  |  Branch (136:7): [True: 0, False: 5]
  ------------------
  137|      0|    m_tai_timestamp = heif_tai_timestamp_packet_alloc();
  138|      0|    heif_tai_timestamp_packet_copy(m_tai_timestamp, other.m_tai_timestamp);
  139|      0|  }
  140|       |
  141|      5|  m_gimi_sample_content_id = other.m_gimi_sample_content_id;
  142|       |
  143|      5|  m_bayer_pattern = other.m_bayer_pattern;
  144|      5|  m_polarization_patterns = other.m_polarization_patterns;
  145|      5|  m_sensor_bad_pixels_maps = other.m_sensor_bad_pixels_maps;
  146|      5|  m_sensor_nuc = other.m_sensor_nuc;
  147|       |
  148|      5|  m_chroma_location = other.m_chroma_location;
  149|       |
  150|      5|  m_sample_duration = other.m_sample_duration;
  151|       |
  152|      5|#if HEIF_WITH_OMAF
  153|      5|  m_omaf_image_projection = other.m_omaf_image_projection;
  154|      5|#endif
  155|      5|}
_ZNK16ImageDescription22has_nclx_color_profileEv:
  159|     13|{
  160|     13|  return m_color_profile_nclx != nclx_profile::undefined();
  161|     13|}
_ZNK16ImageDescription36get_color_profile_nclx_with_fallbackEv:
  165|      5|{
  166|      5|  if (has_nclx_color_profile()) {
  ------------------
  |  Branch (166:7): [True: 1, False: 4]
  ------------------
  167|      1|    return get_color_profile_nclx();
  168|      1|  }
  169|      4|  else {
  170|      4|    return nclx_profile::defaults();
  171|      4|  }
  172|      5|}
_ZNK16ImageDescription20create_colr_box_nclxEv:
  216|      3|{
  217|      3|  if (!has_nclx_color_profile()) {
  ------------------
  |  Branch (217:7): [True: 0, False: 3]
  ------------------
  218|      0|    return {};
  219|      0|  }
  220|       |
  221|      3|  auto colr = std::make_shared<Box_colr>();
  222|      3|  colr->set_color_profile(std::make_shared<color_profile_nclx>(get_color_profile_nclx()));
  223|      3|  return colr;
  224|      3|}
_ZNK16ImageDescription19create_colr_box_iccEv:
  228|    175|{
  229|    175|  if (!has_icc_color_profile()) {
  ------------------
  |  Branch (229:7): [True: 0, False: 175]
  ------------------
  230|      0|    return {};
  231|      0|  }
  232|       |
  233|    175|  auto colr = std::make_shared<Box_colr>();
  234|    175|  colr->set_color_profile(get_color_profile_icc());
  235|    175|  return colr;
  236|    175|}

_ZN16ImageDescription22set_color_profile_nclxERK12nclx_profile:
  173|      9|  virtual void set_color_profile_nclx(const nclx_profile& profile) { m_color_profile_nclx = profile; }
_ZNK16ImageDescription22get_color_profile_nclxEv:
  175|    201|  nclx_profile get_color_profile_nclx() const { return m_color_profile_nclx; }
_ZN16ImageDescription21set_color_profile_iccERKNSt3__110shared_ptrIK17color_profile_rawEE:
  180|    179|  virtual void set_color_profile_icc(const std::shared_ptr<const color_profile_raw>& profile) { m_color_profile_icc = profile; }
_ZNK16ImageDescription21has_icc_color_profileEv:
  182|    175|  bool has_icc_color_profile() const { return m_color_profile_icc != nullptr; }
_ZNK16ImageDescription21get_color_profile_iccEv:
  184|    180|  const std::shared_ptr<const color_profile_raw>& get_color_profile_icc() const { return m_color_profile_icc; }
_ZN16ImageDescription17set_color_profileERKNSt3__110shared_ptrIK13color_profileEE:
  187|    178|  {
  188|    178|    auto icc = std::dynamic_pointer_cast<const color_profile_raw>(profile);
  189|    178|    if (icc) {
  ------------------
  |  Branch (189:9): [True: 175, False: 3]
  ------------------
  190|    175|      set_color_profile_icc(icc);
  191|    175|    }
  192|       |
  193|    178|    auto nclx = std::dynamic_pointer_cast<const color_profile_nclx>(profile);
  194|    178|    if (nclx) {
  ------------------
  |  Branch (194:9): [True: 3, False: 175]
  ------------------
  195|      3|      set_color_profile_nclx(nclx->get_nclx_color_profile());
  196|      3|    }
  197|    178|  }
_ZNK16ImageDescription26get_component_descriptionsEv:
  288|    550|  [[nodiscard]] const std::vector<ComponentDescription>& get_component_descriptions() const { return m_components; }
_ZN16ImageDescription25add_component_descriptionE20ComponentDescription:
  295|    601|  {
  296|    601|    m_components.push_back(std::move(desc));
  297|    601|  }
_ZN16ImageDescription17mint_component_idEv:
  321|    601|  [[nodiscard]] uint32_t mint_component_id() { return m_next_component_id++; }

_Z12chroma_widthj11heif_chroma:
   56|    190|{
   57|    190|  switch (chroma) {
   58|    189|    case heif_chroma_420:
  ------------------
  |  Branch (58:5): [True: 189, False: 1]
  ------------------
   59|    189|    case heif_chroma_422:
  ------------------
  |  Branch (59:5): [True: 0, False: 190]
  ------------------
   60|    189|      return (w+1)/2;
   61|      1|    default:
  ------------------
  |  Branch (61:5): [True: 1, False: 189]
  ------------------
   62|      1|      return w;
   63|    190|  }
   64|    190|}
_Z13chroma_heightj11heif_chroma:
   67|    190|{
   68|    190|  switch (chroma) {
   69|    189|    case heif_chroma_420:
  ------------------
  |  Branch (69:5): [True: 189, False: 1]
  ------------------
   70|    189|      return (h+1)/2;
   71|      1|    default:
  ------------------
  |  Branch (71:5): [True: 1, False: 189]
  ------------------
   72|      1|      return h;
   73|    190|  }
   74|    190|}
_Z13channel_widthj11heif_chroma12heif_channel:
   77|    190|{
   78|    190|  if (channel == heif_channel_Cb || channel == heif_channel_Cr) {
  ------------------
  |  Branch (78:7): [True: 190, False: 0]
  |  Branch (78:37): [True: 0, False: 0]
  ------------------
   79|    190|    return chroma_width(w, chroma);
   80|    190|  }
   81|      0|  else {
   82|      0|    return w;
   83|      0|  }
   84|    190|}
_Z14channel_heightj11heif_chroma12heif_channel:
   87|    190|{
   88|    190|  if (channel == heif_channel_Cb || channel == heif_channel_Cr) {
  ------------------
  |  Branch (88:7): [True: 190, False: 0]
  |  Branch (88:37): [True: 0, False: 0]
  ------------------
   89|    190|    return chroma_height(h, chroma);
   90|    190|  }
   91|      0|  else {
   92|      0|    return h;
   93|      0|  }
   94|    190|}
_ZN14HeifPixelImageD2Ev:
  157|     12|{
  158|     30|  for (auto& component : m_storage) {
  ------------------
  |  Branch (158:24): [True: 30, False: 12]
  ------------------
  159|     30|    delete[] component.allocated_mem;
  160|     30|  }
  161|     12|}
_ZN14HeifPixelImage24find_storage_for_channelE12heif_channel:
  165|     50|{
  166|    105|  for (auto& component : m_storage) {
  ------------------
  |  Branch (166:24): [True: 105, False: 5]
  ------------------
  167|    105|    if (component.m_channel == channel) {
  ------------------
  |  Branch (167:9): [True: 45, False: 60]
  ------------------
  168|     45|      return &component;
  169|     45|    }
  170|    105|  }
  171|      5|  return nullptr;
  172|     50|}
_ZNK14HeifPixelImage24find_storage_for_channelE12heif_channel:
  175|     40|{
  176|     85|  for (const auto& component : m_storage) {
  ------------------
  |  Branch (176:30): [True: 85, False: 15]
  ------------------
  177|     85|    if (component.m_channel == channel) {
  ------------------
  |  Branch (177:9): [True: 25, False: 60]
  ------------------
  178|     25|      return &component;
  179|     25|    }
  180|     85|  }
  181|     15|  return nullptr;
  182|     40|}
_Z36num_interleaved_components_per_plane11heif_chroma:
  186|     37|{
  187|     37|  switch (chroma) {
  ------------------
  |  Branch (187:11): [True: 37, False: 0]
  ------------------
  188|      0|    case heif_chroma_undefined:
  ------------------
  |  Branch (188:5): [True: 0, False: 37]
  ------------------
  189|      0|    case heif_chroma_monochrome:
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (189:5): [True: 0, False: 37]
  ------------------
  190|     20|    case heif_chroma_420:
  ------------------
  |  Branch (190:5): [True: 20, False: 17]
  ------------------
  191|     20|    case heif_chroma_422:
  ------------------
  |  Branch (191:5): [True: 0, False: 37]
  ------------------
  192|     37|    case heif_chroma_444:
  ------------------
  |  Branch (192:5): [True: 17, False: 20]
  ------------------
  193|     37|      return 1;
  194|       |
  195|      0|    case heif_chroma_interleaved_RGB:
  ------------------
  |  Branch (195:5): [True: 0, False: 37]
  ------------------
  196|      0|    case heif_chroma_interleaved_RRGGBB_BE:
  ------------------
  |  Branch (196:5): [True: 0, False: 37]
  ------------------
  197|      0|    case heif_chroma_interleaved_RRGGBB_LE:
  ------------------
  |  Branch (197:5): [True: 0, False: 37]
  ------------------
  198|      0|      return 3;
  199|       |
  200|      0|    case heif_chroma_interleaved_RGBA:
  ------------------
  |  Branch (200:5): [True: 0, False: 37]
  ------------------
  201|      0|    case heif_chroma_interleaved_RRGGBBAA_BE:
  ------------------
  |  Branch (201:5): [True: 0, False: 37]
  ------------------
  202|      0|    case heif_chroma_interleaved_RRGGBBAA_LE:
  ------------------
  |  Branch (202:5): [True: 0, False: 37]
  ------------------
  203|      0|      return 4;
  204|     37|  }
  205|       |
  206|     37|  assert(false);
  ------------------
  |  Branch (206:3): [Folded, False: 0]
  ------------------
  207|      0|  return 0;
  208|      0|}
_ZN14HeifPixelImage6createEjj15heif_colorspace11heif_chroma:
  274|     12|{
  275|       |  // Canonicalize (RGB, planar) to (RGB, 444). heif_chroma_planar is accepted
  276|       |  // as a synonym at this layer too (not just at heif_image_create), so any
  277|       |  // internal caller passing it gets the canonical form stored.
  278|     12|  if (colorspace == heif_colorspace_RGB && chroma == heif_chroma_planar) {
  ------------------
  |  Branch (278:7): [True: 7, False: 5]
  |  Branch (278:44): [True: 0, False: 7]
  ------------------
  279|      0|    chroma = heif_chroma_444;
  280|      0|  }
  281|       |
  282|     12|  m_width = width;
  283|     12|  m_height = height;
  284|     12|  m_colorspace = colorspace;
  285|     12|  m_chroma = chroma;
  286|     12|}
_ZN14HeifPixelImage31register_component_descriptionsERNS_16ComponentStorageERKNSt3__16vectorItNS2_9allocatorItEEEE:
  301|     30|{
  302|     30|  for (uint16_t type : component_types) {
  ------------------
  |  Branch (302:22): [True: 30, False: 30]
  ------------------
  303|     30|    uint32_t id = mint_component_id();
  304|     30|    plane.m_component_ids.push_back(id);
  305|       |
  306|     30|    ComponentDescription desc;
  307|     30|    desc.component_id = id;
  308|     30|    desc.channel = plane.m_channel;
  309|     30|    desc.component_type = type;
  310|     30|    desc.datatype = plane.m_datatype;
  311|     30|    desc.bit_depth = plane.m_bit_depth;
  312|     30|    desc.width = plane.m_width;
  313|     30|    desc.height = plane.m_height;
  314|     30|    desc.has_data_plane = true;
  315|     30|    add_component_description(std::move(desc));
  316|     30|  }
  317|     30|}
_ZN14HeifPixelImage11add_channelE12heif_channeljjiPK20heif_security_limits23heif_component_datatype:
  349|     32|{
  350|       |  // for backwards compatibility, allow for 24/32 bits for RGB/RGBA interleaved chromas
  351|       |
  352|     32|  if (m_chroma == heif_chroma_interleaved_RGB && bit_depth == 24) {
  ------------------
  |  Branch (352:7): [True: 0, False: 32]
  |  Branch (352:50): [True: 0, False: 0]
  ------------------
  353|      0|    bit_depth = 8;
  354|      0|  }
  355|       |
  356|     32|  if (m_chroma == heif_chroma_interleaved_RGBA && bit_depth == 32) {
  ------------------
  |  Branch (356:7): [True: 0, False: 32]
  |  Branch (356:51): [True: 0, False: 0]
  ------------------
  357|      0|    bit_depth = 8;
  358|      0|  }
  359|       |
  360|     32|  int num_interleaved_pixels = num_interleaved_components_per_plane(m_chroma);
  361|       |
  362|     32|  ComponentStorage plane;
  363|     32|  plane.m_channel = channel;
  364|       |
  365|     32|  if (auto err = plane.alloc(width, height, datatype, bit_depth, num_interleaved_pixels, limits, m_memory_handle)) {
  ------------------
  |  Branch (365:12): [True: 2, False: 30]
  ------------------
  366|      2|    return err;
  367|      2|  }
  368|       |
  369|     30|  register_component_descriptions(plane, map_channel_to_component_type(channel, m_chroma));
  370|     30|  m_storage.push_back(std::move(plane));
  371|     30|  return Error::Ok;
  372|     32|}
_ZN14HeifPixelImage16ComponentStorage5allocEjj23heif_component_datatypeiiPK20heif_security_limitsR12MemoryHandle:
  379|     32|{
  380|     32|  assert(bit_depth >= 1);
  ------------------
  |  Branch (380:3): [True: 32, False: 0]
  ------------------
  381|     32|  assert(bit_depth <= 128);
  ------------------
  |  Branch (381:3): [True: 32, False: 0]
  ------------------
  382|       |
  383|     32|  if (width == 0 || height == 0) {
  ------------------
  |  Branch (383:7): [True: 0, False: 32]
  |  Branch (383:21): [True: 0, False: 32]
  ------------------
  384|      0|    return {heif_error_Usage_error,
  385|      0|            heif_suberror_Unspecified,
  386|      0|            "Invalid image size"};
  387|      0|  }
  388|       |
  389|     32|  if (width == std::numeric_limits<uint32_t>::max() || height == std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (389:7): [True: 0, False: 32]
  |  Branch (389:56): [True: 0, False: 32]
  ------------------
  390|      0|    return {heif_error_Memory_allocation_error,
  391|      0|            heif_suberror_Security_limit_exceeded,
  392|      0|            "Image size too large for memory alignment"};
  393|      0|  }
  394|       |
  395|       |  // use 16 byte alignment (enough for 128 bit data-types). Every row is an integer number of data-elements.
  396|     32|  uint16_t alignment = 16; // must be power of two
  397|       |
  398|     32|  m_width = width;
  399|     32|  m_height = height;
  400|       |
  401|     32|  m_mem_width = rounded_size(width);
  402|     32|  m_mem_height = rounded_size(height);
  403|       |
  404|     32|  assert(num_interleaved_components > 0 && num_interleaved_components <= 255);
  ------------------
  |  Branch (404:3): [True: 32, False: 0]
  |  Branch (404:3): [True: 32, False: 0]
  |  Branch (404:3): [True: 32, False: 0]
  ------------------
  405|       |
  406|     32|  m_bit_depth = static_cast<uint8_t>(bit_depth);
  407|     32|  m_num_interleaved_components = static_cast<uint8_t>(num_interleaved_components);
  408|     32|  m_datatype = datatype;
  409|       |
  410|       |  // Cache bytes-per-pixel for the inner-loop get_bytes_per_pixel().
  411|     32|  int bytes_per_component;
  412|     32|  if (bit_depth <= 8)        bytes_per_component = 1;
  ------------------
  |  Branch (412:7): [True: 32, False: 0]
  ------------------
  413|      0|  else if (bit_depth <= 16)  bytes_per_component = 2;
  ------------------
  |  Branch (413:12): [True: 0, False: 0]
  ------------------
  414|      0|  else if (bit_depth <= 32)  bytes_per_component = 4;
  ------------------
  |  Branch (414:12): [True: 0, False: 0]
  ------------------
  415|      0|  else if (bit_depth <= 64)  bytes_per_component = 8;
  ------------------
  |  Branch (415:12): [True: 0, False: 0]
  ------------------
  416|      0|  else { assert(bit_depth <= 128); bytes_per_component = 16; }
  ------------------
  |  Branch (416:10): [True: 0, False: 0]
  ------------------
  417|     32|  m_bytes_per_pixel = static_cast<uint8_t>(bytes_per_component * num_interleaved_components);
  418|       |
  419|     32|  int bytes_per_pixel = m_bytes_per_pixel;
  420|       |
  421|     32|  uint64_t stride_64 = static_cast<uint64_t>(m_mem_width) * bytes_per_pixel;
  422|     32|  stride_64 = (stride_64 + alignment - 1U) & ~static_cast<uint64_t>(alignment - 1U);
  423|     32|  if (stride_64 > std::numeric_limits<size_t>::max()) {
  ------------------
  |  Branch (423:7): [True: 0, False: 32]
  ------------------
  424|      0|    return {heif_error_Memory_allocation_error,
  425|      0|            heif_suberror_Security_limit_exceeded,
  426|      0|            "Image stride overflow"};
  427|      0|  }
  428|     32|  stride = static_cast<size_t>(stride_64);
  429|       |
  430|     32|  assert(alignment>=1);
  ------------------
  |  Branch (430:3): [True: 32, False: 0]
  ------------------
  431|       |
  432|     32|  if (limits &&
  ------------------
  |  Branch (432:7): [True: 32, False: 0]
  ------------------
  433|     32|      limits->max_image_size_pixels &&
  ------------------
  |  Branch (433:7): [True: 32, False: 0]
  ------------------
  434|     32|      limits->max_image_size_pixels / height < width) {
  ------------------
  |  Branch (434:7): [True: 0, False: 32]
  ------------------
  435|       |
  436|      0|    std::stringstream sstr;
  437|      0|    sstr << "Allocating an image of size " << width << "x" << height << " exceeds the security limit of "
  438|      0|         << limits->max_image_size_pixels << " pixels";
  439|       |
  440|      0|    return {heif_error_Memory_allocation_error,
  441|      0|            heif_suberror_Security_limit_exceeded,
  442|      0|            sstr.str()};
  443|      0|  }
  444|       |
  445|       |  // Check for allocation size overflow using 64-bit arithmetic
  446|       |  // Test case was an overlay image with size 1x134217727.
  447|       |  // Width 1 gets aligned to 64 and then width * height overflows 32 bit systems.
  448|     32|  uint64_t alloc_64 = static_cast<uint64_t>(m_mem_height) * stride + alignment - 1;
  449|     32|  if (alloc_64 > std::numeric_limits<size_t>::max()) {
  ------------------
  |  Branch (449:7): [True: 0, False: 32]
  ------------------
  450|      0|    return {heif_error_Memory_allocation_error,
  451|      0|            heif_suberror_Security_limit_exceeded,
  452|      0|            "Image allocation size overflow"};
  453|      0|  }
  454|     32|  allocation_size = static_cast<size_t>(alloc_64);
  455|       |
  456|     32|  if (auto err = memory_handle.alloc(allocation_size, limits, "image data")) {
  ------------------
  |  Branch (456:12): [True: 2, False: 30]
  ------------------
  457|      2|    return err;
  458|      2|  }
  459|       |
  460|       |    // --- allocate memory
  461|       |
  462|     30|  allocated_mem = new (std::nothrow) uint8_t[allocation_size];
  463|     30|  if (allocated_mem == nullptr) {
  ------------------
  |  Branch (463:7): [True: 0, False: 30]
  ------------------
  464|      0|    std::stringstream sstr;
  465|      0|    sstr << "Allocating " << allocation_size << " bytes failed";
  466|       |
  467|      0|    return {heif_error_Memory_allocation_error,
  468|      0|            heif_suberror_Unspecified,
  469|      0|            sstr.str()};
  470|      0|  }
  471|       |
  472|     30|  uint8_t* mem_8 = allocated_mem;
  473|       |
  474|       |  // shift beginning of image data to aligned memory position
  475|       |
  476|     30|  auto mem_start_addr = (uint64_t) mem_8;
  477|     30|  auto mem_start_offset = (mem_start_addr & (alignment - 1U));
  478|     30|  if (mem_start_offset != 0) {
  ------------------
  |  Branch (478:7): [True: 0, False: 30]
  ------------------
  479|      0|    mem_8 += alignment - mem_start_offset;
  480|      0|  }
  481|       |
  482|     30|  mem = mem_8;
  483|       |
  484|     30|  return Error::Ok;
  485|     30|}
_ZNK14HeifPixelImage11has_channelE12heif_channel:
  674|     15|{
  675|     15|  return find_storage_for_channel(channel) != nullptr;
  676|     15|}
_ZNK14HeifPixelImage15get_channel_setEv:
  783|      5|{
  784|      5|  std::set<heif_channel> channels;
  785|       |
  786|     15|  for (const auto& component : m_storage) {
  ------------------
  |  Branch (786:30): [True: 15, False: 5]
  ------------------
  787|     15|    channels.insert(component.m_channel);
  788|     15|  }
  789|       |
  790|      5|  return channels;
  791|      5|}
_ZNK14HeifPixelImage18get_bits_per_pixelE12heif_channel:
  811|     25|{
  812|     25|  auto* comp = find_storage_for_channel(channel);
  813|     25|  if (!comp) {
  ------------------
  |  Branch (813:7): [True: 0, False: 25]
  ------------------
  814|       |    // Channel not present -- see get_storage_bits_per_pixel().
  815|      0|    return 0;
  816|      0|  }
  817|       |
  818|     25|  return comp->m_bit_depth;
  819|     25|}
_ZNK14HeifPixelImage31get_visual_image_bits_per_pixelEv:
  823|      5|{
  824|      5|  switch (m_colorspace) {
  825|      0|    case heif_colorspace_monochrome:
  ------------------
  |  Branch (825:5): [True: 0, False: 5]
  ------------------
  826|      0|      return get_bits_per_pixel(heif_channel_Y);
  827|      0|      break;
  828|      0|    case heif_colorspace_YCbCr:
  ------------------
  |  Branch (828:5): [True: 0, False: 5]
  ------------------
  829|      0|      return std::max(get_bits_per_pixel(heif_channel_Y),
  830|      0|                      std::max(get_bits_per_pixel(heif_channel_Cb),
  831|      0|                               get_bits_per_pixel(heif_channel_Cr)));
  832|      0|      break;
  833|      5|    case heif_colorspace_RGB:
  ------------------
  |  Branch (833:5): [True: 5, False: 0]
  ------------------
  834|      5|      if (m_chroma == heif_chroma_444) {
  ------------------
  |  Branch (834:11): [True: 5, False: 0]
  ------------------
  835|      5|        return std::max(get_bits_per_pixel(heif_channel_R),
  836|      5|             std::max(get_bits_per_pixel(heif_channel_G),
  837|      5|                        get_bits_per_pixel(heif_channel_B)));
  838|      5|      }
  839|      0|      else {
  840|      0|        assert(has_channel(heif_channel_interleaved));
  ------------------
  |  Branch (840:9): [True: 0, False: 0]
  ------------------
  841|      0|        return get_bits_per_pixel(heif_channel_interleaved);
  842|      0|      }
  843|      0|      break;
  844|      0|    case heif_colorspace_custom:
  ------------------
  |  Branch (844:5): [True: 0, False: 5]
  ------------------
  845|      0|      return 0;
  846|      0|      break;
  847|      0|    case heif_colorspace_filter_array:
  ------------------
  |  Branch (847:5): [True: 0, False: 5]
  ------------------
  848|      0|      assert(has_channel(heif_channel_filter_array));
  ------------------
  |  Branch (848:7): [True: 0, False: 0]
  ------------------
  849|      0|      return get_bits_per_pixel(heif_channel_filter_array);
  850|      0|    default:
  ------------------
  |  Branch (850:5): [True: 0, False: 5]
  ------------------
  851|      0|      assert(false);
  ------------------
  |  Branch (851:7): [Folded, False: 0]
  ------------------
  852|      0|      return 0;
  853|      0|      break;
  854|      5|  }
  855|      5|}
_Z25is_interleaved_with_alpha11heif_chroma:
 1067|      5|{
 1068|      5|  switch (chroma) {
  ------------------
  |  Branch (1068:11): [True: 5, False: 0]
  ------------------
 1069|      0|    case heif_chroma_undefined:
  ------------------
  |  Branch (1069:5): [True: 0, False: 5]
  ------------------
 1070|      0|    case heif_chroma_monochrome:
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (1070:5): [True: 0, False: 5]
  ------------------
 1071|      0|    case heif_chroma_420:
  ------------------
  |  Branch (1071:5): [True: 0, False: 5]
  ------------------
 1072|      0|    case heif_chroma_422:
  ------------------
  |  Branch (1072:5): [True: 0, False: 5]
  ------------------
 1073|      5|    case heif_chroma_444:
  ------------------
  |  Branch (1073:5): [True: 5, False: 0]
  ------------------
 1074|      5|    case heif_chroma_interleaved_RGB:
  ------------------
  |  Branch (1074:5): [True: 0, False: 5]
  ------------------
 1075|      5|    case heif_chroma_interleaved_RRGGBB_BE:
  ------------------
  |  Branch (1075:5): [True: 0, False: 5]
  ------------------
 1076|      5|    case heif_chroma_interleaved_RRGGBB_LE:
  ------------------
  |  Branch (1076:5): [True: 0, False: 5]
  ------------------
 1077|      5|      return false;
 1078|       |
 1079|      0|    case heif_chroma_interleaved_RGBA:
  ------------------
  |  Branch (1079:5): [True: 0, False: 5]
  ------------------
 1080|      0|    case heif_chroma_interleaved_RRGGBBAA_BE:
  ------------------
  |  Branch (1080:5): [True: 0, False: 5]
  ------------------
 1081|      0|    case heif_chroma_interleaved_RRGGBBAA_LE:
  ------------------
  |  Branch (1081:5): [True: 0, False: 5]
  ------------------
 1082|      0|      return true;
 1083|      5|  }
 1084|       |
 1085|      5|  assert(false);
  ------------------
  |  Branch (1085:3): [Folded, False: 0]
  ------------------
 1086|      0|  return false;
 1087|      0|}
_ZN14HeifPixelImage14fill_RGB_16bitEtttt:
 1560|      5|{
 1561|     20|  for (const auto& channel : {heif_channel_R, heif_channel_G, heif_channel_B, heif_channel_Alpha}) {
  ------------------
  |  Branch (1561:28): [True: 20, False: 5]
  ------------------
 1562|       |
 1563|     20|    auto* comp = find_storage_for_channel(channel);
 1564|     20|    if (!comp) {
  ------------------
  |  Branch (1564:9): [True: 5, False: 15]
  ------------------
 1565|       |
 1566|       |      // alpha channel is optional, R,G,B is required
 1567|      5|      if (channel == heif_channel_Alpha) {
  ------------------
  |  Branch (1567:11): [True: 5, False: 0]
  ------------------
 1568|      5|        continue;
 1569|      5|      }
 1570|       |
 1571|      0|      return {heif_error_Usage_error,
 1572|      0|              heif_suberror_Nonexisting_image_channel_referenced};
 1573|       |
 1574|      5|    }
 1575|       |
 1576|     15|    ComponentStorage& plane = *comp;
 1577|       |
 1578|     15|    if (plane.m_bit_depth != 8) {
  ------------------
  |  Branch (1578:9): [True: 0, False: 15]
  ------------------
 1579|      0|      return {heif_error_Unsupported_feature,
 1580|      0|              heif_suberror_Unspecified,
 1581|      0|              "Can currently only fill images with 8 bits per pixel"};
 1582|      0|    }
 1583|       |
 1584|     15|    size_t h = plane.m_height;
 1585|       |
 1586|     15|    size_t stride = plane.stride;
 1587|     15|    auto* data = static_cast<uint8_t*>(plane.mem);
 1588|       |
 1589|     15|    uint16_t val16;
 1590|     15|    switch (channel) {
 1591|      5|      case heif_channel_R:
  ------------------
  |  Branch (1591:7): [True: 5, False: 10]
  ------------------
 1592|      5|        val16 = r;
 1593|      5|        break;
 1594|      5|      case heif_channel_G:
  ------------------
  |  Branch (1594:7): [True: 5, False: 10]
  ------------------
 1595|      5|        val16 = g;
 1596|      5|        break;
 1597|      5|      case heif_channel_B:
  ------------------
  |  Branch (1597:7): [True: 5, False: 10]
  ------------------
 1598|      5|        val16 = b;
 1599|      5|        break;
 1600|      0|      case heif_channel_Alpha:
  ------------------
  |  Branch (1600:7): [True: 0, False: 15]
  ------------------
 1601|      0|        val16 = a;
 1602|      0|        break;
 1603|      0|      default:
  ------------------
  |  Branch (1603:7): [True: 0, False: 15]
  ------------------
 1604|       |        // initialization only to avoid warning of uninitialized variable.
 1605|      0|        val16 = 0;
 1606|       |        // Should already be detected by the check above ("find_storage_for_channel").
 1607|      0|        assert(false);
  ------------------
  |  Branch (1607:9): [Folded, False: 0]
  ------------------
 1608|     15|    }
 1609|       |
 1610|     15|    auto val8 = static_cast<uint8_t>(val16 >> 8U);
 1611|       |
 1612|       |
 1613|       |    // memset() even when h * stride > sizeof(size_t)
 1614|       |
 1615|     15|    if (std::numeric_limits<size_t>::max() / stride > h) {
  ------------------
  |  Branch (1615:9): [True: 15, False: 0]
  ------------------
 1616|       |      // can fill in one step
 1617|     15|      memset(data, val8, stride * h);
 1618|     15|    }
 1619|      0|    else {
 1620|       |      // fill line by line
 1621|      0|      auto* p = data;
 1622|       |
 1623|      0|      for (size_t y=0;y<h;y++) {
  ------------------
  |  Branch (1623:23): [True: 0, False: 0]
  ------------------
 1624|      0|        memset(p, val8, stride);
 1625|      0|        p += stride;
 1626|      0|      }
 1627|      0|    }
 1628|     15|  }
 1629|       |
 1630|      5|  return Error::Ok;
 1631|      5|}
_ZN14HeifPixelImage23apply_descriptions_fromERK16ImageDescription:
 2243|      5|{
 2244|      5|  const auto& src_descs = src.get_component_descriptions();
 2245|      5|  if (src_descs.empty()) {
  ------------------
  |  Branch (2245:7): [True: 5, False: 0]
  ------------------
 2246|      5|    return; // nothing to apply (e.g. grid/iden ImageItem with no description)
 2247|      5|  }
 2248|       |
 2249|       |  // Skip when this image's descriptions already match src's exactly. This
 2250|       |  // is the unci decode path: the decoder used clone_component_descriptions_from
 2251|       |  // (item) so the full description list (including any cpat reference-only
 2252|       |  // entries with has_data_plane=false) was copied verbatim. Comparing the
 2253|       |  // full lists also handles multiple planes that share a channel
 2254|       |  // (e.g. unci multi-component-of-same-type), which the channel-keyed remap
 2255|       |  // below can't represent.
 2256|      0|  const auto& my_descs = get_component_descriptions();
 2257|      0|  if (my_descs.size() == src_descs.size()) {
  ------------------
  |  Branch (2257:7): [True: 0, False: 0]
  ------------------
 2258|      0|    bool already_aligned = true;
 2259|      0|    for (size_t i = 0; i < src_descs.size(); i++) {
  ------------------
  |  Branch (2259:24): [True: 0, False: 0]
  ------------------
 2260|      0|      if (my_descs[i].component_id != src_descs[i].component_id ||
  ------------------
  |  Branch (2260:11): [True: 0, False: 0]
  ------------------
 2261|      0|          my_descs[i].channel != src_descs[i].channel) {
  ------------------
  |  Branch (2261:11): [True: 0, False: 0]
  ------------------
 2262|      0|        already_aligned = false;
 2263|      0|        break;
 2264|      0|      }
 2265|      0|    }
 2266|      0|    if (already_aligned) {
  ------------------
  |  Branch (2266:9): [True: 0, False: 0]
  ------------------
 2267|      0|      return;
 2268|      0|    }
 2269|      0|  }
 2270|       |
 2271|       |  // Snapshot pre-remap descriptions keyed by channel (for any "extra"
 2272|       |  // channels not in src that we need to keep, like alpha-from-aux).
 2273|      0|  std::map<heif_channel, ComponentDescription> auto_minted_by_channel;
 2274|      0|  for (const auto& d : my_descs) {
  ------------------
  |  Branch (2274:22): [True: 0, False: 0]
  ------------------
 2275|      0|    auto_minted_by_channel[d.channel] = d;
 2276|      0|  }
 2277|       |
 2278|       |  // Build a channel -> actual-plane-dimensions map. For tile decodes the
 2279|       |  // src description carries full-image dims, but the decoded plane was
 2280|       |  // allocated at tile size; the description we publish should match what
 2281|       |  // the buffer actually contains.
 2282|      0|  std::map<heif_channel, std::pair<uint32_t, uint32_t>> plane_dims_by_channel;
 2283|      0|  for (const auto& plane : m_storage) {
  ------------------
  |  Branch (2283:26): [True: 0, False: 0]
  ------------------
 2284|      0|    plane_dims_by_channel[plane.m_channel] = {plane.m_width, plane.m_height};
 2285|      0|  }
 2286|       |
 2287|       |  // Build the new component list from src's data-plane descriptions and a
 2288|       |  // channel -> src-id map.
 2289|      0|  std::vector<ComponentDescription> new_components;
 2290|      0|  std::map<heif_channel, uint32_t> src_id_by_channel;
 2291|      0|  for (const auto& d : src_descs) {
  ------------------
  |  Branch (2291:22): [True: 0, False: 0]
  ------------------
 2292|      0|    if (d.has_data_plane) {
  ------------------
  |  Branch (2292:9): [True: 0, False: 0]
  ------------------
 2293|      0|      ComponentDescription copy = d;
 2294|      0|      auto it = plane_dims_by_channel.find(d.channel);
 2295|      0|      if (it != plane_dims_by_channel.end()) {
  ------------------
  |  Branch (2295:11): [True: 0, False: 0]
  ------------------
 2296|      0|        copy.width = it->second.first;
 2297|      0|        copy.height = it->second.second;
 2298|      0|      }
 2299|      0|      new_components.push_back(copy);
 2300|      0|      src_id_by_channel[d.channel] = d.component_id;
 2301|      0|    }
 2302|      0|  }
 2303|       |
 2304|       |  // Compute a starting id for any extras (above src's high-water mark).
 2305|      0|  uint32_t next_id = src.peek_next_component_id();
 2306|      0|  for (const auto& d : new_components) {
  ------------------
  |  Branch (2306:22): [True: 0, False: 0]
  ------------------
 2307|      0|    if (d.component_id >= next_id) next_id = d.component_id + 1;
  ------------------
  |  Branch (2307:9): [True: 0, False: 0]
  ------------------
 2308|      0|  }
 2309|       |
 2310|       |  // Remap each plane's m_component_ids by channel match against src; for
 2311|       |  // channels not in src, re-add the auto-minted description with a fresh id.
 2312|      0|  for (auto& plane : m_storage) {
  ------------------
  |  Branch (2312:20): [True: 0, False: 0]
  ------------------
 2313|      0|    if (plane.m_component_ids.empty()) continue;
  ------------------
  |  Branch (2313:9): [True: 0, False: 0]
  ------------------
 2314|       |
 2315|      0|    heif_channel ch = plane.m_channel;
 2316|      0|    auto src_it = src_id_by_channel.find(ch);
 2317|      0|    if (src_it != src_id_by_channel.end()) {
  ------------------
  |  Branch (2317:9): [True: 0, False: 0]
  ------------------
 2318|      0|      plane.m_component_ids.assign(1, src_it->second);
 2319|      0|    } else {
 2320|      0|      auto auto_it = auto_minted_by_channel.find(ch);
 2321|      0|      if (auto_it != auto_minted_by_channel.end()) {
  ------------------
  |  Branch (2321:11): [True: 0, False: 0]
  ------------------
 2322|      0|        ComponentDescription extra = auto_it->second;
 2323|      0|        extra.component_id = next_id++;
 2324|      0|        new_components.push_back(extra);
 2325|      0|        plane.m_component_ids.assign(1, extra.component_id);
 2326|      0|      }
 2327|      0|    }
 2328|      0|  }
 2329|       |
 2330|      0|  set_component_descriptions(std::move(new_components), next_id);
 2331|      0|}
pixelimage.cc:_ZL29map_channel_to_component_type12heif_channel11heif_chroma:
   99|     30|{
  100|     30|  switch (channel) {
  101|      5|    case heif_channel_Y:
  ------------------
  |  Branch (101:5): [True: 5, False: 25]
  ------------------
  102|      5|      return {heif_unci_component_type_Y};
  103|      5|    case heif_channel_Cb:
  ------------------
  |  Branch (103:5): [True: 5, False: 25]
  ------------------
  104|      5|      return {heif_unci_component_type_Cb};
  105|      5|    case heif_channel_Cr:
  ------------------
  |  Branch (105:5): [True: 5, False: 25]
  ------------------
  106|      5|      return {heif_unci_component_type_Cr};
  107|      5|    case heif_channel_R:
  ------------------
  |  Branch (107:5): [True: 5, False: 25]
  ------------------
  108|      5|      return {heif_unci_component_type_red};
  109|      5|    case heif_channel_G:
  ------------------
  |  Branch (109:5): [True: 5, False: 25]
  ------------------
  110|      5|      return {heif_unci_component_type_green};
  111|      5|    case heif_channel_B:
  ------------------
  |  Branch (111:5): [True: 5, False: 25]
  ------------------
  112|      5|      return {heif_unci_component_type_blue};
  113|      0|    case heif_channel_Alpha:
  ------------------
  |  Branch (113:5): [True: 0, False: 30]
  ------------------
  114|      0|      return {heif_unci_component_type_alpha};
  115|      0|    case heif_channel_filter_array:
  ------------------
  |  Branch (115:5): [True: 0, False: 30]
  ------------------
  116|      0|      return {heif_unci_component_type_filter_array};
  117|      0|    case heif_channel_depth:
  ------------------
  |  Branch (117:5): [True: 0, False: 30]
  ------------------
  118|      0|      return {heif_unci_component_type_depth};
  119|      0|    case heif_channel_disparity:
  ------------------
  |  Branch (119:5): [True: 0, False: 30]
  ------------------
  120|      0|      return {heif_unci_component_type_disparity};
  121|      0|    case heif_channel_interleaved:
  ------------------
  |  Branch (121:5): [True: 0, False: 30]
  ------------------
  122|      0|      switch (chroma) {
  123|      0|        case heif_chroma_interleaved_RGB:
  ------------------
  |  Branch (123:9): [True: 0, False: 0]
  ------------------
  124|      0|        case heif_chroma_interleaved_RRGGBB_BE:
  ------------------
  |  Branch (124:9): [True: 0, False: 0]
  ------------------
  125|      0|        case heif_chroma_interleaved_RRGGBB_LE:
  ------------------
  |  Branch (125:9): [True: 0, False: 0]
  ------------------
  126|      0|          return {
  127|      0|            heif_unci_component_type_red,
  128|      0|            heif_unci_component_type_green,
  129|      0|            heif_unci_component_type_blue
  130|      0|          };
  131|      0|        case heif_chroma_interleaved_RGBA:
  ------------------
  |  Branch (131:9): [True: 0, False: 0]
  ------------------
  132|      0|        case heif_chroma_interleaved_RRGGBBAA_BE:
  ------------------
  |  Branch (132:9): [True: 0, False: 0]
  ------------------
  133|      0|        case heif_chroma_interleaved_RRGGBBAA_LE:
  ------------------
  |  Branch (133:9): [True: 0, False: 0]
  ------------------
  134|      0|          return {
  135|      0|            heif_unci_component_type_red,
  136|      0|            heif_unci_component_type_green,
  137|      0|            heif_unci_component_type_blue,
  138|      0|            heif_unci_component_type_alpha
  139|      0|          };
  140|      0|        default:
  ------------------
  |  Branch (140:9): [True: 0, False: 0]
  ------------------
  141|      0|          assert(false);
  ------------------
  |  Branch (141:11): [Folded, False: 0]
  ------------------
  142|      0|          return {static_cast<uint16_t>(1000 + channel)};
  143|      0|          break;
  144|      0|      }
  145|      0|    default:
  ------------------
  |  Branch (145:5): [True: 0, False: 30]
  ------------------
  146|       |      // For other channels without a direct match,
  147|       |      // use an internal custom value.
  148|      0|      return {static_cast<uint16_t>(1000 + channel)};
  149|     30|  }
  150|     30|}
pixelimage.cc:_ZL12rounded_sizej:
  289|     64|{
  290|     64|  s = (s + 1U) & ~1U;
  291|       |
  292|     64|  if (s < 64) {
  ------------------
  |  Branch (292:7): [True: 30, False: 34]
  ------------------
  293|     30|    s = 64;
  294|     30|  }
  295|       |
  296|     64|  return s;
  297|     64|}

_ZNK14HeifPixelImage9get_widthEv:
   84|     10|  uint32_t get_width() const { return m_width; }
_ZNK14HeifPixelImage10get_heightEv:
   87|     10|  uint32_t get_height() const { return m_height; }
_ZNK14HeifPixelImage17get_chroma_formatEv:
  110|     20|  heif_chroma get_chroma_format() const { return m_chroma; }
_ZNK14HeifPixelImage14get_colorspaceEv:
  112|     15|  heif_colorspace get_colorspace() const { return m_colorspace; }
_ZN14HeifPixelImage18get_channel_memoryE12heif_channelPm:
  130|     15|  uint8_t* get_channel_memory(heif_channel channel, size_t* out_stride) { return get_channel_memory<uint8_t>(channel, out_stride); }
_ZNK14HeifPixelImage18get_channel_memoryE12heif_channelPm:
  132|     15|  const uint8_t* get_channel_memory(heif_channel channel, size_t* out_stride) const { return get_channel_memory<uint8_t>(channel, out_stride); }
_ZN14HeifPixelImage12add_warningsERKNSt3__16vectorI5ErrorNS0_9allocatorIS2_EEEE:
  309|      5|  void add_warnings(const std::vector<Error>& warning) { for (const auto& err : warning) m_warnings.emplace_back(err); }
  ------------------
  |  Branch (309:79): [True: 5, False: 5]
  ------------------
_ZNK14HeifPixelImage12get_warningsEv:
  311|      5|  const std::vector<Error>& get_warnings() const { return m_warnings; }
_ZN14HeifPixelImage18get_channel_memoryIhEEPT_12heif_channelPm:
  136|     30|  {
  137|     30|    auto* comp = find_storage_for_channel(channel);
  138|     30|    if (!comp) {
  ------------------
  |  Branch (138:9): [True: 0, False: 30]
  ------------------
  139|      0|      if (out_stride)
  ------------------
  |  Branch (139:11): [True: 0, False: 0]
  ------------------
  140|      0|        *out_stride = 0;
  141|       |
  142|      0|      return nullptr;
  143|      0|    }
  144|       |
  145|     30|    if (out_stride) {
  ------------------
  |  Branch (145:9): [True: 30, False: 0]
  ------------------
  146|     30|      *out_stride = static_cast<int>(comp->stride);
  147|     30|    }
  148|       |
  149|     30|    return static_cast<T*>(comp->mem);
  150|     30|  }
_ZNK14HeifPixelImage18get_channel_memoryIhEEPKT_12heif_channelPm:
  154|     15|  {
  155|     15|    return const_cast<HeifPixelImage*>(this)->get_channel_memory<T>(channel, out_stride);
  156|     15|  }
_ZN14HeifPixelImageC2Ev:
   65|     12|  explicit HeifPixelImage() = default;

_Z35load_plugins_if_not_initialized_yetv:
  101|     73|{
  102|     73|  if (heif_library_initialization_count == 0) {
  ------------------
  |  Branch (102:7): [True: 1, False: 72]
  ------------------
  103|      1|    heif_init(nullptr);
  104|      1|  }
  105|     73|}
heif_init:
  109|      9|{
  110|      9|#if ENABLE_MULTITHREADING_SUPPORT
  111|      9|  std::lock_guard<std::recursive_mutex> lock(heif_init_mutex());
  112|      9|#endif
  113|       |
  114|      9|  if (heif_library_initialization_count == 0) {
  ------------------
  |  Branch (114:7): [True: 1, False: 8]
  ------------------
  115|       |
  116|      1|    ColorConversionPipeline::init_ops();
  117|       |
  118|       |    // --- initialize builtin plugins
  119|       |
  120|      1|    if (!default_plugins_registered) {
  ------------------
  |  Branch (120:9): [True: 0, False: 1]
  ------------------
  121|      0|      register_default_plugins();
  122|      0|    }
  123|       |
  124|       |#if ENABLE_PLUGIN_LOADING
  125|       |    struct heif_error err{};
  126|       |    std::vector<std::string> plugin_paths = get_plugin_paths();
  127|       |
  128|       |    for (const auto& dir : plugin_paths) {
  129|       |      err = heif_load_plugins(dir.c_str(), nullptr, nullptr, 0);
  130|       |      if (err.code != 0) {
  131|       |        return err;
  132|       |      }
  133|       |    }
  134|       |#endif
  135|      1|  }
  136|       |
  137|       |  // Note: it is important that we increase the counter AFTER initialization such that
  138|       |  // 'load_plugins_if_not_initialized_yet()' can check this without having to lock the mutex.
  139|      9|  heif_library_initialization_count++;
  140|       |
  141|      9|  return {heif_error_Ok, heif_suberror_Unspecified, Error::kSuccess};
  142|      9|}
heif_deinit:
  146|      8|{
  147|      8|#if ENABLE_MULTITHREADING_SUPPORT
  148|      8|  std::lock_guard<std::recursive_mutex> lock(heif_init_mutex());
  149|      8|#endif
  150|       |
  151|      8|  if (heif_library_initialization_count == 0) {
  ------------------
  |  Branch (151:7): [True: 0, False: 8]
  ------------------
  152|       |    // This case should never happen (heif_deinit() is called more often than heif_init()).
  153|      0|    return;
  154|      0|  }
  155|       |
  156|      8|  if (heif_library_initialization_count == 1) {
  ------------------
  |  Branch (156:7): [True: 0, False: 8]
  ------------------
  157|      0|    heif_unregister_decoder_plugins();
  158|      0|    heif_unregister_encoder_plugins();
  159|      0|    default_plugins_registered = false;
  160|       |
  161|      0|    heif_unload_all_plugins();
  162|       |
  163|      0|    ColorConversionPipeline::release_ops();
  164|      0|  }
  165|       |
  166|       |  // Note: contrary to heif_init() I think it does not matter whether we decrease the counter before or after deinitialization.
  167|       |  // If the client application calls heif_deinit() in parallel to some other libheif function, it is really broken.
  168|      8|  heif_library_initialization_count--;
  169|      8|}
init.cc:_ZL15heif_init_mutexv:
   92|     17|{
   93|     17|  static std::recursive_mutex init_mutex;
   94|     17|  return init_mutex;
   95|     17|}

_Z9get_Kr_Kbtt:
   85|      5|{
   86|      5|  Kr_Kb result;
   87|       |
   88|      5|  if (matrix_coefficients_idx == 12 ||
  ------------------
  |  Branch (88:7): [True: 0, False: 5]
  ------------------
   89|      5|      matrix_coefficients_idx == 13) {
  ------------------
  |  Branch (89:7): [True: 0, False: 5]
  ------------------
   90|       |
   91|      0|    primaries p = get_colour_primaries(primaries_idx);
   92|      0|    float zr = 1 - (p.redX + p.redY);
   93|      0|    float zg = 1 - (p.greenX + p.greenY);
   94|      0|    float zb = 1 - (p.blueX + p.blueY);
   95|      0|    float zw = 1 - (p.whiteX + p.whiteY);
   96|       |
   97|      0|    float denom = p.whiteY * (p.redX * (p.greenY * zb - p.blueY * zg) + p.greenX * (p.blueY * zr - p.redY * zb) +
   98|      0|                              p.blueX * (p.redY * zg - p.greenY * zr));
   99|       |
  100|      0|    if (denom == 0.0f) {
  ------------------
  |  Branch (100:9): [True: 0, False: 0]
  ------------------
  101|      0|      return result;
  102|      0|    }
  103|       |
  104|      0|    result.Kr = (p.redY * (p.whiteX * (p.greenY * zb - p.blueY * zg) + p.whiteY * (p.blueX * zg - p.greenX * zb) +
  105|      0|                           zw * (p.greenX * p.blueY - p.blueX * p.greenY))) / denom;
  106|      0|    result.Kb = (p.blueY * (p.whiteX * (p.redY * zg - p.greenY * zr) + p.whiteY * (p.greenX * zr - p.redX * zg) +
  107|      0|                            zw * (p.redX * p.greenY - p.greenX * p.redY))) / denom;
  108|      0|  }
  109|      5|  else
  110|      5|    switch (matrix_coefficients_idx) {
  111|      0|      case 1:
  ------------------
  |  Branch (111:7): [True: 0, False: 5]
  ------------------
  112|      0|        result.Kr = 0.2126f;
  113|      0|        result.Kb = 0.0722f;
  114|      0|        break;
  115|      0|      case 4:
  ------------------
  |  Branch (115:7): [True: 0, False: 5]
  ------------------
  116|      0|        result.Kr = 0.30f;
  117|      0|        result.Kb = 0.11f;
  118|      0|        break;
  119|      0|      case 5:
  ------------------
  |  Branch (119:7): [True: 0, False: 5]
  ------------------
  120|      5|      case 6:
  ------------------
  |  Branch (120:7): [True: 5, False: 0]
  ------------------
  121|      5|        result.Kr = 0.299f;
  122|      5|        result.Kb = 0.114f;
  123|      5|        break;
  124|      0|      case 7:
  ------------------
  |  Branch (124:7): [True: 0, False: 5]
  ------------------
  125|      0|        result.Kr = 0.212f;
  126|      0|        result.Kb = 0.087f;
  127|      0|        break;
  128|      0|      case 9:
  ------------------
  |  Branch (128:7): [True: 0, False: 5]
  ------------------
  129|      0|      case 10:
  ------------------
  |  Branch (129:7): [True: 0, False: 5]
  ------------------
  130|       |        // TODO: case 10 is BT.2020 constant-luminance, which is not a linear matrix conversion
  131|       |        //   (Y' is derived from gamma-corrected linear luminance; Cb/Cr need EOTF inversion).
  132|       |        //   We currently fall through to the NCL coefficients, which is wrong for CL content.
  133|      0|        result.Kr = 0.2627f;
  134|      0|        result.Kb = 0.0593f;
  135|      0|        break;
  136|      0|      default:;
  ------------------
  |  Branch (136:7): [True: 0, False: 5]
  ------------------
  137|      5|    }
  138|       |
  139|      5|  return result;
  140|      5|}
_Z29get_RGB_to_YCbCr_coefficientstt:
  178|      5|{
  179|      5|  RGB_to_YCbCr_coefficients coeffs;
  180|       |
  181|      5|  Kr_Kb k = get_Kr_Kb(matrix_coefficients_idx, primaries_idx);
  182|       |
  183|      5|  if (k.Kb != 0 || k.Kr != 0) { // both will be != 0 when valid
  ------------------
  |  Branch (183:7): [True: 5, False: 0]
  |  Branch (183:20): [True: 0, False: 0]
  ------------------
  184|      5|    coeffs.defined = true;
  185|      5|    coeffs.c[0][0] = k.Kr;
  186|      5|    coeffs.c[0][1] = 1 - k.Kr - k.Kb;
  187|      5|    coeffs.c[0][2] = k.Kb;
  188|      5|    coeffs.c[1][0] = -k.Kr / (1 - k.Kb) / 2;
  189|      5|    coeffs.c[1][1] = -(1 - k.Kr - k.Kb) / (1 - k.Kb) / 2;
  190|      5|    coeffs.c[1][2] = 0.5f;
  191|      5|    coeffs.c[2][0] = 0.5f;
  192|      5|    coeffs.c[2][1] = -(1 - k.Kr - k.Kb) / (1 - k.Kr) / 2;
  193|      5|    coeffs.c[2][2] = -k.Kb / (1 - k.Kr) / 2;
  194|      5|  }
  195|      0|  else {
  196|      0|    coeffs = RGB_to_YCbCr_coefficients::defaults();
  197|      0|  }
  198|       |
  199|      5|  return coeffs;
  200|      5|}
_ZN25RGB_to_YCbCr_coefficients8defaultsEv:
  204|      5|{
  205|      5|  RGB_to_YCbCr_coefficients coeffs;
  206|      5|  coeffs.defined = true;
  207|       |  // Rec 601 full. Kr=0.2990f Kb=0.1140f.
  208|      5|  coeffs.c[0][0] = 0.299f;
  209|      5|  coeffs.c[0][1] = 0.587f;
  210|      5|  coeffs.c[0][2] = 0.114f;
  211|      5|  coeffs.c[1][0] = -0.168735f;
  212|      5|  coeffs.c[1][1] = -0.331264f;
  213|      5|  coeffs.c[1][2] = 0.5f;
  214|      5|  coeffs.c[2][0] = 0.5f;
  215|      5|  coeffs.c[2][1] = -0.418688f;
  216|      5|  coeffs.c[2][2] = -0.081312f;
  217|       |
  218|      5|  return coeffs;
  219|      5|}
_ZN18color_profile_nclx5parseER14BitstreamRange:
  223|     48|{
  224|     48|  StreamReader::grow_status status;
  225|     48|  status = range.wait_for_available_bytes(7);
  226|     48|  if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (226:7): [True: 0, False: 48]
  ------------------
  227|       |    // TODO: return recoverable error at timeout
  228|      0|    return Error(heif_error_Invalid_input,
  229|      0|                 heif_suberror_End_of_data);
  230|      0|  }
  231|       |
  232|     48|  m_profile.m_colour_primaries = range.read16();
  233|     48|  m_profile.m_transfer_characteristics = range.read16();
  234|     48|  m_profile.m_matrix_coefficients = range.read16();
  235|     48|  m_profile.m_full_range_flag = (range.read8() & 0x80 ? true : false);
  ------------------
  |  Branch (235:34): [True: 48, False: 0]
  ------------------
  236|       |
  237|     48|  return Error::Ok;
  238|     48|}
_ZN12nclx_profile17set_sRGB_defaultsEv:
  315|     57|{
  316|       |  // sRGB defaults
  317|     57|  m_colour_primaries = 1;
  318|     57|  m_transfer_characteristics = 13;
  319|     57|  m_matrix_coefficients = 6;
  320|     57|  m_full_range_flag = true;
  321|     57|}
_ZNK12nclx_profile12is_undefinedEv:
  334|      6|{
  335|      6|  return *this == nclx_profile::undefined();
  336|      6|}
_ZN12nclx_profile43replace_undefined_values_with_sRGB_defaultsEv:
  361|      5|{
  362|      5|  if (m_matrix_coefficients == heif_matrix_coefficients_unspecified) {
  ------------------
  |  Branch (362:7): [True: 4, False: 1]
  ------------------
  363|      4|    m_matrix_coefficients = heif_matrix_coefficients_ITU_R_BT_601_6;
  364|      4|  }
  365|       |
  366|      5|  if (m_colour_primaries == heif_color_primaries_unspecified) {
  ------------------
  |  Branch (366:7): [True: 5, False: 0]
  ------------------
  367|      5|    m_colour_primaries = heif_color_primaries_ITU_R_BT_709_5;
  368|      5|  }
  369|       |
  370|      5|  if (m_transfer_characteristics == heif_transfer_characteristic_unspecified) {
  ------------------
  |  Branch (370:7): [True: 5, False: 0]
  ------------------
  371|      5|    m_transfer_characteristics = heif_transfer_characteristic_IEC_61966_2_1;
  372|      5|  }
  373|      5|}
_ZNK12nclx_profile27equal_except_transfer_curveERKS_:
  377|     25|{
  378|     25|  return (m_matrix_coefficients == b.m_matrix_coefficients &&
  ------------------
  |  Branch (378:11): [True: 25, False: 0]
  ------------------
  379|     25|          m_colour_primaries == b.m_colour_primaries &&
  ------------------
  |  Branch (379:11): [True: 25, False: 0]
  ------------------
  380|     25|          m_full_range_flag == b.m_full_range_flag);
  ------------------
  |  Branch (380:11): [True: 25, False: 0]
  ------------------
  381|     25|}
_ZN8Box_colr5parseER14BitstreamRangePK20heif_security_limits:
  385|    153|{
  386|    153|  StreamReader::grow_status status;
  387|    153|  uint32_t colour_type = range.read32();
  388|       |
  389|    153|  if (colour_type == fourcc("nclx")) {
  ------------------
  |  Branch (389:7): [True: 48, False: 105]
  ------------------
  390|     48|    auto color_profile = std::make_shared<color_profile_nclx>();
  391|     48|    m_color_profile = color_profile;
  392|     48|    Error err = color_profile->parse(range);
  393|     48|    if (err) {
  ------------------
  |  Branch (393:9): [True: 0, False: 48]
  ------------------
  394|      0|      return err;
  395|      0|    }
  396|     48|  }
  397|    105|  else if (colour_type == fourcc("nclc")) {
  ------------------
  |  Branch (397:12): [True: 0, False: 105]
  ------------------
  398|      0|    auto color_profile = std::make_shared<color_profile_nclx>();
  399|      0|    m_color_profile = color_profile;
  400|      0|    Error err = color_profile->parse_nclc(range);
  401|      0|    if (err) {
  ------------------
  |  Branch (401:9): [True: 0, False: 0]
  ------------------
  402|      0|      return err;
  403|      0|    }
  404|      0|  }
  405|    105|  else if (colour_type == fourcc("prof") ||
  ------------------
  |  Branch (405:12): [True: 105, False: 0]
  ------------------
  406|    105|           colour_type == fourcc("rICC")) {
  ------------------
  |  Branch (406:12): [True: 0, False: 0]
  ------------------
  407|    105|    if (!has_fixed_box_size()) {
  ------------------
  |  Branch (407:9): [True: 0, False: 105]
  ------------------
  408|      0|      return Error(heif_error_Unsupported_feature, heif_suberror_Unspecified, "colr boxes with undefined box size are not supported");
  409|      0|    }
  410|       |
  411|    105|    uint64_t profile_size_64 = get_box_size() - get_header_size() - 4;
  412|    105|    if (limits->max_color_profile_size && profile_size_64 > limits->max_color_profile_size) {
  ------------------
  |  Branch (412:9): [True: 105, False: 0]
  |  Branch (412:43): [True: 0, False: 105]
  ------------------
  413|      0|      return Error(heif_error_Invalid_input, heif_suberror_Security_limit_exceeded, "Color profile exceeds maximum supported size");
  414|      0|    }
  415|       |
  416|    105|    size_t profile_size = static_cast<size_t>(profile_size_64);
  417|       |
  418|    105|    status = range.wait_for_available_bytes(profile_size);
  419|    105|    if (status != StreamReader::grow_status::size_reached) {
  ------------------
  |  Branch (419:9): [True: 0, False: 105]
  ------------------
  420|       |      // TODO: return recoverable error at timeout
  421|      0|      return Error(heif_error_Invalid_input,
  422|      0|                   heif_suberror_End_of_data);
  423|      0|    }
  424|       |
  425|    105|    std::vector<uint8_t> rawData(profile_size);
  426|  6.81k|    for (size_t i = 0; i < profile_size; i++) {
  ------------------
  |  Branch (426:24): [True: 6.70k, False: 105]
  ------------------
  427|  6.70k|      rawData[i] = range.read8();
  428|  6.70k|    }
  429|       |
  430|    105|    m_color_profile = std::make_shared<color_profile_raw>(colour_type, rawData);
  431|    105|  }
  432|      0|  else {
  433|      0|    return Error(heif_error_Invalid_input,
  434|      0|                 heif_suberror_Unknown_color_profile_type);
  435|      0|  }
  436|       |
  437|    153|  return range.get_error();
  438|    153|}
_ZNK18color_profile_nclx5writeER12StreamWriter:
  479|      6|{
  480|      6|  writer.write16(m_profile.m_colour_primaries);
  481|      6|  writer.write16(m_profile.m_transfer_characteristics);
  482|      6|  writer.write16(m_profile.m_matrix_coefficients);
  483|      6|  writer.write8(m_profile.m_full_range_flag ? 0x80 : 0x00);
  ------------------
  |  Branch (483:17): [True: 6, False: 0]
  ------------------
  484|       |
  485|      6|  return Error::Ok;
  486|      6|}
_ZNK17color_profile_raw5writeER12StreamWriter:
  489|    350|{
  490|    350|  writer.write(m_data);
  491|       |
  492|    350|  return Error::Ok;
  493|    350|}
_ZNK8Box_colr5writeER12StreamWriter:
  496|    356|{
  497|    356|  size_t box_start = reserve_box_header_space(writer);
  498|       |
  499|    356|  assert(m_color_profile);
  ------------------
  |  Branch (499:3): [True: 356, False: 0]
  ------------------
  500|       |
  501|    356|  writer.write32(m_color_profile->get_type());
  502|       |
  503|    356|  Error err = m_color_profile->write(writer);
  504|    356|  if (err) {
  ------------------
  |  Branch (504:7): [True: 0, False: 356]
  ------------------
  505|      0|    return err;
  506|      0|  }
  507|       |
  508|    356|  prepend_header(writer, box_start);
  509|       |
  510|    356|  return Error::Ok;
  511|    356|}

_ZN17color_profile_rawC2EjRKNSt3__16vectorIhNS0_9allocatorIhEEEE:
  105|    105|      : m_type(type), m_data(data) {}
_ZNK17color_profile_raw8get_typeEv:
  107|    350|  uint32_t get_type() const override { return m_type; }
_ZN12nclx_profile9undefinedEv:
  132|    375|  static nclx_profile undefined() { return {}; }
_ZN12nclx_profile8defaultsEv:
  134|      4|  static nclx_profile defaults() { nclx_profile profile; profile.set_sRGB_defaults(); return profile; }
_ZNK12nclx_profile20get_colour_primariesEv:
  136|     10|  heif_color_primaries get_colour_primaries() const { return static_cast<heif_color_primaries>(m_colour_primaries); }
_ZNK12nclx_profile28get_transfer_characteristicsEv:
  138|      5|  heif_transfer_characteristics get_transfer_characteristics() const { return static_cast<heif_transfer_characteristics>(m_transfer_characteristics); }
_ZNK12nclx_profile23get_matrix_coefficientsEv:
  140|    230|  heif_matrix_coefficients get_matrix_coefficients() const { return static_cast<heif_matrix_coefficients>(m_matrix_coefficients); }
_ZNK12nclx_profile19get_full_range_flagEv:
  142|      5|  bool get_full_range_flag() const { return m_full_range_flag; }
_ZN18color_profile_nclxC2Ev:
  173|     48|  color_profile_nclx() { m_profile.set_sRGB_defaults(); }
_ZN18color_profile_nclxC2ERK12nclx_profile:
  175|      3|  color_profile_nclx(const nclx_profile& profile) : m_profile(profile) { }
_ZNK18color_profile_nclx8get_typeEv:
  182|      6|  uint32_t get_type() const override { return fourcc("nclx"); }
_ZNK18color_profile_nclx22get_nclx_color_profileEv:
  192|      3|  nclx_profile get_nclx_color_profile() const { return m_profile; }
_ZN8Box_colrC2Ev:
  203|    331|  {
  204|    331|    set_short_type(fourcc("colr"));
  205|    331|  }
_ZNK8Box_colr17get_color_profileEv:
  211|    178|  const std::shared_ptr<const color_profile>& get_color_profile() const { return m_color_profile; }
_ZN8Box_colr17set_color_profileERKNSt3__110shared_ptrIK13color_profileEE:
  213|    178|  void set_color_profile(const std::shared_ptr<const color_profile>& prof) { m_color_profile = prof; }
_ZN13color_profileD2Ev:
   92|    156|  virtual ~color_profile() = default;
_ZNK12nclx_profileneERKS_:
  130|     13|  bool operator!=(const nclx_profile& b) const = default;
_ZNK12nclx_profileeqERKS_:
  128|     83|  bool operator==(const nclx_profile& b) const = default;

_Z24register_default_pluginsv:
  149|      2|{
  150|       |#if HAVE_WEBCODECS
  151|       |  register_decoder(get_decoder_plugin_webcodecs());
  152|       |#endif
  153|       |
  154|      2|#if HAVE_LIBDE265
  155|      2|  register_decoder(get_decoder_plugin_libde265());
  156|      2|#endif
  157|       |
  158|      2|#if HAVE_X265
  159|      2|  register_encoder(get_encoder_plugin_x265());
  160|      2|#endif
  161|       |
  162|       |#if HAVE_KVAZAAR
  163|       |  register_encoder(get_encoder_plugin_kvazaar());
  164|       |#endif
  165|       |
  166|       |#if HAVE_UVG266
  167|       |  register_encoder(get_encoder_plugin_uvg266());
  168|       |#endif
  169|       |
  170|      2|#if HAVE_VVENC
  171|      2|  register_encoder(get_encoder_plugin_vvenc());
  172|      2|#endif
  173|       |
  174|      2|#if HAVE_VVDEC
  175|      2|  register_decoder(get_decoder_plugin_vvdec());
  176|      2|#endif
  177|       |
  178|      2|#if HAVE_AOM_ENCODER
  179|      2|  register_encoder(get_encoder_plugin_aom());
  180|      2|#endif
  181|       |
  182|      2|#if HAVE_AOM_DECODER
  183|      2|  register_decoder(get_decoder_plugin_aom());
  184|      2|#endif
  185|       |
  186|       |#if HAVE_RAV1E
  187|       |  register_encoder(get_encoder_plugin_rav1e());
  188|       |#endif
  189|       |
  190|      2|#if HAVE_DAV1D
  191|      2|  register_decoder(get_decoder_plugin_dav1d());
  192|      2|#endif
  193|       |
  194|      2|#if HAVE_SvtEnc
  195|      2|  register_encoder(get_encoder_plugin_svt());
  196|      2|#endif
  197|       |
  198|       |#if HAVE_FFMPEG_DECODER
  199|       |  register_decoder(get_decoder_plugin_ffmpeg());
  200|       |#endif
  201|       |
  202|      2|#if HAVE_JPEG_DECODER
  203|      2|  register_decoder(get_decoder_plugin_jpeg());
  204|      2|#endif
  205|       |
  206|      2|#if HAVE_JPEG_ENCODER
  207|      2|  register_encoder(get_encoder_plugin_jpeg());
  208|      2|#endif
  209|       |
  210|      2|#if HAVE_OPENJPEG_ENCODER
  211|      2|  register_encoder(get_encoder_plugin_openjpeg());
  212|      2|#endif
  213|       |
  214|      2|#if HAVE_OPENJPEG_DECODER
  215|      2|  register_decoder(get_decoder_plugin_openjpeg());
  216|      2|#endif
  217|       |
  218|      2|#if HAVE_OPENJPH_ENCODER
  219|      2|  register_encoder(get_encoder_plugin_openjph());
  220|      2|#endif
  221|       |
  222|      2|#if HAVE_OpenH264_DECODER
  223|      2|  register_decoder(get_decoder_plugin_openh264());
  224|      2|#endif
  225|       |
  226|      2|#if HAVE_X264
  227|      2|  register_encoder(get_encoder_plugin_x264());
  228|      2|#endif
  229|       |
  230|      2|#if WITH_UNCOMPRESSED_CODEC
  231|      2|  register_encoder(get_encoder_plugin_uncompressed());
  232|      2|  register_decoder(get_decoder_plugin_uncompressed());
  233|      2|#endif
  234|       |
  235|      2|  register_encoder(get_encoder_plugin_mask());
  236|      2|}
_Z16register_decoderPK19heif_decoder_plugin:
  240|     16|{
  241|     16|  if (decoder_plugin->init_plugin) {
  ------------------
  |  Branch (241:7): [True: 14, False: 2]
  ------------------
  242|     14|    (*decoder_plugin->init_plugin)();
  243|     14|  }
  244|       |
  245|     16|  s_decoder_plugins.insert(decoder_plugin);
  246|     16|}
_Z11get_decoder23heif_compression_formatPKc:
  265|     39|{
  266|     39|  load_plugins_if_not_initialized_yet();
  267|       |
  268|     39|  int highest_priority = 0;
  269|     39|  const struct heif_decoder_plugin* best_plugin = nullptr;
  270|       |
  271|    312|  for (const auto* plugin : s_decoder_plugins) {
  ------------------
  |  Branch (271:27): [True: 312, False: 39]
  ------------------
  272|       |
  273|    312|    int priority = plugin->does_support_format(type);
  274|       |
  275|    312|    if (priority > 0 && name_id && plugin->plugin_api_version >= 3) {
  ------------------
  |  Branch (275:9): [True: 45, False: 267]
  |  Branch (275:25): [True: 0, False: 45]
  |  Branch (275:36): [True: 0, False: 0]
  ------------------
  276|      0|      if (strcmp(name_id, plugin->id_name) == 0) {
  ------------------
  |  Branch (276:11): [True: 0, False: 0]
  ------------------
  277|      0|        return plugin;
  278|      0|      }
  279|      0|    }
  280|       |
  281|    312|    if (priority > highest_priority) {
  ------------------
  |  Branch (281:9): [True: 39, False: 273]
  ------------------
  282|     39|      highest_priority = priority;
  283|     39|      best_plugin = plugin;
  284|     39|    }
  285|    312|  }
  286|       |
  287|     39|  return best_plugin;
  288|     39|}
_Z16register_encoderPK19heif_encoder_plugin:
  292|     20|{
  293|     20|  if (encoder_plugin->init_plugin) {
  ------------------
  |  Branch (293:7): [True: 20, False: 0]
  ------------------
  294|     20|    (*encoder_plugin->init_plugin)();
  295|     20|  }
  296|       |
  297|     20|  auto descriptor = std::unique_ptr<heif_encoder_descriptor>(new heif_encoder_descriptor);
  298|     20|  descriptor->plugin = encoder_plugin;
  299|       |
  300|     20|  s_encoder_descriptors.insert(std::move(descriptor));
  301|     20|}
_ZN24Register_Default_PluginsC2Ev:
  142|      2|  {
  143|      2|    register_default_plugins();
  144|      2|  }

_ZNK33encoder_descriptor_priority_orderclERKNSt3__110unique_ptrI23heif_encoder_descriptorNS0_14default_deleteIS2_EEEES7_:
   50|     50|  {
   51|     50|    return a->plugin->priority > b->plugin->priority;  // highest priority first
   52|     50|  }

_Z22get_decoder_plugin_aomv:
  435|      2|{
  436|      2|  return &decoder_aom;
  437|      2|}
decoder_aom.cc:_ZL15aom_init_pluginv:
   88|      2|{
   89|      2|}
decoder_aom.cc:_ZL23aom_does_support_format23heif_compression_format:
   98|     39|{
   99|     39|  if (format == heif_compression_AV1) {
  ------------------
  |  Branch (99:7): [True: 6, False: 33]
  ------------------
  100|      6|    return AOM_PLUGIN_PRIORITY;
  101|      6|  }
  102|     33|  else {
  103|     33|    return 0;
  104|     33|  }
  105|     39|}

_Z18dav1d_new_decoder2PPvPK27heif_decoder_plugin_options:
   97|      9|{
   98|      9|  auto* decoder = new dav1d_decoder();
   99|       |
  100|      9|  dav1d_default_settings(&decoder->settings);
  101|       |
  102|      9|  const heif_security_limits* limits = options->limits ? options->limits : heif_get_global_security_limits();
  ------------------
  |  Branch (102:40): [True: 9, False: 0]
  ------------------
  103|      9|  if (limits->max_image_size_pixels > std::numeric_limits<unsigned int>::max()) {
  ------------------
  |  Branch (103:7): [True: 0, False: 9]
  ------------------
  104|      0|    decoder->settings.frame_size_limit = 0;
  105|      0|  }
  106|      9|  else {
  107|      9|    decoder->settings.frame_size_limit = static_cast<unsigned int>(limits->max_image_size_pixels);
  108|      9|  }
  109|       |
  110|      9|  decoder->settings.all_layers = 0;
  111|       |
  112|      9|  if (options->num_threads) {
  ------------------
  |  Branch (112:7): [True: 0, False: 9]
  ------------------
  113|      0|    decoder->settings.n_threads = options->num_threads;
  114|      0|  }
  115|       |
  116|      9|  if (dav1d_open(&decoder->context, &decoder->settings) != 0) {
  ------------------
  |  Branch (116:7): [True: 0, False: 9]
  ------------------
  117|      0|    delete decoder;
  118|      0|    return {heif_error_Decoder_plugin_error, heif_suberror_Unspecified, kSuccess};
  119|      0|  }
  120|       |
  121|      9|  *dec = decoder;
  122|       |
  123|      9|  return heif_error_ok;
  124|      9|}
_Z18dav1d_free_decoderPv:
  137|      9|{
  138|      9|  auto* decoder = (dav1d_decoder*) decoder_raw;
  139|       |
  140|      9|  if (!decoder) {
  ------------------
  |  Branch (140:7): [True: 0, False: 9]
  ------------------
  141|      0|    return;
  142|      0|  }
  143|       |
  144|       |  // free queued data
  145|       |
  146|      9|  for (auto& pkt : decoder->queued_data) {
  ------------------
  |  Branch (146:18): [True: 0, False: 9]
  ------------------
  147|      0|    dav1d_data_unref(&pkt);
  148|      0|  }
  149|      9|  decoder->queued_data.clear();
  150|       |
  151|       |  // free decoder context
  152|       |
  153|      9|  if (decoder->context) {
  ------------------
  |  Branch (153:7): [True: 9, False: 0]
  ------------------
  154|      9|    dav1d_close(&decoder->context);
  155|      9|  }
  156|       |
  157|      9|  delete decoder;
  158|      9|}
_Z16dav1d_push_data2PvPKvmm:
  203|      9|{
  204|      9|  auto* decoder = (struct dav1d_decoder*) decoder_raw;
  205|       |
  206|       |  // --- copy input data into Dav1dData packet
  207|       |
  208|      9|  Dav1dData packet{};
  209|       |
  210|      9|  uint8_t* d = dav1d_data_create(&packet, frame_size);
  211|      9|  if (d == nullptr) {
  ------------------
  |  Branch (211:7): [True: 0, False: 9]
  ------------------
  212|      0|    return {heif_error_Memory_allocation_error, heif_suberror_Unspecified, kSuccess};
  213|      0|  }
  214|       |
  215|      9|  memcpy(d, frame_data, frame_size);
  216|       |
  217|      9|  packet.m.user_data.data = (uint8_t*)user_data;
  218|       |
  219|       |  // --- put data into queue
  220|       |
  221|      9|  decoder->queued_data.push_back(packet);
  222|       |
  223|       |  // --- push pending data to decoder
  224|       |
  225|      9|  return push_pending_data_into_decoder(decoder);
  226|      9|}
_Z24dav1d_decode_next_image2PvPP10heif_imagePmPK20heif_security_limits:
  238|    108|{
  239|    108|  auto* decoder = (struct dav1d_decoder*) decoder_raw;
  240|       |
  241|    108|  heif_error err;
  242|       |
  243|    108|  Dav1dPicture frame{};
  244|       |
  245|    108|  for (;;) {
  246|       |
  247|       |    // --- send more pending data to decoder
  248|       |
  249|    108|    err = push_pending_data_into_decoder(decoder);
  250|    108|    if (err.code) {
  ------------------
  |  Branch (250:9): [True: 0, False: 108]
  ------------------
  251|      0|      return err;
  252|      0|    }
  253|       |
  254|       |    // --- try to get decoded image
  255|       |
  256|    108|    int res = dav1d_get_picture(decoder->context, &frame);
  257|       |
  258|       |    // We got a picture from the decoder. Continue with processing it.
  259|    108|    if (res == 0) {
  ------------------
  |  Branch (259:9): [True: 0, False: 108]
  ------------------
  260|      0|      break;
  261|      0|    }
  262|       |
  263|       |    // decoder wants more data, but queue is empty
  264|    108|    if (res == DAV1D_ERR(EAGAIN) && decoder->queued_data.empty()) {
  ------------------
  |  Branch (264:9): [True: 104, False: 4]
  |  Branch (264:37): [True: 104, False: 0]
  ------------------
  265|    104|      *out_img = nullptr;
  266|    104|      return heif_error_ok;
  267|    104|    }
  268|       |
  269|       |    // continue feeding more data from queue
  270|      4|    if (res == DAV1D_ERR(EAGAIN)) {
  ------------------
  |  Branch (270:9): [True: 0, False: 4]
  ------------------
  271|      0|      continue;
  272|      0|    }
  273|       |
  274|       |    // decoder error
  275|      4|    if (res < 0) {
  ------------------
  |  Branch (275:9): [True: 4, False: 0]
  ------------------
  276|      4|      return {
  277|      4|        heif_error_Decoder_plugin_error,
  278|      4|        heif_suberror_Unspecified,
  279|      4|        kEmptyString
  280|      4|      };
  281|      4|    }
  282|      4|  }
  283|       |
  284|       |  // --- convert image to heif_image
  285|       |
  286|      0|  heif_chroma chroma;
  287|      0|  heif_colorspace colorspace;
  288|      0|  switch (frame.p.layout) {
  289|      0|    case DAV1D_PIXEL_LAYOUT_I420:
  ------------------
  |  Branch (289:5): [True: 0, False: 0]
  ------------------
  290|      0|      chroma = heif_chroma_420;
  291|      0|      colorspace = heif_colorspace_YCbCr;
  292|      0|      break;
  293|      0|    case DAV1D_PIXEL_LAYOUT_I422:
  ------------------
  |  Branch (293:5): [True: 0, False: 0]
  ------------------
  294|      0|      chroma = heif_chroma_422;
  295|      0|      colorspace = heif_colorspace_YCbCr;
  296|      0|      break;
  297|      0|    case DAV1D_PIXEL_LAYOUT_I444:
  ------------------
  |  Branch (297:5): [True: 0, False: 0]
  ------------------
  298|      0|      chroma = heif_chroma_444;
  299|      0|      colorspace = heif_colorspace_YCbCr;
  300|      0|      break;
  301|      0|    case DAV1D_PIXEL_LAYOUT_I400:
  ------------------
  |  Branch (301:5): [True: 0, False: 0]
  ------------------
  302|      0|      chroma = heif_chroma_monochrome;
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  303|      0|      colorspace = heif_colorspace_monochrome;
  304|      0|      break;
  305|      0|    default: {
  ------------------
  |  Branch (305:5): [True: 0, False: 0]
  ------------------
  306|      0|      dav1d_picture_unref(&frame);
  307|      0|      return {
  308|      0|        heif_error_Decoder_plugin_error,
  309|      0|        heif_suberror_Unspecified,
  310|      0|        kEmptyString
  311|      0|      };
  312|      0|    }
  313|      0|  }
  314|       |
  315|      0|  if (out_user_data) {
  ------------------
  |  Branch (315:7): [True: 0, False: 0]
  ------------------
  316|      0|    *out_user_data = (uintptr_t)frame.m.user_data.data;
  317|      0|  }
  318|       |
  319|      0|  heif_image* heif_img = nullptr;
  320|      0|  err = heif_image_create(frame.p.w, frame.p.h,
  321|      0|                          colorspace,
  322|      0|                          chroma,
  323|      0|                          &heif_img);
  324|      0|  if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (324:7): [True: 0, False: 0]
  ------------------
  325|      0|    assert(heif_img == nullptr);
  ------------------
  |  Branch (325:5): [True: 0, False: 0]
  ------------------
  326|      0|    dav1d_picture_unref(&frame);
  327|      0|    return err;
  328|      0|  }
  329|       |
  330|       |
  331|       |  // --- read nclx parameters from decoded AV1 bitstream
  332|       |
  333|      0|  heif_color_profile_nclx nclx;
  334|      0|  HEIF_WARN_OR_FAIL(decoder->strict_decoding, heif_img, heif_nclx_color_profile_set_color_primaries(&nclx, static_cast<uint16_t>(frame.seq_hdr->pri)), {});
  ------------------
  |  |  369|      0|#define HEIF_WARN_OR_FAIL(strict, image, cmd, cleanupBlock) \
  |  |  370|      0|{ heif_error e = cmd;                         \
  |  |  371|      0|  if (e.code != heif_error_Ok) {              \
  |  |  ------------------
  |  |  |  Branch (371:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  372|      0|    if (strict) {                             \
  |  |  ------------------
  |  |  |  Branch (372:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  373|      0|      cleanupBlock                            \
  |  |  374|      0|      return e;                               \
  |  |  375|      0|    }                                         \
  |  |  376|      0|    else {                                    \
  |  |  377|      0|      heif_image_add_decoding_warning(image, e); \
  |  |  378|      0|    }                                         \
  |  |  379|      0|  }                                           \
  |  |  380|      0|}
  ------------------
  335|      0|  HEIF_WARN_OR_FAIL(decoder->strict_decoding, heif_img, heif_nclx_color_profile_set_transfer_characteristics(&nclx, static_cast<uint16_t>(frame.seq_hdr->trc)), {});
  ------------------
  |  |  369|      0|#define HEIF_WARN_OR_FAIL(strict, image, cmd, cleanupBlock) \
  |  |  370|      0|{ heif_error e = cmd;                         \
  |  |  371|      0|  if (e.code != heif_error_Ok) {              \
  |  |  ------------------
  |  |  |  Branch (371:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  372|      0|    if (strict) {                             \
  |  |  ------------------
  |  |  |  Branch (372:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  373|      0|      cleanupBlock                            \
  |  |  374|      0|      return e;                               \
  |  |  375|      0|    }                                         \
  |  |  376|      0|    else {                                    \
  |  |  377|      0|      heif_image_add_decoding_warning(image, e); \
  |  |  378|      0|    }                                         \
  |  |  379|      0|  }                                           \
  |  |  380|      0|}
  ------------------
  336|      0|  HEIF_WARN_OR_FAIL(decoder->strict_decoding, heif_img, heif_nclx_color_profile_set_matrix_coefficients(&nclx, static_cast<uint16_t>(frame.seq_hdr->mtrx)), {});
  ------------------
  |  |  369|      0|#define HEIF_WARN_OR_FAIL(strict, image, cmd, cleanupBlock) \
  |  |  370|      0|{ heif_error e = cmd;                         \
  |  |  371|      0|  if (e.code != heif_error_Ok) {              \
  |  |  ------------------
  |  |  |  Branch (371:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  372|      0|    if (strict) {                             \
  |  |  ------------------
  |  |  |  Branch (372:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  373|      0|      cleanupBlock                            \
  |  |  374|      0|      return e;                               \
  |  |  375|      0|    }                                         \
  |  |  376|      0|    else {                                    \
  |  |  377|      0|      heif_image_add_decoding_warning(image, e); \
  |  |  378|      0|    }                                         \
  |  |  379|      0|  }                                           \
  |  |  380|      0|}
  ------------------
  337|      0|  nclx.full_range_flag = (frame.seq_hdr->color_range != 0);
  338|      0|  heif_image_set_nclx_color_profile(heif_img, &nclx);
  339|       |
  340|       |
  341|      0|  heif_channel channel2plane[3] = {
  342|      0|      heif_channel_Y,
  343|      0|      heif_channel_Cb,
  344|      0|      heif_channel_Cr
  345|      0|  };
  346|       |
  347|       |
  348|       |  // --- copy image data
  349|       |
  350|      0|  int num_planes = (chroma == heif_chroma_monochrome ? 1 : 3);
  ------------------
  |  |   75|      0|#define heif_chroma_monochrome heif_chroma_planar
  ------------------
  |  Branch (350:21): [True: 0, False: 0]
  ------------------
  351|       |
  352|      0|  for (int c = 0; c < num_planes; c++) {
  ------------------
  |  Branch (352:19): [True: 0, False: 0]
  ------------------
  353|      0|    int bpp = frame.p.bpc;
  354|       |
  355|      0|    const uint8_t* data = (uint8_t*) frame.data[c];
  356|      0|    int stride = (int) frame.stride[c > 0 ? 1 : 0];
  ------------------
  |  Branch (356:37): [True: 0, False: 0]
  ------------------
  357|       |
  358|      0|    uint32_t w, h;
  359|      0|    get_subsampled_size(frame.p.w, frame.p.h,
  360|      0|                        channel2plane[c], chroma, &w, &h);
  361|       |
  362|      0|    err = heif_image_add_plane_safe(heif_img, channel2plane[c], w, h, bpp, limits);
  363|      0|    if (err.code != heif_error_Ok) {
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  ------------------
  364|       |      // copy error message to decoder object because heif_image will be released
  365|      0|      decoder->error_message = err.message;
  366|      0|      err.message = decoder->error_message.c_str();
  367|       |
  368|      0|      heif_image_release(heif_img);
  369|      0|      dav1d_picture_unref(&frame);
  370|      0|      return err;
  371|      0|    }
  372|       |
  373|      0|    size_t dst_stride;
  374|      0|    uint8_t* dst_mem = heif_image_get_plane2(heif_img, channel2plane[c], &dst_stride);
  375|       |
  376|      0|    const int bytes_per_pixel = (bpp + 7) / 8;
  377|       |
  378|      0|    for (uint32_t y = 0; y < h; y++) {
  ------------------
  |  Branch (378:26): [True: 0, False: 0]
  ------------------
  379|      0|      memcpy(dst_mem + y * dst_stride, data + static_cast<size_t>(y) * stride, static_cast<size_t>(w) * bytes_per_pixel);
  380|      0|    }
  381|      0|  }
  382|       |
  383|      0|  dav1d_picture_unref(&frame);
  384|       |
  385|      0|  *out_img = heif_img;
  386|       |
  387|       |
  388|      0|  return {heif_error_Ok, heif_suberror_Unspecified, kSuccess};
  389|      0|}
_Z16dav1d_flush_dataPv:
  407|      6|{
  408|      6|  auto* decoder = (struct dav1d_decoder*) decoder_raw;
  409|       |
  410|      6|  constexpr Dav1dData packet{}; // empty packet
  411|       |
  412|       |  // --- put data into queue
  413|       |
  414|      6|  decoder->queued_data.push_back(packet);
  415|       |
  416|       |  // --- push pending data to decoder
  417|       |
  418|      6|  return push_pending_data_into_decoder(decoder);
  419|      6|}
_Z24get_decoder_plugin_dav1dv:
  446|      2|{
  447|      2|  return &decoder_dav1d;
  448|      2|}
decoder_dav1d.cc:_ZL30push_pending_data_into_decoderP13dav1d_decoder:
  170|    123|{
  171|    135|  while (!decoder->queued_data.empty()) {
  ------------------
  |  Branch (171:10): [True: 15, False: 120]
  ------------------
  172|       |
  173|       |    // send data
  174|       |
  175|     15|    int res = dav1d_send_data(decoder->context, &decoder->queued_data.front());
  176|       |
  177|       |    // decoder does not accept more data at this moment
  178|       |
  179|     15|    if (res == DAV1D_ERR(EAGAIN)) {
  ------------------
  |  Branch (179:9): [True: 0, False: 15]
  ------------------
  180|      0|      break;
  181|      0|    }
  182|       |
  183|     15|    if (res < 0) {
  ------------------
  |  Branch (183:9): [True: 3, False: 12]
  ------------------
  184|       |      // dav1d_send_data failed. Data was not consumed, unref before removing from queue.
  185|      3|      dav1d_data_unref(&decoder->queued_data.front());
  186|      3|      decoder->queued_data.pop_front();
  187|      3|      return {
  188|      3|        heif_error_Decoder_plugin_error,
  189|      3|        heif_suberror_Unspecified,
  190|      3|        kEmptyString
  191|      3|      };
  192|      3|    }
  193|       |
  194|       |    // Decoder has accepted data (Dav1dData is consumed). Remove from queue.
  195|     12|    decoder->queued_data.pop_front();
  196|     12|  }
  197|       |
  198|    120|  return heif_error_ok;
  199|    123|}
decoder_dav1d.cc:_ZL17dav1d_init_pluginv:
   71|      2|{
   72|      2|}
decoder_dav1d.cc:_ZL25dav1d_does_support_format23heif_compression_format:
   81|     39|{
   82|     39|  if (format == heif_compression_AV1) {
  ------------------
  |  Branch (82:7): [True: 6, False: 33]
  ------------------
   83|      6|    return DAV1D_PLUGIN_PRIORITY;
   84|      6|  }
   85|     33|  else {
   86|     33|    return 0;
   87|     33|  }
   88|     39|}

_Z23get_decoder_plugin_jpegv:
  494|      2|{
  495|      2|  return &decoder_jpeg;
  496|      2|}
decoder_jpeg.cc:_ZL16jpeg_init_pluginv:
   70|      2|{
   71|      2|}
decoder_jpeg.cc:_ZL24jpeg_does_support_format23heif_compression_format:
   80|     39|{
   81|     39|  if (format == heif_compression_JPEG) {
  ------------------
  |  Branch (81:7): [True: 0, False: 39]
  ------------------
   82|      0|    return JPEG_PLUGIN_PRIORITY;
   83|      0|  }
   84|     39|  else {
   85|     39|    return 0;
   86|     39|  }
   87|     39|}

_Z21libde265_new_decoder2PPvPK27heif_decoder_plugin_options:
  176|     33|{
  177|     33|  libde265_decoder* decoder = new libde265_decoder();
  178|     33|  heif_error err = {heif_error_Ok, heif_suberror_Unspecified, kSuccess};
  179|       |
  180|     33|  decoder->ctx = de265_new_decoder();
  181|       |#if defined(__EMSCRIPTEN__)
  182|       |  // Speed up decoding from JavaScript.
  183|       |  de265_set_parameter_bool(decoder->ctx, DE265_DECODER_PARAM_DISABLE_DEBLOCKING, 1);
  184|       |  de265_set_parameter_bool(decoder->ctx, DE265_DECODER_PARAM_DISABLE_SAO, 1);
  185|       |#else
  186|     33|  int nThreads = (options->num_threads ? options->num_threads : 1);
  ------------------
  |  Branch (186:19): [True: 0, False: 33]
  ------------------
  187|       |
  188|       |  // Worker threads are not supported when running on Emscripten.
  189|     33|  de265_start_worker_threads(decoder->ctx, nThreads);
  190|     33|#endif
  191|       |
  192|     33|  decoder->strict_decoding = options->strict_decoding;
  193|       |
  194|     33|  *dec = decoder;
  195|     33|  return err;
  196|     33|}
_Z27get_decoder_plugin_libde265v:
  502|      2|{
  503|      2|  return &decoder_libde265;
  504|      2|}
decoder_libde265.cc:_ZL20libde265_init_pluginv:
   66|      2|{
   67|      2|  de265_init();
   68|      2|}
decoder_libde265.cc:_ZL28libde265_does_support_format23heif_compression_format:
   78|     39|{
   79|     39|  if (format == heif_compression_HEVC) {
  ------------------
  |  Branch (79:7): [True: 33, False: 6]
  ------------------
   80|     33|    return LIBDE265_PLUGIN_PRIORITY;
   81|     33|  }
   82|      6|  else {
   83|      6|    return 0;
   84|      6|  }
   85|     39|}
decoder_libde265.cc:_ZL21libde265_free_decoderPv:
  210|     33|{
  211|     33|  libde265_decoder* decoder = (libde265_decoder*) decoder_raw;
  212|       |
  213|     33|  de265_error err = de265_free_decoder(decoder->ctx);
  214|     33|  (void) err;
  215|       |
  216|     33|  delete decoder;
  217|     33|}
decoder_libde265.cc:_ZL22libde265_v1_push_data2PvPKvmm:
  303|     18|{
  304|     18|  libde265_decoder* decoder = (libde265_decoder*) decoder_raw;
  305|       |
  306|     18|  const uint8_t* cdata = (const uint8_t*) data;
  307|       |
  308|     18|  size_t ptr = 0;
  309|  46.2k|  while (ptr < size) {
  ------------------
  |  Branch (309:10): [True: 46.2k, False: 0]
  ------------------
  310|  46.2k|    if (4 > size - ptr) {
  ------------------
  |  Branch (310:9): [True: 6, False: 46.2k]
  ------------------
  311|      6|      return {
  312|      6|        heif_error_Decoder_plugin_error,
  313|      6|        heif_suberror_End_of_data,
  314|      6|        kEmptyString
  315|      6|      };
  316|      6|    }
  317|       |
  318|  46.2k|    uint32_t nal_size = static_cast<uint32_t>((cdata[ptr] << 24) | (cdata[ptr + 1] << 16) | (cdata[ptr + 2] << 8) | (cdata[ptr + 3]));
  319|  46.2k|    ptr += 4;
  320|       |
  321|  46.2k|    if (nal_size > size - ptr) {
  ------------------
  |  Branch (321:9): [True: 12, False: 46.2k]
  ------------------
  322|     12|      return {
  323|     12|        heif_error_Decoder_plugin_error,
  324|     12|        heif_suberror_End_of_data,
  325|     12|        kEmptyString
  326|     12|      };
  327|     12|    }
  328|       |
  329|       |#if 0
  330|       |    FILE* fh = fopen("data.h265", "a");
  331|       |    fputc(0, fh);
  332|       |    fputc(0, fh);
  333|       |    fputc(1, fh);
  334|       |    fwrite(cdata + ptr, nal_size, 1, fh);
  335|       |    fclose(fh);
  336|       |
  337|       |    printf("put nal with size %d %x\n", nal_size, *(cdata+ptr));
  338|       |#endif
  339|       |
  340|  46.2k|    de265_push_NAL(decoder->ctx, cdata + ptr, nal_size, 0, (void*)user_data);
  341|  46.2k|    ptr += nal_size;
  342|  46.2k|  }
  343|       |
  344|       |  // TODO(farindk): Set "err" if data could not be pushed
  345|       |  //de265_push_data(decoder->ctx, data, size, 0, nullptr);
  346|       |
  347|      0|  return {heif_error_Ok, heif_suberror_Unspecified, kSuccess};
  348|     18|}

_Z27get_decoder_plugin_openh264v:
  466|      2|{
  467|      2|  return &decoder_openh264;
  468|      2|}
decoder_openh264.cc:_ZL20openh264_init_pluginv:
   95|      2|{
   96|      2|}
decoder_openh264.cc:_ZL28openh264_does_support_format23heif_compression_format:
  105|     39|{
  106|     39|  if (format == heif_compression_AVC) {
  ------------------
  |  Branch (106:7): [True: 0, False: 39]
  ------------------
  107|      0|    return OpenH264_PLUGIN_PRIORITY;
  108|      0|  }
  109|     39|  else {
  110|     39|    return 0;
  111|     39|  }
  112|     39|}

_Z27get_decoder_plugin_openjpegv:
  550|      2|{
  551|      2|  return &decoder_openjpeg;
  552|      2|}
decoder_openjpeg.cc:_ZL20openjpeg_init_pluginv:
   60|      2|{
   61|      2|}
decoder_openjpeg.cc:_ZL28openjpeg_does_support_format23heif_compression_format:
   70|     39|{
   71|     39|  if (format == heif_compression_JPEG2000) {
  ------------------
  |  Branch (71:7): [True: 0, False: 39]
  ------------------
   72|      0|    return OPENJPEG_PLUGIN_PRIORITY;
   73|      0|  }
   74|     39|  else if (format == heif_compression_HTJ2K) {
  ------------------
  |  Branch (74:12): [True: 0, False: 39]
  ------------------
   75|      0|    return OPENJPEG_PLUGIN_PRIORITY_HTJ2K;
   76|      0|  }
   77|     39|  else {
   78|     39|    return 0;
   79|     39|  }
   80|     39|}

_Z31get_decoder_plugin_uncompressedv:
   71|      2|{
   72|      2|  return &decoder_uncompressed;
   73|      2|}
decoder_uncompressed.cc:_ZL32uncompressed_does_support_format23heif_compression_format:
   39|     39|{
   40|     39|  if (format == heif_compression_uncompressed) {
  ------------------
  |  Branch (40:7): [True: 0, False: 39]
  ------------------
   41|      0|    return UNCOMPRESSED_PLUGIN_PRIORITY;
   42|      0|  }
   43|     39|  else {
   44|     39|    return 0;
   45|     39|  }
   46|     39|}

_Z24get_decoder_plugin_vvdecv:
  440|      2|{
  441|      2|  return &decoder_vvdec;
  442|      2|}
decoder_vvdec.cc:_ZL17vvdec_init_pluginv:
   84|      2|{
   85|      2|}
decoder_vvdec.cc:_ZL25vvdec_does_support_format23heif_compression_format:
   94|     39|{
   95|     39|  if (format == heif_compression_VVC) {
  ------------------
  |  Branch (95:7): [True: 0, False: 39]
  ------------------
   96|      0|    return VVDEC_PLUGIN_PRIORITY;
   97|      0|  }
   98|     39|  else {
   99|     39|    return 0;
  100|     39|  }
  101|     39|}

_Z22get_encoder_plugin_aomv:
 1452|      2|{
 1453|      2|  return &encoder_plugin_aom;
 1454|      2|}
encoder_aom.cc:_ZL15aom_init_pluginv:
  416|      2|{
  417|      2|  aom_init_parameters();
  418|      2|}
encoder_aom.cc:_ZL19aom_init_parametersv:
  230|      2|{
  231|      2|  heif_encoder_parameter* p = aom_encoder_params;
  232|      2|  const heif_encoder_parameter** d = aom_encoder_parameter_ptrs;
  233|      2|  int i = 0;
  234|       |
  235|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (235:3): [True: 2, False: 0]
  ------------------
  236|      2|  p->version = 2;
  237|      2|  p->name = kParam_realtime;
  238|      2|  p->type = heif_encoder_parameter_type_boolean;
  239|      2|  p->boolean.default_value = false;
  240|      2|  p->has_default = true;
  241|      2|  d[i++] = p++;
  242|       |
  243|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (243:3): [True: 2, False: 0]
  ------------------
  244|      2|  p->version = 2;
  245|      2|  p->name = kParam_speed;
  246|      2|  p->type = heif_encoder_parameter_type_integer;
  247|      2|  p->integer.default_value = 6;
  248|      2|  p->has_default = true;
  249|      2|  p->integer.have_minimum_maximum = true;
  250|      2|  p->integer.minimum = 0;
  251|      2|  if (aom_codec_version_major() >= 3) {
  ------------------
  |  Branch (251:7): [True: 2, False: 0]
  ------------------
  252|      2|    p->integer.maximum = 9;
  253|      2|  }
  254|      0|  else {
  255|      0|    p->integer.maximum = 8;
  256|      0|  }
  257|      2|  p->integer.valid_values = NULL;
  258|      2|  p->integer.num_valid_values = 0;
  259|      2|  d[i++] = p++;
  260|       |
  261|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (261:3): [True: 2, False: 0]
  ------------------
  262|      2|  p->version = 2;
  263|      2|  p->name = kParam_threads;
  264|      2|  p->type = heif_encoder_parameter_type_integer;
  265|      2|  p->has_default = true;
  266|      2|  p->integer.have_minimum_maximum = true;
  267|      2|  p->integer.minimum = 1;
  268|      2|  p->integer.maximum = 64;
  269|      2|  int threads = static_cast<int>(std::thread::hardware_concurrency());
  270|      2|  if (threads == 0) {
  ------------------
  |  Branch (270:7): [True: 0, False: 2]
  ------------------
  271|       |    // Could not autodetect, use previous default value.
  272|      0|    threads = 4;
  273|      0|  }
  274|      2|  threads = std::min(threads, p->integer.maximum);
  275|      2|  p->integer.default_value = threads;
  276|      2|  p->integer.valid_values = NULL;
  277|      2|  p->integer.num_valid_values = 0;
  278|      2|  d[i++] = p++;
  279|       |
  280|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (280:3): [True: 2, False: 0]
  ------------------
  281|      2|  p->version = 2;
  282|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
  283|      2|  p->type = heif_encoder_parameter_type_integer;
  284|      2|  p->integer.default_value = 50;
  285|      2|  p->has_default = true;
  286|      2|  p->integer.have_minimum_maximum = true;
  287|      2|  p->integer.minimum = 0;
  288|      2|  p->integer.maximum = 100;
  289|      2|  p->integer.valid_values = NULL;
  290|      2|  p->integer.num_valid_values = 0;
  291|      2|  d[i++] = p++;
  292|       |
  293|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (293:3): [True: 2, False: 0]
  ------------------
  294|      2|  p->version = 2;
  295|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  296|      2|  p->type = heif_encoder_parameter_type_boolean;
  297|      2|  p->boolean.default_value = false;
  298|      2|  p->has_default = true;
  299|      2|  d[i++] = p++;
  300|       |
  301|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (301:3): [True: 2, False: 0]
  ------------------
  302|      2|  p->version = 2;
  303|      2|  p->name = kParam_chroma;
  304|      2|  p->type = heif_encoder_parameter_type_string;
  305|      2|  p->string.default_value = "420";
  306|      2|  p->has_default = true;
  307|      2|  p->string.valid_values = kParam_chroma_valid_values;
  308|      2|  d[i++] = p++;
  309|       |
  310|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (310:3): [True: 2, False: 0]
  ------------------
  311|      2|  p->version = 2;
  312|      2|  p->name = kParam_tune;
  313|      2|  p->type = heif_encoder_parameter_type_string;
  314|      2|  p->string.default_value = "auto";
  315|      2|  p->has_default = true;
  316|      2|  p->string.valid_values = kParam_tune_valid_values;
  317|      2|  d[i++] = p++;
  318|       |
  319|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (319:3): [True: 2, False: 0]
  ------------------
  320|      2|  p->version = 2;
  321|      2|  p->name = kParam_min_q;
  322|      2|  p->type = heif_encoder_parameter_type_integer;
  323|      2|  p->integer.default_value = 0;
  324|      2|  p->has_default = true;
  325|      2|  p->integer.have_minimum_maximum = true;
  326|      2|  p->integer.minimum = 0;
  327|      2|  p->integer.maximum = 63;
  328|      2|  p->integer.valid_values = NULL;
  329|      2|  p->integer.num_valid_values = 0;
  330|      2|  d[i++] = p++;
  331|       |
  332|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (332:3): [True: 2, False: 0]
  ------------------
  333|      2|  p->version = 2;
  334|      2|  p->name = kParam_max_q;
  335|      2|  p->type = heif_encoder_parameter_type_integer;
  336|      2|  p->integer.default_value = 63;
  337|      2|  p->has_default = true;
  338|      2|  p->integer.have_minimum_maximum = true;
  339|      2|  p->integer.minimum = 0;
  340|      2|  p->integer.maximum = 63;
  341|      2|  p->integer.valid_values = NULL;
  342|      2|  p->integer.num_valid_values = 0;
  343|      2|  d[i++] = p++;
  344|       |
  345|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (345:3): [True: 2, False: 0]
  ------------------
  346|      2|  p->version = 2;
  347|      2|  p->name = kParam_alpha_quality;
  348|      2|  p->type = heif_encoder_parameter_type_integer;
  349|      2|  p->has_default = false;
  350|      2|  p->integer.have_minimum_maximum = true;
  351|      2|  p->integer.minimum = 0;
  352|      2|  p->integer.maximum = 100;
  353|      2|  p->integer.valid_values = NULL;
  354|      2|  p->integer.num_valid_values = 0;
  355|      2|  d[i++] = p++;
  356|       |
  357|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (357:3): [True: 2, False: 0]
  ------------------
  358|      2|  p->version = 2;
  359|      2|  p->name = kParam_alpha_min_q;
  360|      2|  p->type = heif_encoder_parameter_type_integer;
  361|      2|  p->has_default = false;
  362|      2|  p->integer.have_minimum_maximum = true;
  363|      2|  p->integer.minimum = 0;
  364|      2|  p->integer.maximum = 63;
  365|      2|  p->integer.valid_values = NULL;
  366|      2|  p->integer.num_valid_values = 0;
  367|      2|  d[i++] = p++;
  368|       |
  369|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (369:3): [True: 2, False: 0]
  ------------------
  370|      2|  p->version = 2;
  371|      2|  p->name = kParam_alpha_max_q;
  372|      2|  p->type = heif_encoder_parameter_type_integer;
  373|      2|  p->has_default = false;
  374|      2|  p->integer.have_minimum_maximum = true;
  375|      2|  p->integer.minimum = 0;
  376|      2|  p->integer.maximum = 63;
  377|      2|  p->integer.valid_values = NULL;
  378|      2|  p->integer.num_valid_values = 0;
  379|      2|  d[i++] = p++;
  380|       |
  381|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (381:3): [True: 2, False: 0]
  ------------------
  382|      2|  p->version = 2;
  383|      2|  p->name = kParam_lossless_alpha;
  384|      2|  p->type = heif_encoder_parameter_type_boolean;
  385|      2|  p->boolean.default_value = false;
  386|      2|  p->has_default = true;
  387|      2|  d[i++] = p++;
  388|       |
  389|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (389:3): [True: 2, False: 0]
  ------------------
  390|      2|  p->version = 2;
  391|      2|  p->name = kParam_auto_tiles;
  392|      2|  p->type = heif_encoder_parameter_type_boolean;
  393|      2|  p->boolean.default_value = false;
  394|      2|  p->has_default = true;
  395|      2|  d[i++] = p++;
  396|       |
  397|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (397:3): [True: 2, False: 0]
  ------------------
  398|      2|  p->version = 2;
  399|      2|  p->name = kParam_enable_intra_block_copy;
  400|      2|  p->type = heif_encoder_parameter_type_boolean;
  401|      2|  p->boolean.default_value = true;
  402|      2|  p->has_default = true;
  403|      2|  d[i++] = p++;
  404|       |
  405|      2|  assert(i < MAX_NPARAMETERS + 1);
  ------------------
  |  Branch (405:3): [True: 2, False: 0]
  ------------------
  406|      2|  d[i++] = nullptr;
  407|      2|}

_Z23get_encoder_plugin_jpegv:
  522|      2|{
  523|      2|  return &encoder_plugin_jpeg;
  524|      2|}
encoder_jpeg.cc:_ZL16jpeg_init_pluginv:
  117|      2|{
  118|      2|  jpeg_init_parameters();
  119|      2|}
encoder_jpeg.cc:_ZL20jpeg_init_parametersv:
   79|      2|{
   80|      2|  heif_encoder_parameter* p = jpeg_encoder_params;
   81|      2|  const heif_encoder_parameter** d = jpeg_encoder_parameter_ptrs;
   82|      2|  int i = 0;
   83|       |
   84|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (84:3): [True: 2, False: 0]
  ------------------
   85|      2|  p->version = 2;
   86|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
   87|      2|  p->type = heif_encoder_parameter_type_integer;
   88|      2|  p->integer.default_value = 50;
   89|      2|  p->has_default = true;
   90|      2|  p->integer.have_minimum_maximum = true;
   91|      2|  p->integer.minimum = 0;
   92|      2|  p->integer.maximum = 100;
   93|      2|  p->integer.valid_values = NULL;
   94|      2|  p->integer.num_valid_values = 0;
   95|      2|  d[i++] = p++;
   96|       |
   97|       |  /*
   98|       |  assert(i < MAX_NPARAMETERS);
   99|       |  p->version = 2;
  100|       |  p->name = heif_encoder_parameter_name_lossless;
  101|       |  p->type = heif_encoder_parameter_type_boolean;
  102|       |  p->boolean.default_value = false;
  103|       |  p->has_default = true;
  104|       |  d[i++] = p++;
  105|       |*/
  106|       |
  107|      2|  d[i++] = nullptr;
  108|      2|}

_Z23get_encoder_plugin_maskv:
  293|      2|{
  294|      2|  return &encoder_plugin_mask;
  295|      2|}
encoder_mask.cc:_ZL16mask_init_pluginv:
   80|      2|{
   81|      2|  mask_init_parameters();
   82|      2|}
encoder_mask.cc:_ZL20mask_init_parametersv:
   56|      2|{
   57|      2|  heif_encoder_parameter* p = mask_encoder_params;
   58|      2|  const heif_encoder_parameter** d = mask_encoder_parameter_ptrs;
   59|      2|  int i = 0;
   60|       |
   61|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (61:3): [True: 2, False: 0]
  ------------------
   62|      2|  p->version = 2;
   63|      2|  p->name = kParam_interleave;
   64|      2|  p->type = heif_encoder_parameter_type_string;
   65|      2|  p->string.default_value = "planar";
   66|      2|  p->has_default = true;
   67|      2|  d[i++] = p++;
   68|       |
   69|      2|  assert(i < MAX_NPARAMETERS + 1);
  ------------------
  |  Branch (69:3): [True: 2, False: 0]
  ------------------
   70|      2|  d[i++] = nullptr;
   71|      2|}

_Z15opj_init_pluginv:
  112|      2|{
  113|      2|  opj_init_parameters();
  114|      2|}
_Z27get_encoder_plugin_openjpegv:
  673|      2|{
  674|      2|  return &encoder_plugin_openjpeg;
  675|      2|}
encoder_openjpeg.cc:_ZL19opj_init_parametersv:
   94|      2|{
   95|      2|  heif_encoder_parameter* p = opj_encoder_params;
   96|      2|  const heif_encoder_parameter** d = opj_encoder_parameter_ptrs;
   97|      2|  int i = 0;
   98|       |
   99|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (99:3): [True: 2, False: 0]
  ------------------
  100|      2|  p->version = 2;
  101|      2|  p->name = kParam_chroma;
  102|      2|  p->type = heif_encoder_parameter_type_string;
  103|       |  //p->string.default_value = "420";
  104|      2|  p->has_default = false;
  105|      2|  p->string.valid_values = kParam_chroma_valid_values;
  106|      2|  d[i++] = p++;
  107|       |
  108|      2|  d[i++] = nullptr;
  109|      2|}

_Z16ojph_init_pluginv:
  231|      2|{
  232|      2|  ojph_init_encoder_parameters();
  233|      2|}
_Z26get_encoder_plugin_openjphv:
  935|      2|{
  936|      2|  return &encoder_plugin_openjph;
  937|      2|}
encoder_openjph.cc:_ZL28ojph_init_encoder_parametersv:
  134|      2|{
  135|      2|  heif_encoder_parameter* p = ojph_encoder_params;
  136|      2|  const heif_encoder_parameter** d = ojph_encoder_parameter_ptrs;
  137|      2|  int i = 0;
  138|       |
  139|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (139:3): [True: 2, False: 0]
  ------------------
  140|      2|  p->version = 2;
  141|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  142|      2|  p->type = heif_encoder_parameter_type_boolean;
  143|      2|  p->boolean.default_value = false;
  144|      2|  p->has_default = true;
  145|      2|  d[i++] = p++;
  146|       |
  147|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (147:3): [True: 2, False: 0]
  ------------------
  148|      2|  p->version = 2;
  149|      2|  p->name = kParam_chroma;
  150|      2|  p->type = heif_encoder_parameter_type_string;
  151|      2|  p->string.default_value = "444";
  152|      2|  p->has_default = true;
  153|      2|  p->string.valid_values = kParam_chroma_valid_values;
  154|      2|  d[i++] = p++;
  155|       |
  156|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (156:3): [True: 2, False: 0]
  ------------------
  157|      2|  p->version = 2;
  158|      2|  p->name = kParam_num_decompositions;
  159|      2|  p->type = heif_encoder_parameter_type_integer;
  160|      2|  p->integer.default_value = 5;
  161|      2|  p->integer.have_minimum_maximum = true;
  162|      2|  p->integer.minimum = NUM_DECOMPOSITIONS_MIN;
  163|      2|  p->integer.maximum = NUM_DECOMPOSITIONS_MAX;
  164|      2|  p->integer.valid_values = NULL;
  165|      2|  p->integer.num_valid_values = 0;
  166|      2|  p->has_default = true;
  167|      2|  d[i++] = p++;
  168|       |
  169|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (169:3): [True: 2, False: 0]
  ------------------
  170|      2|  p->version = 2;
  171|      2|  p->name = kParam_progression_order;
  172|      2|  p->type = heif_encoder_parameter_type_string;
  173|      2|  p->string.default_value = "RPCL";
  174|      2|  p->has_default = true;
  175|      2|  p->string.valid_values = kParam_progression_order_valid_values;
  176|      2|  d[i++] = p++;
  177|       |
  178|       |#if OPENJPH_MAJOR_VERSION > 1 || OPENJPH_MINOR_VERSION > 10
  179|       |  assert(i < MAX_NPARAMETERS);
  180|       |  p->version = 2;
  181|       |  p->name = kParam_tlm_marker;
  182|       |  p->type = heif_encoder_parameter_type_boolean;
  183|       |  p->boolean.default_value = false;
  184|       |  p->has_default = true;
  185|       |  d[i++] = p++;
  186|       |#endif
  187|       |
  188|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (188:3): [True: 2, False: 0]
  ------------------
  189|      2|  p->version = 2;
  190|      2|  p->name = kParam_codestream_comment;
  191|      2|  p->type = heif_encoder_parameter_type_string;
  192|      2|  p->string.default_value = nullptr;
  193|      2|  p->has_default = false;
  194|      2|  p->string.valid_values = nullptr;
  195|      2|  d[i++] = p++;
  196|       |
  197|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (197:3): [True: 2, False: 0]
  ------------------
  198|      2|  p->version = 2;
  199|      2|  p->name = kParam_tile_size;
  200|      2|  p->type = heif_encoder_parameter_type_string;
  201|      2|  p->string.default_value = "0,0";
  202|      2|  p->has_default = true;
  203|      2|  p->string.valid_values = nullptr;
  204|      2|  d[i++] = p++;
  205|       |
  206|       |#if OPENJPH_MAJOR_VERSION > 1 || OPENJPH_MINOR_VERSION > 11
  207|       |  assert(i < MAX_NPARAMETERS);
  208|       |  p->version = 2;
  209|       |  p->name = kParam_tilepart_division;
  210|       |  p->type = heif_encoder_parameter_type_string;
  211|       |  p->string.default_value = "none";
  212|       |  p->has_default = true;
  213|       |  p->string.valid_values = kParam_tilepart_division_valid_values;
  214|       |  d[i++] = p++;
  215|       |#endif
  216|       |
  217|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (217:3): [True: 2, False: 0]
  ------------------
  218|      2|  p->version = 2;
  219|      2|  p->name = kParam_block_dimensions;
  220|      2|  p->type = heif_encoder_parameter_type_string;
  221|      2|  p->string.default_value = "64,64";
  222|      2|  p->has_default = true;
  223|      2|  p->string.valid_values = nullptr;
  224|      2|  d[i++] = p++;
  225|       |
  226|      2|  d[i++] = nullptr;
  227|      2|}

_Z22get_encoder_plugin_svtv:
 1277|      2|{
 1278|      2|  return &encoder_plugin_svt;
 1279|      2|}
encoder_svt.cc:_ZL15svt_init_pluginv:
  324|      2|{
  325|      2|  svt_init_parameters();
  326|      2|}
encoder_svt.cc:_ZL19svt_init_parametersv:
  176|      2|{
  177|      2|  heif_encoder_parameter* p = svt_encoder_params;
  178|      2|  const heif_encoder_parameter** d = svt_encoder_parameter_ptrs;
  179|      2|  int i = 0;
  180|       |
  181|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (181:3): [True: 2, False: 0]
  ------------------
  182|      2|  p->version = 2;
  183|      2|  p->name = kParam_speed;
  184|      2|  p->type = heif_encoder_parameter_type_integer;
  185|      2|  p->integer.default_value = 12;
  186|      2|  p->has_default = true;
  187|      2|  p->integer.have_minimum_maximum = true;
  188|      2|  p->integer.minimum = 0;
  189|      2|  p->integer.maximum = 13;
  190|      2|  p->integer.valid_values = nullptr;
  191|      2|  p->integer.num_valid_values = 0;
  192|      2|  d[i++] = p++;
  193|       |
  194|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (194:3): [True: 2, False: 0]
  ------------------
  195|      2|  p->version = 2;
  196|      2|  p->name = kParam_threads;
  197|      2|  p->type = heif_encoder_parameter_type_integer;
  198|      2|  p->integer.default_value = 4;
  199|      2|  p->has_default = true;
  200|      2|  p->integer.have_minimum_maximum = true;
  201|      2|  p->integer.minimum = 1;
  202|      2|  p->integer.maximum = 16;
  203|      2|  p->integer.valid_values = nullptr;
  204|      2|  p->integer.num_valid_values = 0;
  205|      2|  d[i++] = p++;
  206|       |
  207|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (207:3): [True: 2, False: 0]
  ------------------
  208|      2|  p->version = 2;
  209|      2|  p->name = "tile-rows";
  210|      2|  p->type = heif_encoder_parameter_type_integer;
  211|      2|  p->integer.default_value = 4;
  212|      2|  p->has_default = true;
  213|      2|  p->integer.have_minimum_maximum = false;
  214|      2|  p->integer.valid_values = valid_tile_num_values;
  215|      2|  p->integer.num_valid_values = 7;
  216|      2|  d[i++] = p++;
  217|       |
  218|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (218:3): [True: 2, False: 0]
  ------------------
  219|      2|  p->version = 2;
  220|      2|  p->name = "tile-cols";
  221|      2|  p->type = heif_encoder_parameter_type_integer;
  222|      2|  p->integer.default_value = 4;
  223|      2|  p->has_default = true;
  224|      2|  p->integer.have_minimum_maximum = false;
  225|      2|  p->integer.valid_values = valid_tile_num_values;
  226|      2|  p->integer.num_valid_values = 7;
  227|      2|  d[i++] = p++;
  228|       |
  229|       |
  230|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (230:3): [True: 2, False: 0]
  ------------------
  231|      2|  p->version = 2;
  232|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
  233|      2|  p->type = heif_encoder_parameter_type_integer;
  234|      2|  p->integer.default_value = 50;
  235|      2|  p->has_default = true;
  236|      2|  p->integer.have_minimum_maximum = true;
  237|      2|  p->integer.minimum = 0;
  238|      2|  p->integer.maximum = 100;
  239|      2|  p->integer.valid_values = NULL;
  240|      2|  p->integer.num_valid_values = 0;
  241|      2|  d[i++] = p++;
  242|       |
  243|      2|#if SVT_AV1_CHECK_VERSION(3, 0, 0)
  244|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (244:3): [True: 2, False: 0]
  ------------------
  245|      2|  p->version = 2;
  246|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  247|      2|  p->type = heif_encoder_parameter_type_boolean;
  248|      2|  p->boolean.default_value = false;
  249|      2|  p->has_default = true;
  250|      2|  d[i++] = p++;
  251|      2|#endif
  252|       |
  253|       |#if 0
  254|       |  assert(i < MAX_NPARAMETERS);
  255|       |  p->version = 2;
  256|       |  p->name = kParam_chroma;
  257|       |  p->type = heif_encoder_parameter_type_string;
  258|       |  p->string.default_value = "420";
  259|       |  p->has_default = true;
  260|       |  p->string.valid_values = kParam_chroma_valid_values;
  261|       |  d[i++] = p++;
  262|       |#endif
  263|       |
  264|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (264:3): [True: 2, False: 0]
  ------------------
  265|      2|  p->version = 2;
  266|      2|  p->name = kParam_qp;
  267|      2|  p->type = heif_encoder_parameter_type_integer;
  268|      2|  p->integer.default_value = 50;
  269|      2|  p->has_default = false;
  270|      2|  p->integer.have_minimum_maximum = true;
  271|      2|  p->integer.minimum = 0;
  272|      2|  p->integer.maximum = 63;
  273|      2|  p->integer.valid_values = nullptr;
  274|      2|  p->integer.num_valid_values = 0;
  275|      2|  d[i++] = p++;
  276|       |
  277|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (277:3): [True: 2, False: 0]
  ------------------
  278|      2|  p->version = 2;
  279|      2|  p->name = kParam_min_q;
  280|      2|  p->type = heif_encoder_parameter_type_integer;
  281|      2|  p->integer.default_value = 0;
  282|      2|  p->has_default = true;
  283|      2|  p->integer.have_minimum_maximum = true;
  284|      2|  p->integer.minimum = 0;
  285|      2|  p->integer.maximum = 63;
  286|      2|  p->integer.valid_values = nullptr;
  287|      2|  p->integer.num_valid_values = 0;
  288|      2|  d[i++] = p++;
  289|       |
  290|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (290:3): [True: 2, False: 0]
  ------------------
  291|      2|  p->version = 2;
  292|      2|  p->name = kParam_max_q;
  293|      2|  p->type = heif_encoder_parameter_type_integer;
  294|      2|  p->integer.default_value = 63;
  295|      2|  p->has_default = true;
  296|      2|  p->integer.have_minimum_maximum = true;
  297|      2|  p->integer.minimum = 0;
  298|      2|  p->integer.maximum = 63;
  299|      2|  p->integer.valid_values = nullptr;
  300|      2|  p->integer.num_valid_values = 0;
  301|      2|  d[i++] = p++;
  302|       |
  303|      2|#if SVT_AV1_CHECK_VERSION(0, 9, 1)
  304|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (304:3): [True: 2, False: 0]
  ------------------
  305|      2|  p->version = 2;
  306|      2|  p->name = kParam_tune;
  307|      2|  p->type = heif_encoder_parameter_type_string;
  308|      2|  p->string.default_value = "psnr";
  309|      2|  p->has_default = true;
  310|      2|  p->string.valid_values = kParam_tune_valid_values;
  311|      2|  d[i++] = p++;
  312|      2|#endif
  313|       |
  314|      2|  d[i++] = nullptr;
  315|      2|}

_Z31get_encoder_plugin_uncompressedv:
  359|      2|{
  360|      2|  return &encoder_plugin_uncompressed;
  361|      2|}
encoder_uncompressed.cc:_ZL24uncompressed_init_pluginv:
   80|      2|{
   81|      2|  uncompressed_init_parameters();
   82|      2|}
encoder_uncompressed.cc:_ZL28uncompressed_init_parametersv:
   56|      2|{
   57|      2|  heif_encoder_parameter* p = uncompressed_encoder_params;
   58|      2|  const heif_encoder_parameter** d = uncompressed_encoder_parameter_ptrs;
   59|      2|  int i = 0;
   60|       |
   61|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (61:3): [True: 2, False: 0]
  ------------------
   62|      2|  p->version = 2;
   63|      2|  p->name = kParam_interleave;
   64|      2|  p->type = heif_encoder_parameter_type_string;
   65|      2|  p->string.default_value = "planar";
   66|      2|  p->has_default = true;
   67|      2|  d[i++] = p++;
   68|       |
   69|      2|  assert(i < MAX_NPARAMETERS + 1);
  ------------------
  |  Branch (69:3): [True: 2, False: 0]
  ------------------
   70|      2|  d[i++] = nullptr;
   71|      2|}

_Z24get_encoder_plugin_vvencv:
  875|      2|{
  876|      2|  return &encoder_plugin_vvenc;
  877|      2|}
encoder_vvenc.cc:_ZL17vvenc_init_pluginv:
  138|      2|{
  139|      2|  vvenc_init_parameters();
  140|      2|}
encoder_vvenc.cc:_ZL21vvenc_init_parametersv:
  101|      2|{
  102|      2|  heif_encoder_parameter* p = vvenc_encoder_params;
  103|      2|  const heif_encoder_parameter** d = vvenc_encoder_parameter_ptrs;
  104|      2|  int i = 0;
  105|       |
  106|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (106:3): [True: 2, False: 0]
  ------------------
  107|      2|  p->version = 2;
  108|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
  109|      2|  p->type = heif_encoder_parameter_type_integer;
  110|      2|  p->integer.default_value = 50;
  111|      2|  p->has_default = true;
  112|      2|  p->integer.have_minimum_maximum = true;
  113|      2|  p->integer.minimum = 0;
  114|      2|  p->integer.maximum = 100;
  115|      2|  p->integer.valid_values = NULL;
  116|      2|  p->integer.num_valid_values = 0;
  117|      2|  d[i++] = p++;
  118|       |
  119|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (119:3): [True: 2, False: 0]
  ------------------
  120|      2|  p->version = 2;
  121|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  122|      2|  p->type = heif_encoder_parameter_type_boolean;
  123|      2|  p->boolean.default_value = false;
  124|      2|  p->has_default = true;
  125|      2|  d[i++] = p++;
  126|       |
  127|      2|  d[i++] = nullptr;
  128|      2|}

_Z23get_encoder_plugin_x264v:
 1227|      2|{
 1228|      2|  return &encoder_plugin_x264;
 1229|      2|}
encoder_x264.cc:_ZL16x264_init_pluginv:
  368|      2|{
  369|      2|  x264_init_parameters();
  370|      2|}
encoder_x264.cc:_ZL20x264_init_parametersv:
  278|      2|{
  279|      2|  heif_encoder_parameter* p = x264_encoder_params;
  280|      2|  const heif_encoder_parameter** d = x264_encoder_parameter_ptrs;
  281|      2|  int i = 0;
  282|       |
  283|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (283:3): [True: 2, False: 0]
  ------------------
  284|      2|  p->version = 2;
  285|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
  286|      2|  p->type = heif_encoder_parameter_type_integer;
  287|      2|  p->integer.default_value = 50;
  288|      2|  p->has_default = true;
  289|      2|  p->integer.have_minimum_maximum = true;
  290|      2|  p->integer.minimum = 0;
  291|      2|  p->integer.maximum = 100;
  292|      2|  p->integer.valid_values = NULL;
  293|      2|  p->integer.num_valid_values = 0;
  294|      2|  d[i++] = p++;
  295|       |
  296|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (296:3): [True: 2, False: 0]
  ------------------
  297|      2|  p->version = 2;
  298|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  299|      2|  p->type = heif_encoder_parameter_type_boolean;
  300|      2|  p->boolean.default_value = false;
  301|      2|  p->has_default = true;
  302|      2|  d[i++] = p++;
  303|       |
  304|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (304:3): [True: 2, False: 0]
  ------------------
  305|      2|  p->version = 2;
  306|      2|  p->name = kParam_preset;
  307|      2|  p->type = heif_encoder_parameter_type_string;
  308|      2|  p->string.default_value = "slow";  // increases computation time
  309|      2|  p->has_default = true;
  310|      2|  p->string.valid_values = kParam_preset_valid_values;
  311|      2|  d[i++] = p++;
  312|       |
  313|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (313:3): [True: 2, False: 0]
  ------------------
  314|      2|  p->version = 2;
  315|      2|  p->name = kParam_tune;
  316|      2|  p->type = heif_encoder_parameter_type_string;
  317|      2|  p->string.default_value = "ssim";
  318|      2|  p->has_default = true;
  319|      2|  p->string.valid_values = kParam_tune_valid_values;
  320|      2|  d[i++] = p++;
  321|       |
  322|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (322:3): [True: 2, False: 0]
  ------------------
  323|      2|  p->version = 2;
  324|      2|  p->name = kParam_TU_intra_depth;
  325|      2|  p->type = heif_encoder_parameter_type_integer;
  326|      2|  p->integer.default_value = 2;  // increases computation time
  327|      2|  p->has_default = true;
  328|      2|  p->integer.have_minimum_maximum = true;
  329|      2|  p->integer.minimum = 1;
  330|      2|  p->integer.maximum = 4;
  331|      2|  p->integer.valid_values = NULL;
  332|      2|  p->integer.num_valid_values = 0;
  333|      2|  d[i++] = p++;
  334|       |
  335|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (335:3): [True: 2, False: 0]
  ------------------
  336|      2|  p->version = 2;
  337|      2|  p->name = kParam_complexity;
  338|      2|  p->type = heif_encoder_parameter_type_integer;
  339|      2|  p->integer.default_value = 50;
  340|      2|  p->has_default = false;
  341|      2|  p->integer.have_minimum_maximum = true;
  342|      2|  p->integer.minimum = 0;
  343|      2|  p->integer.maximum = 100;
  344|      2|  p->integer.valid_values = NULL;
  345|      2|  p->integer.num_valid_values = 0;
  346|      2|  d[i++] = p++;
  347|       |
  348|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (348:3): [True: 2, False: 0]
  ------------------
  349|      2|  p->version = 2;
  350|      2|  p->name = kParam_chroma;
  351|      2|  p->type = heif_encoder_parameter_type_string;
  352|      2|  p->string.default_value = "420";
  353|      2|  p->has_default = true;
  354|      2|  p->string.valid_values = kParam_chroma_valid_values;
  355|      2|  d[i++] = p++;
  356|       |
  357|      2|  d[i++] = nullptr;
  358|      2|}

_Z23get_encoder_plugin_x265v:
 1287|      2|{
 1288|      2|  return &encoder_plugin_x265;
 1289|      2|}
encoder_x265.cc:_ZL16x265_init_pluginv:
  310|      2|{
  311|      2|  x265_init_parameters();
  312|      2|}
encoder_x265.cc:_ZL20x265_init_parametersv:
  220|      2|{
  221|      2|  heif_encoder_parameter* p = x265_encoder_params;
  222|      2|  const heif_encoder_parameter** d = x265_encoder_parameter_ptrs;
  223|      2|  int i = 0;
  224|       |
  225|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (225:3): [True: 2, False: 0]
  ------------------
  226|      2|  p->version = 2;
  227|      2|  p->name = heif_encoder_parameter_name_quality;
  ------------------
  |  |  317|      2|#define heif_encoder_parameter_name_quality  "quality"
  ------------------
  228|      2|  p->type = heif_encoder_parameter_type_integer;
  229|      2|  p->integer.default_value = 50;
  230|      2|  p->has_default = true;
  231|      2|  p->integer.have_minimum_maximum = true;
  232|      2|  p->integer.minimum = 0;
  233|      2|  p->integer.maximum = 100;
  234|      2|  p->integer.valid_values = NULL;
  235|      2|  p->integer.num_valid_values = 0;
  236|      2|  d[i++] = p++;
  237|       |
  238|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (238:3): [True: 2, False: 0]
  ------------------
  239|      2|  p->version = 2;
  240|      2|  p->name = heif_encoder_parameter_name_lossless;
  ------------------
  |  |  318|      2|#define heif_encoder_parameter_name_lossless "lossless"
  ------------------
  241|      2|  p->type = heif_encoder_parameter_type_boolean;
  242|      2|  p->boolean.default_value = false;
  243|      2|  p->has_default = true;
  244|      2|  d[i++] = p++;
  245|       |
  246|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (246:3): [True: 2, False: 0]
  ------------------
  247|      2|  p->version = 2;
  248|      2|  p->name = kParam_preset;
  249|      2|  p->type = heif_encoder_parameter_type_string;
  250|      2|  p->string.default_value = "slow";  // increases computation time
  251|      2|  p->has_default = true;
  252|      2|  p->string.valid_values = kParam_preset_valid_values;
  253|      2|  d[i++] = p++;
  254|       |
  255|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (255:3): [True: 2, False: 0]
  ------------------
  256|      2|  p->version = 2;
  257|      2|  p->name = kParam_tune;
  258|      2|  p->type = heif_encoder_parameter_type_string;
  259|      2|  p->string.default_value = "ssim";
  260|      2|  p->has_default = true;
  261|      2|  p->string.valid_values = kParam_tune_valid_values;
  262|      2|  d[i++] = p++;
  263|       |
  264|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (264:3): [True: 2, False: 0]
  ------------------
  265|      2|  p->version = 2;
  266|      2|  p->name = kParam_TU_intra_depth;
  267|      2|  p->type = heif_encoder_parameter_type_integer;
  268|      2|  p->integer.default_value = 2;  // increases computation time
  269|      2|  p->has_default = true;
  270|      2|  p->integer.have_minimum_maximum = true;
  271|      2|  p->integer.minimum = 1;
  272|      2|  p->integer.maximum = 4;
  273|      2|  p->integer.valid_values = NULL;
  274|      2|  p->integer.num_valid_values = 0;
  275|      2|  d[i++] = p++;
  276|       |
  277|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (277:3): [True: 2, False: 0]
  ------------------
  278|      2|  p->version = 2;
  279|      2|  p->name = kParam_complexity;
  280|      2|  p->type = heif_encoder_parameter_type_integer;
  281|      2|  p->integer.default_value = 50;
  282|      2|  p->has_default = false;
  283|      2|  p->integer.have_minimum_maximum = true;
  284|      2|  p->integer.minimum = 0;
  285|      2|  p->integer.maximum = 100;
  286|      2|  p->integer.valid_values = NULL;
  287|      2|  p->integer.num_valid_values = 0;
  288|      2|  d[i++] = p++;
  289|       |
  290|      2|  assert(i < MAX_NPARAMETERS);
  ------------------
  |  Branch (290:3): [True: 2, False: 0]
  ------------------
  291|      2|  p->version = 2;
  292|      2|  p->name = kParam_chroma;
  293|      2|  p->type = heif_encoder_parameter_type_string;
  294|      2|  p->string.default_value = "420";
  295|      2|  p->has_default = true;
  296|      2|  p->string.valid_values = kParam_chroma_valid_values;
  297|      2|  d[i++] = p++;
  298|       |
  299|      2|  d[i++] = nullptr;
  300|      2|}

_Z30max_coding_unit_size_for_codec23heif_compression_format:
   68|     42|{
   69|     42|  switch (format) {
   70|      9|    case heif_compression_AV1:      return 128;  // AV1 max superblock
  ------------------
  |  Branch (70:5): [True: 9, False: 33]
  ------------------
   71|      0|    case heif_compression_VVC:      return 128;  // VVC max CTU
  ------------------
  |  Branch (71:5): [True: 0, False: 42]
  ------------------
   72|     33|    case heif_compression_HEVC:     return 64;   // HEVC max CTU
  ------------------
  |  Branch (72:5): [True: 33, False: 9]
  ------------------
   73|      0|    case heif_compression_AVC:      return 16;   // H.264 macroblock
  ------------------
  |  Branch (73:5): [True: 0, False: 42]
  ------------------
   74|      0|    case heif_compression_JPEG:     return 16;   // JPEG MCU (4:2:0)
  ------------------
  |  Branch (74:5): [True: 0, False: 42]
  ------------------
   75|      0|    case heif_compression_JPEG2000: return 64;
  ------------------
  |  Branch (75:5): [True: 0, False: 42]
  ------------------
   76|      0|    case heif_compression_HTJ2K:    return 64;
  ------------------
  |  Branch (76:5): [True: 0, False: 42]
  ------------------
   77|      0|    default:                        return 0;
  ------------------
  |  Branch (77:5): [True: 0, False: 42]
  ------------------
   78|     42|  }
   79|     42|}
_Z33tighten_image_size_limit_for_ispePK20heif_security_limitsjjj:
   86|     42|{
   87|     42|  heif_security_limits result = *base;
   88|       |
   89|     42|  if (ispe_width == 0 || ispe_height == 0) {
  ------------------
  |  Branch (89:7): [True: 34, False: 8]
  |  Branch (89:26): [True: 0, False: 8]
  ------------------
   90|     34|    return result;
   91|     34|  }
   92|       |
   93|      8|  uint64_t allowed = (static_cast<uint64_t>(ispe_width)  + coding_unit_size) *
   94|      8|                     (static_cast<uint64_t>(ispe_height) + coding_unit_size);
   95|       |
   96|      8|  if (result.max_image_size_pixels == 0 || allowed < result.max_image_size_pixels) {
  ------------------
  |  Branch (96:7): [True: 0, False: 8]
  |  Branch (96:44): [True: 8, False: 0]
  ------------------
   97|      8|    result.max_image_size_pixels = allowed;
   98|      8|  }
   99|      8|  return result;
  100|     42|}
_Z26check_for_valid_image_sizePK20heif_security_limitsjj:
  104|     50|{
  105|     50|  uint64_t maximum_image_size_limit = limits->max_image_size_pixels;
  106|       |
  107|       |  // --- check whether the image size is "too large"
  108|       |
  109|     50|  if (maximum_image_size_limit > 0) {
  ------------------
  |  Branch (109:7): [True: 50, False: 0]
  ------------------
  110|     50|    auto max_width_height = static_cast<uint32_t>(std::numeric_limits<int>::max());
  111|     50|    if ((width > max_width_height || height > max_width_height) ||
  ------------------
  |  Branch (111:10): [True: 0, False: 50]
  |  Branch (111:38): [True: 0, False: 50]
  ------------------
  112|     50|        (height != 0 && width > maximum_image_size_limit / height)) {
  ------------------
  |  Branch (112:10): [True: 50, False: 0]
  |  Branch (112:25): [True: 2, False: 48]
  ------------------
  113|      2|      std::stringstream sstr;
  114|      2|      sstr << "Image size " << width << "x" << height << " exceeds the maximum image size "
  115|      2|           << maximum_image_size_limit << "\n";
  116|       |
  117|      2|      return {heif_error_Memory_allocation_error,
  118|      2|              heif_suberror_Security_limit_exceeded,
  119|      2|              sstr.str()};
  120|      2|    }
  121|     50|  }
  122|       |
  123|     48|  if (width == 0 || height == 0) {
  ------------------
  |  Branch (123:7): [True: 0, False: 48]
  |  Branch (123:21): [True: 0, False: 48]
  ------------------
  124|      0|    return {heif_error_Memory_allocation_error,
  125|      0|            heif_suberror_Invalid_image_size,
  126|      0|            "zero width or height"};
  127|      0|  }
  128|       |
  129|     48|  return Error::Ok;
  130|     48|}
_Z22get_memory_usage_mutexv:
  139|    494|{
  140|    494|  static std::mutex sMutex;
  141|    494|  return sMutex;
  142|    494|}
_ZN18TotalMemoryTrackerC2EPK20heif_security_limits:
  147|     34|{
  148|     34|  std::lock_guard<std::mutex> lock(get_memory_usage_mutex());
  149|       |
  150|     34|  sMemoryUsage[limits] = {};
  151|     34|  m_limits_context = limits;
  152|     34|}
_ZN18TotalMemoryTrackerD2Ev:
  155|     34|{
  156|     34|  std::lock_guard<std::mutex> lock(get_memory_usage_mutex());
  157|     34|  sMemoryUsage.erase(m_limits_context);
  158|     34|}
_ZN12MemoryHandle5allocEmPK20heif_security_limitsPKc:
  178|    225|{
  179|       |  // we allow several allocations on the same handle, but they have to be for the same context
  180|    225|  if (m_limits_context) {
  ------------------
  |  Branch (180:7): [True: 20, False: 205]
  ------------------
  181|     20|    assert(m_limits_context == limits_context);
  ------------------
  |  Branch (181:5): [True: 20, False: 0]
  ------------------
  182|     20|  }
  183|       |
  184|       |
  185|       |  // --- check whether limits are exceeded
  186|       |
  187|    225|  if (!limits_context) {
  ------------------
  |  Branch (187:7): [True: 0, False: 225]
  ------------------
  188|      0|    return Error::Ok;
  189|      0|  }
  190|       |
  191|       |  // check against maximum memory block size
  192|       |
  193|    225|  if (limits_context->max_memory_block_size != 0 &&
  ------------------
  |  Branch (193:7): [True: 225, False: 0]
  ------------------
  194|    225|      memory_amount > limits_context->max_memory_block_size) {
  ------------------
  |  Branch (194:7): [True: 2, False: 223]
  ------------------
  195|      2|    std::stringstream sstr;
  196|       |
  197|      2|    if (reason_description) {
  ------------------
  |  Branch (197:9): [True: 2, False: 0]
  ------------------
  198|      2|      sstr << "Allocating " << memory_amount << " bytes for " << reason_description <<" exceeds the security limit of "
  199|      2|           << limits_context->max_memory_block_size << " bytes";
  200|      2|    }
  201|      0|    else {
  202|      0|      sstr << "Allocating " << memory_amount << " bytes exceeds the security limit of "
  203|      0|           << limits_context->max_memory_block_size << " bytes";
  204|      0|    }
  205|       |
  206|      2|    return {heif_error_Memory_allocation_error,
  207|      2|            heif_suberror_Security_limit_exceeded,
  208|      2|            sstr.str()};
  209|      2|  }
  210|       |
  211|    223|  if (limits_context == &global_security_limits ||
  ------------------
  |  Branch (211:7): [True: 0, False: 223]
  ------------------
  212|    223|      limits_context == &disabled_security_limits) {
  ------------------
  |  Branch (212:7): [True: 0, False: 223]
  ------------------
  213|      0|    return Error::Ok;
  214|      0|  }
  215|       |
  216|    223|  std::lock_guard<std::mutex> lock(get_memory_usage_mutex());
  217|    223|  auto it = sMemoryUsage.find(limits_context);
  218|    223|  if (it == sMemoryUsage.end()) {
  ------------------
  |  Branch (218:7): [True: 0, False: 223]
  ------------------
  219|      0|    assert(false);
  ------------------
  |  Branch (219:5): [Folded, False: 0]
  ------------------
  220|      0|    return Error::Ok;
  221|      0|  }
  222|       |
  223|       |  // check against maximum total memory usage
  224|       |
  225|    223|  if (limits_context->max_total_memory != 0 &&
  ------------------
  |  Branch (225:7): [True: 223, False: 0]
  ------------------
  226|    223|      it->second.total_memory_usage + memory_amount > limits_context->max_total_memory) {
  ------------------
  |  Branch (226:7): [True: 0, False: 223]
  ------------------
  227|      0|    std::stringstream sstr;
  228|       |
  229|      0|    if (reason_description) {
  ------------------
  |  Branch (229:9): [True: 0, False: 0]
  ------------------
  230|      0|      sstr << "Memory usage of " << it->second.total_memory_usage + memory_amount
  231|      0|           << " bytes for " << reason_description << " exceeds the security limit of "
  232|      0|           << limits_context->max_total_memory << " bytes of total memory usage";
  233|      0|    }
  234|      0|    else {
  235|      0|      sstr << "Memory usage of " << it->second.total_memory_usage + memory_amount
  236|      0|           << " bytes exceeds the security limit of "
  237|      0|           << limits_context->max_total_memory << " bytes of total memory usage";
  238|      0|    }
  239|       |
  240|      0|    return {heif_error_Memory_allocation_error,
  241|      0|            heif_suberror_Security_limit_exceeded,
  242|      0|            sstr.str()};
  243|      0|  }
  244|       |
  245|       |
  246|       |  // --- register memory usage
  247|       |
  248|    223|  m_limits_context = limits_context;
  249|    223|  m_memory_amount += memory_amount;
  250|       |
  251|    223|  it->second.total_memory_usage += memory_amount;
  252|       |
  253|       |  // remember maximum memory usage (for informational purpose)
  254|    223|  if (it->second.total_memory_usage > it->second.max_memory_usage) {
  ------------------
  |  Branch (254:7): [True: 18, False: 205]
  ------------------
  255|     18|    it->second.max_memory_usage = it->second.total_memory_usage;
  256|     18|  }
  257|       |
  258|    223|  return Error::Ok;
  259|    223|}
_ZN12MemoryHandle4freeEv:
  263|    205|{
  264|    205|  if (m_limits_context) {
  ------------------
  |  Branch (264:7): [True: 203, False: 2]
  ------------------
  265|    203|    std::lock_guard<std::mutex> lock(get_memory_usage_mutex());
  266|       |
  267|    203|    auto it = sMemoryUsage.find(m_limits_context);
  268|    203|    if (it != sMemoryUsage.end()) {
  ------------------
  |  Branch (268:9): [True: 10, False: 193]
  ------------------
  269|     10|      it->second.total_memory_usage -= m_memory_amount;
  270|     10|    }
  271|       |
  272|    203|    m_limits_context = nullptr;
  273|    203|    m_memory_amount = 0;
  274|    203|  }
  275|    205|}

_ZN12MemoryHandleD2Ev:
   85|    205|  ~MemoryHandle() { free(); }
_ZN12MemoryHandleC2Ev:
   84|    205|  MemoryHandle() = default;

_ZN13Box_container5parseER14BitstreamRangePK20heif_security_limits:
   30|  2.46k|{
   31|  2.46k|  return read_children(range, READ_CHILDREN_ALL, limits);
   32|  2.46k|}
_ZN8Box_mdhd5parseER14BitstreamRangePK20heif_security_limits:
  302|      2|{
  303|      2|  parse_full_box_header(range);
  304|       |
  305|      2|  if (get_version() > 1) {
  ------------------
  |  Branch (305:7): [True: 0, False: 2]
  ------------------
  306|      0|    return unsupported_version_error("mdhd");
  307|      0|  }
  308|       |
  309|      2|  if (get_version() == 1) {
  ------------------
  |  Branch (309:7): [True: 0, False: 2]
  ------------------
  310|      0|    m_creation_time = range.read64();
  311|      0|    m_modification_time = range.read64();
  312|      0|    m_timescale = range.read32();
  313|      0|    m_duration = range.read64();
  314|      0|  }
  315|      2|  else {
  316|       |    // version==0
  317|      2|    m_creation_time = range.read32();
  318|      2|    m_modification_time = range.read32();
  319|      2|    m_timescale = range.read32();
  320|      2|    m_duration = range.read32();
  321|      2|  }
  322|       |
  323|      2|  uint16_t language_packed = range.read16();
  324|      2|  m_language[0] = ((language_packed >> 10) & 0x1F) + 0x60;
  325|      2|  m_language[1] = ((language_packed >> 5) & 0x1F) + 0x60;
  326|      2|  m_language[2] = ((language_packed >> 0) & 0x1F) + 0x60;
  327|      2|  m_language[3] = 0;
  328|       |
  329|      2|  range.skip(2);
  330|       |
  331|      2|  return range.get_error();
  332|      2|}
_ZN8Box_stss5parseER14BitstreamRangePK20heif_security_limits:
 1177|    193|{
 1178|    193|  parse_full_box_header(range);
 1179|       |
 1180|    193|  if (get_version() > 0) {
  ------------------
  |  Branch (1180:7): [True: 0, False: 193]
  ------------------
 1181|      0|    return unsupported_version_error("stss");
 1182|      0|  }
 1183|       |
 1184|    193|  uint32_t sample_count = range.read32();
 1185|       |
 1186|       |  // check required memory
 1187|       |
 1188|    193|  uint64_t mem_size = sample_count * sizeof(uint32_t);
 1189|    193|  if (auto err = m_memory_handle.alloc(mem_size, limits, "the 'stss' table")) {
  ------------------
  |  Branch (1189:12): [True: 0, False: 193]
  ------------------
 1190|      0|    return err;
 1191|      0|  }
 1192|       |
 1193|    193|  for (uint32_t i = 0; i < sample_count; i++) {
  ------------------
  |  Branch (1193:24): [True: 0, False: 193]
  ------------------
 1194|      0|    m_sync_samples.push_back(range.read32());
 1195|       |
 1196|      0|    if (range.error()) {
  ------------------
  |  Branch (1196:9): [True: 0, False: 0]
  ------------------
 1197|      0|      return range.get_error();
 1198|      0|    }
 1199|      0|  }
 1200|       |
 1201|    193|  return range.get_error();
 1202|    193|}

_ZN13Box_containerC2EPKc:
   36|  2.46k|  {
   37|  2.46k|    set_short_type(fourcc(type));
   38|  2.46k|  }
_ZN8Box_moovC2Ev:
   50|  2.46k|  Box_moov() : Box_container("moov") {}
_ZN8Box_mdhdC2Ev:
  207|      2|  {
  208|      2|    set_short_type(fourcc("mdhd"));
  209|      2|  }
_ZN8Box_stssC2Ev:
  534|    193|  {
  535|    193|    set_short_type(fourcc("stss"));
  536|    193|  }

aom_codec_version:
   25|      2|int aom_codec_version(void) { return VERSION_PACKED; }
  ------------------
  |  |   17|      2|  ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH))
  |  |  ------------------
  |  |  |  |   12|      2|#define VERSION_MAJOR 3
  |  |  ------------------
  |  |                 ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH))
  |  |  ------------------
  |  |  |  |   13|      2|#define VERSION_MINOR 2
  |  |  ------------------
  |  |                 ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH))
  |  |  ------------------
  |  |  |  |   14|      2|#define VERSION_PATCH 0
  |  |  ------------------
  ------------------

thread_task.c:ctz:
  182|      8|static inline int ctz(const unsigned int mask) {
  183|      8|    return __builtin_ctz(mask);
  184|      8|}
decode.c:clz:
  186|  7.93k|static inline int clz(const unsigned int mask) {
  187|  7.93k|    return __builtin_clz(mask);
  188|  7.93k|}
msac.c:clz:
  186|   211k|static inline int clz(const unsigned int mask) {
  187|   211k|    return __builtin_clz(mask);
  188|   211k|}
ipred_tmpl.c:ctz:
  182|  1.93k|static inline int ctz(const unsigned int mask) {
  183|  1.93k|    return __builtin_ctz(mask);
  184|  1.93k|}
recon_tmpl.c:clz:
  186|  19.1k|static inline int clz(const unsigned int mask) {
  187|  19.1k|    return __builtin_clz(mask);
  188|  19.1k|}

lib.c:iclip:
   51|      9|static inline int iclip(const int v, const int min, const int max) {
   52|      9|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 0, False: 9]
  |  Branch (52:28): [True: 0, False: 9]
  ------------------
   53|      9|}
obu.c:imin:
   39|     12|static inline int imin(const int a, const int b) {
   40|     12|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 12, False: 0]
  ------------------
   41|     12|}
obu.c:imax:
   35|     12|static inline int imax(const int a, const int b) {
   36|     12|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 0, False: 12]
  ------------------
   37|     12|}
obu.c:iclip_u8:
   55|     24|static inline int iclip_u8(const int v) {
   56|     24|    return iclip(v, 0, 255);
   57|     24|}
obu.c:iclip:
   51|     24|static inline int iclip(const int v, const int min, const int max) {
   52|     24|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 0, False: 24]
  |  Branch (52:28): [True: 15, False: 9]
  ------------------
   53|     24|}
refmvs.c:imin:
   39|  6.77k|static inline int imin(const int a, const int b) {
   40|  6.77k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 3.18k, False: 3.59k]
  ------------------
   41|  6.77k|}
refmvs.c:imax:
   35|  4.00k|static inline int imax(const int a, const int b) {
   36|  4.00k|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 698, False: 3.30k]
  ------------------
   37|  4.00k|}
refmvs.c:iclip:
   51|  1.97k|static inline int iclip(const int v, const int min, const int max) {
   52|  1.97k|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 0, False: 1.97k]
  |  Branch (52:28): [True: 0, False: 1.97k]
  ------------------
   53|  1.97k|}
thread_task.c:umin:
   47|     82|static inline unsigned umin(const unsigned a, const unsigned b) {
   48|     82|    return a < b ? a : b;
  ------------------
  |  Branch (48:12): [True: 0, False: 82]
  ------------------
   49|     82|}
wedge.c:imax:
   35|    256|static inline int imax(const int a, const int b) {
   36|    256|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 128, False: 128]
  ------------------
   37|    256|}
wedge.c:imin:
   39|  2.48k|static inline int imin(const int a, const int b) {
   40|  2.48k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 1.41k, False: 1.06k]
  ------------------
   41|  2.48k|}
decode.c:iclip:
   51|    106|static inline int iclip(const int v, const int min, const int max) {
   52|    106|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 0, False: 106]
  |  Branch (52:28): [True: 10, False: 96]
  ------------------
   53|    106|}
decode.c:ulog2:
   67|  7.93k|static inline int ulog2(const unsigned v) {
   68|  7.93k|    return 31 ^ clz(v);
   69|  7.93k|}
decode.c:imax:
   35|  3.45k|static inline int imax(const int a, const int b) {
   36|  3.45k|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 1.21k, False: 2.24k]
  ------------------
   37|  3.45k|}
decode.c:imin:
   39|  10.4k|static inline int imin(const int a, const int b) {
   40|  10.4k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 8.96k, False: 1.50k]
  ------------------
   41|  10.4k|}
decode.c:iclip_u8:
   55|    106|static inline int iclip_u8(const int v) {
   56|    106|    return iclip(v, 0, 255);
   57|    106|}
lf_mask.c:imax:
   35|    256|static inline int imax(const int a, const int b) {
   36|    256|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 248, False: 8]
  ------------------
   37|    256|}
ipred_tmpl.c:iclip:
   51|   228k|static inline int iclip(const int v, const int min, const int max) {
   52|   228k|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 5.01k, False: 223k]
  |  Branch (52:28): [True: 4.97k, False: 218k]
  ------------------
   53|   228k|}
ipred_tmpl.c:iclip_u8:
   55|  71.3k|static inline int iclip_u8(const int v) {
   56|  71.3k|    return iclip(v, 0, 255);
   57|  71.3k|}
ipred_tmpl.c:imin:
   39|  24.9k|static inline int imin(const int a, const int b) {
   40|  24.9k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 46, False: 24.8k]
  ------------------
   41|  24.9k|}
ipred_tmpl.c:imax:
   35|    408|static inline int imax(const int a, const int b) {
   36|    408|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 48, False: 360]
  ------------------
   37|    408|}
ipred_tmpl.c:apply_sign:
   59|  20.7k|static inline int apply_sign(const int v, const int s) {
   60|  20.7k|    return s < 0 ? -v : v;
  ------------------
  |  Branch (60:12): [True: 9.94k, False: 10.7k]
  ------------------
   61|  20.7k|}
itx_tmpl.c:iclip_u8:
   55|   368k|static inline int iclip_u8(const int v) {
   56|   368k|    return iclip(v, 0, 255);
   57|   368k|}
itx_tmpl.c:iclip:
   51|   625k|static inline int iclip(const int v, const int min, const int max) {
   52|   625k|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 32.9k, False: 592k]
  |  Branch (52:28): [True: 7.95k, False: 584k]
  ------------------
   53|   625k|}
itx_tmpl.c:imin:
   39|  4.01k|static inline int imin(const int a, const int b) {
   40|  4.01k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 3.81k, False: 196]
  ------------------
   41|  4.01k|}
mc_tmpl.c:iclip_u8:
   55|   106k|static inline int iclip_u8(const int v) {
   56|   106k|    return iclip(v, 0, 255);
   57|   106k|}
mc_tmpl.c:iclip:
   51|   106k|static inline int iclip(const int v, const int min, const int max) {
   52|   106k|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 64, False: 106k]
  |  Branch (52:28): [True: 0, False: 106k]
  ------------------
   53|   106k|}
recon_tmpl.c:ulog2:
   67|  19.1k|static inline int ulog2(const unsigned v) {
   68|  19.1k|    return 31 ^ clz(v);
   69|  19.1k|}
recon_tmpl.c:imin:
   39|  70.6k|static inline int imin(const int a, const int b) {
   40|  70.6k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 64.6k, False: 5.98k]
  ------------------
   41|  70.6k|}
recon_tmpl.c:imax:
   35|  4.06k|static inline int imax(const int a, const int b) {
   36|  4.06k|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 2.83k, False: 1.23k]
  ------------------
   37|  4.06k|}
recon_tmpl.c:umin:
   47|   201k|static inline unsigned umin(const unsigned a, const unsigned b) {
   48|   201k|    return a < b ? a : b;
  ------------------
  |  Branch (48:12): [True: 109k, False: 91.4k]
  ------------------
   49|   201k|}
itx_1d.c:iclip:
   51|  1.51M|static inline int iclip(const int v, const int min, const int max) {
   52|  1.51M|    return v < min ? min : v > max ? max : v;
  ------------------
  |  Branch (52:12): [True: 6, False: 1.51M]
  |  Branch (52:28): [True: 8, False: 1.51M]
  ------------------
   53|  1.51M|}
scan.c:imax:
   35|  3.34k|static inline int imax(const int a, const int b) {
   36|  3.34k|    return a > b ? a : b;
  ------------------
  |  Branch (36:12): [True: 2.82k, False: 523]
  ------------------
   37|  3.34k|}
ipred_prepare_tmpl.c:imin:
   39|  10.0k|static inline int imin(const int a, const int b) {
   40|  10.0k|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 10.0k, False: 62]
  ------------------
   41|  10.0k|}
lf_apply_tmpl.c:imin:
   39|      8|static inline int imin(const int a, const int b) {
   40|      8|    return a < b ? a : b;
  ------------------
  |  Branch (40:12): [True: 8, False: 0]
  ------------------
   41|      8|}

dav1d_cdef_brow_8bpc:
  102|      4|{
  103|      4|    Dav1dFrameContext *const f = (Dav1dFrameContext *)tc->f;
  104|      4|    const int bitdepth_min_8 = BITDEPTH == 8 ? 0 : f->cur.p.bpc - 8;
  ------------------
  |  Branch (104:32): [True: 4, Folded]
  ------------------
  105|      4|    const Dav1dDSPContext *const dsp = f->dsp;
  106|      4|    enum CdefEdgeFlags edges = CDEF_HAVE_BOTTOM | (by_start > 0 ? CDEF_HAVE_TOP : 0);
  ------------------
  |  Branch (106:52): [True: 0, False: 4]
  ------------------
  107|      4|    pixel *ptrs[3] = { p[0], p[1], p[2] };
  108|      4|    const int sbsz = 16;
  109|      4|    const int sb64w = f->sb128w << 1;
  110|      4|    const int damping = f->frame_hdr->cdef.damping + bitdepth_min_8;
  111|      4|    const enum Dav1dPixelLayout layout = f->cur.p.layout;
  112|      4|    const int uv_idx = DAV1D_PIXEL_LAYOUT_I444 - layout;
  113|      4|    const int ss_ver = layout == DAV1D_PIXEL_LAYOUT_I420;
  114|      4|    const int ss_hor = layout != DAV1D_PIXEL_LAYOUT_I444;
  115|      4|    static const uint8_t uv_dirs[2][8] = { { 0, 1, 2, 3, 4, 5, 6, 7 },
  116|      4|                                           { 7, 0, 2, 4, 5, 6, 6, 6 } };
  117|      4|    const uint8_t *uv_dir = uv_dirs[layout == DAV1D_PIXEL_LAYOUT_I422];
  118|      4|    const int have_tt = f->c->n_tc > 1;
  119|      4|    const int sb128 = f->seq_hdr->sb128;
  120|      4|    const int resize = f->frame_hdr->width[0] != f->frame_hdr->width[1];
  121|      4|    const ptrdiff_t y_stride = PXSTRIDE(f->cur.stride[0]);
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  122|      4|    const ptrdiff_t uv_stride = PXSTRIDE(f->cur.stride[1]);
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  123|       |
  124|     48|    for (int bit = 0, by = by_start; by < by_end; by += 2, edges |= CDEF_HAVE_TOP) {
  ------------------
  |  Branch (124:38): [True: 44, False: 4]
  ------------------
  125|     44|        const int tf = tc->top_pre_cdef_toggle;
  126|     44|        const int by_idx = (by & 30) >> 1;
  127|     44|        if (by + 2 >= f->bh) edges &= ~CDEF_HAVE_BOTTOM;
  ------------------
  |  Branch (127:13): [True: 0, False: 44]
  ------------------
  128|       |
  129|     44|        if ((!have_tt || sbrow_start || by + 2 < by_end) &&
  ------------------
  |  Branch (129:14): [True: 0, False: 44]
  |  Branch (129:26): [True: 0, False: 44]
  |  Branch (129:41): [True: 40, False: 4]
  ------------------
  130|     40|            edges & CDEF_HAVE_BOTTOM)
  ------------------
  |  Branch (130:13): [True: 40, False: 0]
  ------------------
  131|     40|        {
  132|       |            // backup pre-filter data for next iteration
  133|     40|            pixel *const cdef_top_bak[3] = {
  134|     40|                f->lf.cdef_line[!tf][0] + have_tt * sby * 4 * y_stride,
  135|     40|                f->lf.cdef_line[!tf][1] + have_tt * sby * 8 * uv_stride,
  136|     40|                f->lf.cdef_line[!tf][2] + have_tt * sby * 8 * uv_stride
  137|     40|            };
  138|     40|            backup2lines(cdef_top_bak, ptrs, f->cur.stride, layout);
  139|     40|        }
  140|       |
  141|     44|        ALIGN_STK_16(pixel, lr_bak, 2 /* idx */, [3 /* plane */][8 /* y */][2 /* x */]);
  ------------------
  |  |  100|     44|    ALIGN(type var[sz1d]sznd, ALIGN_16_VAL)
  |  |  ------------------
  |  |  |  |   86|     44|    line __attribute__((aligned(align)))
  |  |  ------------------
  ------------------
  142|     44|        pixel *iptrs[3] = { ptrs[0], ptrs[1], ptrs[2] };
  143|     44|        edges &= ~CDEF_HAVE_LEFT;
  144|     44|        edges |= CDEF_HAVE_RIGHT;
  145|     44|        enum Backup2x8Flags prev_flag = 0;
  146|    924|        for (int sbx = 0; sbx < sb64w; sbx++, edges |= CDEF_HAVE_LEFT) {
  ------------------
  |  Branch (146:27): [True: 880, False: 44]
  ------------------
  147|    880|            const int sb128x = sbx >> 1;
  148|    880|            const int sb64_idx = ((by & sbsz) >> 3) + (sbx & 1);
  149|    880|            const int cdef_idx = lflvl[sb128x].cdef_idx[sb64_idx];
  150|    880|            if (cdef_idx == -1 ||
  ------------------
  |  Branch (150:17): [True: 0, False: 880]
  ------------------
  151|    880|                (!f->frame_hdr->cdef.y_strength[cdef_idx] &&
  ------------------
  |  Branch (151:18): [True: 880, False: 0]
  ------------------
  152|    880|                 !f->frame_hdr->cdef.uv_strength[cdef_idx]))
  ------------------
  |  Branch (152:18): [True: 880, False: 0]
  ------------------
  153|    880|            {
  154|    880|                prev_flag = 0;
  155|    880|                goto next_sb;
  156|    880|            }
  157|       |
  158|       |            // Create a complete 32-bit mask for the sb row ahead of time.
  159|      0|            const uint16_t (*noskip_row)[2] = &lflvl[sb128x].noskip_mask[by_idx];
  160|      0|            const unsigned noskip_mask = (unsigned) noskip_row[0][1] << 16 |
  161|      0|                                                    noskip_row[0][0];
  162|       |
  163|      0|            const int y_lvl = f->frame_hdr->cdef.y_strength[cdef_idx];
  164|      0|            const int uv_lvl = f->frame_hdr->cdef.uv_strength[cdef_idx];
  165|      0|            const enum Backup2x8Flags flag = !!y_lvl + (!!uv_lvl << 1);
  166|       |
  167|      0|            const int y_pri_lvl = (y_lvl >> 2) << bitdepth_min_8;
  168|      0|            int y_sec_lvl = y_lvl & 3;
  169|      0|            y_sec_lvl += y_sec_lvl == 3;
  170|      0|            y_sec_lvl <<= bitdepth_min_8;
  171|       |
  172|      0|            const int uv_pri_lvl = (uv_lvl >> 2) << bitdepth_min_8;
  173|      0|            int uv_sec_lvl = uv_lvl & 3;
  174|      0|            uv_sec_lvl += uv_sec_lvl == 3;
  175|      0|            uv_sec_lvl <<= bitdepth_min_8;
  176|       |
  177|      0|            pixel *bptrs[3] = { iptrs[0], iptrs[1], iptrs[2] };
  178|      0|            for (int bx = sbx * sbsz; bx < imin((sbx + 1) * sbsz, f->bw);
  ------------------
  |  Branch (178:39): [True: 0, False: 0]
  ------------------
  179|      0|                 bx += 2, edges |= CDEF_HAVE_LEFT)
  180|      0|            {
  181|      0|                if (bx + 2 >= f->bw) edges &= ~CDEF_HAVE_RIGHT;
  ------------------
  |  Branch (181:21): [True: 0, False: 0]
  ------------------
  182|       |
  183|       |                // check if this 8x8 block had any coded coefficients; if not,
  184|       |                // go to the next block
  185|      0|                const uint32_t bx_mask = 3U << (bx & 30);
  186|      0|                if (!(noskip_mask & bx_mask)) {
  ------------------
  |  Branch (186:21): [True: 0, False: 0]
  ------------------
  187|      0|                    prev_flag = 0;
  188|      0|                    goto next_b;
  189|      0|                }
  190|      0|                const enum Backup2x8Flags do_left = (prev_flag ^ flag) & flag;
  191|      0|                prev_flag = flag;
  192|      0|                if (do_left && edges & CDEF_HAVE_LEFT) {
  ------------------
  |  Branch (192:21): [True: 0, False: 0]
  |  Branch (192:32): [True: 0, False: 0]
  ------------------
  193|       |                    // we didn't backup the prefilter data because it wasn't
  194|       |                    // there, so do it here instead
  195|      0|                    backup2x8(lr_bak[bit], bptrs, f->cur.stride, 0, layout, do_left);
  196|      0|                }
  197|      0|                if (edges & CDEF_HAVE_RIGHT) {
  ------------------
  |  Branch (197:21): [True: 0, False: 0]
  ------------------
  198|       |                    // backup pre-filter data for next iteration
  199|      0|                    backup2x8(lr_bak[!bit], bptrs, f->cur.stride, 8, layout, flag);
  200|      0|                }
  201|       |
  202|      0|                int dir;
  203|      0|                unsigned variance;
  204|      0|                if (y_pri_lvl || uv_pri_lvl)
  ------------------
  |  Branch (204:21): [True: 0, False: 0]
  |  Branch (204:34): [True: 0, False: 0]
  ------------------
  205|      0|                    dir = dsp->cdef.dir(bptrs[0], f->cur.stride[0],
  206|      0|                                        &variance HIGHBD_CALL_SUFFIX);
  207|       |
  208|      0|                const pixel *top, *bot;
  209|      0|                ptrdiff_t offset;
  210|       |
  211|      0|                if (!have_tt) goto st_y;
  ------------------
  |  Branch (211:21): [True: 0, False: 0]
  ------------------
  212|      0|                if (sbrow_start && by == by_start) {
  ------------------
  |  Branch (212:21): [True: 0, False: 0]
  |  Branch (212:36): [True: 0, False: 0]
  ------------------
  213|      0|                    if (resize) {
  ------------------
  |  Branch (213:25): [True: 0, False: 0]
  ------------------
  214|      0|                        offset = (sby - 1) * 4 * y_stride + bx * 4;
  215|      0|                        top = &f->lf.cdef_lpf_line[0][offset];
  216|      0|                    } else {
  217|      0|                        offset = (sby * (4 << sb128) - 4) * y_stride + bx * 4;
  218|      0|                        top = &f->lf.lr_lpf_line[0][offset];
  219|      0|                    }
  220|      0|                    bot = bptrs[0] + 8 * y_stride;
  221|      0|                } else if (!sbrow_start && by + 2 >= by_end) {
  ------------------
  |  Branch (221:28): [True: 0, False: 0]
  |  Branch (221:44): [True: 0, False: 0]
  ------------------
  222|      0|                    top = &f->lf.cdef_line[tf][0][sby * 4 * y_stride + bx * 4];
  223|      0|                    if (resize) {
  ------------------
  |  Branch (223:25): [True: 0, False: 0]
  ------------------
  224|      0|                        offset = (sby * 4 + 2) * y_stride + bx * 4;
  225|      0|                        bot = &f->lf.cdef_lpf_line[0][offset];
  226|      0|                    } else {
  227|      0|                        const int line = sby * (4 << sb128) + 4 * sb128 + 2;
  228|      0|                        offset = line * y_stride + bx * 4;
  229|      0|                        bot = &f->lf.lr_lpf_line[0][offset];
  230|      0|                    }
  231|      0|                } else {
  232|      0|            st_y:;
  233|      0|                    offset = sby * 4 * y_stride;
  234|      0|                    top = &f->lf.cdef_line[tf][0][have_tt * offset + bx * 4];
  235|      0|                    bot = bptrs[0] + 8 * y_stride;
  236|      0|                }
  237|      0|                if (y_pri_lvl) {
  ------------------
  |  Branch (237:21): [True: 0, False: 0]
  ------------------
  238|      0|                    const int adj_y_pri_lvl = adjust_strength(y_pri_lvl, variance);
  239|      0|                    if (adj_y_pri_lvl || y_sec_lvl)
  ------------------
  |  Branch (239:25): [True: 0, False: 0]
  |  Branch (239:42): [True: 0, False: 0]
  ------------------
  240|      0|                        dsp->cdef.fb[0](bptrs[0], f->cur.stride[0], lr_bak[bit][0],
  241|      0|                                        top, bot, adj_y_pri_lvl, y_sec_lvl,
  242|      0|                                        dir, damping, edges HIGHBD_CALL_SUFFIX);
  243|      0|                } else if (y_sec_lvl)
  ------------------
  |  Branch (243:28): [True: 0, False: 0]
  ------------------
  244|      0|                    dsp->cdef.fb[0](bptrs[0], f->cur.stride[0], lr_bak[bit][0],
  245|      0|                                    top, bot, 0, y_sec_lvl, 0, damping,
  246|      0|                                    edges HIGHBD_CALL_SUFFIX);
  247|       |
  248|      0|                if (!uv_lvl) goto skip_uv;
  ------------------
  |  Branch (248:21): [True: 0, False: 0]
  ------------------
  249|      0|                assert(layout != DAV1D_PIXEL_LAYOUT_I400);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  250|       |
  251|      0|                const int uvdir = uv_pri_lvl ? uv_dir[dir] : 0;
  ------------------
  |  Branch (251:35): [True: 0, False: 0]
  ------------------
  252|      0|                for (int pl = 1; pl <= 2; pl++) {
  ------------------
  |  Branch (252:34): [True: 0, False: 0]
  ------------------
  253|      0|                    if (!have_tt) goto st_uv;
  ------------------
  |  Branch (253:25): [True: 0, False: 0]
  ------------------
  254|      0|                    if (sbrow_start && by == by_start) {
  ------------------
  |  Branch (254:25): [True: 0, False: 0]
  |  Branch (254:40): [True: 0, False: 0]
  ------------------
  255|      0|                        if (resize) {
  ------------------
  |  Branch (255:29): [True: 0, False: 0]
  ------------------
  256|      0|                            offset = (sby - 1) * 4 * uv_stride + (bx * 4 >> ss_hor);
  257|      0|                            top = &f->lf.cdef_lpf_line[pl][offset];
  258|      0|                        } else {
  259|      0|                            const int line = sby * (4 << sb128) - 4;
  260|      0|                            offset = line * uv_stride + (bx * 4 >> ss_hor);
  261|      0|                            top = &f->lf.lr_lpf_line[pl][offset];
  262|      0|                        }
  263|      0|                        bot = bptrs[pl] + (8 >> ss_ver) * uv_stride;
  264|      0|                    } else if (!sbrow_start && by + 2 >= by_end) {
  ------------------
  |  Branch (264:32): [True: 0, False: 0]
  |  Branch (264:48): [True: 0, False: 0]
  ------------------
  265|      0|                        const ptrdiff_t top_offset = sby * 8 * uv_stride +
  266|      0|                                                     (bx * 4 >> ss_hor);
  267|      0|                        top = &f->lf.cdef_line[tf][pl][top_offset];
  268|      0|                        if (resize) {
  ------------------
  |  Branch (268:29): [True: 0, False: 0]
  ------------------
  269|      0|                            offset = (sby * 4 + 2) * uv_stride + (bx * 4 >> ss_hor);
  270|      0|                            bot = &f->lf.cdef_lpf_line[pl][offset];
  271|      0|                        } else {
  272|      0|                            const int line = sby * (4 << sb128) + 4 * sb128 + 2;
  273|      0|                            offset = line * uv_stride + (bx * 4 >> ss_hor);
  274|      0|                            bot = &f->lf.lr_lpf_line[pl][offset];
  275|      0|                        }
  276|      0|                    } else {
  277|      0|                st_uv:;
  278|      0|                        const ptrdiff_t offset = sby * 8 * uv_stride;
  279|      0|                        top = &f->lf.cdef_line[tf][pl][have_tt * offset + (bx * 4 >> ss_hor)];
  280|      0|                        bot = bptrs[pl] + (8 >> ss_ver) * uv_stride;
  281|      0|                    }
  282|      0|                    dsp->cdef.fb[uv_idx](bptrs[pl], f->cur.stride[1],
  283|      0|                                         lr_bak[bit][pl], top, bot,
  284|      0|                                         uv_pri_lvl, uv_sec_lvl, uvdir,
  285|      0|                                         damping - 1, edges HIGHBD_CALL_SUFFIX);
  286|      0|                }
  287|       |
  288|      0|            skip_uv:
  289|      0|                bit ^= 1;
  290|       |
  291|      0|            next_b:
  292|      0|                bptrs[0] += 8;
  293|      0|                bptrs[1] += 8 >> ss_hor;
  294|      0|                bptrs[2] += 8 >> ss_hor;
  295|      0|            }
  296|       |
  297|    880|        next_sb:
  298|    880|            iptrs[0] += sbsz * 4;
  299|    880|            iptrs[1] += sbsz * 4 >> ss_hor;
  300|    880|            iptrs[2] += sbsz * 4 >> ss_hor;
  301|    880|        }
  302|       |
  303|     44|        ptrs[0] += 8 * PXSTRIDE(f->cur.stride[0]);
  ------------------
  |  |   53|     44|#define PXSTRIDE(x) (x)
  ------------------
  304|     44|        ptrs[1] += 8 * PXSTRIDE(f->cur.stride[1]) >> ss_ver;
  ------------------
  |  |   53|     44|#define PXSTRIDE(x) (x)
  ------------------
  305|     44|        ptrs[2] += 8 * PXSTRIDE(f->cur.stride[1]) >> ss_ver;
  ------------------
  |  |   53|     44|#define PXSTRIDE(x) (x)
  ------------------
  306|     44|        tc->top_pre_cdef_toggle ^= 1;
  307|     44|    }
  308|      4|}
cdef_apply_tmpl.c:backup2lines:
   44|     40|{
   45|     40|    const ptrdiff_t y_stride = PXSTRIDE(stride[0]);
  ------------------
  |  |   53|     40|#define PXSTRIDE(x) (x)
  ------------------
   46|     40|    if (y_stride < 0)
  ------------------
  |  Branch (46:9): [True: 0, False: 40]
  ------------------
   47|      0|        pixel_copy(dst[0] + y_stride, src[0] + 7 * y_stride, -2 * y_stride);
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
   48|     40|    else
   49|     40|        pixel_copy(dst[0], src[0] + 6 * y_stride, 2 * y_stride);
  ------------------
  |  |   47|     40|#define pixel_copy memcpy
  ------------------
   50|       |
   51|     40|    if (layout != DAV1D_PIXEL_LAYOUT_I400) {
  ------------------
  |  Branch (51:9): [True: 40, False: 0]
  ------------------
   52|     40|        const ptrdiff_t uv_stride = PXSTRIDE(stride[1]);
  ------------------
  |  |   53|     40|#define PXSTRIDE(x) (x)
  ------------------
   53|     40|        if (uv_stride < 0) {
  ------------------
  |  Branch (53:13): [True: 0, False: 40]
  ------------------
   54|      0|            const int uv_off = layout == DAV1D_PIXEL_LAYOUT_I420 ? 3 : 7;
  ------------------
  |  Branch (54:32): [True: 0, False: 0]
  ------------------
   55|      0|            pixel_copy(dst[1] + uv_stride, src[1] + uv_off * uv_stride, -2 * uv_stride);
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
   56|      0|            pixel_copy(dst[2] + uv_stride, src[2] + uv_off * uv_stride, -2 * uv_stride);
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
   57|     40|        } else {
   58|     40|            const int uv_off = layout == DAV1D_PIXEL_LAYOUT_I420 ? 2 : 6;
  ------------------
  |  Branch (58:32): [True: 40, False: 0]
  ------------------
   59|     40|            pixel_copy(dst[1], src[1] + uv_off * uv_stride, 2 * uv_stride);
  ------------------
  |  |   47|     40|#define pixel_copy memcpy
  ------------------
   60|     40|            pixel_copy(dst[2], src[2] + uv_off * uv_stride, 2 * uv_stride);
  ------------------
  |  |   47|     40|#define pixel_copy memcpy
  ------------------
   61|     40|        }
   62|     40|    }
   63|     40|}

dav1d_cdef_dsp_init_8bpc:
  320|      4|COLD void bitfn(dav1d_cdef_dsp_init)(Dav1dCdefDSPContext *const c) {
  321|      4|    c->dir = cdef_find_dir_c;
  322|      4|    c->fb[0] = cdef_filter_block_8x8_c;
  323|      4|    c->fb[1] = cdef_filter_block_4x8_c;
  324|      4|    c->fb[2] = cdef_filter_block_4x4_c;
  325|       |
  326|       |#if HAVE_ASM
  327|       |#if ARCH_AARCH64 || ARCH_ARM
  328|       |    cdef_dsp_init_arm(c);
  329|       |#elif ARCH_PPC64LE
  330|       |    cdef_dsp_init_ppc(c);
  331|       |#elif ARCH_RISCV
  332|       |    cdef_dsp_init_riscv(c);
  333|       |#elif ARCH_X86
  334|       |    cdef_dsp_init_x86(c);
  335|       |#elif ARCH_LOONGARCH64
  336|       |    cdef_dsp_init_loongarch(c);
  337|       |#endif
  338|       |#endif
  339|      4|}

dav1d_cdf_thread_init_static:
 4023|      4|void dav1d_cdf_thread_init_static(CdfThreadContext *const cdf, const unsigned qidx) {
 4024|       |    cdf->ref = NULL;
 4025|      4|    cdf->data.qcat = (qidx > 20) + (qidx > 60) + (qidx > 120);
 4026|      4|}
dav1d_cdf_thread_copy:
 4028|      4|void dav1d_cdf_thread_copy(CdfContext *const dst, const CdfThreadContext *const src) {
 4029|      4|    if (src->ref) {
  ------------------
  |  Branch (4029:9): [True: 0, False: 4]
  ------------------
 4030|      0|        memcpy(dst, src->data.cdf, sizeof(*dst));
 4031|      4|    } else {
 4032|      4|        dst->coef = default_coef_cdf[src->data.qcat];
 4033|      4|        memcpy(&dst->m, &default_cdf.m,
 4034|      4|               offsetof(CdfDefaultContext, mv.joint));
 4035|      4|        memcpy(&dst->mv.comp[1], &default_cdf.mv.comp,
 4036|       |               sizeof(default_cdf) - offsetof(CdfDefaultContext, mv.comp));
 4037|      4|    }
 4038|      4|}
dav1d_cdf_thread_ref:
 4056|     32|{
 4057|     32|    *dst = *src;
 4058|     32|    if (src->ref)
  ------------------
  |  Branch (4058:9): [True: 0, False: 32]
  ------------------
 4059|      0|        dav1d_ref_inc(src->ref);
 4060|     32|}
dav1d_cdf_thread_unref:
 4062|    234|void dav1d_cdf_thread_unref(CdfThreadContext *const cdf) {
 4063|       |    memset(&cdf->data, 0, sizeof(*cdf) - offsetof(CdfThreadContext, data));
 4064|    234|    dav1d_ref_dec(&cdf->ref);
 4065|    234|}

dav1d_init_cpu:
   63|      1|COLD void dav1d_init_cpu(void) {
   64|       |#if HAVE_ASM && !__has_feature(memory_sanitizer)
   65|       |// memory sanitizer is inherently incompatible with asm
   66|       |#if ARCH_AARCH64 || ARCH_ARM
   67|       |    dav1d_cpu_flags = dav1d_get_cpu_flags_arm();
   68|       |#elif ARCH_LOONGARCH
   69|       |    dav1d_cpu_flags = dav1d_get_cpu_flags_loongarch();
   70|       |#elif ARCH_PPC64LE
   71|       |    dav1d_cpu_flags = dav1d_get_cpu_flags_ppc();
   72|       |#elif ARCH_RISCV
   73|       |    dav1d_cpu_flags = dav1d_get_cpu_flags_riscv();
   74|       |#elif ARCH_X86
   75|       |    dav1d_cpu_flags = dav1d_get_cpu_flags_x86();
   76|       |#endif
   77|       |#endif
   78|      1|}
dav1d_num_logical_processors:
   84|      9|COLD int dav1d_num_logical_processors(Dav1dContext *const c) {
   85|       |#ifdef _WIN32
   86|       |#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
   87|       |    GROUP_AFFINITY affinity;
   88|       |    if (GetThreadGroupAffinity(GetCurrentThread(), &affinity)) {
   89|       |        int num_processors = 1;
   90|       |        while (affinity.Mask &= affinity.Mask - 1)
   91|       |            num_processors++;
   92|       |        return num_processors;
   93|       |    }
   94|       |#else
   95|       |    SYSTEM_INFO system_info;
   96|       |    GetNativeSystemInfo(&system_info);
   97|       |    return system_info.dwNumberOfProcessors;
   98|       |#endif
   99|       |#elif HAVE_PTHREAD_GETAFFINITY_NP && defined(CPU_COUNT)
  100|       |    cpu_set_t affinity;
  101|      9|    if (!pthread_getaffinity_np(pthread_self(), sizeof(affinity), &affinity))
  ------------------
  |  Branch (101:9): [True: 9, False: 0]
  ------------------
  102|      9|        return CPU_COUNT(&affinity);
  103|       |#elif defined(__APPLE__)
  104|       |    int num_processors;
  105|       |    size_t length = sizeof(num_processors);
  106|       |    if (!sysctlbyname("hw.logicalcpu", &num_processors, &length, NULL, 0))
  107|       |        return num_processors;
  108|       |#elif defined(_SC_NPROCESSORS_ONLN)
  109|       |    return (int)sysconf(_SC_NPROCESSORS_ONLN);
  110|       |#endif
  111|      0|    if (c)
  ------------------
  |  Branch (111:9): [True: 0, False: 0]
  ------------------
  112|      0|        dav1d_log(c, "Unable to detect thread count, defaulting to single-threaded mode\n");
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
  113|      0|    return 1;
  114|      9|}

ctx.c:memset_w1:
   34|  10.3k|static void memset_w1(void *const ptr, const int value) {
   35|  10.3k|    set_ctx1((uint8_t *) ptr, 0, value);
  ------------------
  |  |   56|  10.3k|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  ------------------
   36|  10.3k|}
ctx.c:memset_w2:
   38|  10.2k|static void memset_w2(void *const ptr, const int value) {
   39|  10.2k|    set_ctx2((uint8_t *) ptr, 0, value);
  ------------------
  |  |   58|  10.2k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  ------------------
   40|  10.2k|}
ctx.c:memset_w4:
   42|  3.73k|static void memset_w4(void *const ptr, const int value) {
   43|  3.73k|    set_ctx4((uint8_t *) ptr, 0, value);
  ------------------
  |  |   60|  3.73k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  ------------------
   44|  3.73k|}
ctx.c:memset_w8:
   46|  2.35k|static void memset_w8(void *const ptr, const int value) {
   47|  2.35k|    set_ctx8((uint8_t *) ptr, 0, value);
  ------------------
  |  |   62|  2.35k|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  ------------------
   48|  2.35k|}
ctx.c:memset_w16:
   50|  1.16k|static void memset_w16(void *const ptr, const int value) {
   51|  1.16k|    set_ctx16((uint8_t *) ptr, 0, value);
  ------------------
  |  |   63|  1.16k|#define set_ctx16(var, off, val) do { \
  |  |   64|  1.16k|        memset(&(var)[off], val, 16); \
  |  |   65|  1.16k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (65:14): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
   52|  1.16k|}

recon_tmpl.c:dav1d_memset_likely_pow2:
   44|  18.7k|static inline void dav1d_memset_likely_pow2(void *const ptr, const int value, const int n) {
   45|  18.7k|    assert(n >= 1 && n <= 32);
  ------------------
  |  |  140|  37.4k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 18.7k, False: 0]
  |  |  |  Branch (140:30): [True: 18.7k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 18.7k]
  |  |  ------------------
  ------------------
   46|  18.7k|    if ((n&(n-1)) == 0) {
  ------------------
  |  Branch (46:9): [True: 18.5k, False: 192]
  ------------------
   47|  18.5k|        dav1d_memset_pow2[ulog2(n)](ptr, value);
   48|  18.5k|    } else {
   49|    192|        memset(ptr, value, n);
   50|    192|    }
   51|  18.7k|}

dav1d_data_create_internal:
   43|      9|uint8_t *dav1d_data_create_internal(Dav1dData *const buf, const size_t sz) {
   44|      9|    validate_input_or_ret(buf != NULL, NULL);
  ------------------
  |  |   52|      9|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
   45|       |
   46|      9|    if (sz > SIZE_MAX / 2) return NULL;
  ------------------
  |  Branch (46:9): [True: 0, False: 9]
  ------------------
   47|      9|    buf->ref = dav1d_ref_create(ALLOC_DAV1DDATA, sz);
  ------------------
  |  |   49|      9|#define dav1d_ref_create(type, size) dav1d_ref_create(size)
  ------------------
   48|      9|    if (!buf->ref) return NULL;
  ------------------
  |  Branch (48:9): [True: 0, False: 9]
  ------------------
   49|      9|    buf->data = buf->ref->const_data;
   50|      9|    buf->sz = sz;
   51|      9|    dav1d_data_props_set_defaults(&buf->m);
   52|      9|    buf->m.size = sz;
   53|       |
   54|      9|    return buf->ref->data;
   55|      9|}
dav1d_data_ref:
   98|     19|void dav1d_data_ref(Dav1dData *const dst, const Dav1dData *const src) {
   99|     19|    assert(dst != NULL);
  ------------------
  |  |  140|     19|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 19]
  |  |  |  Branch (140:68): [Folded, False: 19]
  |  |  ------------------
  ------------------
  100|     19|    assert(dst->data == NULL);
  ------------------
  |  |  140|     19|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 19]
  |  |  |  Branch (140:68): [Folded, False: 19]
  |  |  ------------------
  ------------------
  101|     19|    assert(src != NULL);
  ------------------
  |  |  140|     19|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 19]
  |  |  |  Branch (140:68): [Folded, False: 19]
  |  |  ------------------
  ------------------
  102|       |
  103|     19|    if (src->ref) {
  ------------------
  |  Branch (103:9): [True: 13, False: 6]
  ------------------
  104|     13|        assert(src->data != NULL);
  ------------------
  |  |  140|     13|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 13]
  |  |  |  Branch (140:68): [Folded, False: 13]
  |  |  ------------------
  ------------------
  105|     13|        dav1d_ref_inc(src->ref);
  106|     13|    }
  107|     19|    if (src->m.user_data.ref) dav1d_ref_inc(src->m.user_data.ref);
  ------------------
  |  Branch (107:9): [True: 0, False: 19]
  ------------------
  108|     19|    *dst = *src;
  109|     19|}
dav1d_data_props_copy:
  113|      9|{
  114|      9|    assert(dst != NULL);
  ------------------
  |  |  140|      9|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 9]
  |  |  |  Branch (140:68): [Folded, False: 9]
  |  |  ------------------
  ------------------
  115|      9|    assert(src != NULL);
  ------------------
  |  |  140|      9|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 9]
  |  |  |  Branch (140:68): [Folded, False: 9]
  |  |  ------------------
  ------------------
  116|       |
  117|      9|    dav1d_ref_dec(&dst->user_data.ref);
  118|      9|    *dst = *src;
  119|      9|    if (dst->user_data.ref) dav1d_ref_inc(dst->user_data.ref);
  ------------------
  |  Branch (119:9): [True: 0, False: 9]
  ------------------
  120|      9|}
dav1d_data_props_set_defaults:
  122|    220|void dav1d_data_props_set_defaults(Dav1dDataProps *const props) {
  123|    220|    assert(props != NULL);
  ------------------
  |  |  140|    220|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 220]
  |  |  |  Branch (140:68): [Folded, False: 220]
  |  |  ------------------
  ------------------
  124|       |
  125|    220|    memset(props, 0, sizeof(*props));
  126|       |    props->timestamp = INT64_MIN;
  127|    220|    props->offset = -1;
  128|    220|}
dav1d_data_props_unref_internal:
  130|      9|void dav1d_data_props_unref_internal(Dav1dDataProps *const props) {
  131|      9|    validate_input(props != NULL);
  ------------------
  |  |   59|      9|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|      9|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  132|       |
  133|      9|    struct Dav1dRef *user_data_ref = props->user_data.ref;
  134|      9|    dav1d_data_props_set_defaults(props);
  135|      9|    dav1d_ref_dec(&user_data_ref);
  136|      9|}
dav1d_data_unref_internal:
  138|     37|void dav1d_data_unref_internal(Dav1dData *const buf) {
  139|     37|    validate_input(buf != NULL);
  ------------------
  |  |   59|     37|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|     37|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 37]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  140|       |
  141|     37|    struct Dav1dRef *user_data_ref = buf->m.user_data.ref;
  142|     37|    if (buf->ref) {
  ------------------
  |  Branch (142:9): [True: 22, False: 15]
  ------------------
  143|     22|        validate_input(buf->data != NULL);
  ------------------
  |  |   59|     22|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|     22|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 22]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  144|     22|        dav1d_ref_dec(&buf->ref);
  145|     22|    }
  146|     37|    memset(buf, 0, sizeof(*buf));
  147|     37|    dav1d_data_props_set_defaults(&buf->m);
  148|     37|    dav1d_ref_dec(&user_data_ref);
  149|     37|}

dav1d_decode_tile_sbrow:
 2594|     26|int dav1d_decode_tile_sbrow(Dav1dTaskContext *const t) {
 2595|     26|    const Dav1dFrameContext *const f = t->f;
 2596|     26|    const enum BlockLevel root_bl = f->seq_hdr->sb128 ? BL_128X128 : BL_64X64;
  ------------------
  |  Branch (2596:37): [True: 16, False: 10]
  ------------------
 2597|     26|    Dav1dTileState *const ts = t->ts;
 2598|     26|    const Dav1dContext *const c = f->c;
 2599|     26|    const int sb_step = f->sb_step;
 2600|     26|    const int tile_row = ts->tiling.row, tile_col = ts->tiling.col;
 2601|     26|    const int col_sb_start = f->frame_hdr->tiling.col_start_sb[tile_col];
 2602|     26|    const int col_sb128_start = col_sb_start >> !f->seq_hdr->sb128;
 2603|       |
 2604|     26|    if (IS_INTER_OR_SWITCH(f->frame_hdr) || f->frame_hdr->allow_intrabc) {
  ------------------
  |  |   36|     52|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 26]
  |  |  ------------------
  ------------------
  |  Branch (2604:45): [True: 26, False: 0]
  ------------------
 2605|     26|        dav1d_refmvs_tile_sbrow_init(&t->rt, &f->rf, ts->tiling.col_start,
 2606|     26|                                     ts->tiling.col_end, ts->tiling.row_start,
 2607|     26|                                     ts->tiling.row_end, t->by >> f->sb_shift,
 2608|     26|                                     ts->tiling.row, t->frame_thread.pass);
 2609|     26|    }
 2610|       |
 2611|     26|    if (IS_INTER_OR_SWITCH(f->frame_hdr) && c->n_fc > 1) {
  ------------------
  |  |   36|     52|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 26]
  |  |  ------------------
  ------------------
  |  Branch (2611:45): [True: 0, False: 0]
  ------------------
 2612|      0|        const int sby = (t->by - ts->tiling.row_start) >> f->sb_shift;
 2613|      0|        int (*const lowest_px)[2] = ts->lowest_pixel[sby];
 2614|      0|        for (int n = 0; n < 7; n++)
  ------------------
  |  Branch (2614:25): [True: 0, False: 0]
  ------------------
 2615|      0|            for (int m = 0; m < 2; m++)
  ------------------
  |  Branch (2615:29): [True: 0, False: 0]
  ------------------
 2616|      0|                lowest_px[n][m] = INT_MIN;
 2617|      0|    }
 2618|       |
 2619|     26|    reset_context(&t->l, IS_KEY_OR_INTRA(f->frame_hdr), t->frame_thread.pass);
  ------------------
  |  |   43|     26|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|     26|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  ------------------
 2620|     26|    if (t->frame_thread.pass == 2) {
  ------------------
  |  Branch (2620:9): [True: 8, False: 18]
  ------------------
 2621|      8|        const int off_2pass = c->n_tc > 1 ? f->sb128w * f->frame_hdr->tiling.rows : 0;
  ------------------
  |  Branch (2621:31): [True: 8, False: 0]
  ------------------
 2622|      8|        for (t->bx = ts->tiling.col_start,
 2623|      8|             t->a = f->a + off_2pass + col_sb128_start + tile_row * f->sb128w;
 2624|    128|             t->bx < ts->tiling.col_end; t->bx += sb_step)
  ------------------
  |  Branch (2624:14): [True: 120, False: 8]
  ------------------
 2625|    120|        {
 2626|    120|            if (atomic_load_explicit(c->flush, memory_order_acquire))
  ------------------
  |  Branch (2626:17): [True: 0, False: 120]
  ------------------
 2627|      0|                return 1;
 2628|    120|            if (decode_sb(t, root_bl, dav1d_intra_edge_tree[root_bl]))
  ------------------
  |  Branch (2628:17): [True: 0, False: 120]
  ------------------
 2629|      0|                return 1;
 2630|    120|            if (t->bx & 16 || f->seq_hdr->sb128)
  ------------------
  |  Branch (2630:17): [True: 40, False: 80]
  |  Branch (2630:31): [True: 40, False: 40]
  ------------------
 2631|     80|                t->a++;
 2632|    120|        }
 2633|      8|        f->bd_fn.backup_ipred_edge(t);
 2634|      8|        return 0;
 2635|      8|    }
 2636|       |
 2637|     18|    if (f->c->n_tc > 1 && f->frame_hdr->use_ref_frame_mvs) {
  ------------------
  |  Branch (2637:9): [True: 18, False: 0]
  |  Branch (2637:27): [True: 0, False: 18]
  ------------------
 2638|      0|        f->c->refmvs_dsp.load_tmvs(&f->rf, ts->tiling.row,
 2639|      0|                                   ts->tiling.col_start >> 1, ts->tiling.col_end >> 1,
 2640|      0|                                   t->by >> 1, (t->by + sb_step) >> 1);
 2641|      0|    }
 2642|     18|    memset(t->pal_sz_uv[1], 0, sizeof(*t->pal_sz_uv));
 2643|     18|    const int sb128y = t->by >> 5;
 2644|     18|    for (t->bx = ts->tiling.col_start, t->a = f->a + col_sb128_start + tile_row * f->sb128w,
 2645|     18|         t->lf_mask = f->lf.mask + sb128y * f->sb128w + col_sb128_start;
 2646|    258|         t->bx < ts->tiling.col_end; t->bx += sb_step)
  ------------------
  |  Branch (2646:10): [True: 240, False: 18]
  ------------------
 2647|    240|    {
 2648|    240|        if (atomic_load_explicit(c->flush, memory_order_acquire))
  ------------------
  |  Branch (2648:13): [True: 0, False: 240]
  ------------------
 2649|      0|            return 1;
 2650|    240|        if (root_bl == BL_128X128) {
  ------------------
  |  Branch (2650:13): [True: 120, False: 120]
  ------------------
 2651|    120|            t->cur_sb_cdef_idx_ptr = t->lf_mask->cdef_idx;
 2652|    120|            t->cur_sb_cdef_idx_ptr[0] = -1;
 2653|    120|            t->cur_sb_cdef_idx_ptr[1] = -1;
 2654|    120|            t->cur_sb_cdef_idx_ptr[2] = -1;
 2655|    120|            t->cur_sb_cdef_idx_ptr[3] = -1;
 2656|    120|        } else {
 2657|    120|            t->cur_sb_cdef_idx_ptr =
 2658|    120|                &t->lf_mask->cdef_idx[((t->bx & 16) >> 4) +
 2659|    120|                                      ((t->by & 16) >> 3)];
 2660|    120|            t->cur_sb_cdef_idx_ptr[0] = -1;
 2661|    120|        }
 2662|       |        // Restoration filter
 2663|    960|        for (int p = 0; p < 3; p++) {
  ------------------
  |  Branch (2663:25): [True: 720, False: 240]
  ------------------
 2664|    720|            if (!((f->lf.restore_planes >> p) & 1U))
  ------------------
  |  Branch (2664:17): [True: 720, False: 0]
  ------------------
 2665|    720|                continue;
 2666|       |
 2667|      0|            const int ss_ver = p && f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  ------------------
  |  Branch (2667:32): [True: 0, False: 0]
  |  Branch (2667:37): [True: 0, False: 0]
  ------------------
 2668|      0|            const int ss_hor = p && f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  ------------------
  |  Branch (2668:32): [True: 0, False: 0]
  |  Branch (2668:37): [True: 0, False: 0]
  ------------------
 2669|      0|            const int unit_size_log2 = f->frame_hdr->restoration.unit_size[!!p];
 2670|      0|            const int y = t->by * 4 >> ss_ver;
 2671|      0|            const int h = (f->cur.p.h + ss_ver) >> ss_ver;
 2672|       |
 2673|      0|            const int unit_size = 1 << unit_size_log2;
 2674|      0|            const unsigned mask = unit_size - 1;
 2675|      0|            if (y & mask) continue;
  ------------------
  |  Branch (2675:17): [True: 0, False: 0]
  ------------------
 2676|      0|            const int half_unit = unit_size >> 1;
 2677|       |            // Round half up at frame boundaries, if there's more than one
 2678|       |            // restoration unit
 2679|      0|            if (y && y + half_unit > h) continue;
  ------------------
  |  Branch (2679:17): [True: 0, False: 0]
  |  Branch (2679:22): [True: 0, False: 0]
  ------------------
 2680|       |
 2681|      0|            const enum Dav1dRestorationType frame_type = f->frame_hdr->restoration.type[p];
 2682|       |
 2683|      0|            if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
  ------------------
  |  Branch (2683:17): [True: 0, False: 0]
  ------------------
 2684|      0|                const int w = (f->sr_cur.p.p.w + ss_hor) >> ss_hor;
 2685|      0|                const int n_units = imax(1, (w + half_unit) >> unit_size_log2);
 2686|       |
 2687|      0|                const int d = f->frame_hdr->super_res.width_scale_denominator;
 2688|      0|                const int rnd = unit_size * 8 - 1, shift = unit_size_log2 + 3;
 2689|      0|                const int x0 = ((4 *  t->bx            * d >> ss_hor) + rnd) >> shift;
 2690|      0|                const int x1 = ((4 * (t->bx + sb_step) * d >> ss_hor) + rnd) >> shift;
 2691|       |
 2692|      0|                for (int x = x0; x < imin(x1, n_units); x++) {
  ------------------
  |  Branch (2692:34): [True: 0, False: 0]
  ------------------
 2693|      0|                    const int px_x = x << (unit_size_log2 + ss_hor);
 2694|      0|                    const int sb_idx = (t->by >> 5) * f->sr_sb128w + (px_x >> 7);
 2695|      0|                    const int unit_idx = ((t->by & 16) >> 3) + ((px_x & 64) >> 6);
 2696|      0|                    Av1RestorationUnit *const lr = &f->lf.lr_mask[sb_idx].lr[p][unit_idx];
 2697|       |
 2698|      0|                    read_restoration_info(t, lr, p, frame_type);
 2699|      0|                }
 2700|      0|            } else {
 2701|      0|                const int x = 4 * t->bx >> ss_hor;
 2702|      0|                if (x & mask) continue;
  ------------------
  |  Branch (2702:21): [True: 0, False: 0]
  ------------------
 2703|      0|                const int w = (f->cur.p.w + ss_hor) >> ss_hor;
 2704|       |                // Round half up at frame boundaries, if there's more than one
 2705|       |                // restoration unit
 2706|      0|                if (x && x + half_unit > w) continue;
  ------------------
  |  Branch (2706:21): [True: 0, False: 0]
  |  Branch (2706:26): [True: 0, False: 0]
  ------------------
 2707|      0|                const int sb_idx = (t->by >> 5) * f->sr_sb128w + (t->bx >> 5);
 2708|      0|                const int unit_idx = ((t->by & 16) >> 3) + ((t->bx & 16) >> 4);
 2709|      0|                Av1RestorationUnit *const lr = &f->lf.lr_mask[sb_idx].lr[p][unit_idx];
 2710|       |
 2711|      0|                read_restoration_info(t, lr, p, frame_type);
 2712|      0|            }
 2713|      0|        }
 2714|    240|        if (decode_sb(t, root_bl, dav1d_intra_edge_tree[root_bl]))
  ------------------
  |  Branch (2714:13): [True: 0, False: 240]
  ------------------
 2715|      0|            return 1;
 2716|    240|        if (t->bx & 16 || f->seq_hdr->sb128) {
  ------------------
  |  Branch (2716:13): [True: 60, False: 180]
  |  Branch (2716:27): [True: 120, False: 60]
  ------------------
 2717|    180|            t->a++;
 2718|    180|            t->lf_mask++;
 2719|    180|        }
 2720|    240|    }
 2721|       |
 2722|     18|    if (f->seq_hdr->ref_frame_mvs && f->c->n_tc > 1 && IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|      0|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2722:9): [True: 0, False: 18]
  |  Branch (2722:38): [True: 0, False: 0]
  ------------------
 2723|      0|        dav1d_refmvs_save_tmvs(&f->c->refmvs_dsp, &t->rt,
 2724|      0|                               ts->tiling.col_start >> 1, ts->tiling.col_end >> 1,
 2725|      0|                               t->by >> 1, (t->by + sb_step) >> 1);
 2726|      0|    }
 2727|       |
 2728|       |    // backup pre-loopfilter pixels for intra prediction of the next sbrow
 2729|     18|    if (t->frame_thread.pass != 1)
  ------------------
  |  Branch (2729:9): [True: 0, False: 18]
  ------------------
 2730|      0|        f->bd_fn.backup_ipred_edge(t);
 2731|       |
 2732|       |    // backup t->a/l.tx_lpf_y/uv at tile boundaries to use them to "fix"
 2733|       |    // up the initial value in neighbour tiles when running the loopfilter
 2734|     18|    int align_h = (f->bh + 31) & ~31;
 2735|     18|    memcpy(&f->lf.tx_lpf_right_edge[0][align_h * tile_col + t->by],
 2736|     18|           &t->l.tx_lpf_y[t->by & 16], sb_step);
 2737|     18|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 2738|     18|    align_h >>= ss_ver;
 2739|     18|    memcpy(&f->lf.tx_lpf_right_edge[1][align_h * tile_col + (t->by >> ss_ver)],
 2740|     18|           &t->l.tx_lpf_uv[(t->by & 16) >> ss_ver], sb_step >> ss_ver);
 2741|       |
 2742|       |    // error out on symbol decoder overread
 2743|     18|    if (ts->msac.cnt <= -15) return 1;
  ------------------
  |  Branch (2743:9): [True: 4, False: 14]
  ------------------
 2744|       |
 2745|     14|    return c->strict_std_compliance &&
  ------------------
  |  Branch (2745:12): [True: 0, False: 14]
  ------------------
 2746|      0|           (t->by >> f->sb_shift) + 1 >= f->frame_hdr->tiling.row_start_sb[tile_row + 1] &&
  ------------------
  |  Branch (2746:12): [True: 0, False: 0]
  ------------------
 2747|      0|           check_trailing_bits_after_symbol_coder(&ts->msac);
  ------------------
  |  Branch (2747:12): [True: 0, False: 0]
  ------------------
 2748|     18|}
dav1d_decode_frame_init:
 2750|      4|int dav1d_decode_frame_init(Dav1dFrameContext *const f) {
 2751|      4|    const Dav1dContext *const c = f->c;
 2752|      4|    int retval = DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      4|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 2753|       |
 2754|      4|    if (f->sbh > f->lf.start_of_tile_row_sz) {
  ------------------
  |  Branch (2754:9): [True: 4, False: 0]
  ------------------
 2755|      4|        dav1d_free(f->lf.start_of_tile_row);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2756|      4|        f->lf.start_of_tile_row = dav1d_malloc(ALLOC_TILE, f->sbh * sizeof(uint8_t));
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 2757|      4|        if (!f->lf.start_of_tile_row) {
  ------------------
  |  Branch (2757:13): [True: 0, False: 4]
  ------------------
 2758|      0|            f->lf.start_of_tile_row_sz = 0;
 2759|      0|            goto error;
 2760|      0|        }
 2761|      4|        f->lf.start_of_tile_row_sz = f->sbh;
 2762|      4|    }
 2763|      4|    int sby = 0;
 2764|      8|    for (int tile_row = 0; tile_row < f->frame_hdr->tiling.rows; tile_row++) {
  ------------------
  |  Branch (2764:28): [True: 4, False: 4]
  ------------------
 2765|      4|        f->lf.start_of_tile_row[sby++] = tile_row;
 2766|     34|        while (sby < f->frame_hdr->tiling.row_start_sb[tile_row + 1])
  ------------------
  |  Branch (2766:16): [True: 30, False: 4]
  ------------------
 2767|     30|            f->lf.start_of_tile_row[sby++] = 0;
 2768|      4|    }
 2769|       |
 2770|      4|    const int n_ts = f->frame_hdr->tiling.cols * f->frame_hdr->tiling.rows;
 2771|      4|    if (n_ts != f->n_ts) {
  ------------------
  |  Branch (2771:9): [True: 4, False: 0]
  ------------------
 2772|      4|        if (c->n_fc > 1) {
  ------------------
  |  Branch (2772:13): [True: 4, False: 0]
  ------------------
 2773|      4|            dav1d_free(f->frame_thread.tile_start_off);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2774|      4|            f->frame_thread.tile_start_off =
 2775|      4|                dav1d_malloc(ALLOC_TILE, sizeof(*f->frame_thread.tile_start_off) * n_ts);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 2776|      4|            if (!f->frame_thread.tile_start_off) {
  ------------------
  |  Branch (2776:17): [True: 0, False: 4]
  ------------------
 2777|      0|                f->n_ts = 0;
 2778|      0|                goto error;
 2779|      0|            }
 2780|      4|        }
 2781|      4|        dav1d_free_aligned(f->ts);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2782|      4|        f->ts = dav1d_alloc_aligned(ALLOC_TILE, sizeof(*f->ts) * n_ts, 32);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2783|      4|        if (!f->ts) goto error;
  ------------------
  |  Branch (2783:13): [True: 0, False: 4]
  ------------------
 2784|      4|        f->n_ts = n_ts;
 2785|      4|    }
 2786|       |
 2787|      4|    const int a_sz = f->sb128w * f->frame_hdr->tiling.rows * (1 + (c->n_fc > 1 && c->n_tc > 1));
  ------------------
  |  Branch (2787:68): [True: 4, False: 0]
  |  Branch (2787:83): [True: 4, False: 0]
  ------------------
 2788|      4|    if (a_sz != f->a_sz) {
  ------------------
  |  Branch (2788:9): [True: 4, False: 0]
  ------------------
 2789|      4|        dav1d_free(f->a);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2790|      4|        f->a = dav1d_malloc(ALLOC_TILE, sizeof(*f->a) * a_sz);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 2791|      4|        if (!f->a) {
  ------------------
  |  Branch (2791:13): [True: 0, False: 4]
  ------------------
 2792|      0|            f->a_sz = 0;
 2793|      0|            goto error;
 2794|      0|        }
 2795|      4|        f->a_sz = a_sz;
 2796|      4|    }
 2797|       |
 2798|      4|    const int num_sb128 = f->sb128w * f->sb128h;
 2799|      4|    const uint8_t *const size_mul = ss_size_mul[f->cur.p.layout];
 2800|      4|    const int hbd = !!f->seq_hdr->hbd;
 2801|      4|    if (c->n_fc > 1) {
  ------------------
  |  Branch (2801:9): [True: 4, False: 0]
  ------------------
 2802|      4|        const unsigned sb_step4 = f->sb_step * 4;
 2803|      4|        int tile_idx = 0;
 2804|      8|        for (int tile_row = 0; tile_row < f->frame_hdr->tiling.rows; tile_row++) {
  ------------------
  |  Branch (2804:32): [True: 4, False: 4]
  ------------------
 2805|      4|            const unsigned row_off = f->frame_hdr->tiling.row_start_sb[tile_row] *
 2806|      4|                                     sb_step4 * f->sb128w * 128;
 2807|      4|            const unsigned b_diff = (f->frame_hdr->tiling.row_start_sb[tile_row + 1] -
 2808|      4|                                     f->frame_hdr->tiling.row_start_sb[tile_row]) * sb_step4;
 2809|      8|            for (int tile_col = 0; tile_col < f->frame_hdr->tiling.cols; tile_col++) {
  ------------------
  |  Branch (2809:36): [True: 4, False: 4]
  ------------------
 2810|      4|                f->frame_thread.tile_start_off[tile_idx++] = row_off + b_diff *
 2811|      4|                    f->frame_hdr->tiling.col_start_sb[tile_col] * sb_step4;
 2812|      4|            }
 2813|      4|        }
 2814|       |
 2815|      4|        const int lowest_pixel_mem_sz = f->frame_hdr->tiling.cols * f->sbh;
 2816|      4|        if (lowest_pixel_mem_sz != f->tile_thread.lowest_pixel_mem_sz) {
  ------------------
  |  Branch (2816:13): [True: 4, False: 0]
  ------------------
 2817|      4|            dav1d_free(f->tile_thread.lowest_pixel_mem);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2818|      4|            f->tile_thread.lowest_pixel_mem =
 2819|      4|                dav1d_malloc(ALLOC_TILE, lowest_pixel_mem_sz *
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 2820|      4|                             sizeof(*f->tile_thread.lowest_pixel_mem));
 2821|      4|            if (!f->tile_thread.lowest_pixel_mem) {
  ------------------
  |  Branch (2821:17): [True: 0, False: 4]
  ------------------
 2822|      0|                f->tile_thread.lowest_pixel_mem_sz = 0;
 2823|      0|                goto error;
 2824|      0|            }
 2825|      4|            f->tile_thread.lowest_pixel_mem_sz = lowest_pixel_mem_sz;
 2826|      4|        }
 2827|      4|        int (*lowest_pixel_ptr)[7][2] = f->tile_thread.lowest_pixel_mem;
 2828|      8|        for (int tile_row = 0, tile_row_base = 0; tile_row < f->frame_hdr->tiling.rows;
  ------------------
  |  Branch (2828:51): [True: 4, False: 4]
  ------------------
 2829|      4|             tile_row++, tile_row_base += f->frame_hdr->tiling.cols)
 2830|      4|        {
 2831|      4|            const int tile_row_sb_h = f->frame_hdr->tiling.row_start_sb[tile_row + 1] -
 2832|      4|                                      f->frame_hdr->tiling.row_start_sb[tile_row];
 2833|      8|            for (int tile_col = 0; tile_col < f->frame_hdr->tiling.cols; tile_col++) {
  ------------------
  |  Branch (2833:36): [True: 4, False: 4]
  ------------------
 2834|      4|                f->ts[tile_row_base + tile_col].lowest_pixel = lowest_pixel_ptr;
 2835|      4|                lowest_pixel_ptr += tile_row_sb_h;
 2836|      4|            }
 2837|      4|        }
 2838|       |
 2839|      4|        const int cbi_sz = num_sb128 * size_mul[0];
 2840|      4|        if (cbi_sz != f->frame_thread.cbi_sz) {
  ------------------
  |  Branch (2840:13): [True: 4, False: 0]
  ------------------
 2841|      4|            dav1d_free_aligned(f->frame_thread.cbi);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2842|      4|            f->frame_thread.cbi =
 2843|      4|                dav1d_alloc_aligned(ALLOC_BLOCK, sizeof(*f->frame_thread.cbi) *
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2844|      4|                                    cbi_sz * 32 * 32 / 4, 64);
 2845|      4|            if (!f->frame_thread.cbi) {
  ------------------
  |  Branch (2845:17): [True: 0, False: 4]
  ------------------
 2846|      0|                f->frame_thread.cbi_sz = 0;
 2847|      0|                goto error;
 2848|      0|            }
 2849|      4|            f->frame_thread.cbi_sz = cbi_sz;
 2850|      4|        }
 2851|       |
 2852|      4|        const int cf_sz = (num_sb128 * size_mul[0]) << hbd;
 2853|      4|        if (cf_sz != f->frame_thread.cf_sz) {
  ------------------
  |  Branch (2853:13): [True: 4, False: 0]
  ------------------
 2854|      4|            dav1d_free_aligned(f->frame_thread.cf);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2855|      4|            f->frame_thread.cf =
 2856|      4|                dav1d_alloc_aligned(ALLOC_COEF, (size_t)cf_sz * 128 * 128 / 2, 64);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2857|      4|            if (!f->frame_thread.cf) {
  ------------------
  |  Branch (2857:17): [True: 0, False: 4]
  ------------------
 2858|      0|                f->frame_thread.cf_sz = 0;
 2859|      0|                goto error;
 2860|      0|            }
 2861|      4|            memset(f->frame_thread.cf, 0, (size_t)cf_sz * 128 * 128 / 2);
 2862|      4|            f->frame_thread.cf_sz = cf_sz;
 2863|      4|        }
 2864|       |
 2865|      4|        if (f->frame_hdr->allow_screen_content_tools) {
  ------------------
  |  Branch (2865:13): [True: 4, False: 0]
  ------------------
 2866|      4|            const int pal_sz = num_sb128 << hbd;
 2867|      4|            if (pal_sz != f->frame_thread.pal_sz) {
  ------------------
  |  Branch (2867:17): [True: 4, False: 0]
  ------------------
 2868|      4|                dav1d_free_aligned(f->frame_thread.pal);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2869|      4|                f->frame_thread.pal =
 2870|      4|                    dav1d_alloc_aligned(ALLOC_PAL, sizeof(*f->frame_thread.pal) *
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2871|      4|                                        pal_sz * 16 * 16, 64);
 2872|      4|                if (!f->frame_thread.pal) {
  ------------------
  |  Branch (2872:21): [True: 0, False: 4]
  ------------------
 2873|      0|                    f->frame_thread.pal_sz = 0;
 2874|      0|                    goto error;
 2875|      0|                }
 2876|      4|                f->frame_thread.pal_sz = pal_sz;
 2877|      4|            }
 2878|       |
 2879|      4|            const int pal_idx_sz = num_sb128 * size_mul[1];
 2880|      4|            if (pal_idx_sz != f->frame_thread.pal_idx_sz) {
  ------------------
  |  Branch (2880:17): [True: 4, False: 0]
  ------------------
 2881|      4|                dav1d_free_aligned(f->frame_thread.pal_idx);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2882|      4|                f->frame_thread.pal_idx =
 2883|      4|                    dav1d_alloc_aligned(ALLOC_PAL, sizeof(*f->frame_thread.pal_idx) *
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2884|      4|                                        pal_idx_sz * 128 * 128 / 8, 64);
 2885|      4|                if (!f->frame_thread.pal_idx) {
  ------------------
  |  Branch (2885:21): [True: 0, False: 4]
  ------------------
 2886|      0|                    f->frame_thread.pal_idx_sz = 0;
 2887|      0|                    goto error;
 2888|      0|                }
 2889|      4|                f->frame_thread.pal_idx_sz = pal_idx_sz;
 2890|      4|            }
 2891|      4|        } else if (f->frame_thread.pal) {
  ------------------
  |  Branch (2891:20): [True: 0, False: 0]
  ------------------
 2892|      0|            dav1d_freep_aligned(&f->frame_thread.pal);
 2893|      0|            dav1d_freep_aligned(&f->frame_thread.pal_idx);
 2894|      0|            f->frame_thread.pal_sz = f->frame_thread.pal_idx_sz = 0;
 2895|      0|        }
 2896|      4|    }
 2897|       |
 2898|       |    // update allocation of block contexts for above
 2899|      4|    ptrdiff_t y_stride = f->cur.stride[0], uv_stride = f->cur.stride[1];
 2900|      4|    const int has_resize = f->frame_hdr->width[0] != f->frame_hdr->width[1];
 2901|      4|    const int need_cdef_lpf_copy = c->n_tc > 1 && has_resize;
  ------------------
  |  Branch (2901:36): [True: 4, False: 0]
  |  Branch (2901:51): [True: 0, False: 4]
  ------------------
 2902|      4|    if (y_stride * f->sbh * 4 != f->lf.cdef_buf_plane_sz[0] ||
  ------------------
  |  Branch (2902:9): [True: 4, False: 0]
  ------------------
 2903|      0|        uv_stride * f->sbh * 8 != f->lf.cdef_buf_plane_sz[1] ||
  ------------------
  |  Branch (2903:9): [True: 0, False: 0]
  ------------------
 2904|      0|        need_cdef_lpf_copy != f->lf.need_cdef_lpf_copy ||
  ------------------
  |  Branch (2904:9): [True: 0, False: 0]
  ------------------
 2905|      0|        f->sbh != f->lf.cdef_buf_sbh)
  ------------------
  |  Branch (2905:9): [True: 0, False: 0]
  ------------------
 2906|      4|    {
 2907|      4|        dav1d_free_aligned(f->lf.cdef_line_buf);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2908|      4|        size_t alloc_sz = 64;
 2909|      4|        alloc_sz += (size_t)llabs(y_stride) * 4 * f->sbh << need_cdef_lpf_copy;
 2910|      4|        alloc_sz += (size_t)llabs(uv_stride) * 8 * f->sbh << need_cdef_lpf_copy;
 2911|      4|        uint8_t *ptr = f->lf.cdef_line_buf = dav1d_alloc_aligned(ALLOC_CDEF, alloc_sz, 32);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2912|      4|        if (!ptr) {
  ------------------
  |  Branch (2912:13): [True: 0, False: 4]
  ------------------
 2913|      0|            f->lf.cdef_buf_plane_sz[0] = f->lf.cdef_buf_plane_sz[1] = 0;
 2914|      0|            goto error;
 2915|      0|        }
 2916|       |
 2917|      4|        ptr += 32;
 2918|      4|        if (y_stride < 0) {
  ------------------
  |  Branch (2918:13): [True: 0, False: 4]
  ------------------
 2919|      0|            f->lf.cdef_line[0][0] = ptr - y_stride * (f->sbh * 4 - 1);
 2920|      0|            f->lf.cdef_line[1][0] = ptr - y_stride * (f->sbh * 4 - 3);
 2921|      4|        } else {
 2922|      4|            f->lf.cdef_line[0][0] = ptr + y_stride * 0;
 2923|      4|            f->lf.cdef_line[1][0] = ptr + y_stride * 2;
 2924|      4|        }
 2925|      4|        ptr += llabs(y_stride) * f->sbh * 4;
 2926|      4|        if (uv_stride < 0) {
  ------------------
  |  Branch (2926:13): [True: 0, False: 4]
  ------------------
 2927|      0|            f->lf.cdef_line[0][1] = ptr - uv_stride * (f->sbh * 8 - 1);
 2928|      0|            f->lf.cdef_line[0][2] = ptr - uv_stride * (f->sbh * 8 - 3);
 2929|      0|            f->lf.cdef_line[1][1] = ptr - uv_stride * (f->sbh * 8 - 5);
 2930|      0|            f->lf.cdef_line[1][2] = ptr - uv_stride * (f->sbh * 8 - 7);
 2931|      4|        } else {
 2932|      4|            f->lf.cdef_line[0][1] = ptr + uv_stride * 0;
 2933|      4|            f->lf.cdef_line[0][2] = ptr + uv_stride * 2;
 2934|      4|            f->lf.cdef_line[1][1] = ptr + uv_stride * 4;
 2935|      4|            f->lf.cdef_line[1][2] = ptr + uv_stride * 6;
 2936|      4|        }
 2937|       |
 2938|      4|        if (need_cdef_lpf_copy) {
  ------------------
  |  Branch (2938:13): [True: 0, False: 4]
  ------------------
 2939|      0|            ptr += llabs(uv_stride) * f->sbh * 8;
 2940|      0|            if (y_stride < 0)
  ------------------
  |  Branch (2940:17): [True: 0, False: 0]
  ------------------
 2941|      0|                f->lf.cdef_lpf_line[0] = ptr - y_stride * (f->sbh * 4 - 1);
 2942|      0|            else
 2943|      0|                f->lf.cdef_lpf_line[0] = ptr;
 2944|      0|            ptr += llabs(y_stride) * f->sbh * 4;
 2945|      0|            if (uv_stride < 0) {
  ------------------
  |  Branch (2945:17): [True: 0, False: 0]
  ------------------
 2946|      0|                f->lf.cdef_lpf_line[1] = ptr - uv_stride * (f->sbh * 4 - 1);
 2947|      0|                f->lf.cdef_lpf_line[2] = ptr - uv_stride * (f->sbh * 8 - 1);
 2948|      0|            } else {
 2949|      0|                f->lf.cdef_lpf_line[1] = ptr;
 2950|      0|                f->lf.cdef_lpf_line[2] = ptr + uv_stride * f->sbh * 4;
 2951|      0|            }
 2952|      0|        }
 2953|       |
 2954|      4|        f->lf.cdef_buf_plane_sz[0] = (int) y_stride * f->sbh * 4;
 2955|      4|        f->lf.cdef_buf_plane_sz[1] = (int) uv_stride * f->sbh * 8;
 2956|      4|        f->lf.need_cdef_lpf_copy = need_cdef_lpf_copy;
 2957|      4|        f->lf.cdef_buf_sbh = f->sbh;
 2958|      4|    }
 2959|       |
 2960|      4|    const int sb128 = f->seq_hdr->sb128;
 2961|      4|    const int num_lines = c->n_tc > 1 ? f->sbh * 4 << sb128 : 12;
  ------------------
  |  Branch (2961:27): [True: 4, False: 0]
  ------------------
 2962|      4|    y_stride = f->sr_cur.p.stride[0], uv_stride = f->sr_cur.p.stride[1];
 2963|      4|    if (y_stride * num_lines != f->lf.lr_buf_plane_sz[0] ||
  ------------------
  |  Branch (2963:9): [True: 4, False: 0]
  ------------------
 2964|      0|        uv_stride * num_lines * 2 != f->lf.lr_buf_plane_sz[1])
  ------------------
  |  Branch (2964:9): [True: 0, False: 0]
  ------------------
 2965|      4|    {
 2966|      4|        dav1d_free_aligned(f->lf.lr_line_buf);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 2967|       |        // lr simd may overread the input, so slightly over-allocate the lpf buffer
 2968|      4|        size_t alloc_sz = 128;
 2969|      4|        alloc_sz += (size_t)llabs(y_stride) * num_lines;
 2970|      4|        alloc_sz += (size_t)llabs(uv_stride) * num_lines * 2;
 2971|      4|        uint8_t *ptr = f->lf.lr_line_buf = dav1d_alloc_aligned(ALLOC_LR, alloc_sz, 64);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 2972|      4|        if (!ptr) {
  ------------------
  |  Branch (2972:13): [True: 0, False: 4]
  ------------------
 2973|      0|            f->lf.lr_buf_plane_sz[0] = f->lf.lr_buf_plane_sz[1] = 0;
 2974|      0|            goto error;
 2975|      0|        }
 2976|       |
 2977|      4|        ptr += 64;
 2978|      4|        if (y_stride < 0)
  ------------------
  |  Branch (2978:13): [True: 0, False: 4]
  ------------------
 2979|      0|            f->lf.lr_lpf_line[0] = ptr - y_stride * (num_lines - 1);
 2980|      4|        else
 2981|      4|            f->lf.lr_lpf_line[0] = ptr;
 2982|      4|        ptr += llabs(y_stride) * num_lines;
 2983|      4|        if (uv_stride < 0) {
  ------------------
  |  Branch (2983:13): [True: 0, False: 4]
  ------------------
 2984|      0|            f->lf.lr_lpf_line[1] = ptr - uv_stride * (num_lines * 1 - 1);
 2985|      0|            f->lf.lr_lpf_line[2] = ptr - uv_stride * (num_lines * 2 - 1);
 2986|      4|        } else {
 2987|      4|            f->lf.lr_lpf_line[1] = ptr;
 2988|      4|            f->lf.lr_lpf_line[2] = ptr + uv_stride * num_lines;
 2989|      4|        }
 2990|       |
 2991|      4|        f->lf.lr_buf_plane_sz[0] = (int) y_stride * num_lines;
 2992|      4|        f->lf.lr_buf_plane_sz[1] = (int) uv_stride * num_lines * 2;
 2993|      4|    }
 2994|       |
 2995|       |    // update allocation for loopfilter masks
 2996|      4|    if (num_sb128 != f->lf.mask_sz) {
  ------------------
  |  Branch (2996:9): [True: 4, False: 0]
  ------------------
 2997|      4|        dav1d_free(f->lf.mask);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2998|      4|        dav1d_free(f->lf.level);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 2999|      4|        f->lf.mask = dav1d_malloc(ALLOC_LF, sizeof(*f->lf.mask) * num_sb128);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3000|       |        // over-allocate by 3 bytes since some of the SIMD implementations
 3001|       |        // index this from the level type and can thus over-read by up to 3
 3002|      4|        f->lf.level = dav1d_malloc(ALLOC_LF, sizeof(*f->lf.level) * num_sb128 * 32 * 32 + 3);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3003|      4|        if (!f->lf.mask || !f->lf.level) {
  ------------------
  |  Branch (3003:13): [True: 0, False: 4]
  |  Branch (3003:28): [True: 0, False: 4]
  ------------------
 3004|      0|            f->lf.mask_sz = 0;
 3005|      0|            goto error;
 3006|      0|        }
 3007|      4|        if (c->n_fc > 1) {
  ------------------
  |  Branch (3007:13): [True: 4, False: 0]
  ------------------
 3008|      4|            dav1d_free(f->frame_thread.b);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 3009|      4|            f->frame_thread.b = dav1d_malloc(ALLOC_BLOCK, sizeof(*f->frame_thread.b) *
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3010|      4|                                             num_sb128 * 32 * 32);
 3011|      4|            if (!f->frame_thread.b) {
  ------------------
  |  Branch (3011:17): [True: 0, False: 4]
  ------------------
 3012|      0|                f->lf.mask_sz = 0;
 3013|      0|                goto error;
 3014|      0|            }
 3015|      4|        }
 3016|      4|        f->lf.mask_sz = num_sb128;
 3017|      4|    }
 3018|       |
 3019|      4|    f->sr_sb128w = (f->sr_cur.p.p.w + 127) >> 7;
 3020|      4|    const int lr_mask_sz = f->sr_sb128w * f->sb128h;
 3021|      4|    if (lr_mask_sz != f->lf.lr_mask_sz) {
  ------------------
  |  Branch (3021:9): [True: 4, False: 0]
  ------------------
 3022|      4|        dav1d_free(f->lf.lr_mask);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 3023|      4|        f->lf.lr_mask = dav1d_malloc(ALLOC_LR, sizeof(*f->lf.lr_mask) * lr_mask_sz);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3024|      4|        if (!f->lf.lr_mask) {
  ------------------
  |  Branch (3024:13): [True: 0, False: 4]
  ------------------
 3025|      0|            f->lf.lr_mask_sz = 0;
 3026|      0|            goto error;
 3027|      0|        }
 3028|      4|        f->lf.lr_mask_sz = lr_mask_sz;
 3029|      4|    }
 3030|      4|    f->lf.restore_planes =
 3031|      4|        ((f->frame_hdr->restoration.type[0] != DAV1D_RESTORATION_NONE) << 0) +
 3032|      4|        ((f->frame_hdr->restoration.type[1] != DAV1D_RESTORATION_NONE) << 1) +
 3033|      4|        ((f->frame_hdr->restoration.type[2] != DAV1D_RESTORATION_NONE) << 2);
 3034|      4|    if (f->frame_hdr->loopfilter.sharpness != f->lf.last_sharpness) {
  ------------------
  |  Branch (3034:9): [True: 4, False: 0]
  ------------------
 3035|      4|        dav1d_calc_eih(&f->lf.lim_lut, f->frame_hdr->loopfilter.sharpness);
 3036|      4|        f->lf.last_sharpness = f->frame_hdr->loopfilter.sharpness;
 3037|      4|    }
 3038|      4|    dav1d_calc_lf_values(f->lf.lvl, f->frame_hdr, (int8_t[4]) { 0, 0, 0, 0 });
 3039|      4|    memset(f->lf.mask, 0, sizeof(*f->lf.mask) * num_sb128);
 3040|       |
 3041|      4|    const int ipred_edge_sz = f->sbh * f->sb128w << hbd;
 3042|      4|    if (ipred_edge_sz != f->ipred_edge_sz) {
  ------------------
  |  Branch (3042:9): [True: 4, False: 0]
  ------------------
 3043|      4|        dav1d_free_aligned(f->ipred_edge[0]);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
 3044|      4|        uint8_t *ptr = f->ipred_edge[0] =
 3045|      4|            dav1d_alloc_aligned(ALLOC_IPRED, ipred_edge_sz * 128 * 3, 64);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
 3046|      4|        if (!ptr) {
  ------------------
  |  Branch (3046:13): [True: 0, False: 4]
  ------------------
 3047|      0|            f->ipred_edge_sz = 0;
 3048|      0|            goto error;
 3049|      0|        }
 3050|      4|        f->ipred_edge[1] = ptr + ipred_edge_sz * 128 * 1;
 3051|      4|        f->ipred_edge[2] = ptr + ipred_edge_sz * 128 * 2;
 3052|      4|        f->ipred_edge_sz = ipred_edge_sz;
 3053|      4|    }
 3054|       |
 3055|      4|    const int re_sz = f->sb128h * f->frame_hdr->tiling.cols;
 3056|      4|    if (re_sz != f->lf.re_sz) {
  ------------------
  |  Branch (3056:9): [True: 4, False: 0]
  ------------------
 3057|      4|        dav1d_free(f->lf.tx_lpf_right_edge[0]);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 3058|      4|        f->lf.tx_lpf_right_edge[0] = dav1d_malloc(ALLOC_LF, re_sz * 32 * 2);
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3059|      4|        if (!f->lf.tx_lpf_right_edge[0]) {
  ------------------
  |  Branch (3059:13): [True: 0, False: 4]
  ------------------
 3060|      0|            f->lf.re_sz = 0;
 3061|      0|            goto error;
 3062|      0|        }
 3063|      4|        f->lf.tx_lpf_right_edge[1] = f->lf.tx_lpf_right_edge[0] + re_sz * 32;
 3064|      4|        f->lf.re_sz = re_sz;
 3065|      4|    }
 3066|       |
 3067|       |    // init ref mvs
 3068|      4|    if (IS_INTER_OR_SWITCH(f->frame_hdr) || f->frame_hdr->allow_intrabc) {
  ------------------
  |  |   36|      8|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  |  Branch (3068:45): [True: 4, False: 0]
  ------------------
 3069|      4|        const int ret =
 3070|      4|            dav1d_refmvs_init_frame(&f->rf, f->seq_hdr, f->frame_hdr,
 3071|      4|                                    f->refpoc, f->mvs, f->refrefpoc, f->ref_mvs,
 3072|      4|                                    f->c->n_tc, f->c->n_fc);
 3073|      4|        if (ret < 0) goto error;
  ------------------
  |  Branch (3073:13): [True: 0, False: 4]
  ------------------
 3074|      4|    }
 3075|       |
 3076|       |    // setup dequant tables
 3077|      4|    init_quant_tables(f->seq_hdr, f->frame_hdr, f->frame_hdr->quant.yac, f->dq);
 3078|      4|    if (f->frame_hdr->quant.qm)
  ------------------
  |  Branch (3078:9): [True: 2, False: 2]
  ------------------
 3079|     40|        for (int i = 0; i < N_RECT_TX_SIZES; i++) {
  ------------------
  |  Branch (3079:25): [True: 38, False: 2]
  ------------------
 3080|     38|            f->qm[i][0] = dav1d_qm_tbl[f->frame_hdr->quant.qm_y][0][i];
 3081|     38|            f->qm[i][1] = dav1d_qm_tbl[f->frame_hdr->quant.qm_u][1][i];
 3082|     38|            f->qm[i][2] = dav1d_qm_tbl[f->frame_hdr->quant.qm_v][1][i];
 3083|     38|        }
 3084|      2|    else
 3085|      2|        memset(f->qm, 0, sizeof(f->qm));
 3086|       |
 3087|       |    // setup jnt_comp weights
 3088|      4|    if (f->frame_hdr->switchable_comp_refs) {
  ------------------
  |  Branch (3088:9): [True: 0, False: 4]
  ------------------
 3089|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (3089:25): [True: 0, False: 0]
  ------------------
 3090|      0|            const unsigned ref0poc = f->refp[i].p.frame_hdr->frame_offset;
 3091|       |
 3092|      0|            for (int j = i + 1; j < 7; j++) {
  ------------------
  |  Branch (3092:33): [True: 0, False: 0]
  ------------------
 3093|      0|                const unsigned ref1poc = f->refp[j].p.frame_hdr->frame_offset;
 3094|       |
 3095|      0|                const unsigned d1 =
 3096|      0|                    imin(abs(get_poc_diff(f->seq_hdr->order_hint_n_bits, ref0poc,
 3097|      0|                                          f->cur.frame_hdr->frame_offset)), 31);
 3098|      0|                const unsigned d0 =
 3099|      0|                    imin(abs(get_poc_diff(f->seq_hdr->order_hint_n_bits, ref1poc,
 3100|      0|                                          f->cur.frame_hdr->frame_offset)), 31);
 3101|      0|                const int order = d0 <= d1;
 3102|       |
 3103|      0|                static const uint8_t quant_dist_weight[3][2] = {
 3104|      0|                    { 2, 3 }, { 2, 5 }, { 2, 7 }
 3105|      0|                };
 3106|      0|                static const uint8_t quant_dist_lookup_table[4][2] = {
 3107|      0|                    { 9, 7 }, { 11, 5 }, { 12, 4 }, { 13, 3 }
 3108|      0|                };
 3109|       |
 3110|      0|                int k;
 3111|      0|                for (k = 0; k < 3; k++) {
  ------------------
  |  Branch (3111:29): [True: 0, False: 0]
  ------------------
 3112|      0|                    const int c0 = quant_dist_weight[k][order];
 3113|      0|                    const int c1 = quant_dist_weight[k][!order];
 3114|      0|                    const int d0_c0 = d0 * c0;
 3115|      0|                    const int d1_c1 = d1 * c1;
 3116|      0|                    if ((d0 > d1 && d0_c0 < d1_c1) || (d0 <= d1 && d0_c0 > d1_c1)) break;
  ------------------
  |  Branch (3116:26): [True: 0, False: 0]
  |  Branch (3116:37): [True: 0, False: 0]
  |  Branch (3116:56): [True: 0, False: 0]
  |  Branch (3116:68): [True: 0, False: 0]
  ------------------
 3117|      0|                }
 3118|       |
 3119|      0|                f->jnt_weights[i][j] = quant_dist_lookup_table[k][order];
 3120|      0|            }
 3121|      0|        }
 3122|      0|    }
 3123|       |
 3124|       |    /* Init loopfilter pointers. Increasing NULL pointers is technically UB,
 3125|       |     * so just point the chroma pointers in 4:0:0 to the luma plane here to
 3126|       |     * avoid having additional in-loop branches in various places. We never
 3127|       |     * dereference those pointers so it doesn't really matter what they
 3128|       |     * point at, as long as the pointers are valid. */
 3129|      4|    const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400;
 3130|      4|    f->lf.p[0] = f->cur.data[0];
 3131|      4|    f->lf.p[1] = f->cur.data[has_chroma ? 1 : 0];
  ------------------
  |  Branch (3131:30): [True: 4, False: 0]
  ------------------
 3132|      4|    f->lf.p[2] = f->cur.data[has_chroma ? 2 : 0];
  ------------------
  |  Branch (3132:30): [True: 4, False: 0]
  ------------------
 3133|      4|    f->lf.sr_p[0] = f->sr_cur.p.data[0];
 3134|      4|    f->lf.sr_p[1] = f->sr_cur.p.data[has_chroma ? 1 : 0];
  ------------------
  |  Branch (3134:38): [True: 4, False: 0]
  ------------------
 3135|      4|    f->lf.sr_p[2] = f->sr_cur.p.data[has_chroma ? 2 : 0];
  ------------------
  |  Branch (3135:38): [True: 4, False: 0]
  ------------------
 3136|       |
 3137|      4|    retval = 0;
 3138|      4|error:
 3139|      4|    return retval;
 3140|      4|}
dav1d_decode_frame_init_cdf:
 3142|      4|int dav1d_decode_frame_init_cdf(Dav1dFrameContext *const f) {
 3143|      4|    const Dav1dContext *const c = f->c;
 3144|      4|    int retval = DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      4|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3145|       |
 3146|      4|    if (f->frame_hdr->refresh_context)
  ------------------
  |  Branch (3146:9): [True: 0, False: 4]
  ------------------
 3147|      0|        dav1d_cdf_thread_copy(f->out_cdf.data.cdf, &f->in_cdf);
 3148|       |
 3149|       |    // parse individual tiles per tile group
 3150|      4|    int tile_row = 0, tile_col = 0;
 3151|      4|    f->task_thread.update_set = 0;
 3152|      8|    for (int i = 0; i < f->n_tile_data; i++) {
  ------------------
  |  Branch (3152:21): [True: 4, False: 4]
  ------------------
 3153|      4|        const uint8_t *data = f->tile[i].data.data;
 3154|      4|        size_t size = f->tile[i].data.sz;
 3155|       |
 3156|      8|        for (int j = f->tile[i].start; j <= f->tile[i].end; j++) {
  ------------------
  |  Branch (3156:40): [True: 4, False: 4]
  ------------------
 3157|      4|            size_t tile_sz;
 3158|      4|            if (j == f->tile[i].end) {
  ------------------
  |  Branch (3158:17): [True: 4, False: 0]
  ------------------
 3159|      4|                tile_sz = size;
 3160|      4|            } else {
 3161|      0|                if (f->frame_hdr->tiling.n_bytes > size) goto error;
  ------------------
  |  Branch (3161:21): [True: 0, False: 0]
  ------------------
 3162|      0|                tile_sz = 0;
 3163|      0|                for (unsigned k = 0; k < f->frame_hdr->tiling.n_bytes; k++)
  ------------------
  |  Branch (3163:38): [True: 0, False: 0]
  ------------------
 3164|      0|                    tile_sz |= (unsigned)*data++ << (k * 8);
 3165|      0|                tile_sz++;
 3166|      0|                size -= f->frame_hdr->tiling.n_bytes;
 3167|      0|                if (tile_sz > size) goto error;
  ------------------
  |  Branch (3167:21): [True: 0, False: 0]
  ------------------
 3168|      0|            }
 3169|       |
 3170|      4|            setup_tile(&f->ts[j], f, data, tile_sz, tile_row, tile_col++,
 3171|      4|                       c->n_fc > 1 ? f->frame_thread.tile_start_off[j] : 0);
  ------------------
  |  Branch (3171:24): [True: 4, False: 0]
  ------------------
 3172|       |
 3173|      4|            if (tile_col == f->frame_hdr->tiling.cols) {
  ------------------
  |  Branch (3173:17): [True: 4, False: 0]
  ------------------
 3174|      4|                tile_col = 0;
 3175|      4|                tile_row++;
 3176|      4|            }
 3177|      4|            if (j == f->frame_hdr->tiling.update && f->frame_hdr->refresh_context)
  ------------------
  |  Branch (3177:17): [True: 4, False: 0]
  |  Branch (3177:53): [True: 0, False: 4]
  ------------------
 3178|      0|                f->task_thread.update_set = 1;
 3179|      4|            data += tile_sz;
 3180|      4|            size -= tile_sz;
 3181|      4|        }
 3182|      4|    }
 3183|       |
 3184|      4|    if (c->n_tc > 1) {
  ------------------
  |  Branch (3184:9): [True: 4, False: 0]
  ------------------
 3185|      4|        const int uses_2pass = c->n_fc > 1;
 3186|     84|        for (int n = 0; n < f->sb128w * f->frame_hdr->tiling.rows * (1 + uses_2pass); n++)
  ------------------
  |  Branch (3186:25): [True: 80, False: 4]
  ------------------
 3187|     80|            reset_context(&f->a[n], IS_KEY_OR_INTRA(f->frame_hdr),
  ------------------
  |  |   43|     80|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|     80|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  ------------------
 3188|     80|                          uses_2pass ? 1 + (n >= f->sb128w * f->frame_hdr->tiling.rows) : 0);
  ------------------
  |  Branch (3188:27): [True: 80, False: 0]
  ------------------
 3189|      4|    }
 3190|       |
 3191|      4|    retval = 0;
 3192|      4|error:
 3193|      4|    return retval;
 3194|      4|}
dav1d_decode_frame_exit:
 3242|     58|void dav1d_decode_frame_exit(Dav1dFrameContext *const f, int retval) {
 3243|     58|    const Dav1dContext *const c = f->c;
 3244|       |
 3245|     58|    if (f->sr_cur.p.data[0])
  ------------------
  |  Branch (3245:9): [True: 4, False: 54]
  ------------------
 3246|     58|        atomic_init(&f->task_thread.error, 0);
 3247|       |
 3248|     58|    if (c->n_fc > 1 && retval && f->frame_thread.cf) {
  ------------------
  |  Branch (3248:9): [True: 58, False: 0]
  |  Branch (3248:24): [True: 58, False: 0]
  |  Branch (3248:34): [True: 8, False: 50]
  ------------------
 3249|      8|        memset(f->frame_thread.cf, 0,
 3250|      8|               (size_t)f->frame_thread.cf_sz * 128 * 128 / 2);
 3251|      8|    }
 3252|    464|    for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (3252:21): [True: 406, False: 58]
  ------------------
 3253|    406|        if (f->refp[i].p.frame_hdr) {
  ------------------
  |  Branch (3253:13): [True: 0, False: 406]
  ------------------
 3254|      0|            if (!retval && c->n_fc > 1 && c->strict_std_compliance &&
  ------------------
  |  Branch (3254:17): [True: 0, False: 0]
  |  Branch (3254:28): [True: 0, False: 0]
  |  Branch (3254:43): [True: 0, False: 0]
  ------------------
 3255|      0|                atomic_load(&f->refp[i].progress[1]) == FRAME_ERROR)
  ------------------
  |  |   35|      0|#define FRAME_ERROR (UINT_MAX - 1)
  ------------------
  |  Branch (3255:17): [True: 0, False: 0]
  ------------------
 3256|      0|            {
 3257|      0|                retval = DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3258|      0|                atomic_store(&f->task_thread.error, 1);
 3259|      0|                atomic_store(&f->sr_cur.progress[1], FRAME_ERROR);
 3260|      0|            }
 3261|      0|            dav1d_thread_picture_unref(&f->refp[i]);
 3262|      0|        }
 3263|    406|        dav1d_ref_dec(&f->ref_mvs_ref[i]);
 3264|    406|    }
 3265|       |
 3266|     58|    dav1d_picture_unref_internal(&f->cur);
 3267|     58|    dav1d_thread_picture_unref(&f->sr_cur);
 3268|     58|    dav1d_cdf_thread_unref(&f->in_cdf);
 3269|     58|    if (f->frame_hdr && f->frame_hdr->refresh_context) {
  ------------------
  |  Branch (3269:9): [True: 8, False: 50]
  |  Branch (3269:25): [True: 0, False: 8]
  ------------------
 3270|      0|        if (f->out_cdf.progress)
  ------------------
  |  Branch (3270:13): [True: 0, False: 0]
  ------------------
 3271|      0|            atomic_store(f->out_cdf.progress, retval == 0 ? 1 : TILE_ERROR);
  ------------------
  |  Branch (3271:13): [True: 0, False: 0]
  ------------------
 3272|      0|        dav1d_cdf_thread_unref(&f->out_cdf);
 3273|      0|    }
 3274|     58|    dav1d_ref_dec(&f->cur_segmap_ref);
 3275|     58|    dav1d_ref_dec(&f->prev_segmap_ref);
 3276|     58|    dav1d_ref_dec(&f->mvs_ref);
 3277|     58|    dav1d_ref_dec(&f->seq_hdr_ref);
 3278|     58|    dav1d_ref_dec(&f->frame_hdr_ref);
 3279|       |
 3280|     62|    for (int i = 0; i < f->n_tile_data; i++)
  ------------------
  |  Branch (3280:21): [True: 4, False: 58]
  ------------------
 3281|      4|        dav1d_data_unref_internal(&f->tile[i].data);
 3282|     58|    f->task_thread.retval = retval;
 3283|     58|}
dav1d_submit_frame:
 3327|      4|int dav1d_submit_frame(Dav1dContext *const c) {
 3328|      4|    Dav1dFrameContext *f;
 3329|      4|    int res = -1;
 3330|       |
 3331|       |    // wait for c->out_delayed[next] and move into c->out if visible
 3332|      4|    Dav1dThreadPicture *out_delayed;
 3333|      4|    if (c->n_fc > 1) {
  ------------------
  |  Branch (3333:9): [True: 4, False: 0]
  ------------------
 3334|      4|        pthread_mutex_lock(&c->task_thread.lock);
 3335|      4|        const unsigned next = c->frame_thread.next++;
 3336|      4|        if (c->frame_thread.next == c->n_fc)
  ------------------
  |  Branch (3336:13): [True: 0, False: 4]
  ------------------
 3337|      0|            c->frame_thread.next = 0;
 3338|       |
 3339|      4|        f = &c->fc[next];
 3340|      4|        while (f->n_tile_data > 0)
  ------------------
  |  Branch (3340:16): [True: 0, False: 4]
  ------------------
 3341|      0|            pthread_cond_wait(&f->task_thread.cond,
 3342|      0|                              &c->task_thread.lock);
 3343|      4|        out_delayed = &c->frame_thread.out_delayed[next];
 3344|      4|        if (out_delayed->p.data[0] || atomic_load(&f->task_thread.error)) {
  ------------------
  |  Branch (3344:13): [True: 0, False: 4]
  |  Branch (3344:39): [True: 0, False: 4]
  ------------------
 3345|      0|            unsigned first = atomic_load(&c->task_thread.first);
 3346|      0|            if (first + 1U < c->n_fc)
  ------------------
  |  Branch (3346:17): [True: 0, False: 0]
  ------------------
 3347|      0|                atomic_fetch_add(&c->task_thread.first, 1U);
 3348|      0|            else
 3349|      0|                atomic_store(&c->task_thread.first, 0);
 3350|      0|            atomic_compare_exchange_strong(&c->task_thread.reset_task_cur,
 3351|      0|                                           &first, UINT_MAX);
 3352|      0|            if (c->task_thread.cur && c->task_thread.cur < c->n_fc)
  ------------------
  |  Branch (3352:17): [True: 0, False: 0]
  |  Branch (3352:39): [True: 0, False: 0]
  ------------------
 3353|      0|                c->task_thread.cur--;
 3354|      0|        }
 3355|      4|        const int error = f->task_thread.retval;
 3356|      4|        if (error) {
  ------------------
  |  Branch (3356:13): [True: 0, False: 4]
  ------------------
 3357|      0|            f->task_thread.retval = 0;
 3358|      0|            c->cached_error = error;
 3359|      0|            dav1d_data_props_copy(&c->cached_error_props, &out_delayed->p.m);
 3360|      0|            dav1d_thread_picture_unref(out_delayed);
 3361|      4|        } else if (out_delayed->p.data[0]) {
  ------------------
  |  Branch (3361:20): [True: 0, False: 4]
  ------------------
 3362|      0|            const unsigned progress = atomic_load_explicit(&out_delayed->progress[1],
 3363|      0|                                                           memory_order_relaxed);
 3364|      0|            if ((out_delayed->visible || c->output_invisible_frames) &&
  ------------------
  |  Branch (3364:18): [True: 0, False: 0]
  |  Branch (3364:42): [True: 0, False: 0]
  ------------------
 3365|      0|                progress != FRAME_ERROR)
  ------------------
  |  |   35|      0|#define FRAME_ERROR (UINT_MAX - 1)
  ------------------
  |  Branch (3365:17): [True: 0, False: 0]
  ------------------
 3366|      0|            {
 3367|      0|                dav1d_thread_picture_ref(&c->out, out_delayed);
 3368|      0|                c->event_flags |= dav1d_picture_get_event_flags(out_delayed);
 3369|      0|            }
 3370|      0|            dav1d_thread_picture_unref(out_delayed);
 3371|      0|        }
 3372|      4|    } else {
 3373|      0|        f = c->fc;
 3374|      0|    }
 3375|       |
 3376|      4|    f->seq_hdr = c->seq_hdr;
 3377|      4|    f->seq_hdr_ref = c->seq_hdr_ref;
 3378|      4|    dav1d_ref_inc(f->seq_hdr_ref);
 3379|      4|    f->frame_hdr = c->frame_hdr;
 3380|      4|    f->frame_hdr_ref = c->frame_hdr_ref;
 3381|      4|    c->frame_hdr = NULL;
 3382|      4|    c->frame_hdr_ref = NULL;
 3383|      4|    f->dsp = &c->dsp[f->seq_hdr->hbd];
 3384|       |
 3385|      4|    const int bpc = 8 + 2 * f->seq_hdr->hbd;
 3386|       |
 3387|      4|    if (!f->dsp->ipred.intra_pred[DC_PRED]) {
  ------------------
  |  Branch (3387:9): [True: 4, False: 0]
  ------------------
 3388|      4|        Dav1dDSPContext *const dsp = &c->dsp[f->seq_hdr->hbd];
 3389|       |
 3390|      4|        switch (bpc) {
 3391|      0|#define assign_bitdepth_case(bd) \
 3392|      0|            dav1d_cdef_dsp_init_##bd##bpc(&dsp->cdef); \
 3393|      0|            dav1d_intra_pred_dsp_init_##bd##bpc(&dsp->ipred); \
 3394|      0|            dav1d_itx_dsp_init_##bd##bpc(&dsp->itx, bpc); \
 3395|      0|            dav1d_loop_filter_dsp_init_##bd##bpc(&dsp->lf); \
 3396|      0|            dav1d_loop_restoration_dsp_init_##bd##bpc(&dsp->lr, bpc); \
 3397|      0|            dav1d_mc_dsp_init_##bd##bpc(&dsp->mc); \
 3398|      0|            dav1d_film_grain_dsp_init_##bd##bpc(&dsp->fg); \
 3399|      0|            break
 3400|      0|#if CONFIG_8BPC
 3401|      4|        case 8:
  ------------------
  |  Branch (3401:9): [True: 4, False: 0]
  ------------------
 3402|      4|            assign_bitdepth_case(8);
  ------------------
  |  | 3392|      4|            dav1d_cdef_dsp_init_##bd##bpc(&dsp->cdef); \
  |  | 3393|      4|            dav1d_intra_pred_dsp_init_##bd##bpc(&dsp->ipred); \
  |  | 3394|      4|            dav1d_itx_dsp_init_##bd##bpc(&dsp->itx, bpc); \
  |  | 3395|      4|            dav1d_loop_filter_dsp_init_##bd##bpc(&dsp->lf); \
  |  | 3396|      4|            dav1d_loop_restoration_dsp_init_##bd##bpc(&dsp->lr, bpc); \
  |  | 3397|      4|            dav1d_mc_dsp_init_##bd##bpc(&dsp->mc); \
  |  | 3398|      4|            dav1d_film_grain_dsp_init_##bd##bpc(&dsp->fg); \
  |  | 3399|      4|            break
  ------------------
 3403|      0|#endif
 3404|      0|#if CONFIG_16BPC
 3405|      0|        case 10:
  ------------------
  |  Branch (3405:9): [True: 0, False: 4]
  ------------------
 3406|      0|        case 12:
  ------------------
  |  Branch (3406:9): [True: 0, False: 4]
  ------------------
 3407|      0|            assign_bitdepth_case(16);
  ------------------
  |  | 3392|      0|            dav1d_cdef_dsp_init_##bd##bpc(&dsp->cdef); \
  |  | 3393|      0|            dav1d_intra_pred_dsp_init_##bd##bpc(&dsp->ipred); \
  |  | 3394|      0|            dav1d_itx_dsp_init_##bd##bpc(&dsp->itx, bpc); \
  |  | 3395|      0|            dav1d_loop_filter_dsp_init_##bd##bpc(&dsp->lf); \
  |  | 3396|      0|            dav1d_loop_restoration_dsp_init_##bd##bpc(&dsp->lr, bpc); \
  |  | 3397|      0|            dav1d_mc_dsp_init_##bd##bpc(&dsp->mc); \
  |  | 3398|      0|            dav1d_film_grain_dsp_init_##bd##bpc(&dsp->fg); \
  |  | 3399|      0|            break
  ------------------
 3408|      0|#endif
 3409|      0|#undef assign_bitdepth_case
 3410|      0|        default:
  ------------------
  |  Branch (3410:9): [True: 0, False: 4]
  ------------------
 3411|      0|            dav1d_log(c, "Compiled without support for %d-bit decoding\n",
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
 3412|      0|                    8 + 2 * f->seq_hdr->hbd);
 3413|      0|            res = DAV1D_ERR(ENOPROTOOPT);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3414|      0|            goto error;
 3415|      4|        }
 3416|      4|    }
 3417|       |
 3418|      4|#define assign_bitdepth_case(bd) \
 3419|      4|        f->bd_fn.recon_b_inter = dav1d_recon_b_inter_##bd##bpc; \
 3420|      4|        f->bd_fn.recon_b_intra = dav1d_recon_b_intra_##bd##bpc; \
 3421|      4|        f->bd_fn.filter_sbrow = dav1d_filter_sbrow_##bd##bpc; \
 3422|      4|        f->bd_fn.filter_sbrow_deblock_cols = dav1d_filter_sbrow_deblock_cols_##bd##bpc; \
 3423|      4|        f->bd_fn.filter_sbrow_deblock_rows = dav1d_filter_sbrow_deblock_rows_##bd##bpc; \
 3424|      4|        f->bd_fn.filter_sbrow_cdef = dav1d_filter_sbrow_cdef_##bd##bpc; \
 3425|      4|        f->bd_fn.filter_sbrow_resize = dav1d_filter_sbrow_resize_##bd##bpc; \
 3426|      4|        f->bd_fn.filter_sbrow_lr = dav1d_filter_sbrow_lr_##bd##bpc; \
 3427|      4|        f->bd_fn.backup_ipred_edge = dav1d_backup_ipred_edge_##bd##bpc; \
 3428|      4|        f->bd_fn.read_coef_blocks = dav1d_read_coef_blocks_##bd##bpc; \
 3429|      4|        f->bd_fn.copy_pal_block_y = dav1d_copy_pal_block_y_##bd##bpc; \
 3430|      4|        f->bd_fn.copy_pal_block_uv = dav1d_copy_pal_block_uv_##bd##bpc; \
 3431|      4|        f->bd_fn.read_pal_plane = dav1d_read_pal_plane_##bd##bpc; \
 3432|      4|        f->bd_fn.read_pal_uv = dav1d_read_pal_uv_##bd##bpc
 3433|      4|    if (!f->seq_hdr->hbd) {
  ------------------
  |  Branch (3433:9): [True: 4, False: 0]
  ------------------
 3434|      4|#if CONFIG_8BPC
 3435|      4|        assign_bitdepth_case(8);
  ------------------
  |  | 3419|      4|        f->bd_fn.recon_b_inter = dav1d_recon_b_inter_##bd##bpc; \
  |  | 3420|      4|        f->bd_fn.recon_b_intra = dav1d_recon_b_intra_##bd##bpc; \
  |  | 3421|      4|        f->bd_fn.filter_sbrow = dav1d_filter_sbrow_##bd##bpc; \
  |  | 3422|      4|        f->bd_fn.filter_sbrow_deblock_cols = dav1d_filter_sbrow_deblock_cols_##bd##bpc; \
  |  | 3423|      4|        f->bd_fn.filter_sbrow_deblock_rows = dav1d_filter_sbrow_deblock_rows_##bd##bpc; \
  |  | 3424|      4|        f->bd_fn.filter_sbrow_cdef = dav1d_filter_sbrow_cdef_##bd##bpc; \
  |  | 3425|      4|        f->bd_fn.filter_sbrow_resize = dav1d_filter_sbrow_resize_##bd##bpc; \
  |  | 3426|      4|        f->bd_fn.filter_sbrow_lr = dav1d_filter_sbrow_lr_##bd##bpc; \
  |  | 3427|      4|        f->bd_fn.backup_ipred_edge = dav1d_backup_ipred_edge_##bd##bpc; \
  |  | 3428|      4|        f->bd_fn.read_coef_blocks = dav1d_read_coef_blocks_##bd##bpc; \
  |  | 3429|      4|        f->bd_fn.copy_pal_block_y = dav1d_copy_pal_block_y_##bd##bpc; \
  |  | 3430|      4|        f->bd_fn.copy_pal_block_uv = dav1d_copy_pal_block_uv_##bd##bpc; \
  |  | 3431|      4|        f->bd_fn.read_pal_plane = dav1d_read_pal_plane_##bd##bpc; \
  |  | 3432|      4|        f->bd_fn.read_pal_uv = dav1d_read_pal_uv_##bd##bpc
  ------------------
 3436|      4|#endif
 3437|      4|    } else {
 3438|      0|#if CONFIG_16BPC
 3439|      0|        assign_bitdepth_case(16);
  ------------------
  |  | 3419|      0|        f->bd_fn.recon_b_inter = dav1d_recon_b_inter_##bd##bpc; \
  |  | 3420|      0|        f->bd_fn.recon_b_intra = dav1d_recon_b_intra_##bd##bpc; \
  |  | 3421|      0|        f->bd_fn.filter_sbrow = dav1d_filter_sbrow_##bd##bpc; \
  |  | 3422|      0|        f->bd_fn.filter_sbrow_deblock_cols = dav1d_filter_sbrow_deblock_cols_##bd##bpc; \
  |  | 3423|      0|        f->bd_fn.filter_sbrow_deblock_rows = dav1d_filter_sbrow_deblock_rows_##bd##bpc; \
  |  | 3424|      0|        f->bd_fn.filter_sbrow_cdef = dav1d_filter_sbrow_cdef_##bd##bpc; \
  |  | 3425|      0|        f->bd_fn.filter_sbrow_resize = dav1d_filter_sbrow_resize_##bd##bpc; \
  |  | 3426|      0|        f->bd_fn.filter_sbrow_lr = dav1d_filter_sbrow_lr_##bd##bpc; \
  |  | 3427|      0|        f->bd_fn.backup_ipred_edge = dav1d_backup_ipred_edge_##bd##bpc; \
  |  | 3428|      0|        f->bd_fn.read_coef_blocks = dav1d_read_coef_blocks_##bd##bpc; \
  |  | 3429|      0|        f->bd_fn.copy_pal_block_y = dav1d_copy_pal_block_y_##bd##bpc; \
  |  | 3430|      0|        f->bd_fn.copy_pal_block_uv = dav1d_copy_pal_block_uv_##bd##bpc; \
  |  | 3431|      0|        f->bd_fn.read_pal_plane = dav1d_read_pal_plane_##bd##bpc; \
  |  | 3432|      0|        f->bd_fn.read_pal_uv = dav1d_read_pal_uv_##bd##bpc
  ------------------
 3440|      0|#endif
 3441|      0|    }
 3442|      4|#undef assign_bitdepth_case
 3443|       |
 3444|      4|    int ref_coded_width[7];
 3445|      4|    if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|      4|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 3446|      0|        if (f->frame_hdr->primary_ref_frame != DAV1D_PRIMARY_REF_NONE) {
  ------------------
  |  |   45|      0|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  |  Branch (3446:13): [True: 0, False: 0]
  ------------------
 3447|      0|            const int pri_ref = f->frame_hdr->refidx[f->frame_hdr->primary_ref_frame];
 3448|      0|            if (!c->refs[pri_ref].p.p.data[0]) {
  ------------------
  |  Branch (3448:17): [True: 0, False: 0]
  ------------------
 3449|      0|                res = DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3450|      0|                goto error;
 3451|      0|            }
 3452|      0|        }
 3453|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (3453:25): [True: 0, False: 0]
  ------------------
 3454|      0|            const int refidx = f->frame_hdr->refidx[i];
 3455|      0|            if (!c->refs[refidx].p.p.data[0] ||
  ------------------
  |  Branch (3455:17): [True: 0, False: 0]
  ------------------
 3456|      0|                f->frame_hdr->width[0] * 2 < c->refs[refidx].p.p.p.w ||
  ------------------
  |  Branch (3456:17): [True: 0, False: 0]
  ------------------
 3457|      0|                f->frame_hdr->height * 2 < c->refs[refidx].p.p.p.h ||
  ------------------
  |  Branch (3457:17): [True: 0, False: 0]
  ------------------
 3458|      0|                f->frame_hdr->width[0] > c->refs[refidx].p.p.p.w * 16 ||
  ------------------
  |  Branch (3458:17): [True: 0, False: 0]
  ------------------
 3459|      0|                f->frame_hdr->height > c->refs[refidx].p.p.p.h * 16 ||
  ------------------
  |  Branch (3459:17): [True: 0, False: 0]
  ------------------
 3460|      0|                f->seq_hdr->layout != c->refs[refidx].p.p.p.layout ||
  ------------------
  |  Branch (3460:17): [True: 0, False: 0]
  ------------------
 3461|      0|                bpc != c->refs[refidx].p.p.p.bpc)
  ------------------
  |  Branch (3461:17): [True: 0, False: 0]
  ------------------
 3462|      0|            {
 3463|      0|                for (int j = 0; j < i; j++)
  ------------------
  |  Branch (3463:33): [True: 0, False: 0]
  ------------------
 3464|      0|                    dav1d_thread_picture_unref(&f->refp[j]);
 3465|      0|                res = DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3466|      0|                goto error;
 3467|      0|            }
 3468|      0|            dav1d_thread_picture_ref(&f->refp[i], &c->refs[refidx].p);
 3469|      0|            ref_coded_width[i] = c->refs[refidx].p.p.frame_hdr->width[0];
 3470|      0|            if (f->frame_hdr->width[0] != c->refs[refidx].p.p.p.w ||
  ------------------
  |  Branch (3470:17): [True: 0, False: 0]
  ------------------
 3471|      0|                f->frame_hdr->height != c->refs[refidx].p.p.p.h)
  ------------------
  |  Branch (3471:17): [True: 0, False: 0]
  ------------------
 3472|      0|            {
 3473|      0|#define scale_fac(ref_sz, this_sz) \
 3474|      0|    ((((ref_sz) << 14) + ((this_sz) >> 1)) / (this_sz))
 3475|      0|                f->svc[i][0].scale = scale_fac(c->refs[refidx].p.p.p.w,
  ------------------
  |  | 3474|      0|    ((((ref_sz) << 14) + ((this_sz) >> 1)) / (this_sz))
  ------------------
 3476|      0|                                               f->frame_hdr->width[0]);
 3477|      0|                f->svc[i][1].scale = scale_fac(c->refs[refidx].p.p.p.h,
  ------------------
  |  | 3474|      0|    ((((ref_sz) << 14) + ((this_sz) >> 1)) / (this_sz))
  ------------------
 3478|      0|                                               f->frame_hdr->height);
 3479|      0|                f->svc[i][0].step = (f->svc[i][0].scale + 8) >> 4;
 3480|      0|                f->svc[i][1].step = (f->svc[i][1].scale + 8) >> 4;
 3481|      0|            } else {
 3482|      0|                f->svc[i][0].scale = f->svc[i][1].scale = 0;
 3483|      0|            }
 3484|      0|            f->gmv_warp_allowed[i] = f->frame_hdr->gmv[i].type > DAV1D_WM_TYPE_TRANSLATION &&
  ------------------
  |  Branch (3484:38): [True: 0, False: 0]
  ------------------
 3485|      0|                                     !f->frame_hdr->force_integer_mv &&
  ------------------
  |  Branch (3485:38): [True: 0, False: 0]
  ------------------
 3486|      0|                                     !dav1d_get_shear_params(&f->frame_hdr->gmv[i]) &&
  ------------------
  |  Branch (3486:38): [True: 0, False: 0]
  ------------------
 3487|      0|                                     !f->svc[i][0].scale;
  ------------------
  |  Branch (3487:38): [True: 0, False: 0]
  ------------------
 3488|      0|        }
 3489|      0|    }
 3490|       |
 3491|       |    // setup entropy
 3492|      4|    if (f->frame_hdr->primary_ref_frame == DAV1D_PRIMARY_REF_NONE) {
  ------------------
  |  |   45|      4|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  |  Branch (3492:9): [True: 4, False: 0]
  ------------------
 3493|      4|        dav1d_cdf_thread_init_static(&f->in_cdf, f->frame_hdr->quant.yac);
 3494|      4|    } else {
 3495|      0|        const int pri_ref = f->frame_hdr->refidx[f->frame_hdr->primary_ref_frame];
 3496|      0|        dav1d_cdf_thread_ref(&f->in_cdf, &c->cdf[pri_ref]);
 3497|      0|    }
 3498|      4|    if (f->frame_hdr->refresh_context) {
  ------------------
  |  Branch (3498:9): [True: 0, False: 4]
  ------------------
 3499|      0|        res = dav1d_cdf_thread_alloc(c, &f->out_cdf, c->n_fc > 1);
 3500|      0|        if (res < 0) goto error;
  ------------------
  |  Branch (3500:13): [True: 0, False: 0]
  ------------------
 3501|      0|    }
 3502|       |
 3503|       |    // FIXME qsort so tiles are in order (for frame threading)
 3504|      4|    if (f->n_tile_data_alloc < c->n_tile_data) {
  ------------------
  |  Branch (3504:9): [True: 4, False: 0]
  ------------------
 3505|      4|        dav1d_free(f->tile);
  ------------------
  |  |  135|      4|#define dav1d_free(ptr) free(ptr)
  ------------------
 3506|      4|        assert(c->n_tile_data < INT_MAX / (int)sizeof(*f->tile));
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3507|      4|        f->tile = dav1d_malloc(ALLOC_TILE, c->n_tile_data * sizeof(*f->tile));
  ------------------
  |  |  132|      4|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 3508|      4|        if (!f->tile) {
  ------------------
  |  Branch (3508:13): [True: 0, False: 4]
  ------------------
 3509|      0|            f->n_tile_data_alloc = f->n_tile_data = 0;
 3510|      0|            res = DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3511|      0|            goto error;
 3512|      0|        }
 3513|      4|        f->n_tile_data_alloc = c->n_tile_data;
 3514|      4|    }
 3515|      4|    memcpy(f->tile, c->tile, c->n_tile_data * sizeof(*f->tile));
 3516|      4|    memset(c->tile, 0, c->n_tile_data * sizeof(*c->tile));
 3517|      4|    f->n_tile_data = c->n_tile_data;
 3518|      4|    c->n_tile_data = 0;
 3519|       |
 3520|       |    // allocate frame
 3521|      4|    res = dav1d_thread_picture_alloc(c, f, bpc);
 3522|      4|    if (res < 0) goto error;
  ------------------
  |  Branch (3522:9): [True: 0, False: 4]
  ------------------
 3523|       |
 3524|      4|    if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
  ------------------
  |  Branch (3524:9): [True: 0, False: 4]
  ------------------
 3525|      0|        res = dav1d_picture_alloc_copy(c, &f->cur, f->frame_hdr->width[0], &f->sr_cur.p);
 3526|      0|        if (res < 0) goto error;
  ------------------
  |  Branch (3526:13): [True: 0, False: 0]
  ------------------
 3527|      4|    } else {
 3528|      4|        dav1d_picture_ref(&f->cur, &f->sr_cur.p);
 3529|      4|    }
 3530|       |
 3531|      4|    if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
  ------------------
  |  Branch (3531:9): [True: 0, False: 4]
  ------------------
 3532|      0|        f->resize_step[0] = scale_fac(f->cur.p.w, f->sr_cur.p.p.w);
  ------------------
  |  | 3474|      0|    ((((ref_sz) << 14) + ((this_sz) >> 1)) / (this_sz))
  ------------------
 3533|      0|        const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
 3534|      0|        const int in_cw = (f->cur.p.w + ss_hor) >> ss_hor;
 3535|      0|        const int out_cw = (f->sr_cur.p.p.w + ss_hor) >> ss_hor;
 3536|      0|        f->resize_step[1] = scale_fac(in_cw, out_cw);
  ------------------
  |  | 3474|      0|    ((((ref_sz) << 14) + ((this_sz) >> 1)) / (this_sz))
  ------------------
 3537|      0|#undef scale_fac
 3538|      0|        f->resize_start[0] = get_upscale_x0(f->cur.p.w, f->sr_cur.p.p.w, f->resize_step[0]);
 3539|      0|        f->resize_start[1] = get_upscale_x0(in_cw, out_cw, f->resize_step[1]);
 3540|      0|    }
 3541|       |
 3542|       |    // move f->cur into output queue
 3543|      4|    if (c->n_fc == 1) {
  ------------------
  |  Branch (3543:9): [True: 0, False: 4]
  ------------------
 3544|      0|        if (f->frame_hdr->show_frame || c->output_invisible_frames) {
  ------------------
  |  Branch (3544:13): [True: 0, False: 0]
  |  Branch (3544:41): [True: 0, False: 0]
  ------------------
 3545|      0|            dav1d_thread_picture_ref(&c->out, &f->sr_cur);
 3546|      0|            c->event_flags |= dav1d_picture_get_event_flags(&f->sr_cur);
 3547|      0|        }
 3548|      4|    } else {
 3549|      4|        dav1d_thread_picture_ref(out_delayed, &f->sr_cur);
 3550|      4|    }
 3551|       |
 3552|      4|    f->w4 = (f->frame_hdr->width[0] + 3) >> 2;
 3553|      4|    f->h4 = (f->frame_hdr->height + 3) >> 2;
 3554|      4|    f->bw = ((f->frame_hdr->width[0] + 7) >> 3) << 1;
 3555|      4|    f->bh = ((f->frame_hdr->height + 7) >> 3) << 1;
 3556|      4|    f->sb128w = (f->bw + 31) >> 5;
 3557|      4|    f->sb128h = (f->bh + 31) >> 5;
 3558|      4|    f->sb_shift = 4 + f->seq_hdr->sb128;
 3559|      4|    f->sb_step = 16 << f->seq_hdr->sb128;
 3560|      4|    f->sbh = (f->bh + f->sb_step - 1) >> f->sb_shift;
 3561|      4|    f->b4_stride = (f->bw + 31) & ~31;
 3562|      4|    f->bitdepth_max = (1 << f->cur.p.bpc) - 1;
 3563|      4|    atomic_init(&f->task_thread.error, 0);
 3564|      4|    const int uses_2pass = c->n_fc > 1;
 3565|      4|    const int cols = f->frame_hdr->tiling.cols;
 3566|      4|    const int rows = f->frame_hdr->tiling.rows;
 3567|      4|    atomic_store(&f->task_thread.task_counter,
 3568|      4|                 (cols * rows + f->sbh) << uses_2pass);
 3569|       |
 3570|       |    // ref_mvs
 3571|      4|    if (IS_INTER_OR_SWITCH(f->frame_hdr) || f->frame_hdr->allow_intrabc) {
  ------------------
  |  |   36|      8|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  |  Branch (3571:45): [True: 4, False: 0]
  ------------------
 3572|      4|        f->mvs_ref = dav1d_ref_create_using_pool(c->refmvs_pool,
 3573|      4|            sizeof(*f->mvs) * f->sb128h * 16 * (f->b4_stride >> 1));
 3574|      4|        if (!f->mvs_ref) {
  ------------------
  |  Branch (3574:13): [True: 0, False: 4]
  ------------------
 3575|      0|            res = DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3576|      0|            goto error;
 3577|      0|        }
 3578|      4|        f->mvs = f->mvs_ref->data;
 3579|      4|        if (!f->frame_hdr->allow_intrabc) {
  ------------------
  |  Branch (3579:13): [True: 0, False: 4]
  ------------------
 3580|      0|            for (int i = 0; i < 7; i++)
  ------------------
  |  Branch (3580:29): [True: 0, False: 0]
  ------------------
 3581|      0|                f->refpoc[i] = f->refp[i].p.frame_hdr->frame_offset;
 3582|      4|        } else {
 3583|      4|            memset(f->refpoc, 0, sizeof(f->refpoc));
 3584|      4|        }
 3585|      4|        if (f->frame_hdr->use_ref_frame_mvs) {
  ------------------
  |  Branch (3585:13): [True: 0, False: 4]
  ------------------
 3586|      0|            for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (3586:29): [True: 0, False: 0]
  ------------------
 3587|      0|                const int refidx = f->frame_hdr->refidx[i];
 3588|      0|                const int ref_w = ((ref_coded_width[i] + 7) >> 3) << 1;
 3589|      0|                const int ref_h = ((f->refp[i].p.p.h + 7) >> 3) << 1;
 3590|      0|                if (c->refs[refidx].refmvs != NULL &&
  ------------------
  |  Branch (3590:21): [True: 0, False: 0]
  ------------------
 3591|      0|                    ref_w == f->bw && ref_h == f->bh)
  ------------------
  |  Branch (3591:21): [True: 0, False: 0]
  |  Branch (3591:39): [True: 0, False: 0]
  ------------------
 3592|      0|                {
 3593|      0|                    f->ref_mvs_ref[i] = c->refs[refidx].refmvs;
 3594|      0|                    dav1d_ref_inc(f->ref_mvs_ref[i]);
 3595|      0|                    f->ref_mvs[i] = c->refs[refidx].refmvs->data;
 3596|      0|                } else {
 3597|      0|                    f->ref_mvs[i] = NULL;
 3598|      0|                    f->ref_mvs_ref[i] = NULL;
 3599|      0|                }
 3600|      0|                memcpy(f->refrefpoc[i], c->refs[refidx].refpoc,
 3601|      0|                       sizeof(*f->refrefpoc));
 3602|      0|            }
 3603|      4|        } else {
 3604|      4|            memset(f->ref_mvs_ref, 0, sizeof(f->ref_mvs_ref));
 3605|      4|        }
 3606|      4|    } else {
 3607|      0|        f->mvs_ref = NULL;
 3608|      0|        memset(f->ref_mvs_ref, 0, sizeof(f->ref_mvs_ref));
 3609|      0|    }
 3610|       |
 3611|       |    // segmap
 3612|      4|    if (f->frame_hdr->segmentation.enabled) {
  ------------------
  |  Branch (3612:9): [True: 2, False: 2]
  ------------------
 3613|       |        // By default, the previous segmentation map is not initialised.
 3614|      2|        f->prev_segmap_ref = NULL;
 3615|      2|        f->prev_segmap = NULL;
 3616|       |
 3617|       |        // We might need a previous frame's segmentation map. This
 3618|       |        // happens if there is either no update or a temporal update.
 3619|      2|        if (f->frame_hdr->segmentation.temporal || !f->frame_hdr->segmentation.update_map) {
  ------------------
  |  Branch (3619:13): [True: 0, False: 2]
  |  Branch (3619:52): [True: 0, False: 2]
  ------------------
 3620|      0|            const int pri_ref = f->frame_hdr->primary_ref_frame;
 3621|      0|            assert(pri_ref != DAV1D_PRIMARY_REF_NONE);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3622|      0|            const int ref_w = ((ref_coded_width[pri_ref] + 7) >> 3) << 1;
 3623|      0|            const int ref_h = ((f->refp[pri_ref].p.p.h + 7) >> 3) << 1;
 3624|      0|            if (ref_w == f->bw && ref_h == f->bh) {
  ------------------
  |  Branch (3624:17): [True: 0, False: 0]
  |  Branch (3624:35): [True: 0, False: 0]
  ------------------
 3625|      0|                f->prev_segmap_ref = c->refs[f->frame_hdr->refidx[pri_ref]].segmap;
 3626|      0|                if (f->prev_segmap_ref) {
  ------------------
  |  Branch (3626:21): [True: 0, False: 0]
  ------------------
 3627|      0|                    dav1d_ref_inc(f->prev_segmap_ref);
 3628|      0|                    f->prev_segmap = f->prev_segmap_ref->data;
 3629|      0|                }
 3630|      0|            }
 3631|      0|        }
 3632|       |
 3633|      2|        if (f->frame_hdr->segmentation.update_map) {
  ------------------
  |  Branch (3633:13): [True: 2, False: 0]
  ------------------
 3634|       |            // We're updating an existing map, but need somewhere to
 3635|       |            // put the new values. Allocate them here (the data
 3636|       |            // actually gets set elsewhere)
 3637|      2|            f->cur_segmap_ref = dav1d_ref_create_using_pool(c->segmap_pool,
 3638|      2|                sizeof(*f->cur_segmap) * f->b4_stride * 32 * f->sb128h);
 3639|      2|            if (!f->cur_segmap_ref) {
  ------------------
  |  Branch (3639:17): [True: 0, False: 2]
  ------------------
 3640|      0|                dav1d_ref_dec(&f->prev_segmap_ref);
 3641|      0|                res = DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3642|      0|                goto error;
 3643|      0|            }
 3644|      2|            f->cur_segmap = f->cur_segmap_ref->data;
 3645|      2|        } else if (f->prev_segmap_ref) {
  ------------------
  |  Branch (3645:20): [True: 0, False: 0]
  ------------------
 3646|       |            // We're not updating an existing map, and we have a valid
 3647|       |            // reference. Use that.
 3648|      0|            f->cur_segmap_ref = f->prev_segmap_ref;
 3649|      0|            dav1d_ref_inc(f->cur_segmap_ref);
 3650|      0|            f->cur_segmap = f->prev_segmap_ref->data;
 3651|      0|        } else {
 3652|       |            // We need to make a new map. Allocate one here and zero it out.
 3653|      0|            const size_t segmap_size = sizeof(*f->cur_segmap) * f->b4_stride * 32 * f->sb128h;
 3654|      0|            f->cur_segmap_ref = dav1d_ref_create_using_pool(c->segmap_pool, segmap_size);
 3655|      0|            if (!f->cur_segmap_ref) {
  ------------------
  |  Branch (3655:17): [True: 0, False: 0]
  ------------------
 3656|      0|                res = DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 3657|      0|                goto error;
 3658|      0|            }
 3659|      0|            f->cur_segmap = f->cur_segmap_ref->data;
 3660|      0|            memset(f->cur_segmap, 0, segmap_size);
 3661|      0|        }
 3662|      2|    } else {
 3663|      2|        f->cur_segmap = NULL;
 3664|      2|        f->cur_segmap_ref = NULL;
 3665|      2|        f->prev_segmap_ref = NULL;
 3666|      2|    }
 3667|       |
 3668|       |    // update references etc.
 3669|      4|    const unsigned refresh_frame_flags = f->frame_hdr->refresh_frame_flags;
 3670|     36|    for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (3670:21): [True: 32, False: 4]
  ------------------
 3671|     32|        if (refresh_frame_flags & (1 << i)) {
  ------------------
  |  Branch (3671:13): [True: 32, False: 0]
  ------------------
 3672|     32|            if (c->refs[i].p.p.frame_hdr)
  ------------------
  |  Branch (3672:17): [True: 0, False: 32]
  ------------------
 3673|      0|                dav1d_thread_picture_unref(&c->refs[i].p);
 3674|     32|            dav1d_thread_picture_ref(&c->refs[i].p, &f->sr_cur);
 3675|       |
 3676|     32|            dav1d_cdf_thread_unref(&c->cdf[i]);
 3677|     32|            if (f->frame_hdr->refresh_context) {
  ------------------
  |  Branch (3677:17): [True: 0, False: 32]
  ------------------
 3678|      0|                dav1d_cdf_thread_ref(&c->cdf[i], &f->out_cdf);
 3679|     32|            } else {
 3680|     32|                dav1d_cdf_thread_ref(&c->cdf[i], &f->in_cdf);
 3681|     32|            }
 3682|       |
 3683|     32|            dav1d_ref_dec(&c->refs[i].segmap);
 3684|     32|            c->refs[i].segmap = f->cur_segmap_ref;
 3685|     32|            if (f->cur_segmap_ref)
  ------------------
  |  Branch (3685:17): [True: 16, False: 16]
  ------------------
 3686|     16|                dav1d_ref_inc(f->cur_segmap_ref);
 3687|     32|            dav1d_ref_dec(&c->refs[i].refmvs);
 3688|     32|            if (!f->frame_hdr->allow_intrabc) {
  ------------------
  |  Branch (3688:17): [True: 0, False: 32]
  ------------------
 3689|      0|                c->refs[i].refmvs = f->mvs_ref;
 3690|      0|                if (f->mvs_ref)
  ------------------
  |  Branch (3690:21): [True: 0, False: 0]
  ------------------
 3691|      0|                    dav1d_ref_inc(f->mvs_ref);
 3692|      0|            }
 3693|     32|            memcpy(c->refs[i].refpoc, f->refpoc, sizeof(f->refpoc));
 3694|     32|        }
 3695|     32|    }
 3696|       |
 3697|      4|    if (c->n_fc == 1) {
  ------------------
  |  Branch (3697:9): [True: 0, False: 4]
  ------------------
 3698|      0|        if ((res = dav1d_decode_frame(f)) < 0) {
  ------------------
  |  Branch (3698:13): [True: 0, False: 0]
  ------------------
 3699|      0|            dav1d_thread_picture_unref(&c->out);
 3700|      0|            for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (3700:29): [True: 0, False: 0]
  ------------------
 3701|      0|                if (refresh_frame_flags & (1 << i)) {
  ------------------
  |  Branch (3701:21): [True: 0, False: 0]
  ------------------
 3702|      0|                    if (c->refs[i].p.p.frame_hdr)
  ------------------
  |  Branch (3702:25): [True: 0, False: 0]
  ------------------
 3703|      0|                        dav1d_thread_picture_unref(&c->refs[i].p);
 3704|      0|                    dav1d_cdf_thread_unref(&c->cdf[i]);
 3705|      0|                    dav1d_ref_dec(&c->refs[i].segmap);
 3706|      0|                    dav1d_ref_dec(&c->refs[i].refmvs);
 3707|      0|                }
 3708|      0|            }
 3709|      0|            goto error;
 3710|      0|        }
 3711|      4|    } else {
 3712|      4|        dav1d_task_frame_init(f);
 3713|      4|        pthread_mutex_unlock(&c->task_thread.lock);
 3714|      4|    }
 3715|       |
 3716|      4|    return 0;
 3717|      0|error:
 3718|      0|    atomic_init(&f->task_thread.error, 1);
 3719|      0|    dav1d_cdf_thread_unref(&f->in_cdf);
 3720|      0|    if (f->frame_hdr->refresh_context)
  ------------------
  |  Branch (3720:9): [True: 0, False: 0]
  ------------------
 3721|      0|        dav1d_cdf_thread_unref(&f->out_cdf);
 3722|      0|    for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (3722:21): [True: 0, False: 0]
  ------------------
 3723|      0|        if (f->refp[i].p.frame_hdr)
  ------------------
  |  Branch (3723:13): [True: 0, False: 0]
  ------------------
 3724|      0|            dav1d_thread_picture_unref(&f->refp[i]);
 3725|      0|        dav1d_ref_dec(&f->ref_mvs_ref[i]);
 3726|      0|    }
 3727|      0|    if (c->n_fc == 1)
  ------------------
  |  Branch (3727:9): [True: 0, False: 0]
  ------------------
 3728|      0|        dav1d_thread_picture_unref(&c->out);
 3729|      0|    else
 3730|      0|        dav1d_thread_picture_unref(out_delayed);
 3731|      0|    dav1d_picture_unref_internal(&f->cur);
 3732|      0|    dav1d_thread_picture_unref(&f->sr_cur);
 3733|      0|    dav1d_ref_dec(&f->mvs_ref);
 3734|      0|    dav1d_ref_dec(&f->seq_hdr_ref);
 3735|      0|    dav1d_ref_dec(&f->frame_hdr_ref);
 3736|      0|    dav1d_data_props_copy(&c->cached_error_props, &c->in.m);
 3737|       |
 3738|      0|    for (int i = 0; i < f->n_tile_data; i++)
  ------------------
  |  Branch (3738:21): [True: 0, False: 0]
  ------------------
 3739|      0|        dav1d_data_unref_internal(&f->tile[i].data);
 3740|      0|    f->n_tile_data = 0;
 3741|       |
 3742|      0|    if (c->n_fc > 1)
  ------------------
  |  Branch (3742:9): [True: 0, False: 0]
  ------------------
 3743|      0|        pthread_mutex_unlock(&c->task_thread.lock);
 3744|       |
 3745|      0|    return res;
 3746|      4|}
decode.c:reset_context:
 2390|    106|static void reset_context(BlockContext *const ctx, const int keyframe, const int pass) {
 2391|    106|    memset(ctx->intra, keyframe, sizeof(ctx->intra));
 2392|    106|    memset(ctx->uvmode, DC_PRED, sizeof(ctx->uvmode));
 2393|    106|    if (keyframe)
  ------------------
  |  Branch (2393:9): [True: 106, False: 0]
  ------------------
 2394|    106|        memset(ctx->mode, DC_PRED, sizeof(ctx->mode));
 2395|       |
 2396|    106|    if (pass == 2) return;
  ------------------
  |  Branch (2396:9): [True: 48, False: 58]
  ------------------
 2397|       |
 2398|     58|    memset(ctx->partition, 0, sizeof(ctx->partition));
 2399|     58|    memset(ctx->skip, 0, sizeof(ctx->skip));
 2400|     58|    memset(ctx->skip_mode, 0, sizeof(ctx->skip_mode));
 2401|     58|    memset(ctx->tx_lpf_y, 2, sizeof(ctx->tx_lpf_y));
 2402|     58|    memset(ctx->tx_lpf_uv, 1, sizeof(ctx->tx_lpf_uv));
 2403|     58|    memset(ctx->tx_intra, -1, sizeof(ctx->tx_intra));
 2404|     58|    memset(ctx->tx, TX_64X64, sizeof(ctx->tx));
 2405|     58|    if (!keyframe) {
  ------------------
  |  Branch (2405:9): [True: 0, False: 58]
  ------------------
 2406|      0|        memset(ctx->ref, -1, sizeof(ctx->ref));
 2407|      0|        memset(ctx->comp_type, 0, sizeof(ctx->comp_type));
 2408|      0|        memset(ctx->mode, NEARESTMV, sizeof(ctx->mode));
 2409|      0|    }
 2410|     58|    memset(ctx->lcoef, 0x40, sizeof(ctx->lcoef));
 2411|     58|    memset(ctx->ccoef, 0x40, sizeof(ctx->ccoef));
 2412|     58|    memset(ctx->filter, DAV1D_N_SWITCHABLE_FILTERS, sizeof(ctx->filter));
 2413|     58|    memset(ctx->seg_pred, 0, sizeof(ctx->seg_pred));
 2414|     58|    memset(ctx->pal_sz, 0, sizeof(ctx->pal_sz));
 2415|     58|}
decode.c:decode_sb:
 2119|  2.68k|{
 2120|  2.68k|    const Dav1dFrameContext *const f = t->f;
 2121|  2.68k|    Dav1dTileState *const ts = t->ts;
 2122|  2.68k|    const int hsz = 16 >> bl;
 2123|  2.68k|    const int have_h_split = f->bw > t->bx + hsz;
 2124|  2.68k|    const int have_v_split = f->bh > t->by + hsz;
 2125|       |
 2126|  2.68k|    if (!have_h_split && !have_v_split) {
  ------------------
  |  Branch (2126:9): [True: 0, False: 2.68k]
  |  Branch (2126:26): [True: 0, False: 0]
  ------------------
 2127|      0|        assert(bl < BL_8X8);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2128|      0|        return decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 0));
  ------------------
  |  |   51|      0|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
 2129|      0|    }
 2130|       |
 2131|  2.68k|    uint16_t *pc;
 2132|  2.68k|    enum BlockPartition bp;
 2133|  2.68k|    int ctx, bx8, by8;
 2134|  2.68k|    if (t->frame_thread.pass != 2) {
  ------------------
  |  Branch (2134:9): [True: 1.71k, False: 971]
  ------------------
 2135|  1.71k|        if (0 && bl == BL_64X64)
  ------------------
  |  Branch (2135:13): [Folded, False: 1.71k]
  |  Branch (2135:18): [True: 0, False: 0]
  ------------------
 2136|      0|            printf("poc=%d,y=%d,x=%d,bl=%d,r=%d\n",
 2137|      0|                   f->frame_hdr->frame_offset, t->by, t->bx, bl, ts->msac.rng);
 2138|  1.71k|        bx8 = (t->bx & 31) >> 1;
 2139|  1.71k|        by8 = (t->by & 31) >> 1;
 2140|  1.71k|        ctx = get_partition_ctx(t->a, &t->l, bl, by8, bx8);
 2141|  1.71k|        pc = ts->cdf.m.partition[bl][ctx];
 2142|  1.71k|    }
 2143|       |
 2144|  2.68k|    if (have_h_split && have_v_split) {
  ------------------
  |  Branch (2144:9): [True: 2.68k, False: 18.4E]
  |  Branch (2144:25): [True: 2.62k, False: 60]
  ------------------
 2145|  2.62k|        if (t->frame_thread.pass == 2) {
  ------------------
  |  Branch (2145:13): [True: 976, False: 1.65k]
  ------------------
 2146|    976|            const Av1Block *const b = &f->frame_thread.b[t->by * f->b4_stride + t->bx];
 2147|    976|            bp = b->bl == bl ? b->bp : PARTITION_SPLIT;
  ------------------
  |  Branch (2147:18): [True: 762, False: 214]
  ------------------
 2148|  1.65k|        } else {
 2149|  1.65k|            bp = dav1d_msac_decode_symbol_adapt16(&ts->msac, pc,
  ------------------
  |  |   79|  1.65k|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 2150|  1.65k|                                                  dav1d_partition_type_count[bl]);
 2151|  1.65k|            if (f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I422 &&
  ------------------
  |  Branch (2151:17): [True: 0, False: 1.65k]
  ------------------
 2152|      0|                (bp == PARTITION_V || bp == PARTITION_V4 ||
  ------------------
  |  Branch (2152:18): [True: 0, False: 0]
  |  Branch (2152:39): [True: 0, False: 0]
  ------------------
 2153|      0|                 bp == PARTITION_T_LEFT_SPLIT || bp == PARTITION_T_RIGHT_SPLIT))
  ------------------
  |  Branch (2153:18): [True: 0, False: 0]
  |  Branch (2153:50): [True: 0, False: 0]
  ------------------
 2154|      0|            {
 2155|      0|                return 1;
 2156|      0|            }
 2157|  1.65k|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  1.65k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 1.65k]
  |  |  ------------------
  |  |   35|  1.65k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  1.65k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2158|      0|                printf("poc=%d,y=%d,x=%d,bl=%d,ctx=%d,bp=%d: r=%d\n",
 2159|      0|                       f->frame_hdr->frame_offset, t->by, t->bx, bl, ctx, bp,
 2160|      0|                       ts->msac.rng);
 2161|  1.65k|        }
 2162|  2.62k|        const uint8_t *const b = dav1d_block_sizes[bl][bp];
 2163|       |
 2164|  2.62k|        switch (bp) {
 2165|    904|        case PARTITION_NONE:
  ------------------
  |  Branch (2165:9): [True: 904, False: 1.72k]
  ------------------
 2166|    904|            if (decode_b(t, bl, b[0], PARTITION_NONE, node->o))
  ------------------
  |  Branch (2166:17): [True: 0, False: 904]
  ------------------
 2167|      0|                return -1;
 2168|    904|            break;
 2169|    904|        case PARTITION_H:
  ------------------
  |  Branch (2169:9): [True: 330, False: 2.29k]
  ------------------
 2170|    330|            if (decode_b(t, bl, b[0], PARTITION_H, node->h[0]))
  ------------------
  |  Branch (2170:17): [True: 0, False: 330]
  ------------------
 2171|      0|                return -1;
 2172|    330|            t->by += hsz;
 2173|    330|            if (decode_b(t, bl, b[0], PARTITION_H, node->h[1]))
  ------------------
  |  Branch (2173:17): [True: 0, False: 330]
  ------------------
 2174|      0|                return -1;
 2175|    330|            t->by -= hsz;
 2176|    330|            break;
 2177|    286|        case PARTITION_V:
  ------------------
  |  Branch (2177:9): [True: 286, False: 2.34k]
  ------------------
 2178|    286|            if (decode_b(t, bl, b[0], PARTITION_V, node->v[0]))
  ------------------
  |  Branch (2178:17): [True: 0, False: 286]
  ------------------
 2179|      0|                return -1;
 2180|    286|            t->bx += hsz;
 2181|    286|            if (decode_b(t, bl, b[0], PARTITION_V, node->v[1]))
  ------------------
  |  Branch (2181:17): [True: 0, False: 286]
  ------------------
 2182|      0|                return -1;
 2183|    286|            t->bx -= hsz;
 2184|    286|            break;
 2185|    649|        case PARTITION_SPLIT:
  ------------------
  |  Branch (2185:9): [True: 649, False: 1.97k]
  ------------------
 2186|    649|            if (bl == BL_8X8) {
  ------------------
  |  Branch (2186:17): [True: 84, False: 565]
  ------------------
 2187|     84|                const EdgeTip *const tip = (const EdgeTip *) node;
 2188|     84|                assert(hsz == 1);
  ------------------
  |  |  140|     84|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 84]
  |  |  |  Branch (140:68): [Folded, False: 84]
  |  |  ------------------
  ------------------
 2189|     84|                if (decode_b(t, bl, BS_4x4, PARTITION_SPLIT, EDGE_ALL_TR_AND_BL))
  ------------------
  |  Branch (2189:21): [True: 0, False: 84]
  ------------------
 2190|      0|                    return -1;
 2191|     84|                const enum Filter2d tl_filter = t->tl_4x4_filter;
 2192|     84|                t->bx++;
 2193|     84|                if (decode_b(t, bl, BS_4x4, PARTITION_SPLIT, tip->split[0]))
  ------------------
  |  Branch (2193:21): [True: 0, False: 84]
  ------------------
 2194|      0|                    return -1;
 2195|     84|                t->bx--;
 2196|     84|                t->by++;
 2197|     84|                if (decode_b(t, bl, BS_4x4, PARTITION_SPLIT, tip->split[1]))
  ------------------
  |  Branch (2197:21): [True: 0, False: 84]
  ------------------
 2198|      0|                    return -1;
 2199|     84|                t->bx++;
 2200|     84|                t->tl_4x4_filter = tl_filter;
 2201|     84|                if (decode_b(t, bl, BS_4x4, PARTITION_SPLIT, tip->split[2]))
  ------------------
  |  Branch (2201:21): [True: 0, False: 84]
  ------------------
 2202|      0|                    return -1;
 2203|     84|                t->bx--;
 2204|     84|                t->by--;
 2205|     84|#if ARCH_X86_64
 2206|     84|                if (t->frame_thread.pass) {
  ------------------
  |  Branch (2206:21): [True: 84, False: 0]
  ------------------
 2207|       |                    /* In 8-bit mode with 2-pass decoding the coefficient buffer
 2208|       |                     * can end up misaligned due to skips here. Work around
 2209|       |                     * the issue by explicitly realigning the buffer. */
 2210|     84|                    const int p = t->frame_thread.pass & 1;
 2211|     84|                    ts->frame_thread[p].cf =
 2212|     84|                        (void*)(((uintptr_t)ts->frame_thread[p].cf + 63) & ~63);
 2213|     84|                }
 2214|     84|#endif
 2215|    565|            } else {
 2216|    565|                if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 0)))
  ------------------
  |  |   51|    565|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2216:21): [True: 0, False: 565]
  ------------------
 2217|      0|                    return 1;
 2218|    565|                t->bx += hsz;
 2219|    565|                if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 1)))
  ------------------
  |  |   51|    565|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2219:21): [True: 0, False: 565]
  ------------------
 2220|      0|                    return 1;
 2221|    565|                t->bx -= hsz;
 2222|    565|                t->by += hsz;
 2223|    565|                if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 2)))
  ------------------
  |  |   51|    565|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2223:21): [True: 0, False: 565]
  ------------------
 2224|      0|                    return 1;
 2225|    565|                t->bx += hsz;
 2226|    565|                if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 3)))
  ------------------
  |  |   51|    565|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2226:21): [True: 0, False: 565]
  ------------------
 2227|      0|                    return 1;
 2228|    565|                t->bx -= hsz;
 2229|    565|                t->by -= hsz;
 2230|    565|            }
 2231|    649|            break;
 2232|    649|        case PARTITION_T_TOP_SPLIT: {
  ------------------
  |  Branch (2232:9): [True: 36, False: 2.59k]
  ------------------
 2233|     36|            if (decode_b(t, bl, b[0], PARTITION_T_TOP_SPLIT, EDGE_ALL_TR_AND_BL))
  ------------------
  |  Branch (2233:17): [True: 0, False: 36]
  ------------------
 2234|      0|                return -1;
 2235|     36|            t->bx += hsz;
 2236|     36|            if (decode_b(t, bl, b[0], PARTITION_T_TOP_SPLIT, node->v[1]))
  ------------------
  |  Branch (2236:17): [True: 0, False: 36]
  ------------------
 2237|      0|                return -1;
 2238|     36|            t->bx -= hsz;
 2239|     36|            t->by += hsz;
 2240|     36|            if (decode_b(t, bl, b[1], PARTITION_T_TOP_SPLIT, node->h[1]))
  ------------------
  |  Branch (2240:17): [True: 0, False: 36]
  ------------------
 2241|      0|                return -1;
 2242|     36|            t->by -= hsz;
 2243|     36|            break;
 2244|     36|        }
 2245|     92|        case PARTITION_T_BOTTOM_SPLIT: {
  ------------------
  |  Branch (2245:9): [True: 92, False: 2.53k]
  ------------------
 2246|     92|            if (decode_b(t, bl, b[0], PARTITION_T_BOTTOM_SPLIT, node->h[0]))
  ------------------
  |  Branch (2246:17): [True: 0, False: 92]
  ------------------
 2247|      0|                return -1;
 2248|     92|            t->by += hsz;
 2249|     92|            if (decode_b(t, bl, b[1], PARTITION_T_BOTTOM_SPLIT, node->v[0]))
  ------------------
  |  Branch (2249:17): [True: 0, False: 92]
  ------------------
 2250|      0|                return -1;
 2251|     92|            t->bx += hsz;
 2252|     92|            if (decode_b(t, bl, b[1], PARTITION_T_BOTTOM_SPLIT, 0))
  ------------------
  |  Branch (2252:17): [True: 0, False: 92]
  ------------------
 2253|      0|                return -1;
 2254|     92|            t->bx -= hsz;
 2255|     92|            t->by -= hsz;
 2256|     92|            break;
 2257|     92|        }
 2258|     48|        case PARTITION_T_LEFT_SPLIT: {
  ------------------
  |  Branch (2258:9): [True: 48, False: 2.58k]
  ------------------
 2259|     48|            if (decode_b(t, bl, b[0], PARTITION_T_LEFT_SPLIT, EDGE_ALL_TR_AND_BL))
  ------------------
  |  Branch (2259:17): [True: 0, False: 48]
  ------------------
 2260|      0|                return -1;
 2261|     48|            t->by += hsz;
 2262|     48|            if (decode_b(t, bl, b[0], PARTITION_T_LEFT_SPLIT, node->h[1]))
  ------------------
  |  Branch (2262:17): [True: 0, False: 48]
  ------------------
 2263|      0|                return -1;
 2264|     48|            t->by -= hsz;
 2265|     48|            t->bx += hsz;
 2266|     48|            if (decode_b(t, bl, b[1], PARTITION_T_LEFT_SPLIT, node->v[1]))
  ------------------
  |  Branch (2266:17): [True: 0, False: 48]
  ------------------
 2267|      0|                return -1;
 2268|     48|            t->bx -= hsz;
 2269|     48|            break;
 2270|     48|        }
 2271|     46|        case PARTITION_T_RIGHT_SPLIT: {
  ------------------
  |  Branch (2271:9): [True: 46, False: 2.58k]
  ------------------
 2272|     46|            if (decode_b(t, bl, b[0], PARTITION_T_RIGHT_SPLIT, node->v[0]))
  ------------------
  |  Branch (2272:17): [True: 0, False: 46]
  ------------------
 2273|      0|                return -1;
 2274|     46|            t->bx += hsz;
 2275|     46|            if (decode_b(t, bl, b[1], PARTITION_T_RIGHT_SPLIT, node->h[0]))
  ------------------
  |  Branch (2275:17): [True: 0, False: 46]
  ------------------
 2276|      0|                return -1;
 2277|     46|            t->by += hsz;
 2278|     46|            if (decode_b(t, bl, b[1], PARTITION_T_RIGHT_SPLIT, 0))
  ------------------
  |  Branch (2278:17): [True: 0, False: 46]
  ------------------
 2279|      0|                return -1;
 2280|     46|            t->by -= hsz;
 2281|     46|            t->bx -= hsz;
 2282|     46|            break;
 2283|     46|        }
 2284|    136|        case PARTITION_H4: {
  ------------------
  |  Branch (2284:9): [True: 136, False: 2.49k]
  ------------------
 2285|    136|            const EdgeBranch *const branch = (const EdgeBranch *) node;
 2286|    136|            if (decode_b(t, bl, b[0], PARTITION_H4, node->h[0]))
  ------------------
  |  Branch (2286:17): [True: 0, False: 136]
  ------------------
 2287|      0|                return -1;
 2288|    136|            t->by += hsz >> 1;
 2289|    136|            if (decode_b(t, bl, b[0], PARTITION_H4, branch->h4))
  ------------------
  |  Branch (2289:17): [True: 0, False: 136]
  ------------------
 2290|      0|                return -1;
 2291|    136|            t->by += hsz >> 1;
 2292|    136|            if (decode_b(t, bl, b[0], PARTITION_H4, EDGE_ALL_LEFT_HAS_BOTTOM))
  ------------------
  |  Branch (2292:17): [True: 0, False: 136]
  ------------------
 2293|      0|                return -1;
 2294|    136|            t->by += hsz >> 1;
 2295|    136|            if (t->by < f->bh)
  ------------------
  |  Branch (2295:17): [True: 134, False: 2]
  ------------------
 2296|    134|                if (decode_b(t, bl, b[0], PARTITION_H4, node->h[1]))
  ------------------
  |  Branch (2296:21): [True: 0, False: 134]
  ------------------
 2297|      0|                    return -1;
 2298|    136|            t->by -= hsz * 3 >> 1;
 2299|    136|            break;
 2300|    136|        }
 2301|    104|        case PARTITION_V4: {
  ------------------
  |  Branch (2301:9): [True: 104, False: 2.52k]
  ------------------
 2302|    104|            const EdgeBranch *const branch = (const EdgeBranch *) node;
 2303|    104|            if (decode_b(t, bl, b[0], PARTITION_V4, node->v[0]))
  ------------------
  |  Branch (2303:17): [True: 0, False: 104]
  ------------------
 2304|      0|                return -1;
 2305|    104|            t->bx += hsz >> 1;
 2306|    104|            if (decode_b(t, bl, b[0], PARTITION_V4, branch->v4))
  ------------------
  |  Branch (2306:17): [True: 0, False: 104]
  ------------------
 2307|      0|                return -1;
 2308|    104|            t->bx += hsz >> 1;
 2309|    104|            if (decode_b(t, bl, b[0], PARTITION_V4, EDGE_ALL_TOP_HAS_RIGHT))
  ------------------
  |  Branch (2309:17): [True: 0, False: 104]
  ------------------
 2310|      0|                return -1;
 2311|    104|            t->bx += hsz >> 1;
 2312|    104|            if (t->bx < f->bw)
  ------------------
  |  Branch (2312:17): [True: 104, False: 0]
  ------------------
 2313|    104|                if (decode_b(t, bl, b[0], PARTITION_V4, node->v[1]))
  ------------------
  |  Branch (2313:21): [True: 0, False: 104]
  ------------------
 2314|      0|                    return -1;
 2315|    104|            t->bx -= hsz * 3 >> 1;
 2316|    104|            break;
 2317|    104|        }
 2318|      0|        default: assert(0);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2318:9): [True: 0, False: 2.62k]
  ------------------
 2319|  2.62k|        }
 2320|  2.62k|    } else if (have_h_split) {
  ------------------
  |  Branch (2320:16): [True: 60, False: 18.4E]
  ------------------
 2321|     60|        unsigned is_split;
 2322|     60|        if (t->frame_thread.pass == 2) {
  ------------------
  |  Branch (2322:13): [True: 0, False: 60]
  ------------------
 2323|      0|            const Av1Block *const b = &f->frame_thread.b[t->by * f->b4_stride + t->bx];
 2324|      0|            is_split = b->bl != bl;
 2325|     60|        } else {
 2326|     60|            is_split = dav1d_msac_decode_bool(&ts->msac,
  ------------------
  |  |   88|     60|#define dav1d_msac_decode_bool           dav1d_msac_decode_bool_c
  ------------------
 2327|     60|                           gather_top_partition_prob(pc, bl));
 2328|     60|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|     60|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 60]
  |  |  ------------------
  |  |   35|     60|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|     60|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2329|      0|                printf("poc=%d,y=%d,x=%d,bl=%d,ctx=%d,bp=%d: r=%d\n",
 2330|      0|                       f->frame_hdr->frame_offset, t->by, t->bx, bl, ctx,
 2331|      0|                       is_split ? PARTITION_SPLIT : PARTITION_H, ts->msac.rng);
  ------------------
  |  Branch (2331:24): [True: 0, False: 0]
  ------------------
 2332|     60|        }
 2333|       |
 2334|     60|        assert(bl < BL_8X8);
  ------------------
  |  |  140|     60|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 60]
  |  |  |  Branch (140:68): [Folded, False: 60]
  |  |  ------------------
  ------------------
 2335|     60|        if (is_split) {
  ------------------
  |  Branch (2335:13): [True: 34, False: 26]
  ------------------
 2336|     34|            bp = PARTITION_SPLIT;
 2337|     34|            if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 0))) return 1;
  ------------------
  |  |   51|     34|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2337:17): [True: 0, False: 34]
  ------------------
 2338|     34|            t->bx += hsz;
 2339|     34|            if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 1))) return 1;
  ------------------
  |  |   51|     34|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2339:17): [True: 0, False: 34]
  ------------------
 2340|     34|            t->bx -= hsz;
 2341|     34|        } else {
 2342|     26|            bp = PARTITION_H;
 2343|     26|            if (decode_b(t, bl, dav1d_block_sizes[bl][PARTITION_H][0],
  ------------------
  |  Branch (2343:17): [True: 0, False: 26]
  ------------------
 2344|     26|                         PARTITION_H, node->h[0]))
 2345|      0|                return -1;
 2346|     26|        }
 2347|  18.4E|    } else {
 2348|  18.4E|        assert(have_v_split);
  ------------------
  |  |  140|  18.4E|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 18.4E]
  |  |  |  Branch (140:68): [Folded, False: 18.4E]
  |  |  ------------------
  ------------------
 2349|  18.4E|        unsigned is_split;
 2350|  18.4E|        if (t->frame_thread.pass == 2) {
  ------------------
  |  Branch (2350:13): [True: 0, False: 18.4E]
  ------------------
 2351|      0|            const Av1Block *const b = &f->frame_thread.b[t->by * f->b4_stride + t->bx];
 2352|      0|            is_split = b->bl != bl;
 2353|  18.4E|        } else {
 2354|  18.4E|            is_split = dav1d_msac_decode_bool(&ts->msac,
  ------------------
  |  |   88|  18.4E|#define dav1d_msac_decode_bool           dav1d_msac_decode_bool_c
  ------------------
 2355|  18.4E|                           gather_left_partition_prob(pc, bl));
 2356|  18.4E|            if (f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I422 && !is_split)
  ------------------
  |  Branch (2356:17): [True: 0, False: 18.4E]
  |  Branch (2356:63): [True: 0, False: 0]
  ------------------
 2357|      0|                return 1;
 2358|  18.4E|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  18.4E|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 18.4E]
  |  |  ------------------
  |  |   35|  18.4E|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  18.4E|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2359|      0|                printf("poc=%d,y=%d,x=%d,bl=%d,ctx=%d,bp=%d: r=%d\n",
 2360|      0|                       f->frame_hdr->frame_offset, t->by, t->bx, bl, ctx,
 2361|      0|                       is_split ? PARTITION_SPLIT : PARTITION_V, ts->msac.rng);
  ------------------
  |  Branch (2361:24): [True: 0, False: 0]
  ------------------
 2362|  18.4E|        }
 2363|       |
 2364|  18.4E|        assert(bl < BL_8X8);
  ------------------
  |  |  140|  18.4E|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 18.4E]
  |  |  |  Branch (140:68): [Folded, False: 18.4E]
  |  |  ------------------
  ------------------
 2365|  18.4E|        if (is_split) {
  ------------------
  |  Branch (2365:13): [True: 0, False: 18.4E]
  ------------------
 2366|      0|            bp = PARTITION_SPLIT;
 2367|      0|            if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 0))) return 1;
  ------------------
  |  |   51|      0|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2367:17): [True: 0, False: 0]
  ------------------
 2368|      0|            t->by += hsz;
 2369|      0|            if (decode_sb(t, bl + 1, INTRA_EDGE_SPLIT(node, 2))) return 1;
  ------------------
  |  |   51|      0|    ((const EdgeNode*)((uintptr_t)(n) + ((const EdgeBranch*)(n))->split_offset[i]))
  ------------------
  |  Branch (2369:17): [True: 0, False: 0]
  ------------------
 2370|      0|            t->by -= hsz;
 2371|  18.4E|        } else {
 2372|  18.4E|            bp = PARTITION_V;
 2373|  18.4E|            if (decode_b(t, bl, dav1d_block_sizes[bl][PARTITION_V][0],
  ------------------
  |  Branch (2373:17): [True: 0, False: 18.4E]
  ------------------
 2374|  18.4E|                         PARTITION_V, node->v[0]))
 2375|      0|                return -1;
 2376|  18.4E|        }
 2377|  18.4E|    }
 2378|       |
 2379|  2.69k|    if (t->frame_thread.pass != 2 && (bp != PARTITION_SPLIT || bl == BL_8X8)) {
  ------------------
  |  Branch (2379:9): [True: 1.71k, False: 974]
  |  Branch (2379:39): [True: 1.27k, False: 438]
  |  Branch (2379:64): [True: 52, False: 386]
  ------------------
 2380|  1.33k|#define set_ctx(rep_macro) \
 2381|  1.33k|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
 2382|  1.33k|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
 2383|  1.33k|        case_set_upto16(ulog2(hsz));
  ------------------
  |  |   80|  1.33k|    switch (var) { \
  |  |   81|    408|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  | 2381|    408|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|    408|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    408|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2382|    408|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|    408|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    408|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:5): [True: 408, False: 922]
  |  |  ------------------
  |  |   82|    534|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  | 2381|    534|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|    534|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    534|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2382|    534|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|    534|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    534|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (82:5): [True: 534, False: 796]
  |  |  ------------------
  |  |   83|    232|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  | 2381|    232|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   83|    232|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    232|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2382|    232|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
  |  |  |  |  ------------------
  |  |  |  |  |  |   83|    232|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    232|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:5): [True: 232, False: 1.09k]
  |  |  ------------------
  |  |   84|     50|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  | 2381|     50|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     50|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|     50|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2382|     50|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     50|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|     50|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (84:5): [True: 50, False: 1.28k]
  |  |  ------------------
  |  |   85|    106|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  | 2381|    106|        rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|    106|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|    106|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|    106|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|    106|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 106]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2382|    106|        rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|    106|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|    106|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|    106|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|    106|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 106]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (85:5): [True: 106, False: 1.22k]
  |  |  ------------------
  |  |   86|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (86:5): [True: 0, False: 1.33k]
  |  |  ------------------
  |  |   87|  1.33k|    }
  ------------------
 2384|  1.33k|#undef set_ctx
 2385|  1.33k|    }
 2386|       |
 2387|  2.69k|    return 0;
 2388|  2.69k|}
decode.c:decode_b:
  687|  4.11k|                    const enum EdgeFlags intra_edge_flags) {
  688|  4.11k|    Dav1dTileState *const ts = t->ts;
  689|  4.11k|    const Dav1dFrameContext *const f = t->f;
  690|  4.11k|    Av1Block b_mem, *const b = t->frame_thread.pass ?
  ------------------
  |  Branch (690:32): [True: 4.11k, False: 0]
  ------------------
  691|  4.11k|        &f->frame_thread.b[t->by * f->b4_stride + t->bx] : &b_mem;
  692|  4.11k|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
  693|  4.11k|    const int bx4 = t->bx & 31, by4 = t->by & 31;
  694|  4.11k|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  695|  4.11k|    const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  696|  4.11k|    const int cbx4 = bx4 >> ss_hor, cby4 = by4 >> ss_ver;
  697|  4.11k|    const int bw4 = b_dim[0], bh4 = b_dim[1];
  698|  4.11k|    const int w4 = imin(bw4, f->bw - t->bx), h4 = imin(bh4, f->bh - t->by);
  699|  4.11k|    const int cbw4 = (bw4 + ss_hor) >> ss_hor, cbh4 = (bh4 + ss_ver) >> ss_ver;
  700|  4.11k|    const int have_left = t->bx > ts->tiling.col_start;
  701|  4.11k|    const int have_top = t->by > ts->tiling.row_start;
  702|  4.11k|    const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400 &&
  ------------------
  |  Branch (702:28): [True: 4.11k, False: 18.4E]
  ------------------
  703|  4.11k|                           (bw4 > ss_hor || t->bx & 1) &&
  ------------------
  |  Branch (703:29): [True: 3.29k, False: 820]
  |  Branch (703:45): [True: 410, False: 410]
  ------------------
  704|  3.70k|                           (bh4 > ss_ver || t->by & 1);
  ------------------
  |  Branch (704:29): [True: 2.88k, False: 823]
  |  Branch (704:45): [True: 412, False: 411]
  ------------------
  705|       |
  706|  4.11k|    if (t->frame_thread.pass == 2) {
  ------------------
  |  Branch (706:9): [True: 1.46k, False: 2.64k]
  ------------------
  707|  1.46k|        if (b->intra) {
  ------------------
  |  Branch (707:13): [True: 1.35k, False: 116]
  ------------------
  708|  1.35k|            f->bd_fn.recon_b_intra(t, bs, intra_edge_flags, b);
  709|       |
  710|  1.35k|            const enum IntraPredMode y_mode_nofilt =
  711|  1.35k|                b->y_mode == FILTER_PRED ? DC_PRED : b->y_mode;
  ------------------
  |  Branch (711:17): [True: 336, False: 1.01k]
  ------------------
  712|  1.35k|#define set_ctx(rep_macro) \
  713|  1.35k|            rep_macro(edge->mode, off, y_mode_nofilt); \
  714|  1.35k|            rep_macro(edge->intra, off, 1)
  715|  1.35k|            BlockContext *edge = t->a;
  716|  4.05k|            for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
  ------------------
  |  Branch (716:40): [True: 2.70k, False: 1.35k]
  ------------------
  717|  2.70k|                case_set(b_dim[2 + i]);
  ------------------
  |  |   70|  2.70k|    switch (var) { \
  |  |   71|    630|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  |  713|    630|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    630|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    630|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|    630|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    630|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    630|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 630, False: 2.07k]
  |  |  ------------------
  |  |   72|  1.00k|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  |  713|  1.00k|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.00k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.00k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|  1.00k|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.00k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.00k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 1.00k, False: 1.69k]
  |  |  ------------------
  |  |   73|    690|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  |  713|    690|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    690|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    690|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|    690|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    690|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    690|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 690, False: 2.01k]
  |  |  ------------------
  |  |   74|    270|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  |  713|    270|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    270|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    270|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|    270|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    270|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    270|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 270, False: 2.43k]
  |  |  ------------------
  |  |   75|     56|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  |  713|     56|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     56|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     56|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     56|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     56|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 56]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|     56|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     56|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     56|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     56|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     56|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 56]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 56, False: 2.64k]
  |  |  ------------------
  |  |   76|     48|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  |  713|     48|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     48|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     48|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     48|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     48|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 48]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  714|     48|            rep_macro(edge->intra, off, 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     48|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     48|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     48|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     48|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 48]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 48, False: 2.65k]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 2.70k]
  |  |  ------------------
  |  |   78|  2.70k|    }
  ------------------
  718|  2.70k|            }
  719|  1.35k|#undef set_ctx
  720|  1.35k|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|  1.35k|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 1.35k]
  |  |  ------------------
  ------------------
  721|      0|                refmvs_block *const r = &t->rt.r[(t->by & 31) + 5 + bh4 - 1][t->bx];
  722|      0|                for (int x = 0; x < bw4; x++) {
  ------------------
  |  Branch (722:33): [True: 0, False: 0]
  ------------------
  723|      0|                    r[x].ref.ref[0] = 0;
  724|      0|                    r[x].bs = bs;
  725|      0|                }
  726|      0|                refmvs_block *const *rr = &t->rt.r[(t->by & 31) + 5];
  727|      0|                for (int y = 0; y < bh4 - 1; y++) {
  ------------------
  |  Branch (727:33): [True: 0, False: 0]
  ------------------
  728|      0|                    rr[y][t->bx + bw4 - 1].ref.ref[0] = 0;
  729|      0|                    rr[y][t->bx + bw4 - 1].bs = bs;
  730|      0|                }
  731|      0|            }
  732|       |
  733|  1.35k|            if (has_chroma) {
  ------------------
  |  Branch (733:17): [True: 1.06k, False: 290]
  ------------------
  734|  1.06k|                uint8_t uv_mode = b->uv_mode;
  735|  1.06k|                dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], uv_mode);
  736|  1.06k|                dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], uv_mode);
  737|  1.06k|            }
  738|  1.35k|        } else {
  739|    116|            if (IS_INTER_OR_SWITCH(f->frame_hdr) /* not intrabc */ &&
  ------------------
  |  |   36|    232|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 116]
  |  |  ------------------
  ------------------
  740|      0|                b->comp_type == COMP_INTER_NONE && b->motion_mode == MM_WARP)
  ------------------
  |  Branch (740:17): [True: 0, False: 0]
  |  Branch (740:52): [True: 0, False: 0]
  ------------------
  741|      0|            {
  742|      0|                if (b->matrix[0] == INT16_MIN) {
  ------------------
  |  Branch (742:21): [True: 0, False: 0]
  ------------------
  743|      0|                    t->warpmv.type = DAV1D_WM_TYPE_IDENTITY;
  744|      0|                } else {
  745|      0|                    t->warpmv.type = DAV1D_WM_TYPE_AFFINE;
  746|      0|                    t->warpmv.matrix[2] = b->matrix[0] + 0x10000;
  747|      0|                    t->warpmv.matrix[3] = b->matrix[1];
  748|      0|                    t->warpmv.matrix[4] = b->matrix[2];
  749|      0|                    t->warpmv.matrix[5] = b->matrix[3] + 0x10000;
  750|      0|                    dav1d_set_affine_mv2d(bw4, bh4, b->mv2d, &t->warpmv,
  751|      0|                                          t->bx, t->by);
  752|      0|                    dav1d_get_shear_params(&t->warpmv);
  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  754|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  755|      0|                        printf("[ %c%x %c%x %c%x\n  %c%x %c%x %c%x ]\n"
  756|      0|                               "alpha=%c%x, beta=%c%x, gamma=%c%x, delta=%c%x, mv=y:%d,x:%d\n",
  757|      0|                               signabs(t->warpmv.matrix[0]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  758|      0|                               signabs(t->warpmv.matrix[1]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  759|      0|                               signabs(t->warpmv.matrix[2]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  760|      0|                               signabs(t->warpmv.matrix[3]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  761|      0|                               signabs(t->warpmv.matrix[4]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  762|      0|                               signabs(t->warpmv.matrix[5]),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  763|      0|                               signabs(t->warpmv.u.p.alpha),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  764|      0|                               signabs(t->warpmv.u.p.beta),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  765|      0|                               signabs(t->warpmv.u.p.gamma),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  766|      0|                               signabs(t->warpmv.u.p.delta),
  ------------------
  |  |  753|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (753:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  767|      0|                               b->mv2d.y, b->mv2d.x);
  768|      0|#undef signabs
  769|      0|                }
  770|      0|            }
  771|    116|            if (f->bd_fn.recon_b_inter(t, bs, b)) return -1;
  ------------------
  |  Branch (771:17): [True: 0, False: 116]
  ------------------
  772|       |
  773|    116|            const uint8_t *const filter = dav1d_filter_dir[b->filter2d];
  774|    116|            BlockContext *edge = t->a;
  775|    348|            for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
  ------------------
  |  Branch (775:40): [True: 232, False: 116]
  ------------------
  776|    232|#define set_ctx(rep_macro) \
  777|    232|                rep_macro(edge->filter[0], off, filter[0]); \
  778|    232|                rep_macro(edge->filter[1], off, filter[1]); \
  779|    232|                rep_macro(edge->intra, off, 0)
  780|    232|                case_set(b_dim[2 + i]);
  ------------------
  |  |   70|    232|    switch (var) { \
  |  |   71|     42|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  |  777|     42|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|     42|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|     42|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|     42|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|     42|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|     42|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|     42|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|     42|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|     42|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 42, False: 190]
  |  |  ------------------
  |  |   72|     72|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  |  777|     72|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|     72|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     72|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|     72|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|     72|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     72|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|     72|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|     72|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     72|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 72, False: 160]
  |  |  ------------------
  |  |   73|     62|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  |  777|     62|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|     62|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|     62|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|     62|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|     62|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|     62|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|     62|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|     62|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|     62|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 62, False: 170]
  |  |  ------------------
  |  |   74|     22|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  |  777|     22|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|     22|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|     22|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|     22|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|     22|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|     22|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|     22|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|     22|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|     22|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 22, False: 210]
  |  |  ------------------
  |  |   75|      2|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  |  777|      2|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      2|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      2|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      2|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      2|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|      2|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      2|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      2|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      2|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      2|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|      2|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      2|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      2|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      2|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      2|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 2, False: 230]
  |  |  ------------------
  |  |   76|     32|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  |  777|     32|                rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     32|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     32|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     32|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     32|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 32]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  778|     32|                rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     32|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     32|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     32|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     32|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 32]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  779|     32|                rep_macro(edge->intra, off, 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     32|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     32|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     32|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     32|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 32]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 32, False: 200]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 232]
  |  |  ------------------
  |  |   78|    232|    }
  ------------------
  781|    232|#undef set_ctx
  782|    232|            }
  783|       |
  784|    116|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|    116|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 116]
  |  |  ------------------
  ------------------
  785|      0|                refmvs_block *const r = &t->rt.r[(t->by & 31) + 5 + bh4 - 1][t->bx];
  786|      0|                for (int x = 0; x < bw4; x++) {
  ------------------
  |  Branch (786:33): [True: 0, False: 0]
  ------------------
  787|      0|                    r[x].ref.ref[0] = b->ref[0] + 1;
  788|      0|                    r[x].mv.mv[0] = b->mv[0];
  789|      0|                    r[x].bs = bs;
  790|      0|                }
  791|      0|                refmvs_block *const *rr = &t->rt.r[(t->by & 31) + 5];
  792|      0|                for (int y = 0; y < bh4 - 1; y++) {
  ------------------
  |  Branch (792:33): [True: 0, False: 0]
  ------------------
  793|      0|                    rr[y][t->bx + bw4 - 1].ref.ref[0] = b->ref[0] + 1;
  794|      0|                    rr[y][t->bx + bw4 - 1].mv.mv[0] = b->mv[0];
  795|      0|                    rr[y][t->bx + bw4 - 1].bs = bs;
  796|      0|                }
  797|      0|            }
  798|       |
  799|    116|            if (has_chroma) {
  ------------------
  |  Branch (799:17): [True: 102, False: 14]
  ------------------
  800|    102|                dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
  801|    102|                dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
  802|    102|            }
  803|    116|        }
  804|  1.46k|        return 0;
  805|  1.46k|    }
  806|       |
  807|  2.64k|    const int cw4 = (w4 + ss_hor) >> ss_hor, ch4 = (h4 + ss_ver) >> ss_ver;
  808|       |
  809|  2.64k|    b->bl = bl;
  810|  2.64k|    b->bp = bp;
  811|  2.64k|    b->bs = bs;
  812|       |
  813|  2.64k|    const Dav1dSegmentationData *seg = NULL;
  814|       |
  815|       |    // segment_id (if seg_feature for skip/ref/gmv is enabled)
  816|  2.64k|    int seg_pred = 0;
  817|  2.64k|    if (f->frame_hdr->segmentation.enabled) {
  ------------------
  |  Branch (817:9): [True: 2.09k, False: 554]
  ------------------
  818|  2.09k|        if (!f->frame_hdr->segmentation.update_map) {
  ------------------
  |  Branch (818:13): [True: 0, False: 2.09k]
  ------------------
  819|      0|            if (f->prev_segmap) {
  ------------------
  |  Branch (819:17): [True: 0, False: 0]
  ------------------
  820|      0|                unsigned seg_id = get_prev_frame_segid(f, t->by, t->bx, w4, h4,
  821|      0|                                                       f->prev_segmap,
  822|      0|                                                       f->b4_stride);
  823|      0|                if (seg_id >= 8) return -1;
  ------------------
  |  Branch (823:21): [True: 0, False: 0]
  ------------------
  824|      0|                b->seg_id = seg_id;
  825|      0|            } else {
  826|      0|                b->seg_id = 0;
  827|      0|            }
  828|      0|            seg = &f->frame_hdr->segmentation.seg_data.d[b->seg_id];
  829|  2.09k|        } else if (f->frame_hdr->segmentation.seg_data.preskip) {
  ------------------
  |  Branch (829:20): [True: 2.09k, False: 0]
  ------------------
  830|  2.09k|            if (f->frame_hdr->segmentation.temporal &&
  ------------------
  |  Branch (830:17): [True: 0, False: 2.09k]
  ------------------
  831|      0|                (seg_pred = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (831:17): [True: 0, False: 0]
  ------------------
  832|      0|                                ts->cdf.m.seg_pred[t->a->seg_pred[bx4] +
  833|      0|                                t->l.seg_pred[by4]])))
  834|      0|            {
  835|       |                // temporal predicted seg_id
  836|      0|                if (f->prev_segmap) {
  ------------------
  |  Branch (836:21): [True: 0, False: 0]
  ------------------
  837|      0|                    unsigned seg_id = get_prev_frame_segid(f, t->by, t->bx,
  838|      0|                                                           w4, h4,
  839|      0|                                                           f->prev_segmap,
  840|      0|                                                           f->b4_stride);
  841|      0|                    if (seg_id >= 8) return -1;
  ------------------
  |  Branch (841:25): [True: 0, False: 0]
  ------------------
  842|      0|                    b->seg_id = seg_id;
  843|      0|                } else {
  844|      0|                    b->seg_id = 0;
  845|      0|                }
  846|  2.09k|            } else {
  847|  2.09k|                int seg_ctx;
  848|  2.09k|                const unsigned pred_seg_id =
  849|  2.09k|                    get_cur_frame_segid(t->by, t->bx, have_top, have_left,
  850|  2.09k|                                        &seg_ctx, f->cur_segmap, f->b4_stride);
  851|  2.09k|                const unsigned diff = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|  2.09k|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
  852|  2.09k|                                          ts->cdf.m.seg_id[seg_ctx],
  853|  2.09k|                                          DAV1D_MAX_SEGMENTS - 1);
  ------------------
  |  |   43|  2.09k|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  854|  2.09k|                const unsigned last_active_seg_id =
  855|  2.09k|                    f->frame_hdr->segmentation.seg_data.last_active_segid;
  856|  2.09k|                b->seg_id = neg_deinterleave(diff, pred_seg_id,
  857|  2.09k|                                             last_active_seg_id + 1);
  858|  2.09k|                if (b->seg_id > last_active_seg_id) b->seg_id = 0; // error?
  ------------------
  |  Branch (858:21): [True: 176, False: 1.91k]
  ------------------
  859|  2.09k|                if (b->seg_id >= DAV1D_MAX_SEGMENTS) b->seg_id = 0; // error?
  ------------------
  |  |   43|  2.09k|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  |  Branch (859:21): [True: 0, False: 2.09k]
  ------------------
  860|  2.09k|            }
  861|       |
  862|  2.09k|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  2.09k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2.09k]
  |  |  ------------------
  |  |   35|  2.09k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  2.09k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  863|      0|                printf("Post-segid[preskip;%d]: r=%d\n",
  864|      0|                       b->seg_id, ts->msac.rng);
  865|       |
  866|  2.09k|            seg = &f->frame_hdr->segmentation.seg_data.d[b->seg_id];
  867|  2.09k|        }
  868|  2.09k|    } else {
  869|    554|        b->seg_id = 0;
  870|    554|    }
  871|       |
  872|       |    // skip_mode
  873|  2.64k|    if ((!seg || (!seg->globalmv && seg->ref == -1 && !seg->skip)) &&
  ------------------
  |  Branch (873:10): [True: 554, False: 2.09k]
  |  Branch (873:19): [True: 144, False: 1.95k]
  |  Branch (873:37): [True: 144, False: 0]
  |  Branch (873:55): [True: 144, False: 0]
  ------------------
  874|    706|        f->frame_hdr->skip_mode_enabled && imin(bw4, bh4) > 1)
  ------------------
  |  Branch (874:9): [True: 0, False: 706]
  |  Branch (874:44): [True: 0, False: 0]
  ------------------
  875|      0|    {
  876|      0|        const int smctx = t->a->skip_mode[bx4] + t->l.skip_mode[by4];
  877|      0|        b->skip_mode = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  878|      0|                           ts->cdf.m.skip_mode[smctx]);
  879|      0|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  880|      0|            printf("Post-skipmode[%d]: r=%d\n", b->skip_mode, ts->msac.rng);
  881|  2.64k|    } else {
  882|  2.64k|        b->skip_mode = 0;
  883|  2.64k|    }
  884|       |
  885|       |    // skip
  886|  2.65k|    if (b->skip_mode || (seg && seg->skip)) {
  ------------------
  |  Branch (886:9): [True: 18.4E, False: 2.65k]
  |  Branch (886:26): [True: 2.09k, False: 562]
  |  Branch (886:33): [True: 0, False: 2.09k]
  ------------------
  887|      0|        b->skip = 1;
  888|  2.64k|    } else {
  889|  2.64k|        const int sctx = t->a->skip[bx4] + t->l.skip[by4];
  890|  2.64k|        b->skip = dav1d_msac_decode_bool_adapt(&ts->msac, ts->cdf.m.skip[sctx]);
  ------------------
  |  |   82|  2.64k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  891|  2.64k|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  2.64k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2.64k]
  |  |  ------------------
  |  |   35|  2.64k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  2.64k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  892|      0|            printf("Post-skip[%d]: r=%d\n", b->skip, ts->msac.rng);
  893|  2.64k|    }
  894|       |
  895|       |    // segment_id
  896|  2.64k|    if (f->frame_hdr->segmentation.enabled &&
  ------------------
  |  Branch (896:9): [True: 2.09k, False: 554]
  ------------------
  897|  2.09k|        f->frame_hdr->segmentation.update_map &&
  ------------------
  |  Branch (897:9): [True: 2.09k, False: 0]
  ------------------
  898|  2.09k|        !f->frame_hdr->segmentation.seg_data.preskip)
  ------------------
  |  Branch (898:9): [True: 0, False: 2.09k]
  ------------------
  899|      0|    {
  900|      0|        if (!b->skip && f->frame_hdr->segmentation.temporal &&
  ------------------
  |  Branch (900:13): [True: 0, False: 0]
  |  Branch (900:25): [True: 0, False: 0]
  ------------------
  901|      0|            (seg_pred = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (901:13): [True: 0, False: 0]
  ------------------
  902|      0|                            ts->cdf.m.seg_pred[t->a->seg_pred[bx4] +
  903|      0|                            t->l.seg_pred[by4]])))
  904|      0|        {
  905|       |            // temporal predicted seg_id
  906|      0|            if (f->prev_segmap) {
  ------------------
  |  Branch (906:17): [True: 0, False: 0]
  ------------------
  907|      0|                unsigned seg_id = get_prev_frame_segid(f, t->by, t->bx, w4, h4,
  908|      0|                                                       f->prev_segmap,
  909|      0|                                                       f->b4_stride);
  910|      0|                if (seg_id >= 8) return -1;
  ------------------
  |  Branch (910:21): [True: 0, False: 0]
  ------------------
  911|      0|                b->seg_id = seg_id;
  912|      0|            } else {
  913|      0|                b->seg_id = 0;
  914|      0|            }
  915|      0|        } else {
  916|      0|            int seg_ctx;
  917|      0|            const unsigned pred_seg_id =
  918|      0|                get_cur_frame_segid(t->by, t->bx, have_top, have_left,
  919|      0|                                    &seg_ctx, f->cur_segmap, f->b4_stride);
  920|      0|            if (b->skip) {
  ------------------
  |  Branch (920:17): [True: 0, False: 0]
  ------------------
  921|      0|                b->seg_id = pred_seg_id;
  922|      0|            } else {
  923|      0|                const unsigned diff = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|      0|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
  924|      0|                                          ts->cdf.m.seg_id[seg_ctx],
  925|      0|                                          DAV1D_MAX_SEGMENTS - 1);
  ------------------
  |  |   43|      0|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  926|      0|                const unsigned last_active_seg_id =
  927|      0|                    f->frame_hdr->segmentation.seg_data.last_active_segid;
  928|      0|                b->seg_id = neg_deinterleave(diff, pred_seg_id,
  929|      0|                                             last_active_seg_id + 1);
  930|      0|                if (b->seg_id > last_active_seg_id) b->seg_id = 0; // error?
  ------------------
  |  Branch (930:21): [True: 0, False: 0]
  ------------------
  931|      0|            }
  932|      0|            if (b->seg_id >= DAV1D_MAX_SEGMENTS) b->seg_id = 0; // error?
  ------------------
  |  |   43|      0|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  |  Branch (932:17): [True: 0, False: 0]
  ------------------
  933|      0|        }
  934|       |
  935|      0|        seg = &f->frame_hdr->segmentation.seg_data.d[b->seg_id];
  936|       |
  937|      0|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  938|      0|            printf("Post-segid[postskip;%d]: r=%d\n",
  939|      0|                   b->seg_id, ts->msac.rng);
  940|      0|    }
  941|       |
  942|       |    // cdef index
  943|  2.64k|    if (!b->skip) {
  ------------------
  |  Branch (943:9): [True: 2.23k, False: 412]
  ------------------
  944|  2.23k|        const int idx = f->seq_hdr->sb128 ? ((t->bx & 16) >> 4) +
  ------------------
  |  Branch (944:25): [True: 562, False: 1.67k]
  ------------------
  945|  1.67k|                                           ((t->by & 16) >> 3) : 0;
  946|  2.23k|        if (t->cur_sb_cdef_idx_ptr[idx] == -1) {
  ------------------
  |  Branch (946:13): [True: 256, False: 1.98k]
  ------------------
  947|    256|            const int v = dav1d_msac_decode_bools(&ts->msac,
  948|    256|                              f->frame_hdr->cdef.n_bits);
  949|    256|            t->cur_sb_cdef_idx_ptr[idx] = v;
  950|    256|            if (bw4 > 16) t->cur_sb_cdef_idx_ptr[idx + 1] = v;
  ------------------
  |  Branch (950:17): [True: 106, False: 150]
  ------------------
  951|    256|            if (bh4 > 16) t->cur_sb_cdef_idx_ptr[idx + 2] = v;
  ------------------
  |  Branch (951:17): [True: 96, False: 160]
  ------------------
  952|    256|            if (bw4 == 32 && bh4 == 32) t->cur_sb_cdef_idx_ptr[idx + 3] = v;
  ------------------
  |  Branch (952:17): [True: 106, False: 150]
  |  Branch (952:30): [True: 96, False: 10]
  ------------------
  953|       |
  954|    256|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    256|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 256]
  |  |  ------------------
  |  |   35|    256|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    256|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  955|      0|                printf("Post-cdef_idx[%d]: r=%d\n",
  956|      0|                        *t->cur_sb_cdef_idx_ptr, ts->msac.rng);
  957|    256|        }
  958|  2.23k|    }
  959|       |
  960|       |    // delta-q/lf
  961|  2.64k|    if (!((t->bx | t->by) & (31 >> !f->seq_hdr->sb128))) {
  ------------------
  |  Branch (961:9): [True: 240, False: 2.40k]
  ------------------
  962|    240|        const int prev_qidx = ts->last_qidx;
  963|    240|        const int have_delta_q = f->frame_hdr->delta.q.present &&
  ------------------
  |  Branch (963:34): [True: 0, False: 240]
  ------------------
  964|      0|            (bs != (f->seq_hdr->sb128 ? BS_128x128 : BS_64x64) || !b->skip);
  ------------------
  |  Branch (964:14): [True: 0, False: 0]
  |  Branch (964:21): [True: 0, False: 0]
  |  Branch (964:67): [True: 0, False: 0]
  ------------------
  965|       |
  966|    240|        uint32_t prev_delta_lf = ts->last_delta_lf.u32;
  967|       |
  968|    240|        if (have_delta_q) {
  ------------------
  |  Branch (968:13): [True: 0, False: 240]
  ------------------
  969|      0|            int delta_q = dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  970|      0|                                                          ts->cdf.m.delta_q, 3);
  971|      0|            if (delta_q == 3) {
  ------------------
  |  Branch (971:17): [True: 0, False: 0]
  ------------------
  972|      0|                const int n_bits = 1 + dav1d_msac_decode_bools(&ts->msac, 3);
  973|      0|                delta_q = dav1d_msac_decode_bools(&ts->msac, n_bits) +
  974|      0|                          1 + (1 << n_bits);
  975|      0|            }
  976|      0|            if (delta_q) {
  ------------------
  |  Branch (976:17): [True: 0, False: 0]
  ------------------
  977|      0|                if (dav1d_msac_decode_bool_equi(&ts->msac)) delta_q = -delta_q;
  ------------------
  |  |   85|      0|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (977:21): [True: 0, False: 0]
  ------------------
  978|      0|                delta_q *= 1 << f->frame_hdr->delta.q.res_log2;
  979|      0|            }
  980|      0|            ts->last_qidx = iclip(ts->last_qidx + delta_q, 1, 255);
  981|      0|            if (have_delta_q && DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (981:17): [True: 0, False: 0]
  ------------------
  982|      0|                printf("Post-delta_q[%d->%d]: r=%d\n",
  983|      0|                       delta_q, ts->last_qidx, ts->msac.rng);
  984|       |
  985|      0|            if (f->frame_hdr->delta.lf.present) {
  ------------------
  |  Branch (985:17): [True: 0, False: 0]
  ------------------
  986|      0|                const int n_lfs = f->frame_hdr->delta.lf.multi ?
  ------------------
  |  Branch (986:35): [True: 0, False: 0]
  ------------------
  987|      0|                    f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400 ? 4 : 2 : 1;
  ------------------
  |  Branch (987:21): [True: 0, False: 0]
  ------------------
  988|       |
  989|      0|                for (int i = 0; i < n_lfs; i++) {
  ------------------
  |  Branch (989:33): [True: 0, False: 0]
  ------------------
  990|      0|                    int delta_lf = dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  991|      0|                        ts->cdf.m.delta_lf[i + f->frame_hdr->delta.lf.multi], 3);
  992|      0|                    if (delta_lf == 3) {
  ------------------
  |  Branch (992:25): [True: 0, False: 0]
  ------------------
  993|      0|                        const int n_bits = 1 + dav1d_msac_decode_bools(&ts->msac, 3);
  994|      0|                        delta_lf = dav1d_msac_decode_bools(&ts->msac, n_bits) +
  995|      0|                                   1 + (1 << n_bits);
  996|      0|                    }
  997|      0|                    if (delta_lf) {
  ------------------
  |  Branch (997:25): [True: 0, False: 0]
  ------------------
  998|      0|                        if (dav1d_msac_decode_bool_equi(&ts->msac))
  ------------------
  |  |   85|      0|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (998:29): [True: 0, False: 0]
  ------------------
  999|      0|                            delta_lf = -delta_lf;
 1000|      0|                        delta_lf *= 1 << f->frame_hdr->delta.lf.res_log2;
 1001|      0|                    }
 1002|      0|                    ts->last_delta_lf.i8[i] =
 1003|      0|                        iclip(ts->last_delta_lf.i8[i] + delta_lf, -63, 63);
 1004|      0|                    if (have_delta_q && DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1004:25): [True: 0, False: 0]
  ------------------
 1005|      0|                        printf("Post-delta_lf[%d:%d]: r=%d\n", i, delta_lf,
 1006|      0|                               ts->msac.rng);
 1007|      0|                }
 1008|      0|            }
 1009|      0|        }
 1010|    240|        if (ts->last_qidx == f->frame_hdr->quant.yac) {
  ------------------
  |  Branch (1010:13): [True: 240, False: 0]
  ------------------
 1011|       |            // assign frame-wide q values to this sb
 1012|    240|            ts->dq = f->dq;
 1013|    240|        } else if (ts->last_qidx != prev_qidx) {
  ------------------
  |  Branch (1013:20): [True: 0, False: 0]
  ------------------
 1014|       |            // find sb-specific quant parameters
 1015|      0|            init_quant_tables(f->seq_hdr, f->frame_hdr, ts->last_qidx, ts->dqmem);
 1016|      0|            ts->dq = ts->dqmem;
 1017|      0|        }
 1018|    240|        if (!ts->last_delta_lf.u32) {
  ------------------
  |  Branch (1018:13): [True: 240, False: 0]
  ------------------
 1019|       |            // assign frame-wide lf values to this sb
 1020|    240|            ts->lflvl = f->lf.lvl;
 1021|    240|        } else if (ts->last_delta_lf.u32 != prev_delta_lf) {
  ------------------
  |  Branch (1021:20): [True: 0, False: 0]
  ------------------
 1022|       |            // find sb-specific lf lvl parameters
 1023|      0|            ts->lflvl = ts->lflvlmem;
 1024|      0|            dav1d_calc_lf_values(ts->lflvlmem, f->frame_hdr, ts->last_delta_lf.i8);
 1025|      0|        }
 1026|    240|    }
 1027|       |
 1028|  2.64k|    if (b->skip_mode) {
  ------------------
  |  Branch (1028:9): [True: 0, False: 2.64k]
  ------------------
 1029|      0|        b->intra = 0;
 1030|  2.64k|    } else if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|  2.64k|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 2.64k]
  |  |  ------------------
  ------------------
 1031|      0|        if (seg && (seg->ref >= 0 || seg->globalmv)) {
  ------------------
  |  Branch (1031:13): [True: 0, False: 0]
  |  Branch (1031:21): [True: 0, False: 0]
  |  Branch (1031:38): [True: 0, False: 0]
  ------------------
 1032|      0|            b->intra = !seg->ref;
 1033|      0|        } else {
 1034|      0|            const int ictx = get_intra_ctx(t->a, &t->l, by4, bx4,
 1035|      0|                                           have_top, have_left);
 1036|      0|            b->intra = !dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1037|      0|                            ts->cdf.m.intra[ictx]);
 1038|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1039|      0|                printf("Post-intra[%d]: r=%d\n", b->intra, ts->msac.rng);
 1040|      0|        }
 1041|  2.65k|    } else if (f->frame_hdr->allow_intrabc) {
  ------------------
  |  Branch (1041:16): [True: 2.65k, False: 18.4E]
  ------------------
 1042|  2.65k|        b->intra = !dav1d_msac_decode_bool_adapt(&ts->msac, ts->cdf.m.intrabc);
  ------------------
  |  |   82|  2.65k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1043|  2.65k|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  2.65k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2.65k]
  |  |  ------------------
  |  |   35|  2.65k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  2.65k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1044|      0|            printf("Post-intrabcflag[%d]: r=%d\n", b->intra, ts->msac.rng);
 1045|  18.4E|    } else {
 1046|  18.4E|        b->intra = 1;
 1047|  18.4E|    }
 1048|       |
 1049|       |    // intra/inter-specific stuff
 1050|  2.64k|    if (b->intra) {
  ------------------
  |  Branch (1050:9): [True: 2.15k, False: 494]
  ------------------
 1051|  2.15k|        uint16_t *const ymode_cdf = IS_INTER_OR_SWITCH(f->frame_hdr) ?
  ------------------
  |  |   36|  2.15k|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 2.15k]
  |  |  ------------------
  ------------------
 1052|      0|            ts->cdf.m.y_mode[dav1d_ymode_size_context[bs]] :
 1053|  2.15k|            ts->cdf.kfym[dav1d_intra_mode_context[t->a->mode[bx4]]]
 1054|  2.15k|                        [dav1d_intra_mode_context[t->l.mode[by4]]];
 1055|  2.15k|        b->y_mode = dav1d_msac_decode_symbol_adapt16(&ts->msac, ymode_cdf,
  ------------------
  |  |   79|  2.15k|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1056|  2.15k|                                                     N_INTRA_PRED_MODES - 1);
 1057|  2.15k|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  2.15k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2.15k]
  |  |  ------------------
  |  |   35|  2.15k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  2.15k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1058|      0|            printf("Post-ymode[%d]: r=%d\n", b->y_mode, ts->msac.rng);
 1059|       |
 1060|       |        // angle delta
 1061|  2.15k|        if (b_dim[2] + b_dim[3] >= 2 && b->y_mode >= VERT_PRED &&
  ------------------
  |  Branch (1061:13): [True: 1.68k, False: 472]
  |  Branch (1061:41): [True: 1.05k, False: 624]
  ------------------
 1062|  1.05k|            b->y_mode <= VERT_LEFT_PRED)
  ------------------
  |  Branch (1062:13): [True: 706, False: 352]
  ------------------
 1063|    706|        {
 1064|    706|            uint16_t *const acdf = ts->cdf.m.angle_delta[b->y_mode - VERT_PRED];
 1065|    706|            const int angle = dav1d_msac_decode_symbol_adapt8(&ts->msac, acdf, 6);
  ------------------
  |  |   76|    706|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1066|    706|            b->y_angle = angle - 3;
 1067|  1.44k|        } else {
 1068|  1.44k|            b->y_angle = 0;
 1069|  1.44k|        }
 1070|       |
 1071|  2.15k|        if (has_chroma) {
  ------------------
  |  Branch (1071:13): [True: 1.71k, False: 444]
  ------------------
 1072|  1.71k|            const int cfl_allowed = f->frame_hdr->segmentation.lossless[b->seg_id] ?
  ------------------
  |  Branch (1072:37): [True: 0, False: 1.71k]
  ------------------
 1073|  1.71k|                cbw4 == 1 && cbh4 == 1 : !!(cfl_allowed_mask & (1 << bs));
  ------------------
  |  Branch (1073:17): [True: 0, False: 0]
  |  Branch (1073:30): [True: 0, False: 0]
  ------------------
 1074|  1.71k|            uint16_t *const uvmode_cdf = ts->cdf.m.uv_mode[cfl_allowed][b->y_mode];
 1075|  1.71k|            b->uv_mode = dav1d_msac_decode_symbol_adapt16(&ts->msac, uvmode_cdf,
  ------------------
  |  |   79|  1.71k|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1076|  1.71k|                             N_UV_INTRA_PRED_MODES - 1 - !cfl_allowed);
 1077|  1.71k|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  1.71k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 1.71k]
  |  |  ------------------
  |  |   35|  1.71k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  1.71k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1078|      0|                printf("Post-uvmode[%d]: r=%d\n", b->uv_mode, ts->msac.rng);
 1079|       |
 1080|  1.71k|            b->uv_angle = 0;
 1081|  1.71k|            if (b->uv_mode == CFL_PRED) {
  ------------------
  |  Branch (1081:17): [True: 366, False: 1.34k]
  ------------------
 1082|    366|#define SIGN(a) (!!(a) + ((a) > 0))
 1083|    366|                const int sign = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|    366|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1084|    366|                                     ts->cdf.m.cfl_sign, 7) + 1;
 1085|    366|                const int sign_u = sign * 0x56 >> 8, sign_v = sign - sign_u * 3;
 1086|    366|                assert(sign_u == sign / 3);
  ------------------
  |  |  140|    366|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 366]
  |  |  |  Branch (140:68): [Folded, False: 366]
  |  |  ------------------
  ------------------
 1087|    366|                if (sign_u) {
  ------------------
  |  Branch (1087:21): [True: 354, False: 12]
  ------------------
 1088|    354|                    const int ctx = (sign_u == 2) * 3 + sign_v;
 1089|    354|                    b->cfl_alpha[0] = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|    354|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1090|    354|                                          ts->cdf.m.cfl_alpha[ctx], 15) + 1;
 1091|    354|                    if (sign_u == 1) b->cfl_alpha[0] = -b->cfl_alpha[0];
  ------------------
  |  Branch (1091:25): [True: 290, False: 64]
  ------------------
 1092|    354|                } else {
 1093|     12|                    b->cfl_alpha[0] = 0;
 1094|     12|                }
 1095|    366|                if (sign_v) {
  ------------------
  |  Branch (1095:21): [True: 232, False: 134]
  ------------------
 1096|    232|                    const int ctx = (sign_v == 2) * 3 + sign_u;
 1097|    232|                    b->cfl_alpha[1] = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|    232|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1098|    232|                                          ts->cdf.m.cfl_alpha[ctx], 15) + 1;
 1099|    232|                    if (sign_v == 1) b->cfl_alpha[1] = -b->cfl_alpha[1];
  ------------------
  |  Branch (1099:25): [True: 96, False: 136]
  ------------------
 1100|    232|                } else {
 1101|    134|                    b->cfl_alpha[1] = 0;
 1102|    134|                }
 1103|    366|#undef SIGN
 1104|    366|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    366|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 366]
  |  |  ------------------
  |  |   35|    366|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    366|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1105|      0|                    printf("Post-uvalphas[%d/%d]: r=%d\n",
 1106|      0|                           b->cfl_alpha[0], b->cfl_alpha[1], ts->msac.rng);
 1107|  1.34k|            } else if (b_dim[2] + b_dim[3] >= 2 && b->uv_mode >= VERT_PRED &&
  ------------------
  |  Branch (1107:24): [True: 1.19k, False: 152]
  |  Branch (1107:52): [True: 806, False: 386]
  ------------------
 1108|    806|                       b->uv_mode <= VERT_LEFT_PRED)
  ------------------
  |  Branch (1108:24): [True: 446, False: 360]
  ------------------
 1109|    446|            {
 1110|    446|                uint16_t *const acdf = ts->cdf.m.angle_delta[b->uv_mode - VERT_PRED];
 1111|    446|                const int angle = dav1d_msac_decode_symbol_adapt8(&ts->msac, acdf, 6);
  ------------------
  |  |   76|    446|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1112|    446|                b->uv_angle = angle - 3;
 1113|    446|            }
 1114|  1.71k|        }
 1115|       |
 1116|  2.15k|        b->pal_sz[0] = b->pal_sz[1] = 0;
 1117|  2.15k|        if (f->frame_hdr->allow_screen_content_tools &&
  ------------------
  |  Branch (1117:13): [True: 2.15k, False: 0]
  ------------------
 1118|  2.15k|            imax(bw4, bh4) <= 16 && bw4 + bh4 >= 4)
  ------------------
  |  Branch (1118:13): [True: 2.09k, False: 60]
  |  Branch (1118:37): [True: 1.62k, False: 472]
  ------------------
 1119|  1.62k|        {
 1120|  1.62k|            const int sz_ctx = b_dim[2] + b_dim[3] - 2;
 1121|  1.62k|            if (b->y_mode == DC_PRED) {
  ------------------
  |  Branch (1121:17): [True: 602, False: 1.02k]
  ------------------
 1122|    602|                const int pal_ctx = (t->a->pal_sz[bx4] > 0) + (t->l.pal_sz[by4] > 0);
 1123|    602|                const int use_y_pal = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|    602|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1124|    602|                                          ts->cdf.m.pal_y[sz_ctx][pal_ctx]);
 1125|    602|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    602|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 602]
  |  |  ------------------
  |  |   35|    602|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    602|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1126|      0|                    printf("Post-y_pal[%d]: r=%d\n", use_y_pal, ts->msac.rng);
 1127|    602|                if (use_y_pal)
  ------------------
  |  Branch (1127:21): [True: 8, False: 594]
  ------------------
 1128|      8|                    f->bd_fn.read_pal_plane(t, b, 0, sz_ctx, bx4, by4);
 1129|    602|            }
 1130|       |
 1131|  1.62k|            if (has_chroma && b->uv_mode == DC_PRED) {
  ------------------
  |  Branch (1131:17): [True: 1.46k, False: 156]
  |  Branch (1131:31): [True: 354, False: 1.11k]
  ------------------
 1132|    354|                const int pal_ctx = b->pal_sz[0] > 0;
 1133|    354|                const int use_uv_pal = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|    354|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1134|    354|                                           ts->cdf.m.pal_uv[pal_ctx]);
 1135|    354|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    354|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 354]
  |  |  ------------------
  |  |   35|    354|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    354|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1136|      0|                    printf("Post-uv_pal[%d]: r=%d\n", use_uv_pal, ts->msac.rng);
 1137|    354|                if (use_uv_pal) // see aomedia bug 2183 for why we use luma coordinates
  ------------------
  |  Branch (1137:21): [True: 2, False: 352]
  ------------------
 1138|      2|                    f->bd_fn.read_pal_uv(t, b, sz_ctx, bx4, by4);
 1139|    354|            }
 1140|  1.62k|        }
 1141|       |
 1142|  2.15k|        if (b->y_mode == DC_PRED && !b->pal_sz[0] &&
  ------------------
  |  Branch (1142:13): [True: 792, False: 1.36k]
  |  Branch (1142:37): [True: 784, False: 8]
  ------------------
 1143|    784|            imax(b_dim[2], b_dim[3]) <= 3 && f->seq_hdr->filter_intra)
  ------------------
  |  Branch (1143:13): [True: 742, False: 42]
  |  Branch (1143:46): [True: 742, False: 0]
  ------------------
 1144|    742|        {
 1145|    742|            const int is_filter = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|    742|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1146|    742|                                      ts->cdf.m.use_filter_intra[bs]);
 1147|    742|            if (is_filter) {
  ------------------
  |  Branch (1147:17): [True: 534, False: 208]
  ------------------
 1148|    534|                b->y_mode = FILTER_PRED;
 1149|    534|                b->y_angle = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|    534|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1150|    534|                                 ts->cdf.m.filter_intra, 4);
 1151|    534|            }
 1152|    742|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    742|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 742]
  |  |  ------------------
  |  |   35|    742|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    742|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1153|      0|                printf("Post-filterintramode[%d/%d]: r=%d\n",
 1154|      0|                       b->y_mode, b->y_angle, ts->msac.rng);
 1155|    742|        }
 1156|       |
 1157|  2.15k|        if (b->pal_sz[0]) {
  ------------------
  |  Branch (1157:13): [True: 8, False: 2.14k]
  ------------------
 1158|      8|            uint8_t *pal_idx;
 1159|      8|            if (t->frame_thread.pass) {
  ------------------
  |  Branch (1159:17): [True: 8, False: 0]
  ------------------
 1160|      8|                const int p = t->frame_thread.pass & 1;
 1161|      8|                assert(ts->frame_thread[p].pal_idx);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 8]
  |  |  |  Branch (140:68): [Folded, False: 8]
  |  |  ------------------
  ------------------
 1162|      8|                pal_idx = ts->frame_thread[p].pal_idx;
 1163|      8|                ts->frame_thread[p].pal_idx += bw4 * bh4 * 8;
 1164|      8|            } else
 1165|      0|                pal_idx = t->scratch.pal_idx_y;
 1166|      8|            read_pal_indices(t, pal_idx, b->pal_sz[0], 0, w4, h4, bw4, bh4);
 1167|      8|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      8|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 8]
  |  |  ------------------
  |  |   35|      8|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      8|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1168|      0|                printf("Post-y-pal-indices: r=%d\n", ts->msac.rng);
 1169|      8|        }
 1170|       |
 1171|  2.15k|        if (has_chroma && b->pal_sz[1]) {
  ------------------
  |  Branch (1171:13): [True: 1.71k, False: 444]
  |  Branch (1171:27): [True: 2, False: 1.70k]
  ------------------
 1172|      2|            uint8_t *pal_idx;
 1173|      2|            if (t->frame_thread.pass) {
  ------------------
  |  Branch (1173:17): [True: 2, False: 0]
  ------------------
 1174|      2|                const int p = t->frame_thread.pass & 1;
 1175|      2|                assert(ts->frame_thread[p].pal_idx);
  ------------------
  |  |  140|      2|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2]
  |  |  |  Branch (140:68): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1176|      2|                pal_idx = ts->frame_thread[p].pal_idx;
 1177|      2|                ts->frame_thread[p].pal_idx += cbw4 * cbh4 * 8;
 1178|      2|            } else
 1179|      0|                pal_idx = t->scratch.pal_idx_uv;
 1180|      2|            read_pal_indices(t, pal_idx, b->pal_sz[1], 1, cw4, ch4, cbw4, cbh4);
 1181|      2|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      2|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2]
  |  |  ------------------
  |  |   35|      2|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      2|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1182|      0|                printf("Post-uv-pal-indices: r=%d\n", ts->msac.rng);
 1183|      2|        }
 1184|       |
 1185|  2.15k|        const TxfmInfo *t_dim;
 1186|  2.15k|        if (f->frame_hdr->segmentation.lossless[b->seg_id]) {
  ------------------
  |  Branch (1186:13): [True: 0, False: 2.15k]
  ------------------
 1187|      0|            b->tx = b->uvtx = (int) TX_4X4;
 1188|      0|            t_dim = &dav1d_txfm_dimensions[TX_4X4];
 1189|  2.15k|        } else {
 1190|  2.15k|            b->tx = dav1d_max_txfm_size_for_bs[bs][0];
 1191|  2.15k|            b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
 1192|  2.15k|            t_dim = &dav1d_txfm_dimensions[b->tx];
 1193|  2.15k|            if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE && t_dim->max > TX_4X4) {
  ------------------
  |  Branch (1193:17): [True: 1.88k, False: 274]
  |  Branch (1193:67): [True: 1.72k, False: 152]
  ------------------
 1194|  1.72k|                const int tctx = get_tx_ctx(t->a, &t->l, t_dim, by4, bx4);
 1195|  1.72k|                uint16_t *const tx_cdf = ts->cdf.m.txsz[t_dim->max - 1][tctx];
 1196|  1.72k|                int depth = dav1d_msac_decode_symbol_adapt4(&ts->msac, tx_cdf,
  ------------------
  |  |   73|  1.72k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1197|  1.72k|                                imin(t_dim->max, 2));
 1198|       |
 1199|  2.76k|                while (depth--) {
  ------------------
  |  Branch (1199:24): [True: 1.03k, False: 1.72k]
  ------------------
 1200|  1.03k|                    b->tx = t_dim->sub;
 1201|  1.03k|                    t_dim = &dav1d_txfm_dimensions[b->tx];
 1202|  1.03k|                }
 1203|  1.72k|            }
 1204|  2.15k|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  2.15k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2.15k]
  |  |  ------------------
  |  |   35|  2.15k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  2.15k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1205|      0|                printf("Post-tx[%d]: r=%d\n", b->tx, ts->msac.rng);
 1206|  2.15k|        }
 1207|       |
 1208|       |        // reconstruction
 1209|  2.15k|        if (t->frame_thread.pass == 1) {
  ------------------
  |  Branch (1209:13): [True: 2.15k, False: 0]
  ------------------
 1210|  2.15k|            f->bd_fn.read_coef_blocks(t, bs, b);
 1211|  2.15k|        } else {
 1212|      0|            f->bd_fn.recon_b_intra(t, bs, intra_edge_flags, b);
 1213|      0|        }
 1214|       |
 1215|  2.15k|        if (f->frame_hdr->loopfilter.level_y[0] ||
  ------------------
  |  Branch (1215:13): [True: 0, False: 2.15k]
  ------------------
 1216|  2.15k|            f->frame_hdr->loopfilter.level_y[1])
  ------------------
  |  Branch (1216:13): [True: 0, False: 2.15k]
  ------------------
 1217|      0|        {
 1218|      0|            dav1d_create_lf_mask_intra(t->lf_mask, f->lf.level, f->b4_stride,
 1219|      0|                                       (const uint8_t (*)[8][2])
 1220|      0|                                       &ts->lflvl[b->seg_id][0][0][0],
 1221|      0|                                       t->bx, t->by, f->w4, f->h4, bs,
 1222|      0|                                       b->tx, b->uvtx, f->cur.p.layout,
 1223|      0|                                       &t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
 1224|      0|                                       has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
  ------------------
  |  Branch (1224:40): [True: 0, False: 0]
  ------------------
 1225|      0|                                       has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
  ------------------
  |  Branch (1225:40): [True: 0, False: 0]
  ------------------
 1226|      0|        }
 1227|       |        // update contexts
 1228|  2.15k|        const enum IntraPredMode y_mode_nofilt =
 1229|  2.15k|            b->y_mode == FILTER_PRED ? DC_PRED : b->y_mode;
  ------------------
  |  Branch (1229:13): [True: 534, False: 1.62k]
  ------------------
 1230|  2.15k|        BlockContext *edge = t->a;
 1231|  6.46k|        for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
  ------------------
  |  Branch (1231:36): [True: 4.30k, False: 2.15k]
  ------------------
 1232|  4.30k|            int t_lsz = ((uint8_t *) &t_dim->lw)[i]; // lw then lh
 1233|  4.30k|#define set_ctx(rep_macro) \
 1234|  4.30k|            rep_macro(edge->tx_intra, off, t_lsz); \
 1235|  4.30k|            rep_macro(edge->tx, off, t_lsz); \
 1236|  4.30k|            rep_macro(edge->mode, off, y_mode_nofilt); \
 1237|  4.30k|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
 1238|  4.30k|            rep_macro(edge->seg_pred, off, seg_pred); \
 1239|  4.30k|            rep_macro(edge->skip_mode, off, 0); \
 1240|  4.30k|            rep_macro(edge->intra, off, 1); \
 1241|  4.30k|            rep_macro(edge->skip, off, b->skip); \
 1242|       |            /* see aomedia bug 2183 for why we use luma coordinates here */ \
 1243|  4.30k|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
 1244|  4.30k|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
 1245|  4.30k|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
 1246|  4.30k|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
 1247|  4.30k|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
 1248|  4.30k|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
 1249|  4.30k|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
 1250|  4.30k|            }
 1251|  4.30k|            case_set(b_dim[2 + i]);
  ------------------
  |  |   70|  4.30k|    switch (var) { \
  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  | 1234|    956|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|    956|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|    956|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|    956|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|    956|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|    956|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|    956|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|    956|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    956|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|    956|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|    956|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    956|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  1.91k|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (56:43): [True: 374, False: 582]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|    956|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    956|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 956]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 956, False: 3.35k]
  |  |  ------------------
  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  | 1234|  1.54k|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|  1.54k|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|  1.54k|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|  1.54k|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|  1.54k|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|  1.54k|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|  1.54k|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|  1.54k|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.54k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|  1.54k|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|  1.54k|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  1.54k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  3.08k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (58:45): [True: 1.39k, False: 150]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|  1.54k|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  1.54k|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 1.54k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 1.54k, False: 2.76k]
  |  |  ------------------
  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  | 1234|  1.16k|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|  1.16k|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|  1.16k|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|  1.16k|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|  1.16k|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|  1.16k|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|  1.16k|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|  1.16k|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  1.16k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|  1.16k|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|  1.16k|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  1.16k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  2.33k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (60:45): [True: 1.01k, False: 156]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|  1.16k|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  1.16k|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 1.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 1.16k, False: 3.14k]
  |  |  ------------------
  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  | 1234|    452|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|    452|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|    452|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|    452|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|    452|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|    452|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|    452|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|    452|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    452|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|    452|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|    452|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    452|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    904|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (62:45): [True: 452, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|    452|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    452|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 452]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 452, False: 3.85k]
  |  |  ------------------
  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  | 1234|     78|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|     78|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|     78|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|     78|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|     78|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|     78|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|     78|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|     78|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     78|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|     78|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|     78|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     78|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     78|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|    156|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (64:29): [True: 78, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   65|     78|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|     78|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|     78|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 78]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 78, False: 4.23k]
  |  |  ------------------
  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  | 1234|    114|            rep_macro(edge->tx_intra, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1235|    114|            rep_macro(edge->tx, off, t_lsz); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1236|    114|            rep_macro(edge->mode, off, y_mode_nofilt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1237|    114|            rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1238|    114|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1239|    114|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1240|    114|            rep_macro(edge->intra, off, 1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1241|    114|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    114|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1242|    114|            /* see aomedia bug 2183 for why we use luma coordinates here */ \
  |  |  |  | 1243|    114|            rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|    114|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|    114|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|    228|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (67:29): [True: 114, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   68|    114|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1244|    114|            if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    114|    ((frame_header)->frame_type & 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:5): [True: 0, False: 114]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1245|      0|                rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1246|      0|                rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1247|      0|                rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1248|      0|                rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1249|      0|                rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1250|      0|            }
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 114, False: 4.19k]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 4.30k]
  |  |  ------------------
  |  |   78|  4.30k|    }
  ------------------
 1252|  4.30k|#undef set_ctx
 1253|  4.30k|        }
 1254|  2.15k|        if (b->pal_sz[0])
  ------------------
  |  Branch (1254:13): [True: 8, False: 2.14k]
  ------------------
 1255|      8|            f->bd_fn.copy_pal_block_y(t, bx4, by4, bw4, bh4);
 1256|  2.15k|        if (has_chroma) {
  ------------------
  |  Branch (1256:13): [True: 1.71k, False: 444]
  ------------------
 1257|  1.71k|            uint8_t uv_mode = b->uv_mode;
 1258|  1.71k|            dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], uv_mode);
 1259|  1.71k|            dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], uv_mode);
 1260|  1.71k|            if (b->pal_sz[1])
  ------------------
  |  Branch (1260:17): [True: 2, False: 1.70k]
  ------------------
 1261|      2|                f->bd_fn.copy_pal_block_uv(t, bx4, by4, bw4, bh4);
 1262|  1.71k|        }
 1263|  2.15k|        if (IS_INTER_OR_SWITCH(f->frame_hdr) || f->frame_hdr->allow_intrabc)
  ------------------
  |  |   36|  4.30k|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 2.15k]
  |  |  ------------------
  ------------------
  |  Branch (1263:49): [True: 2.15k, False: 0]
  ------------------
 1264|  2.15k|            splat_intraref(f->c, t, bs, bw4, bh4);
 1265|  2.15k|    } else if (IS_KEY_OR_INTRA(f->frame_hdr)) {
  ------------------
  |  |   43|    494|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|    494|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (43:5): [True: 502, False: 18.4E]
  |  |  ------------------
  ------------------
 1266|       |        // intra block copy
 1267|    502|        refmvs_candidate mvstack[8];
 1268|    502|        int n_mvs, ctx;
 1269|    502|        dav1d_refmvs_find(&t->rt, mvstack, &n_mvs, &ctx,
 1270|    502|                          (union refmvs_refpair) { .ref = { 0, -1 }},
 1271|    502|                          bs, intra_edge_flags, t->by, t->bx);
 1272|       |
 1273|    502|        if (mvstack[0].mv.mv[0].n)
  ------------------
  |  Branch (1273:13): [True: 376, False: 126]
  ------------------
 1274|    376|            b->mv[0] = mvstack[0].mv.mv[0];
 1275|    126|        else if (mvstack[1].mv.mv[0].n)
  ------------------
  |  Branch (1275:18): [True: 0, False: 126]
  ------------------
 1276|      0|            b->mv[0] = mvstack[1].mv.mv[0];
 1277|    126|        else {
 1278|    126|            if (t->by - (16 << f->seq_hdr->sb128) < ts->tiling.row_start) {
  ------------------
  |  Branch (1278:17): [True: 24, False: 102]
  ------------------
 1279|     24|                b->mv[0].y = 0;
 1280|     24|                b->mv[0].x = -(512 << f->seq_hdr->sb128) - 2048;
 1281|    102|            } else {
 1282|    102|                b->mv[0].y = -(512 << f->seq_hdr->sb128);
 1283|    102|                b->mv[0].x = 0;
 1284|    102|            }
 1285|    126|        }
 1286|       |
 1287|    502|        const union mv ref = b->mv[0];
 1288|    502|        read_mv_residual(ts, &b->mv[0], -1);
 1289|       |
 1290|       |        // clip intrabc motion vector to decoded parts of current tile
 1291|    502|        int border_left = ts->tiling.col_start * 4;
 1292|    502|        int border_top  = ts->tiling.row_start * 4;
 1293|    502|        if (has_chroma) {
  ------------------
  |  Branch (1293:13): [True: 428, False: 74]
  ------------------
 1294|    428|            if (bw4 < 2 &&  ss_hor)
  ------------------
  |  Branch (1294:17): [True: 40, False: 388]
  |  Branch (1294:29): [True: 40, False: 0]
  ------------------
 1295|     40|                border_left += 4;
 1296|    428|            if (bh4 < 2 &&  ss_ver)
  ------------------
  |  Branch (1296:17): [True: 52, False: 376]
  |  Branch (1296:29): [True: 52, False: 0]
  ------------------
 1297|     52|                border_top  += 4;
 1298|    428|        }
 1299|    502|        int src_left   = t->bx * 4 + (b->mv[0].x >> 3);
 1300|    502|        int src_top    = t->by * 4 + (b->mv[0].y >> 3);
 1301|    502|        int src_right  = src_left + bw4 * 4;
 1302|    502|        int src_bottom = src_top  + bh4 * 4;
 1303|    502|        const int border_right = ((ts->tiling.col_end + (bw4 - 1)) & ~(bw4 - 1)) * 4;
 1304|       |
 1305|       |        // check against left or right tile boundary and adjust if necessary
 1306|    502|        if (src_left < border_left) {
  ------------------
  |  Branch (1306:13): [True: 92, False: 410]
  ------------------
 1307|     92|            src_right += border_left - src_left;
 1308|     92|            src_left  += border_left - src_left;
 1309|    410|        } else if (src_right > border_right) {
  ------------------
  |  Branch (1309:20): [True: 2, False: 408]
  ------------------
 1310|      2|            src_left  -= src_right - border_right;
 1311|      2|            src_right -= src_right - border_right;
 1312|      2|        }
 1313|       |        // check against top tile boundary and adjust if necessary
 1314|    502|        if (src_top < border_top) {
  ------------------
  |  Branch (1314:13): [True: 84, False: 418]
  ------------------
 1315|     84|            src_bottom += border_top - src_top;
 1316|     84|            src_top    += border_top - src_top;
 1317|     84|        }
 1318|       |
 1319|    502|        const int sbx = (t->bx >> (4 + f->seq_hdr->sb128)) << (6 + f->seq_hdr->sb128);
 1320|    502|        const int sby = (t->by >> (4 + f->seq_hdr->sb128)) << (6 + f->seq_hdr->sb128);
 1321|    502|        const int sb_size = 1 << (6 + f->seq_hdr->sb128);
 1322|       |        // check for overlap with current superblock
 1323|    502|        if (src_bottom > sby && src_right > sbx) {
  ------------------
  |  Branch (1323:13): [True: 78, False: 424]
  |  Branch (1323:33): [True: 30, False: 48]
  ------------------
 1324|     30|            if (src_top - border_top >= src_bottom - sby) {
  ------------------
  |  Branch (1324:17): [True: 30, False: 0]
  ------------------
 1325|       |                // if possible move src up into the previous suberblock row
 1326|     30|                src_top    -= src_bottom - sby;
 1327|     30|                src_bottom -= src_bottom - sby;
 1328|     30|            } else if (src_left - border_left >= src_right - sbx) {
  ------------------
  |  Branch (1328:24): [True: 0, False: 0]
  ------------------
 1329|       |                // if possible move src left into the previous suberblock
 1330|      0|                src_left  -= src_right - sbx;
 1331|      0|                src_right -= src_right - sbx;
 1332|      0|            }
 1333|     30|        }
 1334|       |        // move src up if it is below current superblock row
 1335|    502|        if (src_bottom > sby + sb_size) {
  ------------------
  |  Branch (1335:13): [True: 8, False: 494]
  ------------------
 1336|      8|            src_top    -= src_bottom - (sby + sb_size);
 1337|      8|            src_bottom -= src_bottom - (sby + sb_size);
 1338|      8|        }
 1339|       |        // error out if mv still overlaps with the current superblock
 1340|    502|        if (src_bottom > sby && src_right > sbx)
  ------------------
  |  Branch (1340:13): [True: 48, False: 454]
  |  Branch (1340:33): [True: 0, False: 48]
  ------------------
 1341|      0|            return -1;
 1342|       |
 1343|    502|        b->mv[0].x = (src_left - t->bx * 4) * 8;
 1344|    502|        b->mv[0].y = (src_top  - t->by * 4) * 8;
 1345|       |
 1346|    502|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    502|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 502]
  |  |  ------------------
  |  |   35|    502|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    502|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1347|      0|            printf("Post-dmv[%d/%d,ref=%d/%d|%d/%d]: r=%d\n",
 1348|      0|                   b->mv[0].y, b->mv[0].x, ref.y, ref.x,
 1349|      0|                   mvstack[0].mv.mv[0].y, mvstack[0].mv.mv[0].x, ts->msac.rng);
 1350|    502|        read_vartx_tree(t, b, bs, bx4, by4);
 1351|       |
 1352|       |        // reconstruction
 1353|    502|        if (t->frame_thread.pass == 1) {
  ------------------
  |  Branch (1353:13): [True: 502, False: 0]
  ------------------
 1354|    502|            f->bd_fn.read_coef_blocks(t, bs, b);
 1355|    502|            b->filter2d = FILTER_2D_BILINEAR;
 1356|    502|        } else {
 1357|      0|            if (f->bd_fn.recon_b_inter(t, bs, b)) return -1;
  ------------------
  |  Branch (1357:17): [True: 0, False: 0]
  ------------------
 1358|      0|        }
 1359|       |
 1360|    502|        splat_intrabc_mv(f->c, t, bs, b, bw4, bh4);
 1361|    502|        BlockContext *edge = t->a;
 1362|  1.50k|        for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
  ------------------
  |  Branch (1362:36): [True: 1.00k, False: 502]
  ------------------
 1363|  1.00k|#define set_ctx(rep_macro) \
 1364|  1.00k|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
 1365|  1.00k|            rep_macro(edge->mode, off, DC_PRED); \
 1366|  1.00k|            rep_macro(edge->pal_sz, off, 0); \
 1367|       |            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
 1368|  1.00k|            rep_macro(t->pal_sz_uv[i], off, 0); \
 1369|  1.00k|            rep_macro(edge->seg_pred, off, seg_pred); \
 1370|  1.00k|            rep_macro(edge->skip_mode, off, 0); \
 1371|  1.00k|            rep_macro(edge->intra, off, 0); \
 1372|  1.00k|            rep_macro(edge->skip, off, b->skip)
 1373|  1.00k|            case_set(b_dim[2 + i]);
  ------------------
  |  |   70|  1.00k|    switch (var) { \
  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  | 1364|    184|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|    184|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|    184|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|    184|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|    184|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|    184|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|    184|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|    184|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|    184|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    184|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    184|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 184, False: 820]
  |  |  ------------------
  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  | 1364|    280|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|    280|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|    280|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|    280|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|    280|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|    280|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|    280|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|    280|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|    280|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|    280|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    280|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 280, False: 724]
  |  |  ------------------
  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  | 1364|    258|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|    258|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|    258|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|    258|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|    258|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|    258|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|    258|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|    258|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|    258|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|    258|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    258|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 258, False: 746]
  |  |  ------------------
  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  | 1364|    152|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|    152|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|    152|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|    152|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|    152|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|    152|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|    152|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|    152|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|    152|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|    152|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    152|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 152, False: 852]
  |  |  ------------------
  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  | 1364|     42|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|     42|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|     42|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|     42|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|     42|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|     42|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|     42|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|     42|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|     42|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     42|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|     42|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|     42|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|     42|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 42]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 42, False: 962]
  |  |  ------------------
  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  | 1364|     88|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1365|     88|            rep_macro(edge->mode, off, DC_PRED); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1366|     88|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1367|     88|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1368|     88|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1369|     88|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1370|     88|            rep_macro(edge->skip_mode, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1371|     88|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1372|     88|            rep_macro(edge->skip, off, b->skip)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|     88|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|     88|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|     88|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|     88|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 88]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 88, False: 916]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 1.00k]
  |  |  ------------------
  |  |   78|  1.00k|    }
  ------------------
 1374|  1.00k|#undef set_ctx
 1375|  1.00k|        }
 1376|    502|        if (has_chroma) {
  ------------------
  |  Branch (1376:13): [True: 428, False: 74]
  ------------------
 1377|    428|            dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
 1378|    428|            dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
 1379|    428|        }
 1380|  18.4E|    } else {
 1381|       |        // inter-specific mode/mv coding
 1382|  18.4E|        int is_comp, has_subpel_filter;
 1383|       |
 1384|  18.4E|        if (b->skip_mode) {
  ------------------
  |  Branch (1384:13): [True: 0, False: 18.4E]
  ------------------
 1385|      0|            is_comp = 1;
 1386|  18.4E|        } else if ((!seg || (seg->ref == -1 && !seg->globalmv && !seg->skip)) &&
  ------------------
  |  Branch (1386:21): [True: 18.4E, False: 0]
  |  Branch (1386:30): [True: 0, False: 0]
  |  Branch (1386:48): [True: 0, False: 0]
  |  Branch (1386:66): [True: 0, False: 0]
  ------------------
 1387|      0|                   f->frame_hdr->switchable_comp_refs && imin(bw4, bh4) > 1)
  ------------------
  |  Branch (1387:20): [True: 0, False: 0]
  |  Branch (1387:58): [True: 0, False: 0]
  ------------------
 1388|      0|        {
 1389|      0|            const int ctx = get_comp_ctx(t->a, &t->l, by4, bx4,
 1390|      0|                                         have_top, have_left);
 1391|      0|            is_comp = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1392|      0|                          ts->cdf.m.comp[ctx]);
 1393|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1394|      0|                printf("Post-compflag[%d]: r=%d\n", is_comp, ts->msac.rng);
 1395|  18.4E|        } else {
 1396|  18.4E|            is_comp = 0;
 1397|  18.4E|        }
 1398|       |
 1399|  18.4E|        if (b->skip_mode) {
  ------------------
  |  Branch (1399:13): [True: 0, False: 18.4E]
  ------------------
 1400|      0|            b->ref[0] = f->frame_hdr->skip_mode_refs[0];
 1401|      0|            b->ref[1] = f->frame_hdr->skip_mode_refs[1];
 1402|      0|            b->comp_type = COMP_INTER_AVG;
 1403|      0|            b->inter_mode = NEARESTMV_NEARESTMV;
 1404|      0|            b->drl_idx = NEAREST_DRL;
 1405|      0|            has_subpel_filter = 0;
 1406|       |
 1407|      0|            refmvs_candidate mvstack[8];
 1408|      0|            int n_mvs, ctx;
 1409|      0|            dav1d_refmvs_find(&t->rt, mvstack, &n_mvs, &ctx,
 1410|      0|                              (union refmvs_refpair) { .ref = {
 1411|      0|                                    b->ref[0] + 1, b->ref[1] + 1 }},
 1412|      0|                              bs, intra_edge_flags, t->by, t->bx);
 1413|       |
 1414|      0|            b->mv[0] = mvstack[0].mv.mv[0];
 1415|      0|            b->mv[1] = mvstack[0].mv.mv[1];
 1416|      0|            fix_mv_precision(f->frame_hdr, &b->mv[0]);
 1417|      0|            fix_mv_precision(f->frame_hdr, &b->mv[1]);
 1418|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1419|      0|                printf("Post-skipmodeblock[mv=1:y=%d,x=%d,2:y=%d,x=%d,refs=%d+%d\n",
 1420|      0|                       b->mv[0].y, b->mv[0].x, b->mv[1].y, b->mv[1].x,
 1421|      0|                       b->ref[0], b->ref[1]);
 1422|  18.4E|        } else if (is_comp) {
  ------------------
  |  Branch (1422:20): [True: 0, False: 18.4E]
  ------------------
 1423|      0|            const int dir_ctx = get_comp_dir_ctx(t->a, &t->l, by4, bx4,
 1424|      0|                                                 have_top, have_left);
 1425|      0|            if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1425:17): [True: 0, False: 0]
  ------------------
 1426|      0|                    ts->cdf.m.comp_dir[dir_ctx]))
 1427|      0|            {
 1428|       |                // bidir - first reference (fw)
 1429|      0|                const int ctx1 = av1_get_fwd_ref_ctx(t->a, &t->l, by4, bx4,
 1430|      0|                                                     have_top, have_left);
 1431|      0|                if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1431:21): [True: 0, False: 0]
  ------------------
 1432|      0|                        ts->cdf.m.comp_fwd_ref[0][ctx1]))
 1433|      0|                {
 1434|      0|                    const int ctx2 = av1_get_fwd_ref_2_ctx(t->a, &t->l, by4, bx4,
 1435|      0|                                                           have_top, have_left);
 1436|      0|                    b->ref[0] = 2 + dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1437|      0|                                        ts->cdf.m.comp_fwd_ref[2][ctx2]);
 1438|      0|                } else {
 1439|      0|                    const int ctx2 = av1_get_fwd_ref_1_ctx(t->a, &t->l, by4, bx4,
 1440|      0|                                                           have_top, have_left);
 1441|      0|                    b->ref[0] = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1442|      0|                                    ts->cdf.m.comp_fwd_ref[1][ctx2]);
 1443|      0|                }
 1444|       |
 1445|       |                // second reference (bw)
 1446|      0|                const int ctx3 = av1_get_bwd_ref_ctx(t->a, &t->l, by4, bx4,
 1447|      0|                                                     have_top, have_left);
 1448|      0|                if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1448:21): [True: 0, False: 0]
  ------------------
 1449|      0|                        ts->cdf.m.comp_bwd_ref[0][ctx3]))
 1450|      0|                {
 1451|      0|                    b->ref[1] = 6;
 1452|      0|                } else {
 1453|      0|                    const int ctx4 = av1_get_bwd_ref_1_ctx(t->a, &t->l, by4, bx4,
 1454|      0|                                                           have_top, have_left);
 1455|      0|                    b->ref[1] = 4 + dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1456|      0|                                        ts->cdf.m.comp_bwd_ref[1][ctx4]);
 1457|      0|                }
 1458|      0|            } else {
 1459|       |                // unidir
 1460|      0|                const int uctx_p = av1_get_uni_p_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  280|      0|#define av1_get_uni_p_ctx av1_get_ref_ctx
  ------------------
 1461|      0|                                                     have_top, have_left);
 1462|      0|                if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1462:21): [True: 0, False: 0]
  ------------------
 1463|      0|                        ts->cdf.m.comp_uni_ref[0][uctx_p]))
 1464|      0|                {
 1465|      0|                    b->ref[0] = 4;
 1466|      0|                    b->ref[1] = 6;
 1467|      0|                } else {
 1468|      0|                    const int uctx_p1 = av1_get_uni_p1_ctx(t->a, &t->l, by4, bx4,
 1469|      0|                                                           have_top, have_left);
 1470|      0|                    b->ref[0] = 0;
 1471|      0|                    b->ref[1] = 1 + dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1472|      0|                                        ts->cdf.m.comp_uni_ref[1][uctx_p1]);
 1473|      0|                    if (b->ref[1] == 2) {
  ------------------
  |  Branch (1473:25): [True: 0, False: 0]
  ------------------
 1474|      0|                        const int uctx_p2 = av1_get_uni_p2_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  281|      0|#define av1_get_uni_p2_ctx av1_get_fwd_ref_2_ctx
  ------------------
 1475|      0|                                                               have_top, have_left);
 1476|      0|                        b->ref[1] += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1477|      0|                                         ts->cdf.m.comp_uni_ref[2][uctx_p2]);
 1478|      0|                    }
 1479|      0|                }
 1480|      0|            }
 1481|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1482|      0|                printf("Post-refs[%d/%d]: r=%d\n",
 1483|      0|                       b->ref[0], b->ref[1], ts->msac.rng);
 1484|       |
 1485|      0|            refmvs_candidate mvstack[8];
 1486|      0|            int n_mvs, ctx;
 1487|      0|            dav1d_refmvs_find(&t->rt, mvstack, &n_mvs, &ctx,
 1488|      0|                              (union refmvs_refpair) { .ref = {
 1489|      0|                                    b->ref[0] + 1, b->ref[1] + 1 }},
 1490|      0|                              bs, intra_edge_flags, t->by, t->bx);
 1491|       |
 1492|      0|            b->inter_mode = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|      0|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1493|      0|                                ts->cdf.m.comp_inter_mode[ctx],
 1494|      0|                                N_COMP_INTER_PRED_MODES - 1);
 1495|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1496|      0|                printf("Post-compintermode[%d,ctx=%d,n_mvs=%d]: r=%d\n",
 1497|      0|                       b->inter_mode, ctx, n_mvs, ts->msac.rng);
 1498|       |
 1499|      0|            const uint8_t *const im = dav1d_comp_inter_pred_modes[b->inter_mode];
 1500|      0|            b->drl_idx = NEAREST_DRL;
 1501|      0|            if (b->inter_mode == NEWMV_NEWMV) {
  ------------------
  |  Branch (1501:17): [True: 0, False: 0]
  ------------------
 1502|      0|                if (n_mvs > 1) { // NEARER, NEAR or NEARISH
  ------------------
  |  Branch (1502:21): [True: 0, False: 0]
  ------------------
 1503|      0|                    const int drl_ctx_v1 = get_drl_context(mvstack, 0);
 1504|      0|                    b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1505|      0|                                      ts->cdf.m.drl_bit[drl_ctx_v1]);
 1506|      0|                    if (b->drl_idx == NEARER_DRL && n_mvs > 2) {
  ------------------
  |  Branch (1506:25): [True: 0, False: 0]
  |  Branch (1506:53): [True: 0, False: 0]
  ------------------
 1507|      0|                        const int drl_ctx_v2 = get_drl_context(mvstack, 1);
 1508|      0|                        b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1509|      0|                                          ts->cdf.m.drl_bit[drl_ctx_v2]);
 1510|      0|                    }
 1511|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1512|      0|                        printf("Post-drlidx[%d,n_mvs=%d]: r=%d\n",
 1513|      0|                               b->drl_idx, n_mvs, ts->msac.rng);
 1514|      0|                }
 1515|      0|            } else if (im[0] == NEARMV || im[1] == NEARMV) {
  ------------------
  |  Branch (1515:24): [True: 0, False: 0]
  |  Branch (1515:43): [True: 0, False: 0]
  ------------------
 1516|      0|                b->drl_idx = NEARER_DRL;
 1517|      0|                if (n_mvs > 2) { // NEAR or NEARISH
  ------------------
  |  Branch (1517:21): [True: 0, False: 0]
  ------------------
 1518|      0|                    const int drl_ctx_v2 = get_drl_context(mvstack, 1);
 1519|      0|                    b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1520|      0|                                      ts->cdf.m.drl_bit[drl_ctx_v2]);
 1521|      0|                    if (b->drl_idx == NEAR_DRL && n_mvs > 3) {
  ------------------
  |  Branch (1521:25): [True: 0, False: 0]
  |  Branch (1521:51): [True: 0, False: 0]
  ------------------
 1522|      0|                        const int drl_ctx_v3 = get_drl_context(mvstack, 2);
 1523|      0|                        b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1524|      0|                                          ts->cdf.m.drl_bit[drl_ctx_v3]);
 1525|      0|                    }
 1526|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1527|      0|                        printf("Post-drlidx[%d,n_mvs=%d]: r=%d\n",
 1528|      0|                               b->drl_idx, n_mvs, ts->msac.rng);
 1529|      0|                }
 1530|      0|            }
 1531|      0|            assert(b->drl_idx >= NEAREST_DRL && b->drl_idx <= NEARISH_DRL);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1532|       |
 1533|      0|#define assign_comp_mv(idx) \
 1534|      0|            switch (im[idx]) { \
 1535|      0|            case NEARMV: \
 1536|      0|            case NEARESTMV: \
 1537|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
 1538|      0|                fix_mv_precision(f->frame_hdr, &b->mv[idx]); \
 1539|      0|                break; \
 1540|      0|            case GLOBALMV: \
 1541|      0|                has_subpel_filter |= \
 1542|      0|                    f->frame_hdr->gmv[b->ref[idx]].type == DAV1D_WM_TYPE_TRANSLATION; \
 1543|      0|                b->mv[idx] = get_gmv_2d(&f->frame_hdr->gmv[b->ref[idx]], \
 1544|      0|                                        t->bx, t->by, bw4, bh4, f->frame_hdr); \
 1545|      0|                break; \
 1546|      0|            case NEWMV: \
 1547|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
 1548|      0|                const int mv_prec = f->frame_hdr->hp - f->frame_hdr->force_integer_mv; \
 1549|      0|                read_mv_residual(ts, &b->mv[idx], mv_prec); \
 1550|      0|                break; \
 1551|      0|            }
 1552|      0|            has_subpel_filter = imin(bw4, bh4) == 1 ||
  ------------------
  |  Branch (1552:33): [True: 0, False: 0]
  ------------------
 1553|      0|                                b->inter_mode != GLOBALMV_GLOBALMV;
  ------------------
  |  Branch (1553:33): [True: 0, False: 0]
  ------------------
 1554|      0|            assign_comp_mv(0);
  ------------------
  |  | 1534|      0|            switch (im[idx]) { \
  |  |  ------------------
  |  |  |  Branch (1534:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1535|      0|            case NEARMV: \
  |  |  ------------------
  |  |  |  Branch (1535:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1536|      0|            case NEARESTMV: \
  |  |  ------------------
  |  |  |  Branch (1536:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1537|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
  |  | 1538|      0|                fix_mv_precision(f->frame_hdr, &b->mv[idx]); \
  |  | 1539|      0|                break; \
  |  | 1540|      0|            case GLOBALMV: \
  |  |  ------------------
  |  |  |  Branch (1540:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1541|      0|                has_subpel_filter |= \
  |  | 1542|      0|                    f->frame_hdr->gmv[b->ref[idx]].type == DAV1D_WM_TYPE_TRANSLATION; \
  |  | 1543|      0|                b->mv[idx] = get_gmv_2d(&f->frame_hdr->gmv[b->ref[idx]], \
  |  | 1544|      0|                                        t->bx, t->by, bw4, bh4, f->frame_hdr); \
  |  | 1545|      0|                break; \
  |  | 1546|      0|            case NEWMV: \
  |  |  ------------------
  |  |  |  Branch (1546:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1547|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
  |  | 1548|      0|                const int mv_prec = f->frame_hdr->hp - f->frame_hdr->force_integer_mv; \
  |  | 1549|      0|                read_mv_residual(ts, &b->mv[idx], mv_prec); \
  |  | 1550|      0|                break; \
  |  | 1551|      0|            }
  ------------------
 1555|      0|            assign_comp_mv(1);
  ------------------
  |  | 1534|      0|            switch (im[idx]) { \
  |  |  ------------------
  |  |  |  Branch (1534:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1535|      0|            case NEARMV: \
  |  |  ------------------
  |  |  |  Branch (1535:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1536|      0|            case NEARESTMV: \
  |  |  ------------------
  |  |  |  Branch (1536:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1537|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
  |  | 1538|      0|                fix_mv_precision(f->frame_hdr, &b->mv[idx]); \
  |  | 1539|      0|                break; \
  |  | 1540|      0|            case GLOBALMV: \
  |  |  ------------------
  |  |  |  Branch (1540:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1541|      0|                has_subpel_filter |= \
  |  | 1542|      0|                    f->frame_hdr->gmv[b->ref[idx]].type == DAV1D_WM_TYPE_TRANSLATION; \
  |  | 1543|      0|                b->mv[idx] = get_gmv_2d(&f->frame_hdr->gmv[b->ref[idx]], \
  |  | 1544|      0|                                        t->bx, t->by, bw4, bh4, f->frame_hdr); \
  |  | 1545|      0|                break; \
  |  | 1546|      0|            case NEWMV: \
  |  |  ------------------
  |  |  |  Branch (1546:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1547|      0|                b->mv[idx] = mvstack[b->drl_idx].mv.mv[idx]; \
  |  | 1548|      0|                const int mv_prec = f->frame_hdr->hp - f->frame_hdr->force_integer_mv; \
  |  | 1549|      0|                read_mv_residual(ts, &b->mv[idx], mv_prec); \
  |  | 1550|      0|                break; \
  |  | 1551|      0|            }
  ------------------
 1556|      0|#undef assign_comp_mv
 1557|      0|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1558|      0|                printf("Post-residual_mv[1:y=%d,x=%d,2:y=%d,x=%d]: r=%d\n",
 1559|      0|                       b->mv[0].y, b->mv[0].x, b->mv[1].y, b->mv[1].x,
 1560|      0|                       ts->msac.rng);
 1561|       |
 1562|       |            // jnt_comp vs. seg vs. wedge
 1563|      0|            int is_segwedge = 0;
 1564|      0|            if (f->seq_hdr->masked_compound) {
  ------------------
  |  Branch (1564:17): [True: 0, False: 0]
  ------------------
 1565|      0|                const int mask_ctx = get_mask_comp_ctx(t->a, &t->l, by4, bx4);
 1566|       |
 1567|      0|                is_segwedge = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1568|      0|                                  ts->cdf.m.mask_comp[mask_ctx]);
 1569|      0|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1570|      0|                    printf("Post-segwedge_vs_jntavg[%d,ctx=%d]: r=%d\n",
 1571|      0|                           is_segwedge, mask_ctx, ts->msac.rng);
 1572|      0|            }
 1573|       |
 1574|      0|            if (!is_segwedge) {
  ------------------
  |  Branch (1574:17): [True: 0, False: 0]
  ------------------
 1575|      0|                if (f->seq_hdr->jnt_comp) {
  ------------------
  |  Branch (1575:21): [True: 0, False: 0]
  ------------------
 1576|      0|                    const int jnt_ctx =
 1577|      0|                        get_jnt_comp_ctx(f->seq_hdr->order_hint_n_bits,
 1578|      0|                                         f->cur.frame_hdr->frame_offset,
 1579|      0|                                         f->refp[b->ref[0]].p.frame_hdr->frame_offset,
 1580|      0|                                         f->refp[b->ref[1]].p.frame_hdr->frame_offset,
 1581|      0|                                         t->a, &t->l, by4, bx4);
 1582|      0|                    b->comp_type = COMP_INTER_WEIGHTED_AVG +
 1583|      0|                                   dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1584|      0|                                       ts->cdf.m.jnt_comp[jnt_ctx]);
 1585|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1586|      0|                        printf("Post-jnt_comp[%d,ctx=%d[ac:%d,ar:%d,lc:%d,lr:%d]]: r=%d\n",
 1587|      0|                               b->comp_type == COMP_INTER_AVG,
 1588|      0|                               jnt_ctx, t->a->comp_type[bx4], t->a->ref[0][bx4],
 1589|      0|                               t->l.comp_type[by4], t->l.ref[0][by4],
 1590|      0|                               ts->msac.rng);
 1591|      0|                } else {
 1592|      0|                    b->comp_type = COMP_INTER_AVG;
 1593|      0|                }
 1594|      0|            } else {
 1595|      0|                if (wedge_allowed_mask & (1 << bs)) {
  ------------------
  |  Branch (1595:21): [True: 0, False: 0]
  ------------------
 1596|      0|                    const int ctx = dav1d_wedge_ctx_lut[bs];
 1597|      0|                    b->comp_type = COMP_INTER_WEDGE -
 1598|      0|                                   dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1599|      0|                                       ts->cdf.m.wedge_comp[ctx]);
 1600|      0|                    if (b->comp_type == COMP_INTER_WEDGE)
  ------------------
  |  Branch (1600:25): [True: 0, False: 0]
  ------------------
 1601|      0|                        b->wedge_idx = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|      0|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1602|      0|                                           ts->cdf.m.wedge_idx[ctx], 15);
 1603|      0|                } else {
 1604|      0|                    b->comp_type = COMP_INTER_SEG;
 1605|      0|                }
 1606|      0|                b->mask_sign = dav1d_msac_decode_bool_equi(&ts->msac);
  ------------------
  |  |   85|      0|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
 1607|      0|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1608|      0|                    printf("Post-seg/wedge[%d,wedge_idx=%d,sign=%d]: r=%d\n",
 1609|      0|                           b->comp_type == COMP_INTER_WEDGE,
 1610|      0|                           b->wedge_idx, b->mask_sign, ts->msac.rng);
 1611|      0|            }
 1612|  18.4E|        } else {
 1613|  18.4E|            b->comp_type = COMP_INTER_NONE;
 1614|       |
 1615|       |            // ref
 1616|  18.4E|            if (seg && seg->ref > 0) {
  ------------------
  |  Branch (1616:17): [True: 0, False: 18.4E]
  |  Branch (1616:24): [True: 0, False: 0]
  ------------------
 1617|      0|                b->ref[0] = seg->ref - 1;
 1618|  18.4E|            } else if (seg && (seg->globalmv || seg->skip)) {
  ------------------
  |  Branch (1618:24): [True: 0, False: 18.4E]
  |  Branch (1618:32): [True: 0, False: 0]
  |  Branch (1618:49): [True: 0, False: 0]
  ------------------
 1619|      0|                b->ref[0] = 0;
 1620|  18.4E|            } else {
 1621|  18.4E|                const int ctx1 = av1_get_ref_ctx(t->a, &t->l, by4, bx4,
 1622|  18.4E|                                                 have_top, have_left);
 1623|  18.4E|                if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|  18.4E|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1623:21): [True: 0, False: 18.4E]
  ------------------
 1624|  18.4E|                                                 ts->cdf.m.ref[0][ctx1]))
 1625|      0|                {
 1626|      0|                    const int ctx2 = av1_get_ref_2_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  275|      0|#define av1_get_ref_2_ctx av1_get_bwd_ref_ctx
  ------------------
 1627|      0|                                                       have_top, have_left);
 1628|      0|                    if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1628:25): [True: 0, False: 0]
  ------------------
 1629|      0|                                                     ts->cdf.m.ref[1][ctx2]))
 1630|      0|                    {
 1631|      0|                        b->ref[0] = 6;
 1632|      0|                    } else {
 1633|      0|                        const int ctx3 = av1_get_ref_6_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  279|      0|#define av1_get_ref_6_ctx av1_get_bwd_ref_1_ctx
  ------------------
 1634|      0|                                                           have_top, have_left);
 1635|      0|                        b->ref[0] = 4 + dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1636|      0|                                            ts->cdf.m.ref[5][ctx3]);
 1637|      0|                    }
 1638|  18.4E|                } else {
 1639|  18.4E|                    const int ctx2 = av1_get_ref_3_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  276|  18.4E|#define av1_get_ref_3_ctx av1_get_fwd_ref_ctx
  ------------------
 1640|  18.4E|                                                       have_top, have_left);
 1641|  18.4E|                    if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|  18.4E|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1641:25): [True: 0, False: 18.4E]
  ------------------
 1642|  18.4E|                                                     ts->cdf.m.ref[2][ctx2]))
 1643|      0|                    {
 1644|      0|                        const int ctx3 = av1_get_ref_5_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  278|      0|#define av1_get_ref_5_ctx av1_get_fwd_ref_2_ctx
  ------------------
 1645|      0|                                                           have_top, have_left);
 1646|      0|                        b->ref[0] = 2 + dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1647|      0|                                            ts->cdf.m.ref[4][ctx3]);
 1648|  18.4E|                    } else {
 1649|  18.4E|                        const int ctx3 = av1_get_ref_4_ctx(t->a, &t->l, by4, bx4,
  ------------------
  |  |  277|  18.4E|#define av1_get_ref_4_ctx av1_get_fwd_ref_1_ctx
  ------------------
 1650|  18.4E|                                                           have_top, have_left);
 1651|  18.4E|                        b->ref[0] = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|  18.4E|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1652|  18.4E|                                        ts->cdf.m.ref[3][ctx3]);
 1653|  18.4E|                    }
 1654|  18.4E|                }
 1655|  18.4E|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  18.4E|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 18.4E]
  |  |  ------------------
  |  |   35|  18.4E|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  18.4E|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1656|      0|                    printf("Post-ref[%d]: r=%d\n", b->ref[0], ts->msac.rng);
 1657|  18.4E|            }
 1658|  18.4E|            b->ref[1] = -1;
 1659|       |
 1660|  18.4E|            refmvs_candidate mvstack[8];
 1661|  18.4E|            int n_mvs, ctx;
 1662|  18.4E|            dav1d_refmvs_find(&t->rt, mvstack, &n_mvs, &ctx,
 1663|  18.4E|                              (union refmvs_refpair) { .ref = { b->ref[0] + 1, -1 }},
 1664|  18.4E|                              bs, intra_edge_flags, t->by, t->bx);
 1665|       |
 1666|       |            // mode parsing and mv derivation from ref_mvs
 1667|  18.4E|            if ((seg && (seg->skip || seg->globalmv)) ||
  ------------------
  |  Branch (1667:18): [True: 0, False: 18.4E]
  |  Branch (1667:26): [True: 0, False: 0]
  |  Branch (1667:39): [True: 0, False: 0]
  ------------------
 1668|      0|                dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1668:17): [True: 0, False: 0]
  ------------------
 1669|      0|                                             ts->cdf.m.newmv_mode[ctx & 7]))
 1670|      0|            {
 1671|      0|                if ((seg && (seg->skip || seg->globalmv)) ||
  ------------------
  |  Branch (1671:22): [True: 0, False: 0]
  |  Branch (1671:30): [True: 0, False: 0]
  |  Branch (1671:43): [True: 0, False: 0]
  ------------------
 1672|      0|                    !dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1672:21): [True: 0, False: 0]
  ------------------
 1673|      0|                         ts->cdf.m.globalmv_mode[(ctx >> 3) & 1]))
 1674|      0|                {
 1675|      0|                    b->inter_mode = GLOBALMV;
 1676|      0|                    b->mv[0] = get_gmv_2d(&f->frame_hdr->gmv[b->ref[0]],
 1677|      0|                                          t->bx, t->by, bw4, bh4, f->frame_hdr);
 1678|      0|                    has_subpel_filter = imin(bw4, bh4) == 1 ||
  ------------------
  |  Branch (1678:41): [True: 0, False: 0]
  ------------------
 1679|      0|                        f->frame_hdr->gmv[b->ref[0]].type == DAV1D_WM_TYPE_TRANSLATION;
  ------------------
  |  Branch (1679:25): [True: 0, False: 0]
  ------------------
 1680|      0|                } else {
 1681|      0|                    has_subpel_filter = 1;
 1682|      0|                    if (dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1682:25): [True: 0, False: 0]
  ------------------
 1683|      0|                            ts->cdf.m.refmv_mode[(ctx >> 4) & 15]))
 1684|      0|                    { // NEAREST, NEARER, NEAR or NEARISH
 1685|      0|                        b->inter_mode = NEARMV;
 1686|      0|                        b->drl_idx = NEARER_DRL;
 1687|      0|                        if (n_mvs > 2) { // NEARER, NEAR or NEARISH
  ------------------
  |  Branch (1687:29): [True: 0, False: 0]
  ------------------
 1688|      0|                            const int drl_ctx_v2 = get_drl_context(mvstack, 1);
 1689|      0|                            b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1690|      0|                                              ts->cdf.m.drl_bit[drl_ctx_v2]);
 1691|      0|                            if (b->drl_idx == NEAR_DRL && n_mvs > 3) { // NEAR or NEARISH
  ------------------
  |  Branch (1691:33): [True: 0, False: 0]
  |  Branch (1691:59): [True: 0, False: 0]
  ------------------
 1692|      0|                                const int drl_ctx_v3 =
 1693|      0|                                    get_drl_context(mvstack, 2);
 1694|      0|                                b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1695|      0|                                                  ts->cdf.m.drl_bit[drl_ctx_v3]);
 1696|      0|                            }
 1697|      0|                        }
 1698|      0|                    } else {
 1699|      0|                        b->inter_mode = NEARESTMV;
 1700|      0|                        b->drl_idx = NEAREST_DRL;
 1701|      0|                    }
 1702|      0|                    assert(b->drl_idx >= NEAREST_DRL && b->drl_idx <= NEARISH_DRL);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1703|      0|                    b->mv[0] = mvstack[b->drl_idx].mv.mv[0];
 1704|      0|                    if (b->drl_idx < NEAR_DRL)
  ------------------
  |  Branch (1704:25): [True: 0, False: 0]
  ------------------
 1705|      0|                        fix_mv_precision(f->frame_hdr, &b->mv[0]);
 1706|      0|                }
 1707|       |
 1708|      0|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1709|      0|                    printf("Post-intermode[%d,drl=%d,mv=y:%d,x:%d,n_mvs=%d]: r=%d\n",
 1710|      0|                           b->inter_mode, b->drl_idx, b->mv[0].y, b->mv[0].x, n_mvs,
 1711|      0|                           ts->msac.rng);
 1712|  18.4E|            } else {
 1713|  18.4E|                has_subpel_filter = 1;
 1714|  18.4E|                b->inter_mode = NEWMV;
 1715|  18.4E|                b->drl_idx = NEAREST_DRL;
 1716|  18.4E|                if (n_mvs > 1) { // NEARER, NEAR or NEARISH
  ------------------
  |  Branch (1716:21): [True: 0, False: 18.4E]
  ------------------
 1717|      0|                    const int drl_ctx_v1 = get_drl_context(mvstack, 0);
 1718|      0|                    b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1719|      0|                                      ts->cdf.m.drl_bit[drl_ctx_v1]);
 1720|      0|                    if (b->drl_idx == NEARER_DRL && n_mvs > 2) { // NEAR or NEARISH
  ------------------
  |  Branch (1720:25): [True: 0, False: 0]
  |  Branch (1720:53): [True: 0, False: 0]
  ------------------
 1721|      0|                        const int drl_ctx_v2 = get_drl_context(mvstack, 1);
 1722|      0|                        b->drl_idx += dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1723|      0|                                          ts->cdf.m.drl_bit[drl_ctx_v2]);
 1724|      0|                    }
 1725|      0|                }
 1726|  18.4E|                assert(b->drl_idx >= NEAREST_DRL && b->drl_idx <= NEARISH_DRL);
  ------------------
  |  |  140|  18.4E|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 0, False: 18.4E]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 18.4E]
  |  |  ------------------
  ------------------
 1727|  18.4E|                if (n_mvs > 1) {
  ------------------
  |  Branch (1727:21): [True: 0, False: 18.4E]
  ------------------
 1728|      0|                    b->mv[0] = mvstack[b->drl_idx].mv.mv[0];
 1729|  18.4E|                } else {
 1730|  18.4E|                    assert(!b->drl_idx);
  ------------------
  |  |  140|  18.4E|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 18.4E]
  |  |  |  Branch (140:68): [Folded, False: 18.4E]
  |  |  ------------------
  ------------------
 1731|  18.4E|                    b->mv[0] = mvstack[0].mv.mv[0];
 1732|  18.4E|                    fix_mv_precision(f->frame_hdr, &b->mv[0]);
 1733|  18.4E|                }
 1734|  18.4E|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  18.4E|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 18.4E]
  |  |  ------------------
  |  |   35|  18.4E|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  18.4E|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1735|      0|                    printf("Post-intermode[%d,drl=%d]: r=%d\n",
 1736|      0|                           b->inter_mode, b->drl_idx, ts->msac.rng);
 1737|  18.4E|                const int mv_prec = f->frame_hdr->hp - f->frame_hdr->force_integer_mv;
 1738|  18.4E|                read_mv_residual(ts, &b->mv[0], mv_prec);
 1739|  18.4E|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  18.4E|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 18.4E]
  |  |  ------------------
  |  |   35|  18.4E|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  18.4E|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1740|      0|                    printf("Post-residualmv[mv=y:%d,x:%d]: r=%d\n",
 1741|      0|                           b->mv[0].y, b->mv[0].x, ts->msac.rng);
 1742|  18.4E|            }
 1743|       |
 1744|       |            // interintra flags
 1745|  18.4E|            const int ii_sz_grp = dav1d_ymode_size_context[bs];
 1746|  18.4E|            if (f->seq_hdr->inter_intra &&
  ------------------
  |  Branch (1746:17): [True: 0, False: 18.4E]
  ------------------
 1747|      0|                interintra_allowed_mask & (1 << bs) &&
  ------------------
  |  Branch (1747:17): [True: 0, False: 0]
  ------------------
 1748|      0|                dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  |  Branch (1748:17): [True: 0, False: 0]
  ------------------
 1749|      0|                                             ts->cdf.m.interintra[ii_sz_grp]))
 1750|      0|            {
 1751|      0|                b->interintra_mode = dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1752|      0|                                         ts->cdf.m.interintra_mode[ii_sz_grp],
 1753|      0|                                         N_INTER_INTRA_PRED_MODES - 1);
 1754|      0|                const int wedge_ctx = dav1d_wedge_ctx_lut[bs];
 1755|      0|                b->interintra_type = INTER_INTRA_BLEND +
 1756|      0|                                     dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1757|      0|                                         ts->cdf.m.interintra_wedge[wedge_ctx]);
 1758|      0|                if (b->interintra_type == INTER_INTRA_WEDGE)
  ------------------
  |  Branch (1758:21): [True: 0, False: 0]
  ------------------
 1759|      0|                    b->wedge_idx = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|      0|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
 1760|      0|                                       ts->cdf.m.wedge_idx[wedge_ctx], 15);
 1761|  18.4E|            } else {
 1762|  18.4E|                b->interintra_type = INTER_INTRA_NONE;
 1763|  18.4E|            }
 1764|  18.4E|            if (DEBUG_BLOCK_INFO && f->seq_hdr->inter_intra &&
  ------------------
  |  |   34|  18.4E|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 18.4E]
  |  |  ------------------
  |  |   35|  18.4E|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  18.4E|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1764:37): [True: 0, False: 0]
  ------------------
 1765|      0|                interintra_allowed_mask & (1 << bs))
  ------------------
  |  Branch (1765:17): [True: 0, False: 0]
  ------------------
 1766|      0|            {
 1767|      0|                printf("Post-interintra[t=%d,m=%d,w=%d]: r=%d\n",
 1768|      0|                       b->interintra_type, b->interintra_mode,
 1769|      0|                       b->wedge_idx, ts->msac.rng);
 1770|      0|            }
 1771|       |
 1772|       |            // motion variation
 1773|  18.4E|            if (f->frame_hdr->switchable_motion_mode &&
  ------------------
  |  Branch (1773:17): [True: 0, False: 18.4E]
  ------------------
 1774|      0|                b->interintra_type == INTER_INTRA_NONE && imin(bw4, bh4) >= 2 &&
  ------------------
  |  Branch (1774:17): [True: 0, False: 0]
  |  Branch (1774:59): [True: 0, False: 0]
  ------------------
 1775|       |                // is not warped global motion
 1776|      0|                !(!f->frame_hdr->force_integer_mv && b->inter_mode == GLOBALMV &&
  ------------------
  |  Branch (1776:19): [True: 0, False: 0]
  |  Branch (1776:54): [True: 0, False: 0]
  ------------------
 1777|      0|                  f->frame_hdr->gmv[b->ref[0]].type > DAV1D_WM_TYPE_TRANSLATION) &&
  ------------------
  |  Branch (1777:19): [True: 0, False: 0]
  ------------------
 1778|       |                // has overlappable neighbours
 1779|      0|                ((have_left && findoddzero(&t->l.intra[by4 + 1], h4 >> 1)) ||
  ------------------
  |  Branch (1779:19): [True: 0, False: 0]
  |  Branch (1779:32): [True: 0, False: 0]
  ------------------
 1780|      0|                 (have_top && findoddzero(&t->a->intra[bx4 + 1], w4 >> 1))))
  ------------------
  |  Branch (1780:19): [True: 0, False: 0]
  |  Branch (1780:31): [True: 0, False: 0]
  ------------------
 1781|      0|            {
 1782|       |                // reaching here means the block allows obmc - check warp by
 1783|       |                // finding matching-ref blocks in top/left edges
 1784|      0|                uint64_t mask[2] = { 0, 0 };
 1785|      0|                find_matching_ref(t, intra_edge_flags, bw4, bh4, w4, h4,
 1786|      0|                                  have_left, have_top, b->ref[0], mask);
 1787|      0|                const int allow_warp = !f->svc[b->ref[0]][0].scale &&
  ------------------
  |  Branch (1787:40): [True: 0, False: 0]
  ------------------
 1788|      0|                    !f->frame_hdr->force_integer_mv &&
  ------------------
  |  Branch (1788:21): [True: 0, False: 0]
  ------------------
 1789|      0|                    f->frame_hdr->warp_motion && (mask[0] | mask[1]);
  ------------------
  |  Branch (1789:21): [True: 0, False: 0]
  |  Branch (1789:50): [True: 0, False: 0]
  ------------------
 1790|       |
 1791|      0|                b->motion_mode = allow_warp ?
  ------------------
  |  Branch (1791:34): [True: 0, False: 0]
  ------------------
 1792|      0|                    dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1793|      0|                        ts->cdf.m.motion_mode[bs], 2) :
 1794|      0|                    dav1d_msac_decode_bool_adapt(&ts->msac, ts->cdf.m.obmc[bs]);
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
 1795|      0|                if (b->motion_mode == MM_WARP) {
  ------------------
  |  Branch (1795:21): [True: 0, False: 0]
  ------------------
 1796|      0|                    has_subpel_filter = 0;
 1797|      0|                    derive_warpmv(t, bw4, bh4, mask, b->mv[0], &t->warpmv);
 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
 1799|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1800|      0|                        printf("[ %c%x %c%x %c%x\n  %c%x %c%x %c%x ]\n"
 1801|      0|                               "alpha=%c%x, beta=%c%x, gamma=%c%x, delta=%c%x, "
 1802|      0|                               "mv=y:%d,x:%d\n",
 1803|      0|                               signabs(t->warpmv.matrix[0]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1804|      0|                               signabs(t->warpmv.matrix[1]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1805|      0|                               signabs(t->warpmv.matrix[2]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1806|      0|                               signabs(t->warpmv.matrix[3]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1807|      0|                               signabs(t->warpmv.matrix[4]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1808|      0|                               signabs(t->warpmv.matrix[5]),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1809|      0|                               signabs(t->warpmv.u.p.alpha),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1810|      0|                               signabs(t->warpmv.u.p.beta),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1811|      0|                               signabs(t->warpmv.u.p.gamma),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1812|      0|                               signabs(t->warpmv.u.p.delta),
  ------------------
  |  | 1798|      0|#define signabs(v) v < 0 ? '-' : ' ', abs(v)
  |  |  ------------------
  |  |  |  Branch (1798:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1813|      0|                               b->mv[0].y, b->mv[0].x);
 1814|      0|#undef signabs
 1815|      0|                    if (t->frame_thread.pass) {
  ------------------
  |  Branch (1815:25): [True: 0, False: 0]
  ------------------
 1816|      0|                        if (t->warpmv.type == DAV1D_WM_TYPE_AFFINE) {
  ------------------
  |  Branch (1816:29): [True: 0, False: 0]
  ------------------
 1817|      0|                            b->matrix[0] = t->warpmv.matrix[2] - 0x10000;
 1818|      0|                            b->matrix[1] = t->warpmv.matrix[3];
 1819|      0|                            b->matrix[2] = t->warpmv.matrix[4];
 1820|      0|                            b->matrix[3] = t->warpmv.matrix[5] - 0x10000;
 1821|      0|                        } else {
 1822|      0|                            b->matrix[0] = INT16_MIN;
 1823|      0|                        }
 1824|      0|                    }
 1825|      0|                }
 1826|       |
 1827|      0|                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1828|      0|                    printf("Post-motionmode[%d]: r=%d [mask: 0x%" PRIx64 "/0x%"
 1829|      0|                           PRIx64 "]\n", b->motion_mode, ts->msac.rng, mask[0],
 1830|      0|                            mask[1]);
 1831|  18.4E|            } else {
 1832|  18.4E|                b->motion_mode = MM_TRANSLATION;
 1833|  18.4E|            }
 1834|  18.4E|        }
 1835|       |
 1836|       |        // subpel filter
 1837|  18.4E|        enum Dav1dFilterMode filter[2];
 1838|  18.4E|        if (f->frame_hdr->subpel_filter_mode == DAV1D_FILTER_SWITCHABLE) {
  ------------------
  |  Branch (1838:13): [True: 0, False: 18.4E]
  ------------------
 1839|      0|            if (has_subpel_filter) {
  ------------------
  |  Branch (1839:17): [True: 0, False: 0]
  ------------------
 1840|      0|                const int comp = b->comp_type != COMP_INTER_NONE;
 1841|      0|                const int ctx1 = get_filter_ctx(t->a, &t->l, comp, 0, b->ref[0],
 1842|      0|                                                by4, bx4);
 1843|      0|                filter[0] = dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1844|      0|                               ts->cdf.m.filter[0][ctx1],
 1845|      0|                               DAV1D_N_SWITCHABLE_FILTERS - 1);
 1846|      0|                if (f->seq_hdr->dual_filter) {
  ------------------
  |  Branch (1846:21): [True: 0, False: 0]
  ------------------
 1847|      0|                    const int ctx2 = get_filter_ctx(t->a, &t->l, comp, 1,
 1848|      0|                                                    b->ref[0], by4, bx4);
 1849|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1850|      0|                        printf("Post-subpel_filter1[%d,ctx=%d]: r=%d\n",
 1851|      0|                               filter[0], ctx1, ts->msac.rng);
 1852|      0|                    filter[1] = dav1d_msac_decode_symbol_adapt4(&ts->msac,
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
 1853|      0|                                    ts->cdf.m.filter[1][ctx2],
 1854|      0|                                    DAV1D_N_SWITCHABLE_FILTERS - 1);
 1855|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1856|      0|                        printf("Post-subpel_filter2[%d,ctx=%d]: r=%d\n",
 1857|      0|                               filter[1], ctx2, ts->msac.rng);
 1858|      0|                } else {
 1859|      0|                    filter[1] = filter[0];
 1860|      0|                    if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1861|      0|                        printf("Post-subpel_filter[%d,ctx=%d]: r=%d\n",
 1862|      0|                               filter[0], ctx1, ts->msac.rng);
 1863|      0|                }
 1864|      0|            } else {
 1865|      0|                filter[0] = filter[1] = DAV1D_FILTER_8TAP_REGULAR;
 1866|      0|            }
 1867|  18.4E|        } else {
 1868|  18.4E|            filter[0] = filter[1] = f->frame_hdr->subpel_filter_mode;
 1869|  18.4E|        }
 1870|  18.4E|        b->filter2d = dav1d_filter_2d[filter[1]][filter[0]];
 1871|       |
 1872|  18.4E|        read_vartx_tree(t, b, bs, bx4, by4);
 1873|       |
 1874|       |        // reconstruction
 1875|  18.4E|        if (t->frame_thread.pass == 1) {
  ------------------
  |  Branch (1875:13): [True: 0, False: 18.4E]
  ------------------
 1876|      0|            f->bd_fn.read_coef_blocks(t, bs, b);
 1877|  18.4E|        } else {
 1878|  18.4E|            if (f->bd_fn.recon_b_inter(t, bs, b)) return -1;
  ------------------
  |  Branch (1878:17): [True: 0, False: 18.4E]
  ------------------
 1879|  18.4E|        }
 1880|       |
 1881|  18.4E|        if (f->frame_hdr->loopfilter.level_y[0] ||
  ------------------
  |  Branch (1881:13): [True: 18.4E, False: 0]
  ------------------
 1882|      0|            f->frame_hdr->loopfilter.level_y[1])
  ------------------
  |  Branch (1882:13): [True: 0, False: 0]
  ------------------
 1883|      0|        {
 1884|      0|            const int is_globalmv =
 1885|      0|                b->inter_mode == (is_comp ? GLOBALMV_GLOBALMV : GLOBALMV);
  ------------------
  |  Branch (1885:35): [True: 0, False: 0]
  ------------------
 1886|      0|            const uint8_t (*const lf_lvls)[8][2] = (const uint8_t (*)[8][2])
 1887|      0|                &ts->lflvl[b->seg_id][0][b->ref[0] + 1][!is_globalmv];
 1888|      0|            const uint16_t tx_split[2] = { b->tx_split0, b->tx_split1 };
 1889|      0|            enum RectTxfmSize ytx = b->max_ytx, uvtx = b->uvtx;
 1890|      0|            if (f->frame_hdr->segmentation.lossless[b->seg_id]) {
  ------------------
  |  Branch (1890:17): [True: 0, False: 0]
  ------------------
 1891|      0|                ytx  = (enum RectTxfmSize) TX_4X4;
 1892|      0|                uvtx = (enum RectTxfmSize) TX_4X4;
 1893|      0|            }
 1894|      0|            dav1d_create_lf_mask_inter(t->lf_mask, f->lf.level, f->b4_stride, lf_lvls,
 1895|      0|                                       t->bx, t->by, f->w4, f->h4, b->skip, bs,
 1896|      0|                                       ytx, tx_split, uvtx, f->cur.p.layout,
 1897|      0|                                       &t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
 1898|      0|                                       has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
  ------------------
  |  Branch (1898:40): [True: 0, False: 0]
  ------------------
 1899|      0|                                       has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
  ------------------
  |  Branch (1899:40): [True: 0, False: 0]
  ------------------
 1900|      0|        }
 1901|       |
 1902|       |        // context updates
 1903|  18.4E|        if (is_comp)
  ------------------
  |  Branch (1903:13): [True: 0, False: 18.4E]
  ------------------
 1904|      0|            splat_tworef_mv(f->c, t, bs, b, bw4, bh4);
 1905|  18.4E|        else
 1906|  18.4E|            splat_oneref_mv(f->c, t, bs, b, bw4, bh4);
 1907|  18.4E|        BlockContext *edge = t->a;
 1908|  18.4E|        for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
  ------------------
  |  Branch (1908:36): [True: 0, False: 18.4E]
  ------------------
 1909|      0|#define set_ctx(rep_macro) \
 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
 1912|      0|            rep_macro(edge->intra, off, 0); \
 1913|      0|            rep_macro(edge->skip, off, b->skip); \
 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
 1915|       |            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
 1924|      0|            case_set(b_dim[2 + i]);
  ------------------
  |  |   70|      0|    switch (var) { \
  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|      0|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|      0|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|      0|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|      0|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|      0|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|      0|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|      0|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  | 1910|      0|            rep_macro(edge->seg_pred, off, seg_pred); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1911|      0|            rep_macro(edge->skip_mode, off, b->skip_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1912|      0|            rep_macro(edge->intra, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1913|      0|            rep_macro(edge->skip, off, b->skip); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1914|      0|            rep_macro(edge->pal_sz, off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1915|      0|            /* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
  |  |  |  | 1916|      0|            rep_macro(t->pal_sz_uv[i], off, 0); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1917|      0|            rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1918|      0|            rep_macro(edge->comp_type, off, b->comp_type); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1919|      0|            rep_macro(edge->filter[0], off, filter[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1920|      0|            rep_macro(edge->filter[1], off, filter[1]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1921|      0|            rep_macro(edge->mode, off, b->inter_mode); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1922|      0|            rep_macro(edge->ref[0], off, b->ref[0]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1923|      0|            rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   78|      0|    }
  ------------------
 1925|      0|#undef set_ctx
 1926|      0|        }
 1927|  18.4E|        if (has_chroma) {
  ------------------
  |  Branch (1927:13): [True: 0, False: 18.4E]
  ------------------
 1928|      0|            dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
 1929|      0|            dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
 1930|      0|        }
 1931|  18.4E|    }
 1932|       |
 1933|       |    // update contexts
 1934|  2.64k|    if (f->frame_hdr->segmentation.enabled &&
  ------------------
  |  Branch (1934:9): [True: 2.09k, False: 554]
  ------------------
 1935|  2.09k|        f->frame_hdr->segmentation.update_map)
  ------------------
  |  Branch (1935:9): [True: 2.09k, False: 0]
  ------------------
 1936|  2.09k|    {
 1937|  2.09k|        uint8_t *seg_ptr = &f->cur_segmap[t->by * f->b4_stride + t->bx];
 1938|  2.09k|#define set_ctx(rep_macro) \
 1939|  2.09k|        for (int y = 0; y < bh4; y++) { \
 1940|  2.09k|            rep_macro(seg_ptr, 0, b->seg_id); \
 1941|  2.09k|            seg_ptr += f->b4_stride; \
 1942|  2.09k|        }
 1943|  2.09k|        case_set(b_dim[2]);
  ------------------
  |  |   70|  2.09k|    switch (var) { \
  |  |   71|    452|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  | 1939|  1.40k|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 952, False: 452]
  |  |  |  |  ------------------
  |  |  |  | 1940|    952|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   71|    952|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    952|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|    952|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|    952|        }
  |  |  ------------------
  |  |  |  Branch (71:5): [True: 452, False: 1.64k]
  |  |  ------------------
  |  |   72|    712|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  | 1939|  2.84k|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 2.13k, False: 712]
  |  |  |  |  ------------------
  |  |  |  | 1940|  2.13k|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  2.13k|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  2.13k|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|  2.13k|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|  2.13k|        }
  |  |  ------------------
  |  |  |  Branch (72:5): [True: 712, False: 1.38k]
  |  |  ------------------
  |  |   73|    702|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  | 1939|  3.12k|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 2.42k, False: 702]
  |  |  |  |  ------------------
  |  |  |  | 1940|  2.42k|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   73|  2.42k|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  2.42k|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|  2.42k|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|  2.42k|        }
  |  |  ------------------
  |  |  |  Branch (73:5): [True: 702, False: 1.39k]
  |  |  ------------------
  |  |   74|    202|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  | 1939|  1.41k|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 1.20k, False: 202]
  |  |  |  |  ------------------
  |  |  |  | 1940|  1.20k|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   74|  1.20k|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  1.20k|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|  1.20k|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|  1.20k|        }
  |  |  ------------------
  |  |  |  Branch (74:5): [True: 202, False: 1.89k]
  |  |  ------------------
  |  |   75|     26|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  | 1939|    410|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 384, False: 26]
  |  |  |  |  ------------------
  |  |  |  | 1940|    384|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|    384|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|    384|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|    384|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|    384|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 384]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|    384|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|    384|        }
  |  |  ------------------
  |  |  |  Branch (75:5): [True: 26, False: 2.06k]
  |  |  ------------------
  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  ------------------
  |  |  |  | 1939|      0|        for (int y = 0; y < bh4; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1939:25): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1940|      0|            rep_macro(seg_ptr, 0, b->seg_id); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    case 5: set_ctx(set_ctx32); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define set_ctx32(var, off, val) do { \
  |  |  |  |  |  |  |  |   67|      0|        memset(&(var)[off], val, 32); \
  |  |  |  |  |  |  |  |   68|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (68:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1941|      0|            seg_ptr += f->b4_stride; \
  |  |  |  | 1942|      0|        }
  |  |  ------------------
  |  |  |  Branch (76:5): [True: 0, False: 2.09k]
  |  |  ------------------
  |  |   77|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:5): [True: 0, False: 2.09k]
  |  |  ------------------
  |  |   78|  2.09k|    }
  ------------------
 1944|  2.09k|#undef set_ctx
 1945|  2.09k|    }
 1946|  2.64k|    if (!b->skip) {
  ------------------
  |  Branch (1946:9): [True: 2.23k, False: 412]
  ------------------
 1947|  2.23k|        uint16_t (*noskip_mask)[2] = &t->lf_mask->noskip_mask[by4 >> 1];
 1948|  2.23k|        const unsigned mask = (~0U >> (32 - bw4)) << (bx4 & 15);
 1949|  2.23k|        const int bx_idx = (bx4 & 16) >> 4;
 1950|  7.71k|        for (int y = 0; y < bh4; y += 2, noskip_mask++) {
  ------------------
  |  Branch (1950:25): [True: 5.47k, False: 2.23k]
  ------------------
 1951|  5.47k|            (*noskip_mask)[bx_idx] |= mask;
 1952|  5.47k|            if (bw4 == 32) // this should be mask >> 16, but it's 0xffffffff anyway
  ------------------
  |  Branch (1952:17): [True: 1.61k, False: 3.86k]
  ------------------
 1953|  1.61k|                (*noskip_mask)[1] |= mask;
 1954|  5.47k|        }
 1955|  2.23k|    }
 1956|       |
 1957|  2.65k|    if (t->frame_thread.pass == 1 && !b->intra && IS_INTER_OR_SWITCH(f->frame_hdr)) {
  ------------------
  |  |   36|    502|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 502]
  |  |  ------------------
  ------------------
  |  Branch (1957:9): [True: 2.65k, False: 18.4E]
  |  Branch (1957:38): [True: 502, False: 2.15k]
  ------------------
 1958|      0|        const int sby = (t->by - ts->tiling.row_start) >> f->sb_shift;
 1959|      0|        int (*const lowest_px)[2] = ts->lowest_pixel[sby];
 1960|       |
 1961|       |        // keep track of motion vectors for each reference
 1962|      0|        if (b->comp_type == COMP_INTER_NONE) {
  ------------------
  |  Branch (1962:13): [True: 0, False: 0]
  ------------------
 1963|       |            // y
 1964|      0|            if (imin(bw4, bh4) > 1 &&
  ------------------
  |  Branch (1964:17): [True: 0, False: 0]
  ------------------
 1965|      0|                ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) ||
  ------------------
  |  Branch (1965:19): [True: 0, False: 0]
  |  Branch (1965:48): [True: 0, False: 0]
  ------------------
 1966|      0|                 (b->motion_mode == MM_WARP && t->warpmv.type > DAV1D_WM_TYPE_TRANSLATION)))
  ------------------
  |  Branch (1966:19): [True: 0, False: 0]
  |  Branch (1966:48): [True: 0, False: 0]
  ------------------
 1967|      0|            {
 1968|      0|                affine_lowest_px_luma(t, &lowest_px[b->ref[0]][0], b_dim,
 1969|      0|                                      b->motion_mode == MM_WARP ? &t->warpmv :
  ------------------
  |  Branch (1969:39): [True: 0, False: 0]
  ------------------
 1970|      0|                                      &f->frame_hdr->gmv[b->ref[0]]);
 1971|      0|            } else {
 1972|      0|                mc_lowest_px(&lowest_px[b->ref[0]][0], t->by, bh4, b->mv[0].y,
 1973|      0|                             0, &f->svc[b->ref[0]][1]);
 1974|      0|                if (b->motion_mode == MM_OBMC) {
  ------------------
  |  Branch (1974:21): [True: 0, False: 0]
  ------------------
 1975|      0|                    obmc_lowest_px(t, lowest_px, 0, b_dim, bx4, by4, w4, h4);
 1976|      0|                }
 1977|      0|            }
 1978|       |
 1979|       |            // uv
 1980|      0|            if (has_chroma) {
  ------------------
  |  Branch (1980:17): [True: 0, False: 0]
  ------------------
 1981|       |                // sub8x8 derivation
 1982|      0|                int is_sub8x8 = bw4 == ss_hor || bh4 == ss_ver;
  ------------------
  |  Branch (1982:33): [True: 0, False: 0]
  |  Branch (1982:50): [True: 0, False: 0]
  ------------------
 1983|      0|                refmvs_block *const *r;
 1984|      0|                if (is_sub8x8) {
  ------------------
  |  Branch (1984:21): [True: 0, False: 0]
  ------------------
 1985|      0|                    assert(ss_hor == 1);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1986|      0|                    r = &t->rt.r[(t->by & 31) + 5];
 1987|      0|                    if (bw4 == 1) is_sub8x8 &= r[0][t->bx - 1].ref.ref[0] > 0;
  ------------------
  |  Branch (1987:25): [True: 0, False: 0]
  ------------------
 1988|      0|                    if (bh4 == ss_ver) is_sub8x8 &= r[-1][t->bx].ref.ref[0] > 0;
  ------------------
  |  Branch (1988:25): [True: 0, False: 0]
  ------------------
 1989|      0|                    if (bw4 == 1 && bh4 == ss_ver)
  ------------------
  |  Branch (1989:25): [True: 0, False: 0]
  |  Branch (1989:37): [True: 0, False: 0]
  ------------------
 1990|      0|                        is_sub8x8 &= r[-1][t->bx - 1].ref.ref[0] > 0;
 1991|      0|                }
 1992|       |
 1993|       |                // chroma prediction
 1994|      0|                if (is_sub8x8) {
  ------------------
  |  Branch (1994:21): [True: 0, False: 0]
  ------------------
 1995|      0|                    assert(ss_hor == 1);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1996|      0|                    if (bw4 == 1 && bh4 == ss_ver) {
  ------------------
  |  Branch (1996:25): [True: 0, False: 0]
  |  Branch (1996:37): [True: 0, False: 0]
  ------------------
 1997|      0|                        const refmvs_block *const rr = &r[-1][t->bx - 1];
 1998|      0|                        mc_lowest_px(&lowest_px[rr->ref.ref[0] - 1][1],
 1999|      0|                                     t->by - 1, bh4, rr->mv.mv[0].y, ss_ver,
 2000|      0|                                     &f->svc[rr->ref.ref[0] - 1][1]);
 2001|      0|                    }
 2002|      0|                    if (bw4 == 1) {
  ------------------
  |  Branch (2002:25): [True: 0, False: 0]
  ------------------
 2003|      0|                        const refmvs_block *const rr = &r[0][t->bx - 1];
 2004|      0|                        mc_lowest_px(&lowest_px[rr->ref.ref[0] - 1][1],
 2005|      0|                                     t->by, bh4, rr->mv.mv[0].y, ss_ver,
 2006|      0|                                     &f->svc[rr->ref.ref[0] - 1][1]);
 2007|      0|                    }
 2008|      0|                    if (bh4 == ss_ver) {
  ------------------
  |  Branch (2008:25): [True: 0, False: 0]
  ------------------
 2009|      0|                        const refmvs_block *const rr = &r[-1][t->bx];
 2010|      0|                        mc_lowest_px(&lowest_px[rr->ref.ref[0] - 1][1],
 2011|      0|                                     t->by - 1, bh4, rr->mv.mv[0].y, ss_ver,
 2012|      0|                                     &f->svc[rr->ref.ref[0] - 1][1]);
 2013|      0|                    }
 2014|      0|                    mc_lowest_px(&lowest_px[b->ref[0]][1], t->by, bh4,
 2015|      0|                                 b->mv[0].y, ss_ver, &f->svc[b->ref[0]][1]);
 2016|      0|                } else {
 2017|      0|                    if (imin(cbw4, cbh4) > 1 &&
  ------------------
  |  Branch (2017:25): [True: 0, False: 0]
  ------------------
 2018|      0|                        ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) ||
  ------------------
  |  Branch (2018:27): [True: 0, False: 0]
  |  Branch (2018:56): [True: 0, False: 0]
  ------------------
 2019|      0|                         (b->motion_mode == MM_WARP && t->warpmv.type > DAV1D_WM_TYPE_TRANSLATION)))
  ------------------
  |  Branch (2019:27): [True: 0, False: 0]
  |  Branch (2019:56): [True: 0, False: 0]
  ------------------
 2020|      0|                    {
 2021|      0|                        affine_lowest_px_chroma(t, &lowest_px[b->ref[0]][1], b_dim,
 2022|      0|                                                b->motion_mode == MM_WARP ? &t->warpmv :
  ------------------
  |  Branch (2022:49): [True: 0, False: 0]
  ------------------
 2023|      0|                                                &f->frame_hdr->gmv[b->ref[0]]);
 2024|      0|                    } else {
 2025|      0|                        mc_lowest_px(&lowest_px[b->ref[0]][1],
 2026|      0|                                     t->by & ~ss_ver, bh4 << (bh4 == ss_ver),
 2027|      0|                                     b->mv[0].y, ss_ver, &f->svc[b->ref[0]][1]);
 2028|      0|                        if (b->motion_mode == MM_OBMC) {
  ------------------
  |  Branch (2028:29): [True: 0, False: 0]
  ------------------
 2029|      0|                            obmc_lowest_px(t, lowest_px, 1, b_dim, bx4, by4, w4, h4);
 2030|      0|                        }
 2031|      0|                    }
 2032|      0|                }
 2033|      0|            }
 2034|      0|        } else {
 2035|       |            // y
 2036|      0|            for (int i = 0; i < 2; i++) {
  ------------------
  |  Branch (2036:29): [True: 0, False: 0]
  ------------------
 2037|      0|                if (b->inter_mode == GLOBALMV_GLOBALMV && f->gmv_warp_allowed[b->ref[i]]) {
  ------------------
  |  Branch (2037:21): [True: 0, False: 0]
  |  Branch (2037:59): [True: 0, False: 0]
  ------------------
 2038|      0|                    affine_lowest_px_luma(t, &lowest_px[b->ref[i]][0], b_dim,
 2039|      0|                                          &f->frame_hdr->gmv[b->ref[i]]);
 2040|      0|                } else {
 2041|      0|                    mc_lowest_px(&lowest_px[b->ref[i]][0], t->by, bh4,
 2042|      0|                                 b->mv[i].y, 0, &f->svc[b->ref[i]][1]);
 2043|      0|                }
 2044|      0|            }
 2045|       |
 2046|       |            // uv
 2047|      0|            if (has_chroma) for (int i = 0; i < 2; i++) {
  ------------------
  |  Branch (2047:17): [True: 0, False: 0]
  |  Branch (2047:45): [True: 0, False: 0]
  ------------------
 2048|      0|                if (b->inter_mode == GLOBALMV_GLOBALMV &&
  ------------------
  |  Branch (2048:21): [True: 0, False: 0]
  ------------------
 2049|      0|                    imin(cbw4, cbh4) > 1 && f->gmv_warp_allowed[b->ref[i]])
  ------------------
  |  Branch (2049:21): [True: 0, False: 0]
  |  Branch (2049:45): [True: 0, False: 0]
  ------------------
 2050|      0|                {
 2051|      0|                    affine_lowest_px_chroma(t, &lowest_px[b->ref[i]][1], b_dim,
 2052|      0|                                            &f->frame_hdr->gmv[b->ref[i]]);
 2053|      0|                } else {
 2054|      0|                    mc_lowest_px(&lowest_px[b->ref[i]][1], t->by, bh4,
 2055|      0|                                 b->mv[i].y, ss_ver, &f->svc[b->ref[i]][1]);
 2056|      0|                }
 2057|      0|            }
 2058|      0|        }
 2059|      0|    }
 2060|       |
 2061|  2.64k|    return 0;
 2062|  2.64k|}
decode.c:neg_deinterleave:
  169|  2.09k|static int neg_deinterleave(int diff, int ref, int max) {
  170|  2.09k|    if (!ref) return diff;
  ------------------
  |  Branch (170:9): [True: 532, False: 1.56k]
  ------------------
  171|  1.56k|    if (ref >= (max - 1)) return max - diff - 1;
  ------------------
  |  Branch (171:9): [True: 138, False: 1.42k]
  ------------------
  172|  1.42k|    if (2 * ref < max) {
  ------------------
  |  Branch (172:9): [True: 644, False: 780]
  ------------------
  173|    644|        if (diff <= 2 * ref) {
  ------------------
  |  Branch (173:13): [True: 480, False: 164]
  ------------------
  174|    480|            if (diff & 1)
  ------------------
  |  Branch (174:17): [True: 72, False: 408]
  ------------------
  175|     72|                return ref + ((diff + 1) >> 1);
  176|    408|            else
  177|    408|                return ref - (diff >> 1);
  178|    480|        }
  179|    164|        return diff;
  180|    780|    } else {
  181|    780|        if (diff <= 2 * (max - ref - 1)) {
  ------------------
  |  Branch (181:13): [True: 622, False: 158]
  ------------------
  182|    622|            if (diff & 1)
  ------------------
  |  Branch (182:17): [True: 80, False: 542]
  ------------------
  183|     80|                return ref + ((diff + 1) >> 1);
  184|    542|            else
  185|    542|                return ref - (diff >> 1);
  186|    622|        }
  187|    158|        return max - (diff + 1);
  188|    780|    }
  189|  1.42k|}
decode.c:read_pal_indices:
  419|     10|{
  420|     10|    Dav1dTileState *const ts = t->ts;
  421|     10|    const ptrdiff_t stride = bw4 * 4;
  422|     10|    assert(pal_idx);
  ------------------
  |  |  140|     10|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 10]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
  423|     10|    uint8_t *const pal_tmp = t->scratch.pal_idx_uv;
  424|     10|    pal_tmp[0] = dav1d_msac_decode_uniform(&ts->msac, pal_sz);
  425|     10|    uint16_t (*const color_map_cdf)[8] =
  426|     10|        ts->cdf.m.color_map[pl][pal_sz - 2];
  427|     10|    uint8_t (*const order)[8] = t->scratch.pal_order;
  428|     10|    uint8_t *const ctx = t->scratch.pal_ctx;
  429|    334|    for (int i = 1; i < 4 * (w4 + h4) - 1; i++) {
  ------------------
  |  Branch (429:21): [True: 324, False: 10]
  ------------------
  430|       |        // top/left-to-bottom/right diagonals ("wave-front")
  431|    324|        const int first = imin(i, w4 * 4 - 1);
  432|    324|        const int last = imax(0, i - h4 * 4 + 1);
  433|    324|        order_palette(pal_tmp, stride, i, first, last, order, ctx);
  434|  3.00k|        for (int j = first, m = 0; j >= last; j--, m++) {
  ------------------
  |  Branch (434:36): [True: 2.67k, False: 324]
  ------------------
  435|  2.67k|            const int color_idx = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|  2.67k|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
  436|  2.67k|                                      color_map_cdf[ctx[m]], pal_sz - 1);
  437|  2.67k|            pal_tmp[(i - j) * stride + j] = order[m][color_idx];
  438|  2.67k|        }
  439|    324|    }
  440|       |
  441|     10|    t->c->pal_dsp.pal_idx_finish(pal_idx, pal_tmp, bw4 * 4, bh4 * 4,
  442|     10|                                 w4 * 4, h4 * 4);
  443|     10|}
decode.c:order_palette:
  356|    324|{
  357|    324|    int have_top = i > first;
  358|       |
  359|    324|    assert(pal_idx);
  ------------------
  |  |  140|    324|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 324]
  |  |  |  Branch (140:68): [Folded, False: 324]
  |  |  ------------------
  ------------------
  360|    324|    pal_idx += first + (i - first) * stride;
  361|  3.00k|    for (int j = first, n = 0; j >= last; have_top = 1, j--, n++, pal_idx += stride - 1) {
  ------------------
  |  Branch (361:32): [True: 2.67k, False: 324]
  ------------------
  362|  2.67k|        const int have_left = j > 0;
  363|       |
  364|  2.67k|        assert(have_left || have_top);
  ------------------
  |  |  140|  2.78k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 2.56k, False: 110]
  |  |  |  Branch (140:30): [True: 110, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 2.67k]
  |  |  ------------------
  ------------------
  365|       |
  366|  2.67k|#define add(v_in) do { \
  367|  2.67k|        const int v = v_in; \
  368|  2.67k|        assert((unsigned)v < 8U); \
  369|  2.67k|        order[n][o_idx++] = v; \
  370|  2.67k|        mask |= 1 << v; \
  371|  2.67k|    } while (0)
  372|       |
  373|  2.67k|        unsigned mask = 0;
  374|  2.67k|        int o_idx = 0;
  375|  2.67k|        if (!have_left) {
  ------------------
  |  Branch (375:13): [True: 110, False: 2.56k]
  ------------------
  376|    110|            ctx[n] = 0;
  377|    110|            add(pal_idx[-stride]);
  ------------------
  |  |  366|    110|#define add(v_in) do { \
  |  |  367|    110|        const int v = v_in; \
  |  |  368|    110|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    110|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 110]
  |  |  |  |  |  Branch (140:68): [Folded, False: 110]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    110|        order[n][o_idx++] = v; \
  |  |  370|    110|        mask |= 1 << v; \
  |  |  371|    110|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 110]
  |  |  ------------------
  ------------------
  378|  2.56k|        } else if (!have_top) {
  ------------------
  |  Branch (378:20): [True: 214, False: 2.35k]
  ------------------
  379|    214|            ctx[n] = 0;
  380|    214|            add(pal_idx[-1]);
  ------------------
  |  |  366|    214|#define add(v_in) do { \
  |  |  367|    214|        const int v = v_in; \
  |  |  368|    214|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    214|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 214]
  |  |  |  |  |  Branch (140:68): [Folded, False: 214]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    214|        order[n][o_idx++] = v; \
  |  |  370|    214|        mask |= 1 << v; \
  |  |  371|    214|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 214]
  |  |  ------------------
  ------------------
  381|  2.35k|        } else {
  382|  2.35k|            const int l = pal_idx[-1], t = pal_idx[-stride], tl = pal_idx[-(stride + 1)];
  383|  2.35k|            const int same_t_l = t == l;
  384|  2.35k|            const int same_t_tl = t == tl;
  385|  2.35k|            const int same_l_tl = l == tl;
  386|  2.35k|            const int same_all = same_t_l & same_t_tl & same_l_tl;
  387|       |
  388|  2.35k|            if (same_all) {
  ------------------
  |  Branch (388:17): [True: 1.21k, False: 1.14k]
  ------------------
  389|  1.21k|                ctx[n] = 4;
  390|  1.21k|                add(t);
  ------------------
  |  |  366|  1.21k|#define add(v_in) do { \
  |  |  367|  1.21k|        const int v = v_in; \
  |  |  368|  1.21k|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|  1.21k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 1.21k]
  |  |  |  |  |  Branch (140:68): [Folded, False: 1.21k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|  1.21k|        order[n][o_idx++] = v; \
  |  |  370|  1.21k|        mask |= 1 << v; \
  |  |  371|  1.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 1.21k]
  |  |  ------------------
  ------------------
  391|  1.21k|            } else if (same_t_l) {
  ------------------
  |  Branch (391:24): [True: 78, False: 1.06k]
  ------------------
  392|     78|                ctx[n] = 3;
  393|     78|                add(t);
  ------------------
  |  |  366|     78|#define add(v_in) do { \
  |  |  367|     78|        const int v = v_in; \
  |  |  368|     78|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|     78|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 78]
  |  |  |  |  |  Branch (140:68): [Folded, False: 78]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|     78|        order[n][o_idx++] = v; \
  |  |  370|     78|        mask |= 1 << v; \
  |  |  371|     78|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 78]
  |  |  ------------------
  ------------------
  394|     78|                add(tl);
  ------------------
  |  |  366|     78|#define add(v_in) do { \
  |  |  367|     78|        const int v = v_in; \
  |  |  368|     78|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|     78|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 78]
  |  |  |  |  |  Branch (140:68): [Folded, False: 78]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|     78|        order[n][o_idx++] = v; \
  |  |  370|     78|        mask |= 1 << v; \
  |  |  371|     78|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 78]
  |  |  ------------------
  ------------------
  395|  1.06k|            } else if (same_t_tl | same_l_tl) {
  ------------------
  |  Branch (395:24): [True: 866, False: 196]
  ------------------
  396|    866|                ctx[n] = 2;
  397|    866|                add(tl);
  ------------------
  |  |  366|    866|#define add(v_in) do { \
  |  |  367|    866|        const int v = v_in; \
  |  |  368|    866|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    866|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 866]
  |  |  |  |  |  Branch (140:68): [Folded, False: 866]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    866|        order[n][o_idx++] = v; \
  |  |  370|    866|        mask |= 1 << v; \
  |  |  371|    866|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 866]
  |  |  ------------------
  ------------------
  398|    866|                add(same_t_tl ? l : t);
  ------------------
  |  |  366|    866|#define add(v_in) do { \
  |  |  367|  1.73k|        const int v = v_in; \
  |  |  ------------------
  |  |  |  Branch (367:23): [True: 440, False: 426]
  |  |  ------------------
  |  |  368|    866|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    866|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 866]
  |  |  |  |  |  Branch (140:68): [Folded, False: 866]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    866|        order[n][o_idx++] = v; \
  |  |  370|    866|        mask |= 1 << v; \
  |  |  371|    866|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 866]
  |  |  ------------------
  ------------------
  399|    866|            } else {
  400|    196|                ctx[n] = 1;
  401|    196|                add(imin(t, l));
  ------------------
  |  |  366|    196|#define add(v_in) do { \
  |  |  367|    196|        const int v = v_in; \
  |  |  368|    196|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    196|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 196]
  |  |  |  |  |  Branch (140:68): [Folded, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    196|        order[n][o_idx++] = v; \
  |  |  370|    196|        mask |= 1 << v; \
  |  |  371|    196|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 196]
  |  |  ------------------
  ------------------
  402|    196|                add(imax(t, l));
  ------------------
  |  |  366|    196|#define add(v_in) do { \
  |  |  367|    196|        const int v = v_in; \
  |  |  368|    196|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    196|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 196]
  |  |  |  |  |  Branch (140:68): [Folded, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    196|        order[n][o_idx++] = v; \
  |  |  370|    196|        mask |= 1 << v; \
  |  |  371|    196|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 196]
  |  |  ------------------
  ------------------
  403|    196|                add(tl);
  ------------------
  |  |  366|    196|#define add(v_in) do { \
  |  |  367|    196|        const int v = v_in; \
  |  |  368|    196|        assert((unsigned)v < 8U); \
  |  |  ------------------
  |  |  |  |  140|    196|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, False: 196]
  |  |  |  |  |  Branch (140:68): [Folded, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  369|    196|        order[n][o_idx++] = v; \
  |  |  370|    196|        mask |= 1 << v; \
  |  |  371|    196|    } while (0)
  |  |  ------------------
  |  |  |  Branch (371:14): [Folded, False: 196]
  |  |  ------------------
  ------------------
  404|    196|            }
  405|  2.35k|        }
  406|  24.1k|        for (unsigned m = 1, bit = 0; m < 0x100; m <<= 1, bit++)
  ------------------
  |  Branch (406:39): [True: 21.4k, False: 2.67k]
  ------------------
  407|  21.4k|            if (!(mask & m))
  ------------------
  |  Branch (407:17): [True: 17.4k, False: 4.01k]
  ------------------
  408|  17.4k|                order[n][o_idx++] = bit;
  409|  2.67k|        assert(o_idx == 8);
  ------------------
  |  |  140|  2.67k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.67k]
  |  |  |  Branch (140:68): [Folded, False: 2.67k]
  |  |  ------------------
  ------------------
  410|  2.67k|#undef add
  411|  2.67k|    }
  412|    324|}
decode.c:splat_intraref:
  566|  2.15k|{
  567|  2.15k|    const refmvs_block ALIGN(tmpl, 16) = (refmvs_block) {
  568|  2.15k|        .ref.ref = { 0, -1 },
  569|  2.15k|        .mv.mv[0].n = INVALID_MV,
  ------------------
  |  |   40|  2.15k|#define INVALID_MV 0x80008000
  ------------------
  570|  2.15k|        .bs = bs,
  571|  2.15k|        .mf = 0,
  572|  2.15k|    };
  573|  2.15k|    c->refmvs_dsp.splat_mv(&t->rt.r[(t->by & 31) + 5], &tmpl, t->bx, bw4, bh4);
  574|  2.15k|}
decode.c:read_mv_residual:
  109|    502|{
  110|    502|    MsacContext *const msac = &ts->msac;
  111|    502|    const enum MVJoint mv_joint =
  112|    502|        dav1d_msac_decode_symbol_adapt4(msac, ts->cdf.mv.joint, N_MV_JOINTS - 1);
  ------------------
  |  |   73|    502|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  113|    502|    if (mv_joint & MV_JOINT_V)
  ------------------
  |  Branch (113:9): [True: 366, False: 136]
  ------------------
  114|    366|        ref_mv->y += read_mv_component_diff(msac, &ts->cdf.mv.comp[0], mv_prec);
  115|    502|    if (mv_joint & MV_JOINT_H)
  ------------------
  |  Branch (115:9): [True: 358, False: 144]
  ------------------
  116|    358|        ref_mv->x += read_mv_component_diff(msac, &ts->cdf.mv.comp[1], mv_prec);
  117|    502|}
decode.c:read_mv_component_diff:
   79|    724|{
   80|    724|    const int sign = dav1d_msac_decode_bool_adapt(msac, mv_comp->sign);
  ------------------
  |  |   82|    724|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
   81|    724|    const int cl = dav1d_msac_decode_symbol_adapt16(msac, mv_comp->classes, 10);
  ------------------
  |  |   79|    724|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
   82|    724|    int up, fp = 3, hp = 1;
   83|       |
   84|    724|    if (!cl) {
  ------------------
  |  Branch (84:9): [True: 502, False: 222]
  ------------------
   85|    502|        up = dav1d_msac_decode_bool_adapt(msac, mv_comp->class0);
  ------------------
  |  |   82|    502|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
   86|    502|        if (mv_prec >= 0) {  // !force_integer_mv
  ------------------
  |  Branch (86:13): [True: 0, False: 502]
  ------------------
   87|      0|            fp = dav1d_msac_decode_symbol_adapt4(msac, mv_comp->class0_fp[up], 3);
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
   88|      0|            if (mv_prec > 0) // allow_high_precision_mv
  ------------------
  |  Branch (88:17): [True: 0, False: 0]
  ------------------
   89|      0|                hp = dav1d_msac_decode_bool_adapt(msac, mv_comp->class0_hp);
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
   90|      0|        }
   91|    502|    } else {
   92|    222|        up = 1 << cl;
   93|  1.86k|        for (int n = 0; n < cl; n++)
  ------------------
  |  Branch (93:25): [True: 1.64k, False: 222]
  ------------------
   94|  1.64k|            up |= dav1d_msac_decode_bool_adapt(msac, mv_comp->classN[n]) << n;
  ------------------
  |  |   82|  1.64k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
   95|    222|        if (mv_prec >= 0) {  // !force_integer_mv
  ------------------
  |  Branch (95:13): [True: 0, False: 222]
  ------------------
   96|      0|            fp = dav1d_msac_decode_symbol_adapt4(msac, mv_comp->classN_fp, 3);
  ------------------
  |  |   73|      0|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
   97|      0|            if (mv_prec > 0) // allow_high_precision_mv
  ------------------
  |  Branch (97:17): [True: 0, False: 0]
  ------------------
   98|      0|                hp = dav1d_msac_decode_bool_adapt(msac, mv_comp->classN_hp);
  ------------------
  |  |   82|      0|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
   99|      0|        }
  100|    222|    }
  101|       |
  102|    724|    const int diff = ((up << 3) | (fp << 1) | hp) + 1;
  103|       |
  104|    724|    return sign ? -diff : diff;
  ------------------
  |  Branch (104:12): [True: 382, False: 342]
  ------------------
  105|    724|}
decode.c:read_vartx_tree:
  448|    502|{
  449|    502|    const Dav1dFrameContext *const f = t->f;
  450|    502|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
  451|    502|    const int bw4 = b_dim[0], bh4 = b_dim[1];
  452|       |
  453|       |    // var-tx tree coding
  454|    502|    uint16_t tx_split[2] = { 0 };
  455|    502|    b->max_ytx = dav1d_max_txfm_size_for_bs[bs][0];
  456|    502|    if (!b->skip && (f->frame_hdr->segmentation.lossless[b->seg_id] ||
  ------------------
  |  Branch (456:9): [True: 414, False: 88]
  |  Branch (456:22): [True: 0, False: 414]
  ------------------
  457|    414|                     b->max_ytx == TX_4X4))
  ------------------
  |  Branch (457:22): [True: 22, False: 392]
  ------------------
  458|     22|    {
  459|     22|        b->max_ytx = b->uvtx = TX_4X4;
  460|     22|        if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
  ------------------
  |  Branch (460:13): [True: 12, False: 10]
  ------------------
  461|     12|            dav1d_memset_pow2[b_dim[2]](&t->a->tx[bx4], TX_4X4);
  462|     12|            dav1d_memset_pow2[b_dim[3]](&t->l.tx[by4], TX_4X4);
  463|     12|        }
  464|    480|    } else if (f->frame_hdr->txfm_mode != DAV1D_TX_SWITCHABLE || b->skip) {
  ------------------
  |  Branch (464:16): [True: 278, False: 202]
  |  Branch (464:66): [True: 88, False: 114]
  ------------------
  465|    366|        if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
  ------------------
  |  Branch (465:13): [True: 88, False: 278]
  ------------------
  466|     88|            dav1d_memset_pow2[b_dim[2]](&t->a->tx[bx4], b_dim[2 + 0]);
  467|     88|            dav1d_memset_pow2[b_dim[3]](&t->l.tx[by4], b_dim[2 + 1]);
  468|     88|        }
  469|    366|        b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
  470|    366|    } else {
  471|    114|        assert(bw4 <= 16 || bh4 <= 16 || b->max_ytx == TX_64X64);
  ------------------
  |  |  140|    228|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 114, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 114]
  |  |  ------------------
  ------------------
  472|    114|        int y, x, y_off, x_off;
  473|    114|        const TxfmInfo *const ytx = &dav1d_txfm_dimensions[b->max_ytx];
  474|    228|        for (y = 0, y_off = 0; y < bh4; y += ytx->h, y_off++) {
  ------------------
  |  Branch (474:32): [True: 114, False: 114]
  ------------------
  475|    228|            for (x = 0, x_off = 0; x < bw4; x += ytx->w, x_off++) {
  ------------------
  |  Branch (475:36): [True: 114, False: 114]
  ------------------
  476|    114|                read_tx_tree(t, b->max_ytx, 0, tx_split, x_off, y_off);
  477|       |                // contexts are updated inside read_tx_tree()
  478|    114|                t->bx += ytx->w;
  479|    114|            }
  480|    114|            t->bx -= x;
  481|    114|            t->by += ytx->h;
  482|    114|        }
  483|    114|        t->by -= y;
  484|    114|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    114|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 114]
  |  |  ------------------
  |  |   35|    114|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    114|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  485|      0|            printf("Post-vartxtree[%x/%x]: r=%d\n",
  486|      0|                   tx_split[0], tx_split[1], t->ts->msac.rng);
  487|    114|        b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
  488|    114|    }
  489|    502|    assert(!(tx_split[0] & ~0x33));
  ------------------
  |  |  140|    502|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 502]
  |  |  |  Branch (140:68): [Folded, False: 502]
  |  |  ------------------
  ------------------
  490|    502|    b->tx_split0 = (uint8_t)tx_split[0];
  491|    502|    b->tx_split1 = tx_split[1];
  492|    502|}
decode.c:read_tx_tree:
  123|    234|{
  124|    234|    const Dav1dFrameContext *const f = t->f;
  125|    234|    const int bx4 = t->bx & 31, by4 = t->by & 31;
  126|    234|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[from];
  127|    234|    const int txw = t_dim->lw, txh = t_dim->lh;
  128|    234|    int is_split;
  129|       |
  130|    234|    if (depth < 2 && from > (int) TX_4X4) {
  ------------------
  |  Branch (130:9): [True: 210, False: 24]
  |  Branch (130:22): [True: 210, False: 0]
  ------------------
  131|    210|        const int cat = 2 * (TX_64X64 - t_dim->max) - depth;
  132|    210|        const int a = t->a->tx[bx4] < txw;
  133|    210|        const int l = t->l.tx[by4] < txh;
  134|       |
  135|    210|        is_split = dav1d_msac_decode_bool_adapt(&t->ts->msac,
  ------------------
  |  |   82|    210|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  136|    210|                       t->ts->cdf.m.txpart[cat][a + l]);
  137|    210|        if (is_split)
  ------------------
  |  Branch (137:13): [True: 58, False: 152]
  ------------------
  138|     58|            masks[depth] |= 1 << (y_off * 4 + x_off);
  139|    210|    } else {
  140|     24|        is_split = 0;
  141|     24|    }
  142|       |
  143|    234|    if (is_split && t_dim->max > TX_8X8) {
  ------------------
  |  Branch (143:9): [True: 58, False: 176]
  |  Branch (143:21): [True: 46, False: 12]
  ------------------
  144|     46|        const enum RectTxfmSize sub = t_dim->sub;
  145|     46|        const TxfmInfo *const sub_t_dim = &dav1d_txfm_dimensions[sub];
  146|     46|        const int txsw = sub_t_dim->w, txsh = sub_t_dim->h;
  147|       |
  148|     46|        read_tx_tree(t, sub, depth + 1, masks, x_off * 2 + 0, y_off * 2 + 0);
  149|     46|        t->bx += txsw;
  150|     46|        if (txw >= txh && t->bx < f->bw)
  ------------------
  |  Branch (150:13): [True: 38, False: 8]
  |  Branch (150:27): [True: 38, False: 0]
  ------------------
  151|     38|            read_tx_tree(t, sub, depth + 1, masks, x_off * 2 + 1, y_off * 2 + 0);
  152|     46|        t->bx -= txsw;
  153|     46|        t->by += txsh;
  154|     46|        if (txh >= txw && t->by < f->bh) {
  ------------------
  |  Branch (154:13): [True: 22, False: 24]
  |  Branch (154:27): [True: 22, False: 0]
  ------------------
  155|     22|            read_tx_tree(t, sub, depth + 1, masks, x_off * 2 + 0, y_off * 2 + 1);
  156|     22|            t->bx += txsw;
  157|     22|            if (txw >= txh && t->bx < f->bw)
  ------------------
  |  Branch (157:17): [True: 14, False: 8]
  |  Branch (157:31): [True: 14, False: 0]
  ------------------
  158|     14|                read_tx_tree(t, sub, depth + 1, masks,
  159|     14|                             x_off * 2 + 1, y_off * 2 + 1);
  160|     22|            t->bx -= txsw;
  161|     22|        }
  162|     46|        t->by -= txsh;
  163|    188|    } else {
  164|    188|        dav1d_memset_pow2[t_dim->lw](&t->a->tx[bx4], is_split ? TX_4X4 : txw);
  ------------------
  |  Branch (164:54): [True: 12, False: 176]
  ------------------
  165|    188|        dav1d_memset_pow2[t_dim->lh](&t->l.tx[by4], is_split ? TX_4X4 : txh);
  ------------------
  |  Branch (165:53): [True: 12, False: 176]
  ------------------
  166|    188|    }
  167|    234|}
decode.c:splat_intrabc_mv:
  535|    502|{
  536|    502|    const refmvs_block ALIGN(tmpl, 16) = (refmvs_block) {
  537|    502|        .ref.ref = { 0, -1 },
  538|    502|        .mv.mv[0] = b->mv[0],
  539|    502|        .bs = bs,
  540|    502|        .mf = 0,
  541|    502|    };
  542|    502|    c->refmvs_dsp.splat_mv(&t->rt.r[(t->by & 31) + 5], &tmpl, t->bx, bw4, bh4);
  543|    502|}
decode.c:init_quant_tables:
   57|      4|{
   58|     22|    for (int i = 0; i < (frame_hdr->segmentation.enabled ? 8 : 1); i++) {
  ------------------
  |  Branch (58:21): [True: 18, False: 4]
  |  Branch (58:26): [True: 18, False: 4]
  ------------------
   59|     18|        const int yac = frame_hdr->segmentation.enabled ?
  ------------------
  |  Branch (59:25): [True: 16, False: 2]
  ------------------
   60|     16|            iclip_u8(qidx + frame_hdr->segmentation.seg_data.d[i].delta_q) : qidx;
   61|     18|        const int ydc = iclip_u8(yac + frame_hdr->quant.ydc_delta);
   62|     18|        const int uac = iclip_u8(yac + frame_hdr->quant.uac_delta);
   63|     18|        const int udc = iclip_u8(yac + frame_hdr->quant.udc_delta);
   64|     18|        const int vac = iclip_u8(yac + frame_hdr->quant.vac_delta);
   65|     18|        const int vdc = iclip_u8(yac + frame_hdr->quant.vdc_delta);
   66|       |
   67|     18|        dq[i][0][0] = dav1d_dq_tbl[seq_hdr->hbd][ydc][0];
   68|     18|        dq[i][0][1] = dav1d_dq_tbl[seq_hdr->hbd][yac][1];
   69|     18|        dq[i][1][0] = dav1d_dq_tbl[seq_hdr->hbd][udc][0];
   70|     18|        dq[i][1][1] = dav1d_dq_tbl[seq_hdr->hbd][uac][1];
   71|     18|        dq[i][2][0] = dav1d_dq_tbl[seq_hdr->hbd][vdc][0];
   72|     18|        dq[i][2][1] = dav1d_dq_tbl[seq_hdr->hbd][vac][1];
   73|     18|    }
   74|      4|}
decode.c:setup_tile:
 2430|      4|{
 2431|      4|    const int col_sb_start = f->frame_hdr->tiling.col_start_sb[tile_col];
 2432|      4|    const int col_sb128_start = col_sb_start >> !f->seq_hdr->sb128;
 2433|      4|    const int col_sb_end = f->frame_hdr->tiling.col_start_sb[tile_col + 1];
 2434|      4|    const int row_sb_start = f->frame_hdr->tiling.row_start_sb[tile_row];
 2435|      4|    const int row_sb_end = f->frame_hdr->tiling.row_start_sb[tile_row + 1];
 2436|      4|    const int sb_shift = f->sb_shift;
 2437|       |
 2438|      4|    const uint8_t *const size_mul = ss_size_mul[f->cur.p.layout];
 2439|     12|    for (int p = 0; p < 2; p++) {
  ------------------
  |  Branch (2439:21): [True: 8, False: 4]
  ------------------
 2440|      8|        ts->frame_thread[p].pal_idx = f->frame_thread.pal_idx ?
  ------------------
  |  Branch (2440:39): [True: 8, False: 0]
  ------------------
 2441|      8|            &f->frame_thread.pal_idx[(size_t)tile_start_off * size_mul[1] / 8] :
 2442|      8|            NULL;
 2443|      8|        ts->frame_thread[p].cbi = f->frame_thread.cbi ?
  ------------------
  |  Branch (2443:35): [True: 8, False: 0]
  ------------------
 2444|      8|            &f->frame_thread.cbi[(size_t)tile_start_off * size_mul[0] / 64] :
 2445|      8|            NULL;
 2446|      8|        ts->frame_thread[p].cf = f->frame_thread.cf ?
  ------------------
  |  Branch (2446:34): [True: 8, False: 0]
  ------------------
 2447|      8|            (uint8_t*)f->frame_thread.cf +
 2448|      8|                (((size_t)tile_start_off * size_mul[0]) >> !f->seq_hdr->hbd) :
 2449|      8|            NULL;
 2450|      8|    }
 2451|       |
 2452|      4|    dav1d_cdf_thread_copy(&ts->cdf, &f->in_cdf);
 2453|      4|    ts->last_qidx = f->frame_hdr->quant.yac;
 2454|      4|    ts->last_delta_lf.u32 = 0;
 2455|       |
 2456|      4|    dav1d_msac_init(&ts->msac, data, sz, f->frame_hdr->disable_cdf_update);
 2457|       |
 2458|      4|    ts->tiling.row = tile_row;
 2459|      4|    ts->tiling.col = tile_col;
 2460|      4|    ts->tiling.col_start = col_sb_start << sb_shift;
 2461|      4|    ts->tiling.col_end = imin(col_sb_end << sb_shift, f->bw);
 2462|      4|    ts->tiling.row_start = row_sb_start << sb_shift;
 2463|      4|    ts->tiling.row_end = imin(row_sb_end << sb_shift, f->bh);
 2464|       |
 2465|       |    // Reference Restoration Unit (used for exp coding)
 2466|      4|    int sb_idx, unit_idx;
 2467|      4|    if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
  ------------------
  |  Branch (2467:9): [True: 0, False: 4]
  ------------------
 2468|       |        // vertical components only
 2469|      0|        sb_idx = (ts->tiling.row_start >> 5) * f->sr_sb128w;
 2470|      0|        unit_idx = (ts->tiling.row_start & 16) >> 3;
 2471|      4|    } else {
 2472|      4|        sb_idx = (ts->tiling.row_start >> 5) * f->sb128w + col_sb128_start;
 2473|      4|        unit_idx = ((ts->tiling.row_start & 16) >> 3) +
 2474|      4|                   ((ts->tiling.col_start & 16) >> 4);
 2475|      4|    }
 2476|     16|    for (int p = 0; p < 3; p++) {
  ------------------
  |  Branch (2476:21): [True: 12, False: 4]
  ------------------
 2477|     12|        if (!((f->lf.restore_planes >> p) & 1U))
  ------------------
  |  Branch (2477:13): [True: 12, False: 0]
  ------------------
 2478|     12|            continue;
 2479|       |
 2480|      0|        if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
  ------------------
  |  Branch (2480:13): [True: 0, False: 0]
  ------------------
 2481|      0|            const int ss_hor = p && f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  ------------------
  |  Branch (2481:32): [True: 0, False: 0]
  |  Branch (2481:37): [True: 0, False: 0]
  ------------------
 2482|      0|            const int d = f->frame_hdr->super_res.width_scale_denominator;
 2483|      0|            const int unit_size_log2 = f->frame_hdr->restoration.unit_size[!!p];
 2484|      0|            const int rnd = (8 << unit_size_log2) - 1, shift = unit_size_log2 + 3;
 2485|      0|            const int x = ((4 * ts->tiling.col_start * d >> ss_hor) + rnd) >> shift;
 2486|      0|            const int px_x = x << (unit_size_log2 + ss_hor);
 2487|      0|            const int u_idx = unit_idx + ((px_x & 64) >> 6);
 2488|      0|            const int sb128x = px_x >> 7;
 2489|      0|            if (sb128x >= f->sr_sb128w) continue;
  ------------------
  |  Branch (2489:17): [True: 0, False: 0]
  ------------------
 2490|      0|            ts->lr_ref[p] = &f->lf.lr_mask[sb_idx + sb128x].lr[p][u_idx];
 2491|      0|        } else {
 2492|      0|            ts->lr_ref[p] = &f->lf.lr_mask[sb_idx].lr[p][unit_idx];
 2493|      0|        }
 2494|       |
 2495|      0|        ts->lr_ref[p]->filter_v[0] = 3;
 2496|      0|        ts->lr_ref[p]->filter_v[1] = -7;
 2497|      0|        ts->lr_ref[p]->filter_v[2] = 15;
 2498|      0|        ts->lr_ref[p]->filter_h[0] = 3;
 2499|      0|        ts->lr_ref[p]->filter_h[1] = -7;
 2500|      0|        ts->lr_ref[p]->filter_h[2] = 15;
 2501|      0|        ts->lr_ref[p]->sgr_weights[0] = -32;
 2502|      0|        ts->lr_ref[p]->sgr_weights[1] = 31;
 2503|      0|    }
 2504|       |
 2505|      4|    if (f->c->n_tc > 1) {
  ------------------
  |  Branch (2505:9): [True: 4, False: 0]
  ------------------
 2506|     12|        for (int p = 0; p < 2; p++)
  ------------------
  |  Branch (2506:25): [True: 8, False: 4]
  ------------------
 2507|      8|            atomic_init(&ts->progress[p], row_sb_start);
 2508|      4|    }
 2509|      4|}

refmvs.c:get_poc_diff:
  239|     56|{
  240|     56|    if (!order_hint_n_bits) return 0;
  ------------------
  |  Branch (240:9): [True: 56, False: 0]
  ------------------
  241|      0|    const int mask = 1 << (order_hint_n_bits - 1);
  242|      0|    const int diff = poc0 - poc1;
  243|      0|    return (diff & (mask - 1)) - (diff & mask);
  244|     56|}
decode.c:get_partition_ctx:
   87|  1.71k|{
   88|  1.71k|    return ((a->partition[xb8] >> (4 - bl)) & 1) +
   89|  1.71k|          (((l->partition[yb8] >> (4 - bl)) & 1) << 1);
   90|  1.71k|}
decode.c:get_cur_frame_segid:
  445|  2.09k|{
  446|  2.09k|    cur_seg_map += bx + by * stride;
  447|  2.09k|    if (have_left && have_top) {
  ------------------
  |  Branch (447:9): [True: 2.08k, False: 8]
  |  Branch (447:22): [True: 1.99k, False: 90]
  ------------------
  448|  1.99k|        const int l = cur_seg_map[-1];
  449|  1.99k|        const int a = cur_seg_map[-stride];
  450|  1.99k|        const int al = cur_seg_map[-(stride + 1)];
  451|       |
  452|  1.99k|        if (l == a && al == l) *seg_ctx = 2;
  ------------------
  |  Branch (452:13): [True: 680, False: 1.31k]
  |  Branch (452:23): [True: 568, False: 112]
  ------------------
  453|  1.42k|        else if (l == a || al == l || a == al) *seg_ctx = 1;
  ------------------
  |  Branch (453:18): [True: 112, False: 1.31k]
  |  Branch (453:28): [True: 478, False: 838]
  |  Branch (453:39): [True: 504, False: 334]
  ------------------
  454|    334|        else *seg_ctx = 0;
  455|  1.99k|        return a == al ? a : l;
  ------------------
  |  Branch (455:16): [True: 1.07k, False: 924]
  ------------------
  456|  1.99k|    } else {
  457|     98|        *seg_ctx = 0;
  458|     98|        return have_left ? cur_seg_map[-1] : have_top ? cur_seg_map[-stride] : 0;
  ------------------
  |  Branch (458:16): [True: 90, False: 8]
  |  Branch (458:46): [True: 6, False: 2]
  ------------------
  459|     98|    }
  460|  2.09k|}
decode.c:get_tx_ctx:
   79|  1.72k|{
   80|  1.72k|    return (l->tx_intra[yb4] >= max_tx->lh) + (a->tx_intra[xb4] >= max_tx->lw);
   81|  1.72k|}
decode.c:gather_top_partition_prob:
  106|     60|{
  107|       |    // Exploit the fact that cdfs for PARTITION_V, PARTITION_SPLIT and
  108|       |    // PARTITION_T_TOP_SPLIT are neighbors.
  109|     60|    unsigned out = in[PARTITION_V - 1] - in[PARTITION_T_TOP_SPLIT];
  110|       |    // Exploit the facts that cdfs for PARTITION_T_LEFT_SPLIT and
  111|       |    // PARTITION_T_RIGHT_SPLIT are neighbors, the probability for
  112|       |    // PARTITION_V4 is always zero, and the probability for
  113|       |    // PARTITION_T_RIGHT_SPLIT is zero in 128x128 blocks.
  114|     60|    out += in[PARTITION_T_LEFT_SPLIT - 1];
  115|     60|    if (bl != BL_128X128)
  ------------------
  |  Branch (115:9): [True: 40, False: 20]
  ------------------
  116|     40|        out += in[PARTITION_V4 - 1] - in[PARTITION_T_RIGHT_SPLIT];
  117|     60|    return out;
  118|     60|}
recon_tmpl.c:get_uv_inter_txtp:
  122|    336|{
  123|    336|    if (uvt_dim->max == TX_32X32)
  ------------------
  |  Branch (123:9): [True: 26, False: 310]
  ------------------
  124|     26|        return ytxtp == IDTX ? IDTX : DCT_DCT;
  ------------------
  |  Branch (124:16): [True: 0, False: 26]
  ------------------
  125|    310|    if (uvt_dim->min == TX_16X16 &&
  ------------------
  |  Branch (125:9): [True: 26, False: 284]
  ------------------
  126|     26|        ((1 << ytxtp) & ((1 << H_FLIPADST) | (1 << V_FLIPADST) |
  ------------------
  |  Branch (126:9): [True: 0, False: 26]
  ------------------
  127|     26|                         (1 << H_ADST) | (1 << V_ADST))))
  128|      0|    {
  129|      0|        return DCT_DCT;
  130|      0|    }
  131|       |
  132|    310|    return ytxtp;
  133|    310|}

dav1d_film_grain_dsp_init_8bpc:
  423|      4|COLD void bitfn(dav1d_film_grain_dsp_init)(Dav1dFilmGrainDSPContext *const c) {
  424|      4|    c->generate_grain_y = generate_grain_y_c;
  425|      4|    c->generate_grain_uv[DAV1D_PIXEL_LAYOUT_I420 - 1] = generate_grain_uv_420_c;
  426|      4|    c->generate_grain_uv[DAV1D_PIXEL_LAYOUT_I422 - 1] = generate_grain_uv_422_c;
  427|      4|    c->generate_grain_uv[DAV1D_PIXEL_LAYOUT_I444 - 1] = generate_grain_uv_444_c;
  428|       |
  429|      4|    c->fgy_32x32xn = fgy_32x32xn_c;
  430|      4|    c->fguv_32x32xn[DAV1D_PIXEL_LAYOUT_I420 - 1] = fguv_32x32xn_420_c;
  431|      4|    c->fguv_32x32xn[DAV1D_PIXEL_LAYOUT_I422 - 1] = fguv_32x32xn_422_c;
  432|      4|    c->fguv_32x32xn[DAV1D_PIXEL_LAYOUT_I444 - 1] = fguv_32x32xn_444_c;
  433|       |
  434|       |#if HAVE_ASM
  435|       |#if ARCH_AARCH64 || ARCH_ARM
  436|       |    film_grain_dsp_init_arm(c);
  437|       |#elif ARCH_X86
  438|       |    film_grain_dsp_init_x86(c);
  439|       |#endif
  440|       |#endif
  441|      4|}

dav1d_init_get_bits:
   38|     27|{
   39|     27|    assert(sz);
  ------------------
  |  |  140|     27|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 27]
  |  |  |  Branch (140:68): [Folded, False: 27]
  |  |  ------------------
  ------------------
   40|     27|    c->ptr = c->ptr_start = data;
   41|     27|    c->ptr_end = &c->ptr_start[sz];
   42|     27|    c->state = 0;
   43|     27|    c->bits_left = 0;
   44|     27|    c->error = 0;
   45|     27|}
dav1d_get_bit:
   47|    501|unsigned dav1d_get_bit(GetBits *const c) {
   48|    501|    if (!c->bits_left) {
  ------------------
  |  Branch (48:9): [True: 85, False: 416]
  ------------------
   49|     85|        if (c->ptr >= c->ptr_end) {
  ------------------
  |  Branch (49:13): [True: 0, False: 85]
  ------------------
   50|      0|            c->error = 1;
   51|     85|        } else {
   52|     85|            const unsigned state = *c->ptr++;
   53|     85|            c->bits_left = 7;
   54|     85|            c->state = (uint64_t) state << 57;
   55|     85|            return state >> 7;
   56|     85|        }
   57|     85|    }
   58|       |
   59|    416|    const uint64_t state = c->state;
   60|    416|    c->bits_left--;
   61|    416|    c->state = state << 1;
   62|    416|    return (unsigned) (state >> 63);
   63|    501|}
dav1d_get_bits:
   81|    174|type name(GetBits *const c, const int n) {      \
   82|    174|    assert(n > 0 && n <= 32);                   \
  ------------------
  |  |  140|    348|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 174, False: 0]
  |  |  |  Branch (140:30): [True: 174, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 174]
  |  |  ------------------
  ------------------
   83|    174|    /* Unsigned cast avoids refill after eob */ \
   84|    174|    if ((unsigned) n > (unsigned) c->bits_left) \
  ------------------
  |  Branch (84:9): [True: 106, False: 68]
  ------------------
   85|    174|        refill(c, n);                           \
   86|    174|    const uint64_t state = c->state;            \
   87|    174|    c->bits_left -= n;                          \
   88|    174|    c->state = state << n;                      \
   89|    174|    return (type) ((type64) state >> (64 - n)); \
   90|    174|}
dav1d_get_sbits:
   81|     87|type name(GetBits *const c, const int n) {      \
   82|     87|    assert(n > 0 && n <= 32);                   \
  ------------------
  |  |  140|    174|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 87, False: 0]
  |  |  |  Branch (140:30): [True: 87, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 87]
  |  |  ------------------
  ------------------
   83|     87|    /* Unsigned cast avoids refill after eob */ \
   84|     87|    if ((unsigned) n > (unsigned) c->bits_left) \
  ------------------
  |  Branch (84:9): [True: 78, False: 9]
  ------------------
   85|     87|        refill(c, n);                           \
   86|     87|    const uint64_t state = c->state;            \
   87|     87|    c->bits_left -= n;                          \
   88|     87|    c->state = state << n;                      \
   89|     87|    return (type) ((type64) state >> (64 - n)); \
   90|     87|}
dav1d_get_uleb128:
   95|     21|unsigned dav1d_get_uleb128(GetBits *const c) {
   96|     21|    uint64_t val = 0;
   97|     21|    unsigned i = 0, more;
   98|       |
   99|     34|    do {
  100|     34|        const int v = dav1d_get_bits(c, 8);
  101|     34|        more = v & 0x80;
  102|     34|        val |= ((uint64_t) (v & 0x7F)) << i;
  103|     34|        i += 7;
  104|     34|    } while (more && i < 56);
  ------------------
  |  Branch (104:14): [True: 14, False: 20]
  |  Branch (104:22): [True: 13, False: 1]
  ------------------
  105|       |
  106|     21|    if (val > UINT32_MAX || more) {
  ------------------
  |  Branch (106:9): [True: 1, False: 20]
  |  Branch (106:29): [True: 0, False: 20]
  ------------------
  107|      1|        c->error = 1;
  108|      1|        return 0;
  109|      1|    }
  110|       |
  111|     20|    return (unsigned) val;
  112|     21|}
getbits.c:refill:
   65|    184|static inline void refill(GetBits *const c, const int n) {
   66|    184|    assert(c->bits_left >= 0 && c->bits_left < 32);
  ------------------
  |  |  140|    368|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 184, False: 0]
  |  |  |  Branch (140:30): [True: 184, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 184]
  |  |  ------------------
  ------------------
   67|    184|    unsigned state = 0;
   68|    190|    do {
   69|    190|        if (c->ptr >= c->ptr_end) {
  ------------------
  |  Branch (69:13): [True: 0, False: 190]
  ------------------
   70|      0|            c->error = 1;
   71|      0|            if (state) break;
  ------------------
  |  Branch (71:17): [True: 0, False: 0]
  ------------------
   72|      0|            return;
   73|      0|        }
   74|    190|        state = (state << 8) | *c->ptr++;
   75|    190|        c->bits_left += 8;
   76|    190|    } while (n > c->bits_left);
  ------------------
  |  Branch (76:14): [True: 6, False: 184]
  ------------------
   77|    184|    c->state |= (uint64_t) state << (64 - c->bits_left);
   78|    184|}

obu.c:dav1d_bytealign_get_bits:
   52|      8|static inline void dav1d_bytealign_get_bits(GetBits *c) {
   53|       |    // bits_left is never more than 7, because it is only incremented
   54|       |    // by refill(), called by dav1d_get_bits and that never reads more
   55|       |    // than 7 bits more than it needs.
   56|       |    //
   57|       |    // If this wasn't true, we would need to work out how many bits to
   58|       |    // discard (bits_left % 8), subtract that from bits_left and then
   59|       |    // shift state right by that amount.
   60|      8|    assert(c->bits_left <= 7);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 8]
  |  |  |  Branch (140:68): [Folded, False: 8]
  |  |  ------------------
  ------------------
   61|       |
   62|      8|    c->bits_left = 0;
   63|      8|    c->state = 0;
   64|      8|}

dav1d_init_intra_edge_tree:
  126|      1|COLD void dav1d_init_intra_edge_tree(void) {
  127|       |    // This function is guaranteed to be called only once
  128|      1|    struct ModeSelMem mem;
  129|       |
  130|      1|    mem.nwc[BL_128X128] = &nodes.branch_sb128[1];
  131|      1|    mem.nwc[BL_64X64] = &nodes.branch_sb128[1 + 4];
  132|      1|    mem.nwc[BL_32X32] = &nodes.branch_sb128[1 + 4 + 16];
  133|      1|    mem.nt = nodes.tip_sb128;
  134|      1|    init_mode_node(nodes.branch_sb128, BL_128X128, &mem, 1, 0);
  135|      1|    assert(mem.nwc[BL_128X128] == &nodes.branch_sb128[1 + 4]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  136|      1|    assert(mem.nwc[BL_64X64] == &nodes.branch_sb128[1 + 4 + 16]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  137|      1|    assert(mem.nwc[BL_32X32] == &nodes.branch_sb128[1 + 4 + 16 + 64]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  138|      1|    assert(mem.nt == &nodes.tip_sb128[256]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  139|       |
  140|      1|    mem.nwc[BL_128X128] = NULL;
  141|      1|    mem.nwc[BL_64X64] = &nodes.branch_sb64[1];
  142|      1|    mem.nwc[BL_32X32] = &nodes.branch_sb64[1 + 4];
  143|      1|    mem.nt = nodes.tip_sb64;
  144|      1|    init_mode_node(nodes.branch_sb64, BL_64X64, &mem, 1, 0);
  145|      1|    assert(mem.nwc[BL_64X64] == &nodes.branch_sb64[1 + 4]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  146|      1|    assert(mem.nwc[BL_32X32] == &nodes.branch_sb64[1 + 4 + 16]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  147|      1|    assert(mem.nt == &nodes.tip_sb64[64]);
  ------------------
  |  |  140|      1|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1]
  |  |  |  Branch (140:68): [Folded, False: 1]
  |  |  ------------------
  ------------------
  148|      1|}
intra_edge.c:init_mode_node:
  101|    106|{
  102|    106|    init_edges(&nwc->node, bl,
  103|    106|               (top_has_right ? EDGE_ALL_TOP_HAS_RIGHT : 0) |
  ------------------
  |  Branch (103:17): [True: 73, False: 33]
  ------------------
  104|    106|               (left_has_bottom ? EDGE_ALL_LEFT_HAS_BOTTOM : 0));
  ------------------
  |  Branch (104:17): [True: 33, False: 73]
  ------------------
  105|    106|    if (bl == BL_16X16) {
  ------------------
  |  Branch (105:9): [True: 80, False: 26]
  ------------------
  106|    400|        for (int n = 0; n < 4; n++) {
  ------------------
  |  Branch (106:25): [True: 320, False: 80]
  ------------------
  107|    320|            EdgeTip *const nt = mem->nt++;
  108|    320|            nwc->split_offset[n] = PTR_OFFSET(nwc, nt);
  ------------------
  |  |   94|    320|#define PTR_OFFSET(a, b) ((uint16_t)((uintptr_t)(b) - (uintptr_t)(a)))
  ------------------
  109|    320|            init_edges(&nt->node, bl + 1,
  110|    320|                       ((n == 3 || (n == 1 && !top_has_right)) ? 0 :
  ------------------
  |  Branch (110:26): [True: 80, False: 240]
  |  Branch (110:37): [True: 80, False: 160]
  |  Branch (110:47): [True: 26, False: 54]
  ------------------
  111|    320|                        EDGE_ALL_TOP_HAS_RIGHT) |
  112|    320|                       (!(n == 0 || (n == 2 && left_has_bottom)) ? 0 :
  ------------------
  |  Branch (112:27): [True: 80, False: 240]
  |  Branch (112:38): [True: 80, False: 160]
  |  Branch (112:48): [True: 26, False: 54]
  ------------------
  113|    320|                        EDGE_ALL_LEFT_HAS_BOTTOM));
  114|    320|        }
  115|     80|    } else {
  116|    130|        for (int n = 0; n < 4; n++) {
  ------------------
  |  Branch (116:25): [True: 104, False: 26]
  ------------------
  117|    104|            EdgeBranch *const nwc_child = mem->nwc[bl]++;
  118|    104|            nwc->split_offset[n] = PTR_OFFSET(nwc, nwc_child);
  ------------------
  |  |   94|    104|#define PTR_OFFSET(a, b) ((uint16_t)((uintptr_t)(b) - (uintptr_t)(a)))
  ------------------
  119|    104|            init_mode_node(nwc_child, bl + 1, mem,
  120|    104|                           !(n == 3 || (n == 1 && !top_has_right)),
  ------------------
  |  Branch (120:30): [True: 26, False: 78]
  |  Branch (120:41): [True: 26, False: 52]
  |  Branch (120:51): [True: 7, False: 19]
  ------------------
  121|    104|                           n == 0 || (n == 2 && left_has_bottom));
  ------------------
  |  Branch (121:28): [True: 26, False: 78]
  |  Branch (121:39): [True: 26, False: 52]
  |  Branch (121:49): [True: 7, False: 19]
  ------------------
  122|    104|        }
  123|     26|    }
  124|    106|}
intra_edge.c:init_edges:
   58|    426|{
   59|    426|    node->o = edge_flags;
   60|    426|    node->h[0] = edge_flags | EDGE_ALL_LEFT_HAS_BOTTOM;
   61|    426|    node->v[0] = edge_flags | EDGE_ALL_TOP_HAS_RIGHT;
   62|       |
   63|    426|    if (bl == BL_8X8) {
  ------------------
  |  Branch (63:9): [True: 320, False: 106]
  ------------------
   64|    320|        EdgeTip *const nt = (EdgeTip *) node;
   65|       |
   66|    320|        node->h[1] = edge_flags & (EDGE_ALL_LEFT_HAS_BOTTOM |
   67|    320|                                   EDGE_I420_TOP_HAS_RIGHT);
   68|    320|        node->v[1] = edge_flags & (EDGE_ALL_TOP_HAS_RIGHT |
   69|    320|                                   EDGE_I420_LEFT_HAS_BOTTOM |
   70|    320|                                   EDGE_I422_LEFT_HAS_BOTTOM);
   71|       |
   72|    320|        nt->split[0] = (edge_flags & EDGE_ALL_TOP_HAS_RIGHT) |
   73|    320|                       EDGE_I422_LEFT_HAS_BOTTOM;
   74|    320|        nt->split[1] = edge_flags | EDGE_I444_TOP_HAS_RIGHT;
   75|    320|        nt->split[2] = edge_flags & (EDGE_I420_TOP_HAS_RIGHT |
   76|    320|                                     EDGE_I420_LEFT_HAS_BOTTOM |
   77|    320|                                     EDGE_I422_LEFT_HAS_BOTTOM);
   78|    320|    } else {
   79|    106|        EdgeBranch *const nwc = (EdgeBranch *) node;
   80|       |
   81|    106|        node->h[1] = edge_flags & EDGE_ALL_LEFT_HAS_BOTTOM;
   82|    106|        node->v[1] = edge_flags & EDGE_ALL_TOP_HAS_RIGHT;
   83|       |
   84|    106|        nwc->h4 = EDGE_ALL_LEFT_HAS_BOTTOM;
   85|    106|        nwc->v4 = EDGE_ALL_TOP_HAS_RIGHT;
   86|    106|        if (bl == BL_16X16) {
  ------------------
  |  Branch (86:13): [True: 80, False: 26]
  ------------------
   87|     80|            nwc->h4 |= edge_flags & EDGE_I420_TOP_HAS_RIGHT;
   88|     80|            nwc->v4 |= edge_flags & (EDGE_I420_LEFT_HAS_BOTTOM |
   89|     80|                                     EDGE_I422_LEFT_HAS_BOTTOM);
   90|     80|        }
   91|    106|    }
   92|    426|}

recon_tmpl.c:sm_flag:
   95|  2.84k|static inline int sm_flag(const BlockContext *const b, const int idx) {
   96|  2.84k|    if (!b->intra[idx]) return 0;
  ------------------
  |  Branch (96:9): [True: 244, False: 2.60k]
  ------------------
   97|  2.60k|    const enum IntraPredMode m = b->mode[idx];
   98|  2.60k|    return (m == SMOOTH_PRED || m == SMOOTH_H_PRED ||
  ------------------
  |  Branch (98:13): [True: 272, False: 2.32k]
  |  Branch (98:33): [True: 98, False: 2.23k]
  ------------------
   99|  2.23k|            m == SMOOTH_V_PRED) ? ANGLE_SMOOTH_EDGE_FLAG : 0;
  ------------------
  |  |   93|    446|#define ANGLE_SMOOTH_EDGE_FLAG      512
  ------------------
  |  Branch (99:13): [True: 76, False: 2.15k]
  ------------------
  100|  2.84k|}
recon_tmpl.c:sm_uv_flag:
  102|  2.26k|static inline int sm_uv_flag(const BlockContext *const b, const int idx) {
  103|  2.26k|    const enum IntraPredMode m = b->uvmode[idx];
  104|  2.26k|    return (m == SMOOTH_PRED || m == SMOOTH_H_PRED ||
  ------------------
  |  Branch (104:13): [True: 222, False: 2.04k]
  |  Branch (104:33): [True: 68, False: 1.97k]
  ------------------
  105|  1.97k|            m == SMOOTH_V_PRED) ? ANGLE_SMOOTH_EDGE_FLAG : 0;
  ------------------
  |  |   93|    336|#define ANGLE_SMOOTH_EDGE_FLAG      512
  ------------------
  |  Branch (105:13): [True: 46, False: 1.92k]
  ------------------
  106|  2.26k|}

dav1d_prepare_intra_edges_8bpc:
   86|  5.71k|{
   87|  5.71k|    const int bitdepth = bitdepth_from_max(bitdepth_max);
  ------------------
  |  |   58|  5.71k|#define bitdepth_from_max(x) 8
  ------------------
   88|  5.71k|    assert(y < h && x < w);
  ------------------
  |  |  140|  11.4k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 5.71k, False: 0]
  |  |  |  Branch (140:30): [True: 5.71k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 5.71k]
  |  |  ------------------
  ------------------
   89|       |
   90|  5.71k|    switch (mode) {
   91|    342|    case VERT_PRED:
  ------------------
  |  Branch (91:5): [True: 342, False: 5.37k]
  ------------------
   92|    928|    case HOR_PRED:
  ------------------
  |  Branch (92:5): [True: 586, False: 5.13k]
  ------------------
   93|  1.13k|    case DIAG_DOWN_LEFT_PRED:
  ------------------
  |  Branch (93:5): [True: 210, False: 5.50k]
  ------------------
   94|  1.24k|    case DIAG_DOWN_RIGHT_PRED:
  ------------------
  |  Branch (94:5): [True: 108, False: 5.61k]
  ------------------
   95|  1.40k|    case VERT_RIGHT_PRED:
  ------------------
  |  Branch (95:5): [True: 162, False: 5.55k]
  ------------------
   96|  1.60k|    case HOR_DOWN_PRED:
  ------------------
  |  Branch (96:5): [True: 192, False: 5.52k]
  ------------------
   97|  1.92k|    case HOR_UP_PRED:
  ------------------
  |  Branch (97:5): [True: 322, False: 5.39k]
  ------------------
   98|  2.14k|    case VERT_LEFT_PRED: {
  ------------------
  |  Branch (98:5): [True: 218, False: 5.50k]
  ------------------
   99|  2.14k|        *angle = av1_mode_to_angle_map[mode - VERT_PRED] + 3 * *angle;
  100|       |
  101|  2.14k|        if (*angle <= 90)
  ------------------
  |  Branch (101:13): [True: 698, False: 1.44k]
  ------------------
  102|    698|            mode = *angle < 90 && have_top ? Z1_PRED : VERT_PRED;
  ------------------
  |  Branch (102:20): [True: 512, False: 186]
  |  Branch (102:35): [True: 504, False: 8]
  ------------------
  103|  1.44k|        else if (*angle < 180)
  ------------------
  |  Branch (103:18): [True: 702, False: 740]
  ------------------
  104|    702|            mode = Z2_PRED;
  105|    740|        else
  106|    740|            mode = *angle > 180 && have_left ? Z3_PRED : HOR_PRED;
  ------------------
  |  Branch (106:20): [True: 436, False: 304]
  |  Branch (106:36): [True: 434, False: 2]
  ------------------
  107|  2.14k|        break;
  108|  1.92k|    }
  109|  1.49k|    case DC_PRED:
  ------------------
  |  Branch (109:5): [True: 1.49k, False: 4.22k]
  ------------------
  110|  1.74k|    case PAETH_PRED:
  ------------------
  |  Branch (110:5): [True: 246, False: 5.47k]
  ------------------
  111|  1.74k|        mode = av1_mode_conv[mode][have_left][have_top];
  112|  1.74k|        break;
  113|  1.83k|    default:
  ------------------
  |  Branch (113:5): [True: 1.83k, False: 3.88k]
  ------------------
  114|  1.83k|        break;
  115|  5.71k|    }
  116|       |
  117|  5.71k|    const pixel *dst_top;
  118|  5.71k|    if (have_top &&
  ------------------
  |  Branch (118:9): [True: 5.27k, False: 440]
  ------------------
  119|  5.27k|        (av1_intra_prediction_edges[mode].needs_top ||
  ------------------
  |  Branch (119:10): [True: 4.60k, False: 676]
  ------------------
  120|    676|         av1_intra_prediction_edges[mode].needs_topleft ||
  ------------------
  |  Branch (120:10): [True: 388, False: 288]
  ------------------
  121|    288|         (av1_intra_prediction_edges[mode].needs_left && !have_left)))
  ------------------
  |  Branch (121:11): [True: 288, False: 0]
  |  Branch (121:58): [True: 2, False: 286]
  ------------------
  122|  4.99k|    {
  123|  4.99k|        if (prefilter_toplevel_sb_edge) {
  ------------------
  |  Branch (123:13): [True: 552, False: 4.44k]
  ------------------
  124|    552|            dst_top = &prefilter_toplevel_sb_edge[x * 4];
  125|  4.44k|        } else {
  126|  4.44k|            dst_top = &dst[-PXSTRIDE(stride)];
  ------------------
  |  |   53|  4.44k|#define PXSTRIDE(x) (x)
  ------------------
  127|  4.44k|        }
  128|  4.99k|    }
  129|       |
  130|  5.71k|    if (av1_intra_prediction_edges[mode].needs_left) {
  ------------------
  |  Branch (130:9): [True: 5.00k, False: 718]
  ------------------
  131|  5.00k|        const int sz = th << 2;
  132|  5.00k|        pixel *const left = &topleft_out[-sz];
  133|       |
  134|  5.00k|        if (have_left) {
  ------------------
  |  Branch (134:13): [True: 4.99k, False: 10]
  ------------------
  135|  4.99k|            const int px_have = imin(sz, (h - y) << 2);
  136|       |
  137|  52.1k|            for (int i = 0; i < px_have; i++)
  ------------------
  |  Branch (137:29): [True: 47.1k, False: 4.99k]
  ------------------
  138|  47.1k|                left[sz - 1 - i] = dst[PXSTRIDE(stride) * i - 1];
  ------------------
  |  |   53|  47.1k|#define PXSTRIDE(x) (x)
  ------------------
  139|  4.99k|            if (px_have < sz)
  ------------------
  |  Branch (139:17): [True: 0, False: 4.99k]
  ------------------
  140|      0|                pixel_set(left, left[sz - px_have], sz - px_have);
  ------------------
  |  |   48|      0|#define pixel_set memset
  ------------------
  141|  4.99k|        } else {
  142|     10|            pixel_set(left, have_top ? *dst_top : ((1 << bitdepth) >> 1) + 1, sz);
  ------------------
  |  |   48|     10|#define pixel_set memset
  ------------------
  |  Branch (142:29): [True: 6, False: 4]
  ------------------
  143|     10|        }
  144|       |
  145|  5.00k|        if (av1_intra_prediction_edges[mode].needs_bottomleft) {
  ------------------
  |  Branch (145:13): [True: 434, False: 4.56k]
  ------------------
  146|    434|            const int have_bottomleft = (!have_left || y + th >= h) ? 0 :
  ------------------
  |  Branch (146:42): [True: 0, False: 434]
  |  Branch (146:56): [True: 0, False: 434]
  ------------------
  147|    434|                                        (edge_flags & EDGE_I444_LEFT_HAS_BOTTOM);
  148|       |
  149|    434|            if (have_bottomleft) {
  ------------------
  |  Branch (149:17): [True: 164, False: 270]
  ------------------
  150|    164|                const int px_have = imin(sz, (h - y - th) << 2);
  151|       |
  152|  1.33k|                for (int i = 0; i < px_have; i++)
  ------------------
  |  Branch (152:33): [True: 1.16k, False: 164]
  ------------------
  153|  1.16k|                    left[-(i + 1)] = dst[(sz + i) * PXSTRIDE(stride) - 1];
  ------------------
  |  |   53|  1.16k|#define PXSTRIDE(x) (x)
  ------------------
  154|    164|                if (px_have < sz)
  ------------------
  |  Branch (154:21): [True: 0, False: 164]
  ------------------
  155|      0|                    pixel_set(left - sz, left[-px_have], sz - px_have);
  ------------------
  |  |   48|      0|#define pixel_set memset
  ------------------
  156|    270|            } else {
  157|    270|                pixel_set(left - sz, left[0], sz);
  ------------------
  |  |   48|    270|#define pixel_set memset
  ------------------
  158|    270|            }
  159|    434|        }
  160|  5.00k|    }
  161|       |
  162|  5.71k|    if (av1_intra_prediction_edges[mode].needs_top) {
  ------------------
  |  Branch (162:9): [True: 4.81k, False: 904]
  ------------------
  163|  4.81k|        const int sz = tw << 2;
  164|  4.81k|        pixel *const top = &topleft_out[1];
  165|       |
  166|  4.81k|        if (have_top) {
  ------------------
  |  Branch (166:13): [True: 4.60k, False: 212]
  ------------------
  167|  4.60k|            const int px_have = imin(sz, (w - x) << 2);
  168|  4.60k|            pixel_copy(top, dst_top, px_have);
  ------------------
  |  |   47|  4.60k|#define pixel_copy memcpy
  ------------------
  169|  4.60k|            if (px_have < sz)
  ------------------
  |  Branch (169:17): [True: 0, False: 4.60k]
  ------------------
  170|      0|                pixel_set(top + px_have, top[px_have - 1], sz - px_have);
  ------------------
  |  |   48|      0|#define pixel_set memset
  ------------------
  171|  4.60k|        } else {
  172|    212|            pixel_set(top, have_left ? dst[-1] : ((1 << bitdepth) >> 1) - 1, sz);
  ------------------
  |  |   48|    212|#define pixel_set memset
  ------------------
  |  Branch (172:28): [True: 212, False: 0]
  ------------------
  173|    212|        }
  174|       |
  175|  4.81k|        if (av1_intra_prediction_edges[mode].needs_topright) {
  ------------------
  |  Branch (175:13): [True: 504, False: 4.31k]
  ------------------
  176|    504|            const int have_topright = (!have_top || x + tw >= w) ? 0 :
  ------------------
  |  Branch (176:40): [True: 0, False: 504]
  |  Branch (176:53): [True: 0, False: 504]
  ------------------
  177|    504|                                      (edge_flags & EDGE_I444_TOP_HAS_RIGHT);
  178|       |
  179|    504|            if (have_topright) {
  ------------------
  |  Branch (179:17): [True: 326, False: 178]
  ------------------
  180|    326|                const int px_have = imin(sz, (w - x - tw) << 2);
  181|       |
  182|    326|                pixel_copy(top + sz, &dst_top[sz], px_have);
  ------------------
  |  |   47|    326|#define pixel_copy memcpy
  ------------------
  183|    326|                if (px_have < sz)
  ------------------
  |  Branch (183:21): [True: 0, False: 326]
  ------------------
  184|      0|                    pixel_set(top + sz + px_have, top[sz + px_have - 1],
  ------------------
  |  |   48|      0|#define pixel_set memset
  ------------------
  185|      0|                              sz - px_have);
  186|    326|            } else {
  187|    178|                pixel_set(top + sz, top[sz - 1], sz);
  ------------------
  |  |   48|    178|#define pixel_set memset
  ------------------
  188|    178|            }
  189|    504|        }
  190|  4.81k|    }
  191|       |
  192|  5.71k|    if (av1_intra_prediction_edges[mode].needs_topleft) {
  ------------------
  |  Branch (192:9): [True: 2.54k, False: 3.17k]
  ------------------
  193|  2.54k|        if (have_left)
  ------------------
  |  Branch (193:13): [True: 2.54k, False: 4]
  ------------------
  194|  2.54k|            *topleft_out = have_top ? dst_top[-1] : dst[-1];
  ------------------
  |  Branch (194:28): [True: 2.38k, False: 164]
  ------------------
  195|      4|        else
  196|      4|            *topleft_out = have_top ? *dst_top : (1 << bitdepth) >> 1;
  ------------------
  |  Branch (196:28): [True: 4, False: 0]
  ------------------
  197|       |
  198|  2.54k|        if (mode == Z2_PRED && tw + th >= 6 && filter_edge)
  ------------------
  |  Branch (198:13): [True: 702, False: 1.84k]
  |  Branch (198:32): [True: 150, False: 552]
  |  Branch (198:48): [True: 150, False: 0]
  ------------------
  199|    150|            *topleft_out = ((topleft_out[-1] + topleft_out[1]) * 5 +
  200|    150|                            topleft_out[0] * 6 + 8) >> 4;
  201|  2.54k|    }
  202|       |
  203|  5.71k|    return mode;
  204|  5.71k|}

dav1d_intra_pred_dsp_init_8bpc:
  744|      4|COLD void bitfn(dav1d_intra_pred_dsp_init)(Dav1dIntraPredDSPContext *const c) {
  745|      4|    c->intra_pred[DC_PRED      ] = ipred_dc_c;
  746|      4|    c->intra_pred[DC_128_PRED  ] = ipred_dc_128_c;
  747|      4|    c->intra_pred[TOP_DC_PRED  ] = ipred_dc_top_c;
  748|      4|    c->intra_pred[LEFT_DC_PRED ] = ipred_dc_left_c;
  749|      4|    c->intra_pred[HOR_PRED     ] = ipred_h_c;
  750|      4|    c->intra_pred[VERT_PRED    ] = ipred_v_c;
  751|      4|    c->intra_pred[PAETH_PRED   ] = ipred_paeth_c;
  752|      4|    c->intra_pred[SMOOTH_PRED  ] = ipred_smooth_c;
  753|      4|    c->intra_pred[SMOOTH_V_PRED] = ipred_smooth_v_c;
  754|      4|    c->intra_pred[SMOOTH_H_PRED] = ipred_smooth_h_c;
  755|      4|    c->intra_pred[Z1_PRED      ] = ipred_z1_c;
  756|      4|    c->intra_pred[Z2_PRED      ] = ipred_z2_c;
  757|      4|    c->intra_pred[Z3_PRED      ] = ipred_z3_c;
  758|      4|    c->intra_pred[FILTER_PRED  ] = ipred_filter_c;
  759|       |
  760|      4|    c->cfl_ac[DAV1D_PIXEL_LAYOUT_I420 - 1] = cfl_ac_420_c;
  761|      4|    c->cfl_ac[DAV1D_PIXEL_LAYOUT_I422 - 1] = cfl_ac_422_c;
  762|      4|    c->cfl_ac[DAV1D_PIXEL_LAYOUT_I444 - 1] = cfl_ac_444_c;
  763|       |
  764|      4|    c->cfl_pred[DC_PRED     ] = ipred_cfl_c;
  765|      4|    c->cfl_pred[DC_128_PRED ] = ipred_cfl_128_c;
  766|      4|    c->cfl_pred[TOP_DC_PRED ] = ipred_cfl_top_c;
  767|      4|    c->cfl_pred[LEFT_DC_PRED] = ipred_cfl_left_c;
  768|       |
  769|      4|    c->pal_pred = pal_pred_c;
  770|       |
  771|       |#if HAVE_ASM
  772|       |#if ARCH_AARCH64 || ARCH_ARM
  773|       |    intra_pred_dsp_init_arm(c);
  774|       |#elif ARCH_RISCV
  775|       |    intra_pred_dsp_init_riscv(c);
  776|       |#elif ARCH_X86
  777|       |    intra_pred_dsp_init_x86(c);
  778|       |#elif ARCH_LOONGARCH64
  779|       |    intra_pred_dsp_init_loongarch(c);
  780|       |#endif
  781|       |#endif
  782|      4|}
ipred_tmpl.c:ipred_dc_c:
  173|  1.00k|{
  174|  1.00k|    splat_dc(dst, stride, width, height, dc_gen(topleft, width, height)
  175|  1.00k|             HIGHBD_TAIL_SUFFIX);
  176|  1.00k|}
ipred_tmpl.c:splat_dc:
   42|  1.12k|{
   43|  1.12k|#if BITDEPTH == 8
   44|  1.12k|    assert(dc <= 0xff);
  ------------------
  |  |  140|  1.12k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1.12k]
  |  |  |  Branch (140:68): [Folded, False: 1.12k]
  |  |  ------------------
  ------------------
   45|  1.12k|    if (width > 4) {
  ------------------
  |  Branch (45:9): [True: 758, False: 370]
  ------------------
   46|    758|        const uint64_t dcN = dc * 0x0101010101010101ULL;
   47|  13.0k|        for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (47:25): [True: 12.3k, False: 758]
  ------------------
   48|  56.6k|            for (int x = 0; x < width; x += sizeof(dcN))
  ------------------
  |  Branch (48:29): [True: 44.3k, False: 12.3k]
  ------------------
   49|  44.3k|                *((uint64_t *) &dst[x]) = dcN;
   50|  12.3k|            dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  12.3k|#define PXSTRIDE(x) (x)
  ------------------
   51|  12.3k|        }
   52|    758|    } else {
   53|    370|        const unsigned dcN = dc * 0x01010101U;
   54|  2.42k|        for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (54:25): [True: 2.05k, False: 370]
  ------------------
   55|  4.11k|            for (int x = 0; x < width; x += sizeof(dcN))
  ------------------
  |  Branch (55:29): [True: 2.05k, False: 2.05k]
  ------------------
   56|  2.05k|                *((unsigned *) &dst[x]) = dcN;
   57|  2.05k|            dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  2.05k|#define PXSTRIDE(x) (x)
  ------------------
   58|  2.05k|        }
   59|    370|    }
   60|       |#else
   61|       |    assert(dc <= bitdepth_max);
   62|       |    const uint64_t dcN = dc * 0x0001000100010001ULL;
   63|       |    for (int y = 0; y < height; y++) {
   64|       |        for (int x = 0; x < width; x += sizeof(dcN) >> 1)
   65|       |            *((uint64_t *) &dst[x]) = dcN;
   66|       |        dst += PXSTRIDE(stride);
   67|       |    }
   68|       |#endif
   69|  1.12k|}
ipred_tmpl.c:dc_gen:
  152|  1.33k|{
  153|  1.33k|    unsigned dc = (width + height) >> 1;
  154|  13.9k|    for (int i = 0; i < width; i++)
  ------------------
  |  Branch (154:21): [True: 12.6k, False: 1.33k]
  ------------------
  155|  12.6k|       dc += topleft[i + 1];
  156|  14.2k|    for (int i = 0; i < height; i++)
  ------------------
  |  Branch (156:21): [True: 12.9k, False: 1.33k]
  ------------------
  157|  12.9k|       dc += topleft[-(i + 1)];
  158|  1.33k|    dc >>= ctz(width + height);
  159|       |
  160|  1.33k|    if (width != height) {
  ------------------
  |  Branch (160:9): [True: 514, False: 822]
  ------------------
  161|    514|        dc *= (width > height * 2 || height > width * 2) ? MULTIPLIER_1x4 :
  ------------------
  |  |  142|    108|#define MULTIPLIER_1x4 0x3334
  ------------------
  |  Branch (161:16): [True: 34, False: 480]
  |  Branch (161:38): [True: 74, False: 406]
  ------------------
  162|    514|                                                           MULTIPLIER_1x2;
  ------------------
  |  |  141|    920|#define MULTIPLIER_1x2 0x5556
  ------------------
  163|    514|        dc >>= BASE_SHIFT;
  ------------------
  |  |  143|    514|#define BASE_SHIFT 16
  ------------------
  164|    514|    }
  165|  1.33k|    return dc;
  166|  1.33k|}
ipred_tmpl.c:ipred_dc_128_c:
  197|      8|{
  198|       |#if BITDEPTH == 16
  199|       |    const int dc = (bitdepth_max + 1) >> 1;
  200|       |#else
  201|      8|    const int dc = 128;
  202|      8|#endif
  203|      8|    splat_dc(dst, stride, width, height, dc HIGHBD_TAIL_SUFFIX);
  204|      8|}
ipred_tmpl.c:ipred_dc_top_c:
   98|     12|{
   99|     12|    splat_dc(dst, stride, width, height, dc_gen_top(topleft, width)
  100|     12|             HIGHBD_TAIL_SUFFIX);
  101|     12|}
ipred_tmpl.c:dc_gen_top:
   86|     12|static unsigned dc_gen_top(const pixel *const topleft, const int width) {
   87|     12|    unsigned dc = width >> 1;
   88|    364|    for (int i = 0; i < width; i++)
  ------------------
  |  Branch (88:21): [True: 352, False: 12]
  ------------------
   89|    352|       dc += topleft[1 + i];
   90|     12|    return dc >> ctz(width);
   91|     12|}
ipred_tmpl.c:ipred_dc_left_c:
  125|    102|{
  126|    102|    splat_dc(dst, stride, width, height, dc_gen_left(topleft, height)
  127|    102|             HIGHBD_TAIL_SUFFIX);
  128|    102|}
ipred_tmpl.c:dc_gen_left:
  113|    138|static unsigned dc_gen_left(const pixel *const topleft, const int height) {
  114|    138|    unsigned dc = height >> 1;
  115|  3.57k|    for (int i = 0; i < height; i++)
  ------------------
  |  Branch (115:21): [True: 3.44k, False: 138]
  ------------------
  116|  3.44k|       dc += topleft[-(1 + i)];
  117|    138|    return dc >> ctz(height);
  118|    138|}
ipred_tmpl.c:ipred_h_c:
  237|    324|{
  238|  3.78k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (238:21): [True: 3.46k, False: 324]
  ------------------
  239|  3.46k|        pixel_set(dst, topleft[-(1 + y)], width);
  ------------------
  |  |   48|  3.46k|#define pixel_set memset
  ------------------
  240|  3.46k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  3.46k|#define PXSTRIDE(x) (x)
  ------------------
  241|  3.46k|    }
  242|    324|}
ipred_tmpl.c:ipred_v_c:
  225|    194|{
  226|  2.57k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (226:21): [True: 2.38k, False: 194]
  ------------------
  227|  2.38k|        pixel_copy(dst, topleft + 1, width);
  ------------------
  |  |   47|  2.38k|#define pixel_copy memcpy
  ------------------
  228|  2.38k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  2.38k|#define PXSTRIDE(x) (x)
  ------------------
  229|  2.38k|    }
  230|    194|}
ipred_tmpl.c:ipred_paeth_c:
  249|    228|{
  250|    228|    const int topleft = tl_ptr[0];
  251|  1.74k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (251:21): [True: 1.51k, False: 228]
  ------------------
  252|  1.51k|        const int left = tl_ptr[-(y + 1)];
  253|  18.8k|        for (int x = 0; x < width; x++) {
  ------------------
  |  Branch (253:25): [True: 17.3k, False: 1.51k]
  ------------------
  254|  17.3k|            const int top = tl_ptr[1 + x];
  255|  17.3k|            const int base = left + top - topleft;
  256|  17.3k|            const int ldiff = abs(left - base);
  257|  17.3k|            const int tdiff = abs(top - base);
  258|  17.3k|            const int tldiff = abs(topleft - base);
  259|       |
  260|  17.3k|            dst[x] = ldiff <= tdiff && ldiff <= tldiff ? left :
  ------------------
  |  Branch (260:22): [True: 13.3k, False: 3.99k]
  |  Branch (260:40): [True: 13.0k, False: 360]
  ------------------
  261|  17.3k|                     tdiff <= tldiff ? top : topleft;
  ------------------
  |  Branch (261:22): [True: 3.81k, False: 540]
  ------------------
  262|  17.3k|        }
  263|  1.51k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  1.51k|#define PXSTRIDE(x) (x)
  ------------------
  264|  1.51k|    }
  265|    228|}
ipred_tmpl.c:ipred_smooth_c:
  272|    718|{
  273|    718|    const uint8_t *const weights_hor = &dav1d_sm_weights[width];
  274|    718|    const uint8_t *const weights_ver = &dav1d_sm_weights[height];
  275|    718|    const int right = topleft[width], bottom = topleft[-height];
  276|       |
  277|  6.55k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (277:21): [True: 5.84k, False: 718]
  ------------------
  278|  88.4k|        for (int x = 0; x < width; x++) {
  ------------------
  |  Branch (278:25): [True: 82.6k, False: 5.84k]
  ------------------
  279|  82.6k|            const int pred = weights_ver[y]  * topleft[1 + x] +
  280|  82.6k|                      (256 - weights_ver[y]) * bottom +
  281|  82.6k|                             weights_hor[x]  * topleft[-(1 + y)] +
  282|  82.6k|                      (256 - weights_hor[x]) * right;
  283|  82.6k|            dst[x] = (pred + 256) >> 9;
  284|  82.6k|        }
  285|  5.84k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  5.84k|#define PXSTRIDE(x) (x)
  ------------------
  286|  5.84k|    }
  287|    718|}
ipred_tmpl.c:ipred_smooth_v_c:
  294|    190|{
  295|    190|    const uint8_t *const weights_ver = &dav1d_sm_weights[height];
  296|    190|    const int bottom = topleft[-height];
  297|       |
  298|  2.47k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (298:21): [True: 2.28k, False: 190]
  ------------------
  299|  62.3k|        for (int x = 0; x < width; x++) {
  ------------------
  |  Branch (299:25): [True: 60.0k, False: 2.28k]
  ------------------
  300|  60.0k|            const int pred = weights_ver[y]  * topleft[1 + x] +
  301|  60.0k|                      (256 - weights_ver[y]) * bottom;
  302|  60.0k|            dst[x] = (pred + 128) >> 8;
  303|  60.0k|        }
  304|  2.28k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  2.28k|#define PXSTRIDE(x) (x)
  ------------------
  305|  2.28k|    }
  306|    190|}
ipred_tmpl.c:ipred_smooth_h_c:
  313|    250|{
  314|    250|    const uint8_t *const weights_hor = &dav1d_sm_weights[width];
  315|    250|    const int right = topleft[width];
  316|       |
  317|  2.21k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (317:21): [True: 1.96k, False: 250]
  ------------------
  318|  20.2k|        for (int x = 0; x < width; x++) {
  ------------------
  |  Branch (318:25): [True: 18.2k, False: 1.96k]
  ------------------
  319|  18.2k|            const int pred = weights_hor[x]  * topleft[-(y + 1)] +
  320|  18.2k|                      (256 - weights_hor[x]) * right;
  321|  18.2k|            dst[x] = (pred + 128) >> 8;
  322|  18.2k|        }
  323|  1.96k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  1.96k|#define PXSTRIDE(x) (x)
  ------------------
  324|  1.96k|    }
  325|    250|}
ipred_tmpl.c:ipred_z1_c:
  413|    504|{
  414|    504|    const int is_sm = (angle >> 9) & 0x1;
  415|    504|    const int enable_intra_edge_filter = angle >> 10;
  416|    504|    angle &= 511;
  417|    504|    assert(angle < 90);
  ------------------
  |  |  140|    504|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 504]
  |  |  |  Branch (140:68): [Folded, False: 504]
  |  |  ------------------
  ------------------
  418|    504|    int dx = dav1d_dr_intra_derivative[angle >> 1];
  419|    504|    pixel top_out[64 + 64];
  420|    504|    const pixel *top;
  421|    504|    int max_base_x;
  422|    504|    const int upsample_above = enable_intra_edge_filter ?
  ------------------
  |  Branch (422:32): [True: 504, False: 0]
  ------------------
  423|    504|        get_upsample(width + height, 90 - angle, is_sm) : 0;
  424|    504|    if (upsample_above) {
  ------------------
  |  Branch (424:9): [True: 238, False: 266]
  ------------------
  425|    238|        upsample_edge(top_out, width + height, &topleft_in[1], -1,
  426|    238|                      width + imin(width, height) HIGHBD_TAIL_SUFFIX);
  427|    238|        top = top_out;
  428|    238|        max_base_x = 2 * (width + height) - 2;
  429|    238|        dx <<= 1;
  430|    266|    } else {
  431|    266|        const int filter_strength = enable_intra_edge_filter ?
  ------------------
  |  Branch (431:37): [True: 266, False: 0]
  ------------------
  432|    266|            get_filter_strength(width + height, 90 - angle, is_sm) : 0;
  433|    266|        if (filter_strength) {
  ------------------
  |  Branch (433:13): [True: 242, False: 24]
  ------------------
  434|    242|            filter_edge(top_out, width + height, 0, width + height,
  435|    242|                        &topleft_in[1], -1, width + imin(width, height),
  436|    242|                        filter_strength);
  437|    242|            top = top_out;
  438|    242|            max_base_x = width + height - 1;
  439|    242|        } else {
  440|     24|            top = &topleft_in[1];
  441|     24|            max_base_x = width + imin(width, height) - 1;
  442|     24|        }
  443|    266|    }
  444|    504|    const int base_inc = 1 + upsample_above;
  445|  5.64k|    for (int y = 0, xpos = dx; y < height;
  ------------------
  |  Branch (445:32): [True: 5.14k, False: 504]
  ------------------
  446|  5.14k|         y++, dst += PXSTRIDE(stride), xpos += dx)
  ------------------
  |  |   53|  5.14k|#define PXSTRIDE(x) (x)
  ------------------
  447|  5.14k|    {
  448|  5.14k|        const int frac = xpos & 0x3E;
  449|       |
  450|   102k|        for (int x = 0, base = xpos >> 6; x < width; x++, base += base_inc) {
  ------------------
  |  Branch (450:43): [True: 97.6k, False: 4.87k]
  ------------------
  451|  97.6k|            if (base < max_base_x) {
  ------------------
  |  Branch (451:17): [True: 97.3k, False: 266]
  ------------------
  452|  97.3k|                const int v = top[base] * (64 - frac) + top[base + 1] * frac;
  453|  97.3k|                dst[x] = (v + 32) >> 6;
  454|  97.3k|            } else {
  455|    266|                pixel_set(&dst[x], top[max_base_x], width - x);
  ------------------
  |  |   48|    266|#define pixel_set memset
  ------------------
  456|    266|                break;
  457|    266|            }
  458|  97.6k|        }
  459|  5.14k|    }
  460|    504|}
ipred_tmpl.c:get_upsample:
  387|  2.34k|static inline int get_upsample(const int wh, const int angle, const int is_sm) {
  388|  2.34k|    return angle < 40 && wh <= 16 >> is_sm;
  ------------------
  |  Branch (388:12): [True: 1.48k, False: 862]
  |  Branch (388:26): [True: 974, False: 506]
  ------------------
  389|  2.34k|}
ipred_tmpl.c:upsample_edge:
  394|    974|{
  395|    974|    static const int8_t kernel[4] = { -1, 9, 9, -1 };
  396|    974|    int i;
  397|  10.3k|    for (i = 0; i < hsz - 1; i++) {
  ------------------
  |  Branch (397:17): [True: 9.34k, False: 974]
  ------------------
  398|  9.34k|        out[i * 2] = in[iclip(i, from, to - 1)];
  399|       |
  400|  9.34k|        int s = 0;
  401|  46.7k|        for (int j = 0; j < 4; j++)
  ------------------
  |  Branch (401:25): [True: 37.3k, False: 9.34k]
  ------------------
  402|  37.3k|            s += in[iclip(i + j - 1, from, to - 1)] * kernel[j];
  403|  9.34k|        out[i * 2 + 1] = iclip_pixel((s + 8) >> 4);
  ------------------
  |  |   49|  9.34k|#define iclip_pixel iclip_u8
  ------------------
  404|  9.34k|    }
  405|    974|    out[i * 2] = in[iclip(i, from, to - 1)];
  406|    974|}
ipred_tmpl.c:get_filter_strength:
  329|  1.36k|{
  330|  1.36k|    if (is_sm) {
  ------------------
  |  Branch (330:9): [True: 426, False: 942]
  ------------------
  331|    426|        if (wh <= 8) {
  ------------------
  |  Branch (331:13): [True: 76, False: 350]
  ------------------
  332|     76|            if (angle >= 64) return 2;
  ------------------
  |  Branch (332:17): [True: 30, False: 46]
  ------------------
  333|     46|            if (angle >= 40) return 1;
  ------------------
  |  Branch (333:17): [True: 46, False: 0]
  ------------------
  334|    350|        } else if (wh <= 16) {
  ------------------
  |  Branch (334:20): [True: 238, False: 112]
  ------------------
  335|    238|            if (angle >= 48) return 2;
  ------------------
  |  Branch (335:17): [True: 58, False: 180]
  ------------------
  336|    180|            if (angle >= 20) return 1;
  ------------------
  |  Branch (336:17): [True: 126, False: 54]
  ------------------
  337|    180|        } else if (wh <= 24) {
  ------------------
  |  Branch (337:20): [True: 68, False: 44]
  ------------------
  338|     68|            if (angle >=  4) return 3;
  ------------------
  |  Branch (338:17): [True: 66, False: 2]
  ------------------
  339|     68|        } else {
  340|     44|            return 3;
  341|     44|        }
  342|    942|    } else {
  343|    942|        if (wh <= 8) {
  ------------------
  |  Branch (343:13): [True: 106, False: 836]
  ------------------
  344|    106|            if (angle >= 56) return 1;
  ------------------
  |  Branch (344:17): [True: 74, False: 32]
  ------------------
  345|    836|        } else if (wh <= 16) {
  ------------------
  |  Branch (345:20): [True: 372, False: 464]
  ------------------
  346|    372|            if (angle >= 40) return 1;
  ------------------
  |  Branch (346:17): [True: 372, False: 0]
  ------------------
  347|    464|        } else if (wh <= 24) {
  ------------------
  |  Branch (347:20): [True: 152, False: 312]
  ------------------
  348|    152|            if (angle >= 32) return 3;
  ------------------
  |  Branch (348:17): [True: 70, False: 82]
  ------------------
  349|     82|            if (angle >= 16) return 2;
  ------------------
  |  Branch (349:17): [True: 48, False: 34]
  ------------------
  350|     34|            if (angle >=  8) return 1;
  ------------------
  |  Branch (350:17): [True: 12, False: 22]
  ------------------
  351|    312|        } else if (wh <= 32) {
  ------------------
  |  Branch (351:20): [True: 110, False: 202]
  ------------------
  352|    110|            if (angle >= 32) return 3;
  ------------------
  |  Branch (352:17): [True: 36, False: 74]
  ------------------
  353|     74|            if (angle >=  4) return 2;
  ------------------
  |  Branch (353:17): [True: 70, False: 4]
  ------------------
  354|      4|            return 1;
  355|    202|        } else {
  356|    202|            return 3;
  357|    202|        }
  358|    942|    }
  359|    110|    return 0;
  360|  1.36k|}
ipred_tmpl.c:filter_edge:
  366|  1.25k|{
  367|  1.25k|    static const uint8_t kernel[3][5] = {
  368|  1.25k|        { 0, 4, 8, 4, 0 },
  369|  1.25k|        { 0, 5, 6, 5, 0 },
  370|  1.25k|        { 2, 4, 4, 4, 2 }
  371|  1.25k|    };
  372|       |
  373|  1.25k|    assert(strength > 0);
  ------------------
  |  |  140|  1.25k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1.25k]
  |  |  |  Branch (140:68): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  374|  1.25k|    int i = 0;
  375|  1.25k|    for (; i < imin(sz, lim_from); i++)
  ------------------
  |  Branch (375:12): [True: 0, False: 1.25k]
  ------------------
  376|      0|        out[i] = in[iclip(i, from, to - 1)];
  377|  23.1k|    for (; i < imin(lim_to, sz); i++) {
  ------------------
  |  Branch (377:12): [True: 21.8k, False: 1.25k]
  ------------------
  378|  21.8k|        int s = 0;
  379|   131k|        for (int j = 0; j < 5; j++)
  ------------------
  |  Branch (379:25): [True: 109k, False: 21.8k]
  ------------------
  380|   109k|            s += in[iclip(i - 2 + j, from, to - 1)] * kernel[strength - 1][j];
  381|  21.8k|        out[i] = (s + 8) >> 4;
  382|  21.8k|    }
  383|  1.25k|    for (; i < sz; i++)
  ------------------
  |  Branch (383:12): [True: 0, False: 1.25k]
  ------------------
  384|      0|        out[i] = in[iclip(i, from, to - 1)];
  385|  1.25k|}
ipred_tmpl.c:ipred_z2_c:
  467|    702|{
  468|    702|    const int is_sm = (angle >> 9) & 0x1;
  469|    702|    const int enable_intra_edge_filter = angle >> 10;
  470|    702|    angle &= 511;
  471|    702|    assert(angle > 90 && angle < 180);
  ------------------
  |  |  140|  1.40k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 702, False: 0]
  |  |  |  Branch (140:30): [True: 702, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 702]
  |  |  ------------------
  ------------------
  472|    702|    int dy = dav1d_dr_intra_derivative[(angle - 90) >> 1];
  473|    702|    int dx = dav1d_dr_intra_derivative[(180 - angle) >> 1];
  474|    702|    const int upsample_left = enable_intra_edge_filter ?
  ------------------
  |  Branch (474:31): [True: 702, False: 0]
  ------------------
  475|    702|        get_upsample(width + height, 180 - angle, is_sm) : 0;
  476|    702|    const int upsample_above = enable_intra_edge_filter ?
  ------------------
  |  Branch (476:32): [True: 702, False: 0]
  ------------------
  477|    702|        get_upsample(width + height, angle - 90, is_sm) : 0;
  478|    702|    pixel edge[64 + 64 + 1];
  479|    702|    pixel *const topleft = &edge[64];
  480|       |
  481|    702|    if (upsample_above) {
  ------------------
  |  Branch (481:9): [True: 196, False: 506]
  ------------------
  482|    196|        upsample_edge(topleft, width + 1, topleft_in, 0, width + 1
  483|    196|                      HIGHBD_TAIL_SUFFIX);
  484|    196|        dx <<= 1;
  485|    506|    } else {
  486|    506|        const int filter_strength = enable_intra_edge_filter ?
  ------------------
  |  Branch (486:37): [True: 506, False: 0]
  ------------------
  487|    506|            get_filter_strength(width + height, angle - 90, is_sm) : 0;
  488|       |
  489|    506|        if (filter_strength) {
  ------------------
  |  Branch (489:13): [True: 484, False: 22]
  ------------------
  490|    484|            filter_edge(&topleft[1], width, 0, max_width,
  491|    484|                        &topleft_in[1], -1, width,
  492|    484|                        filter_strength);
  493|    484|        } else {
  494|     22|            pixel_copy(&topleft[1], &topleft_in[1], width);
  ------------------
  |  |   47|     22|#define pixel_copy memcpy
  ------------------
  495|     22|        }
  496|    506|    }
  497|    702|    if (upsample_left) {
  ------------------
  |  Branch (497:9): [True: 238, False: 464]
  ------------------
  498|    238|        upsample_edge(&topleft[-height * 2], height + 1, &topleft_in[-height],
  499|    238|                      0, height + 1 HIGHBD_TAIL_SUFFIX);
  500|    238|        dy <<= 1;
  501|    464|    } else {
  502|    464|        const int filter_strength = enable_intra_edge_filter ?
  ------------------
  |  Branch (502:37): [True: 464, False: 0]
  ------------------
  503|    464|            get_filter_strength(width + height, 180 - angle, is_sm) : 0;
  504|       |
  505|    464|        if (filter_strength) {
  ------------------
  |  Branch (505:13): [True: 426, False: 38]
  ------------------
  506|    426|            filter_edge(&topleft[-height], height, height - max_height, height,
  507|    426|                        &topleft_in[-height],
  508|    426|                        0, height + 1, filter_strength);
  509|    426|        } else {
  510|     38|            pixel_copy(&topleft[-height], &topleft_in[-height], height);
  ------------------
  |  |   47|     38|#define pixel_copy memcpy
  ------------------
  511|     38|        }
  512|    464|    }
  513|    702|    *topleft = *topleft_in;
  514|       |
  515|    702|    const int base_inc_x = 1 + upsample_above;
  516|    702|    const pixel *const left = &topleft[-(1 + upsample_left)];
  517|  8.19k|    for (int y = 0, xpos = ((1 + upsample_above) << 6) - dx; y < height;
  ------------------
  |  Branch (517:62): [True: 7.48k, False: 702]
  ------------------
  518|  7.48k|         y++, xpos -= dx, dst += PXSTRIDE(stride))
  ------------------
  |  |   53|  7.48k|#define PXSTRIDE(x) (x)
  ------------------
  519|  7.48k|    {
  520|  7.48k|        int base_x = xpos >> 6;
  521|  7.48k|        const int frac_x = xpos & 0x3E;
  522|       |
  523|   154k|        for (int x = 0, ypos = (y << (6 + upsample_left)) - dy; x < width;
  ------------------
  |  Branch (523:65): [True: 146k, False: 7.48k]
  ------------------
  524|   146k|             x++, base_x += base_inc_x, ypos -= dy)
  525|   146k|        {
  526|   146k|            int v;
  527|   146k|            if (base_x >= 0) {
  ------------------
  |  Branch (527:17): [True: 71.7k, False: 75.1k]
  ------------------
  528|  71.7k|                v = topleft[base_x] * (64 - frac_x) +
  529|  71.7k|                    topleft[base_x + 1] * frac_x;
  530|  75.1k|            } else {
  531|  75.1k|                const int base_y = ypos >> 6;
  532|  75.1k|                assert(base_y >= -(1 + upsample_left));
  ------------------
  |  |  140|  75.1k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 75.1k]
  |  |  |  Branch (140:68): [Folded, False: 75.1k]
  |  |  ------------------
  ------------------
  533|  75.1k|                const int frac_y = ypos & 0x3E;
  534|  75.1k|                v = left[-base_y] * (64 - frac_y) +
  535|  75.1k|                    left[-(base_y + 1)] * frac_y;
  536|  75.1k|            }
  537|   146k|            dst[x] = (v + 32) >> 6;
  538|   146k|        }
  539|  7.48k|    }
  540|    702|}
ipred_tmpl.c:ipred_z3_c:
  547|    434|{
  548|    434|    const int is_sm = (angle >> 9) & 0x1;
  549|    434|    const int enable_intra_edge_filter = angle >> 10;
  550|    434|    angle &= 511;
  551|    434|    assert(angle > 180);
  ------------------
  |  |  140|    434|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 434]
  |  |  |  Branch (140:68): [Folded, False: 434]
  |  |  ------------------
  ------------------
  552|    434|    int dy = dav1d_dr_intra_derivative[(270 - angle) >> 1];
  553|    434|    pixel left_out[64 + 64];
  554|    434|    const pixel *left;
  555|    434|    int max_base_y;
  556|    434|    const int upsample_left = enable_intra_edge_filter ?
  ------------------
  |  Branch (556:31): [True: 434, False: 0]
  ------------------
  557|    434|        get_upsample(width + height, angle - 180, is_sm) : 0;
  558|    434|    if (upsample_left) {
  ------------------
  |  Branch (558:9): [True: 302, False: 132]
  ------------------
  559|    302|        upsample_edge(left_out, width + height,
  560|    302|                      &topleft_in[-(width + height)],
  561|    302|                      imax(width - height, 0), width + height + 1
  562|    302|                      HIGHBD_TAIL_SUFFIX);
  563|    302|        left = &left_out[2 * (width + height) - 2];
  564|    302|        max_base_y = 2 * (width + height) - 2;
  565|    302|        dy <<= 1;
  566|    302|    } else {
  567|    132|        const int filter_strength = enable_intra_edge_filter ?
  ------------------
  |  Branch (567:37): [True: 132, False: 0]
  ------------------
  568|    132|            get_filter_strength(width + height, angle - 180, is_sm) : 0;
  569|       |
  570|    132|        if (filter_strength) {
  ------------------
  |  Branch (570:13): [True: 106, False: 26]
  ------------------
  571|    106|            filter_edge(left_out, width + height, 0, width + height,
  572|    106|                        &topleft_in[-(width + height)],
  573|    106|                        imax(width - height, 0), width + height + 1,
  574|    106|                        filter_strength);
  575|    106|            left = &left_out[width + height - 1];
  576|    106|            max_base_y = width + height - 1;
  577|    106|        } else {
  578|     26|            left = &topleft_in[-1];
  579|     26|            max_base_y = height + imin(width, height) - 1;
  580|     26|        }
  581|    132|    }
  582|    434|    const int base_inc = 1 + upsample_left;
  583|  4.37k|    for (int x = 0, ypos = dy; x < width; x++, ypos += dy) {
  ------------------
  |  Branch (583:32): [True: 3.93k, False: 434]
  ------------------
  584|  3.93k|        const int frac = ypos & 0x3E;
  585|       |
  586|  47.1k|        for (int y = 0, base = ypos >> 6; y < height; y++, base += base_inc) {
  ------------------
  |  Branch (586:43): [True: 43.1k, False: 3.93k]
  ------------------
  587|  43.1k|            if (base < max_base_y) {
  ------------------
  |  Branch (587:17): [True: 43.1k, False: 0]
  ------------------
  588|  43.1k|                const int v = left[-base] * (64 - frac) +
  589|  43.1k|                              left[-(base + 1)] * frac;
  590|  43.1k|                dst[y * PXSTRIDE(stride) + x] = (v + 32) >> 6;
  ------------------
  |  |   53|  43.1k|#define PXSTRIDE(x) (x)
  ------------------
  591|  43.1k|            } else {
  592|      0|                do {
  593|      0|                    dst[y * PXSTRIDE(stride) + x] = left[-max_base_y];
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  594|      0|                } while (++y < height);
  ------------------
  |  Branch (594:26): [True: 0, False: 0]
  ------------------
  595|      0|                break;
  596|      0|            }
  597|  43.1k|        }
  598|  3.93k|    }
  599|    434|}
ipred_tmpl.c:ipred_filter_c:
  623|    680|{
  624|    680|    filt_idx &= 511;
  625|    680|    assert(filt_idx < 5);
  ------------------
  |  |  140|    680|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 680]
  |  |  |  Branch (140:68): [Folded, False: 680]
  |  |  ------------------
  ------------------
  626|       |
  627|    680|    const int8_t *const filter = dav1d_filter_intra_taps[filt_idx];
  628|    680|    const pixel *top = &topleft_in[1];
  629|  3.03k|    for (int y = 0; y < height; y += 2) {
  ------------------
  |  Branch (629:21): [True: 2.35k, False: 680]
  ------------------
  630|  2.35k|        const pixel *topleft = &topleft_in[-y];
  631|  2.35k|        const pixel *left = &topleft[-1];
  632|  2.35k|        ptrdiff_t left_stride = -1;
  633|  7.51k|        for (int x = 0; x < width; x += 4) {
  ------------------
  |  Branch (633:25): [True: 5.16k, False: 2.35k]
  ------------------
  634|  5.16k|            const int p0 = *topleft;
  635|  5.16k|            const int p1 = top[0], p2 = top[1], p3 = top[2], p4 = top[3];
  636|  5.16k|            const int p5 = left[0 * left_stride], p6 = left[1 * left_stride];
  637|  5.16k|            pixel *ptr = &dst[x];
  638|  5.16k|            const int8_t *flt_ptr = filter;
  639|       |
  640|  15.4k|            for (int yy = 0; yy < 2; yy++) {
  ------------------
  |  Branch (640:30): [True: 10.3k, False: 5.16k]
  ------------------
  641|  51.6k|                for (int xx = 0; xx < 4; xx++, flt_ptr += FLT_INCR) {
  ------------------
  |  |  607|  41.2k|#define FLT_INCR 2
  ------------------
  |  Branch (641:34): [True: 41.2k, False: 10.3k]
  ------------------
  642|  41.2k|                    const int acc = FILTER(flt_ptr, p0, p1, p2, p3, p4, p5, p6);
  ------------------
  |  |  603|  41.2k|    flt_ptr[ 0] * p0 + flt_ptr[ 1] * p1 +           \
  |  |  604|  41.2k|    flt_ptr[16] * p2 + flt_ptr[17] * p3 +           \
  |  |  605|  41.2k|    flt_ptr[32] * p4 + flt_ptr[33] * p5 +           \
  |  |  606|  41.2k|    flt_ptr[48] * p6
  ------------------
  643|  41.2k|                    ptr[xx] = iclip_pixel((acc + 8) >> 4);
  ------------------
  |  |   49|  41.2k|#define iclip_pixel iclip_u8
  ------------------
  644|  41.2k|                }
  645|  10.3k|                ptr += PXSTRIDE(stride);
  ------------------
  |  |   53|  10.3k|#define PXSTRIDE(x) (x)
  ------------------
  646|  10.3k|            }
  647|  5.16k|            left = &dst[x + 4 - 1];
  648|  5.16k|            left_stride = PXSTRIDE(stride);
  ------------------
  |  |   53|  5.16k|#define PXSTRIDE(x) (x)
  ------------------
  649|  5.16k|            top += 4;
  650|  5.16k|            topleft = &top[-1];
  651|  5.16k|        }
  652|  2.35k|        top = &dst[PXSTRIDE(stride)];
  ------------------
  |  |   53|  2.35k|#define PXSTRIDE(x) (x)
  ------------------
  653|  2.35k|        dst = &dst[PXSTRIDE(stride) * 2];
  ------------------
  |  |   53|  2.35k|#define PXSTRIDE(x) (x)
  ------------------
  654|  2.35k|    }
  655|    680|}
ipred_tmpl.c:cfl_ac_420_c:
  708|    222|                             const int h_pad, const int cw, const int ch) \
  709|    222|{ \
  710|    222|    cfl_ac_c(ac, ypx, stride, w_pad, h_pad, cw, ch, ss_hor, ss_ver); \
  711|    222|}
ipred_tmpl.c:cfl_ac_c:
  661|    222|{
  662|    222|    int y, x;
  663|    222|    int16_t *const ac_orig = ac;
  664|       |
  665|    222|    assert(w_pad >= 0 && w_pad * 4 < width);
  ------------------
  |  |  140|    444|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 222]
  |  |  ------------------
  ------------------
  666|    222|    assert(h_pad >= 0 && h_pad * 4 < height);
  ------------------
  |  |  140|    444|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 222]
  |  |  ------------------
  ------------------
  667|       |
  668|  1.79k|    for (y = 0; y < height - 4 * h_pad; y++) {
  ------------------
  |  Branch (668:17): [True: 1.56k, False: 222]
  ------------------
  669|  13.9k|        for (x = 0; x < width - 4 * w_pad; x++) {
  ------------------
  |  Branch (669:21): [True: 12.4k, False: 1.56k]
  ------------------
  670|  12.4k|            int ac_sum = ypx[x << ss_hor];
  671|  12.4k|            if (ss_hor) ac_sum += ypx[x * 2 + 1];
  ------------------
  |  Branch (671:17): [True: 12.4k, False: 0]
  ------------------
  672|  12.4k|            if (ss_ver) {
  ------------------
  |  Branch (672:17): [True: 12.4k, False: 0]
  ------------------
  673|  12.4k|                ac_sum += ypx[(x << ss_hor) + PXSTRIDE(stride)];
  ------------------
  |  |   53|  12.4k|#define PXSTRIDE(x) (x)
  ------------------
  674|  12.4k|                if (ss_hor) ac_sum += ypx[x * 2 + 1 + PXSTRIDE(stride)];
  ------------------
  |  |   53|  12.4k|#define PXSTRIDE(x) (x)
  ------------------
  |  Branch (674:21): [True: 12.4k, False: 0]
  ------------------
  675|  12.4k|            }
  676|  12.4k|            ac[x] = ac_sum << (1 + !ss_ver + !ss_hor);
  677|  12.4k|        }
  678|  1.56k|        for (; x < width; x++)
  ------------------
  |  Branch (678:16): [True: 0, False: 1.56k]
  ------------------
  679|      0|            ac[x] = ac[x - 1];
  680|  1.56k|        ac += width;
  681|  1.56k|        ypx += PXSTRIDE(stride) << ss_ver;
  ------------------
  |  |   53|  1.56k|#define PXSTRIDE(x) (x)
  ------------------
  682|  1.56k|    }
  683|    222|    for (; y < height; y++) {
  ------------------
  |  Branch (683:12): [True: 0, False: 222]
  ------------------
  684|      0|        memcpy(ac, &ac[-width], width * sizeof(*ac));
  685|      0|        ac += width;
  686|      0|    }
  687|       |
  688|    222|    const int log2sz = ctz(width) + ctz(height);
  689|    222|    int sum = (1 << log2sz) >> 1;
  690|  1.79k|    for (ac = ac_orig, y = 0; y < height; y++) {
  ------------------
  |  Branch (690:31): [True: 1.56k, False: 222]
  ------------------
  691|  13.9k|        for (x = 0; x < width; x++)
  ------------------
  |  Branch (691:21): [True: 12.4k, False: 1.56k]
  ------------------
  692|  12.4k|            sum += ac[x];
  693|  1.56k|        ac += width;
  694|  1.56k|    }
  695|    222|    sum >>= log2sz;
  696|       |
  697|       |    // subtract DC
  698|  1.79k|    for (ac = ac_orig, y = 0; y < height; y++) {
  ------------------
  |  Branch (698:31): [True: 1.56k, False: 222]
  ------------------
  699|  13.9k|        for (x = 0; x < width; x++)
  ------------------
  |  Branch (699:21): [True: 12.4k, False: 1.56k]
  ------------------
  700|  12.4k|            ac[x] -= sum;
  701|  1.56k|        ac += width;
  702|  1.56k|    }
  703|    222|}
ipred_tmpl.c:ipred_cfl_c:
  183|    330|{
  184|    330|    unsigned dc = dc_gen(topleft, width, height);
  185|    330|    cfl_pred(dst, stride, width, height, dc, ac, alpha HIGHBD_TAIL_SUFFIX);
  186|    330|}
ipred_tmpl.c:cfl_pred:
   75|    366|{
   76|  2.99k|    for (int y = 0; y < height; y++) {
  ------------------
  |  Branch (76:21): [True: 2.62k, False: 366]
  ------------------
   77|  23.3k|        for (int x = 0; x < width; x++) {
  ------------------
  |  Branch (77:25): [True: 20.7k, False: 2.62k]
  ------------------
   78|  20.7k|            const int diff = alpha * ac[x];
   79|  20.7k|            dst[x] = iclip_pixel(dc + apply_sign((abs(diff) + 32) >> 6, diff));
  ------------------
  |  |   49|  20.7k|#define iclip_pixel iclip_u8
  ------------------
   80|  20.7k|        }
   81|  2.62k|        ac += width;
   82|  2.62k|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|  2.62k|#define PXSTRIDE(x) (x)
  ------------------
   83|  2.62k|    }
   84|    366|}
ipred_tmpl.c:ipred_cfl_left_c:
  135|     36|{
  136|     36|    const unsigned dc = dc_gen_left(topleft, height);
  137|     36|    cfl_pred(dst, stride, width, height, dc, ac, alpha HIGHBD_TAIL_SUFFIX);
  138|     36|}
ipred_tmpl.c:pal_pred_c:
  720|     12|{
  721|    140|    for (int y = 0; y < h; y++) {
  ------------------
  |  Branch (721:21): [True: 128, False: 12]
  ------------------
  722|  1.53k|        for (int x = 0; x < w; x += 2) {
  ------------------
  |  Branch (722:25): [True: 1.40k, False: 128]
  ------------------
  723|  1.40k|            const int i = *idx++;
  724|  1.40k|            assert(!(i & 0x88));
  ------------------
  |  |  140|  1.40k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1.40k]
  |  |  |  Branch (140:68): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
  725|  1.40k|            dst[x + 0] = pal[i & 7];
  726|  1.40k|            dst[x + 1] = pal[i >> 4];
  727|  1.40k|        }
  728|    128|        dst += PXSTRIDE(stride);
  ------------------
  |  |   53|    128|#define PXSTRIDE(x) (x)
  ------------------
  729|    128|    }
  730|     12|}

itx_1d.c:inv_dct4_1d_c:
   94|  2.27k|{
   95|  2.27k|    inv_dct4_1d_internal_c(c, stride, min, max, 0);
   96|  2.27k|}
itx_1d.c:inv_dct4_1d_internal_c:
   68|  15.7k|{
   69|  15.7k|    assert(stride > 0);
  ------------------
  |  |  140|  15.7k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 15.7k]
  |  |  |  Branch (140:68): [Folded, False: 15.7k]
  |  |  ------------------
  ------------------
   70|  15.7k|    const int in0 = c[0 * stride], in1 = c[1 * stride];
   71|       |
   72|  15.7k|    int t0, t1, t2, t3;
   73|  15.7k|    if (tx64) {
  ------------------
  |  Branch (73:9): [True: 2.66k, False: 13.0k]
  ------------------
   74|  2.66k|        t0 = t1 = (in0 * 181 + 128) >> 8;
   75|  2.66k|        t2 = (in1 * 1567 + 2048) >> 12;
   76|  2.66k|        t3 = (in1 * 3784 + 2048) >> 12;
   77|  13.0k|    } else {
   78|  13.0k|        const int in2 = c[2 * stride], in3 = c[3 * stride];
   79|       |
   80|  13.0k|        t0 = ((in0 + in2) * 181 + 128) >> 8;
   81|  13.0k|        t1 = ((in0 - in2) * 181 + 128) >> 8;
   82|  13.0k|        t2 = ((in1 *  1567         - in3 * (3784 - 4096) + 2048) >> 12) - in3;
   83|  13.0k|        t3 = ((in1 * (3784 - 4096) + in3 *  1567         + 2048) >> 12) + in1;
   84|  13.0k|    }
   85|       |
   86|  15.7k|    c[0 * stride] = CLIP(t0 + t3);
  ------------------
  |  |   37|  15.7k|#define CLIP(a) iclip(a, min, max)
  ------------------
   87|  15.7k|    c[1 * stride] = CLIP(t1 + t2);
  ------------------
  |  |   37|  15.7k|#define CLIP(a) iclip(a, min, max)
  ------------------
   88|  15.7k|    c[2 * stride] = CLIP(t1 - t2);
  ------------------
  |  |   37|  15.7k|#define CLIP(a) iclip(a, min, max)
  ------------------
   89|  15.7k|    c[3 * stride] = CLIP(t0 - t3);
  ------------------
  |  |   37|  15.7k|#define CLIP(a) iclip(a, min, max)
  ------------------
   90|  15.7k|}
itx_1d.c:inv_adst4_1d_c:
  966|  2.55k|                                const int min, const int max) \
  967|  2.55k|{ \
  968|  2.55k|    inv_adst##sz##_1d_internal_c(c, stride, min, max, c, stride); \
  969|  2.55k|} \
itx_1d.c:inv_adst4_1d_internal_c:
  787|  2.62k|{
  788|  2.62k|    assert(in_s > 0 && out_s != 0);
  ------------------
  |  |  140|  5.25k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 2.62k, False: 0]
  |  |  |  Branch (140:30): [True: 2.62k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 2.62k]
  |  |  ------------------
  ------------------
  789|  2.62k|    const int in0 = in[0 * in_s], in1 = in[1 * in_s];
  790|  2.62k|    const int in2 = in[2 * in_s], in3 = in[3 * in_s];
  791|       |
  792|  2.62k|    out[0 * out_s] = (( 1321         * in0 + (3803 - 4096) * in2 +
  793|  2.62k|                       (2482 - 4096) * in3 + (3344 - 4096) * in1 + 2048) >> 12) +
  794|  2.62k|                     in2 + in3 + in1;
  795|  2.62k|    out[1 * out_s] = (((2482 - 4096) * in0 -  1321         * in2 -
  796|  2.62k|                       (3803 - 4096) * in3 + (3344 - 4096) * in1 + 2048) >> 12) +
  797|  2.62k|                     in0 - in3 + in1;
  798|  2.62k|    out[2 * out_s] = (209 * (in0 - in2 + in3) + 128) >> 8;
  799|  2.62k|    out[3 * out_s] = (((3803 - 4096) * in0 + (2482 - 4096) * in2 -
  800|  2.62k|                        1321         * in3 - (3344 - 4096) * in1 + 2048) >> 12) +
  801|  2.62k|                     in0 + in2 - in1;
  802|  2.62k|}
itx_1d.c:inv_identity4_1d_c:
  985|    714|{
  986|    714|    assert(stride > 0);
  ------------------
  |  |  140|    714|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 714]
  |  |  |  Branch (140:68): [Folded, False: 714]
  |  |  ------------------
  ------------------
  987|  3.57k|    for (int i = 0; i < 4; i++) {
  ------------------
  |  Branch (987:21): [True: 2.85k, False: 714]
  ------------------
  988|  2.85k|        const int in = c[stride * i];
  989|  2.85k|        c[stride * i] = in + ((in * 1697 + 2048) >> 12);
  990|  2.85k|    }
  991|    714|}
itx_1d.c:inv_flipadst4_1d_c:
  971|     76|                                          const int min, const int max) \
  972|     76|{ \
  973|     76|    inv_adst##sz##_1d_internal_c(c, stride, min, max, \
  974|     76|                                 &c[(sz - 1) * stride], -stride); \
  975|     76|}
itx_1d.c:inv_dct8_1d_c:
  147|  5.86k|{
  148|  5.86k|    inv_dct8_1d_internal_c(c, stride, min, max, 0);
  149|  5.86k|}
itx_1d.c:inv_dct8_1d_internal_c:
  101|  13.4k|{
  102|  13.4k|    assert(stride > 0);
  ------------------
  |  |  140|  13.4k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 13.4k]
  |  |  |  Branch (140:68): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
  103|  13.4k|    inv_dct4_1d_internal_c(c, stride << 1, min, max, tx64);
  104|       |
  105|  13.4k|    const int in1 = c[1 * stride], in3 = c[3 * stride];
  106|       |
  107|  13.4k|    int t4a, t5a, t6a, t7a;
  108|  13.4k|    if (tx64) {
  ------------------
  |  Branch (108:9): [True: 2.66k, False: 10.7k]
  ------------------
  109|  2.66k|        t4a = (in1 *   799 + 2048) >> 12;
  110|  2.66k|        t5a = (in3 * -2276 + 2048) >> 12;
  111|  2.66k|        t6a = (in3 *  3406 + 2048) >> 12;
  112|  2.66k|        t7a = (in1 *  4017 + 2048) >> 12;
  113|  10.7k|    } else {
  114|  10.7k|        const int in5 = c[5 * stride], in7 = c[7 * stride];
  115|       |
  116|  10.7k|        t4a = ((in1 *   799         - in7 * (4017 - 4096) + 2048) >> 12) - in7;
  117|  10.7k|        t5a =  (in5 *  1703         - in3 *  1138         + 1024) >> 11;
  118|  10.7k|        t6a =  (in5 *  1138         + in3 *  1703         + 1024) >> 11;
  119|  10.7k|        t7a = ((in1 * (4017 - 4096) + in7 *  799          + 2048) >> 12) + in1;
  120|  10.7k|    }
  121|       |
  122|  13.4k|    const int t4  = CLIP(t4a + t5a);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  123|  13.4k|              t5a = CLIP(t4a - t5a);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  124|  13.4k|    const int t7  = CLIP(t7a + t6a);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  125|  13.4k|              t6a = CLIP(t7a - t6a);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  126|       |
  127|  13.4k|    const int t5  = ((t6a - t5a) * 181 + 128) >> 8;
  128|  13.4k|    const int t6  = ((t6a + t5a) * 181 + 128) >> 8;
  129|       |
  130|  13.4k|    const int t0 = c[0 * stride];
  131|  13.4k|    const int t1 = c[2 * stride];
  132|  13.4k|    const int t2 = c[4 * stride];
  133|  13.4k|    const int t3 = c[6 * stride];
  134|       |
  135|  13.4k|    c[0 * stride] = CLIP(t0 + t7);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  136|  13.4k|    c[1 * stride] = CLIP(t1 + t6);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  137|  13.4k|    c[2 * stride] = CLIP(t2 + t5);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  138|  13.4k|    c[3 * stride] = CLIP(t3 + t4);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  139|  13.4k|    c[4 * stride] = CLIP(t3 - t4);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  140|  13.4k|    c[5 * stride] = CLIP(t2 - t5);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  141|  13.4k|    c[6 * stride] = CLIP(t1 - t6);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  142|  13.4k|    c[7 * stride] = CLIP(t0 - t7);
  ------------------
  |  |   37|  13.4k|#define CLIP(a) iclip(a, min, max)
  ------------------
  143|  13.4k|}
itx_1d.c:inv_adst8_1d_c:
  966|  4.48k|                                const int min, const int max) \
  967|  4.48k|{ \
  968|  4.48k|    inv_adst##sz##_1d_internal_c(c, stride, min, max, c, stride); \
  969|  4.48k|} \
itx_1d.c:inv_adst8_1d_internal_c:
  808|  4.62k|{
  809|  4.62k|    assert(in_s > 0 && out_s != 0);
  ------------------
  |  |  140|  9.24k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 4.62k, False: 0]
  |  |  |  Branch (140:30): [True: 4.62k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 4.62k]
  |  |  ------------------
  ------------------
  810|  4.62k|    const int in0 = in[0 * in_s], in1 = in[1 * in_s];
  811|  4.62k|    const int in2 = in[2 * in_s], in3 = in[3 * in_s];
  812|  4.62k|    const int in4 = in[4 * in_s], in5 = in[5 * in_s];
  813|  4.62k|    const int in6 = in[6 * in_s], in7 = in[7 * in_s];
  814|       |
  815|  4.62k|    const int t0a = (((4076 - 4096) * in7 +   401         * in0 + 2048) >> 12) + in7;
  816|  4.62k|    const int t1a = ((  401         * in7 - (4076 - 4096) * in0 + 2048) >> 12) - in0;
  817|  4.62k|    const int t2a = (((3612 - 4096) * in5 +  1931         * in2 + 2048) >> 12) + in5;
  818|  4.62k|    const int t3a = (( 1931         * in5 - (3612 - 4096) * in2 + 2048) >> 12) - in2;
  819|  4.62k|          int t4a =  ( 1299         * in3 +  1583         * in4 + 1024) >> 11;
  820|  4.62k|          int t5a =  ( 1583         * in3 -  1299         * in4 + 1024) >> 11;
  821|  4.62k|          int t6a = (( 1189         * in1 + (3920 - 4096) * in6 + 2048) >> 12) + in6;
  822|  4.62k|          int t7a = (((3920 - 4096) * in1 -  1189         * in6 + 2048) >> 12) + in1;
  823|       |
  824|  4.62k|    const int t0 = CLIP(t0a + t4a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  825|  4.62k|    const int t1 = CLIP(t1a + t5a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  826|  4.62k|          int t2 = CLIP(t2a + t6a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  827|  4.62k|          int t3 = CLIP(t3a + t7a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  828|  4.62k|    const int t4 = CLIP(t0a - t4a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  829|  4.62k|    const int t5 = CLIP(t1a - t5a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  830|  4.62k|          int t6 = CLIP(t2a - t6a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  831|  4.62k|          int t7 = CLIP(t3a - t7a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  832|       |
  833|  4.62k|    t4a = (((3784 - 4096) * t4 +  1567         * t5 + 2048) >> 12) + t4;
  834|  4.62k|    t5a = (( 1567         * t4 - (3784 - 4096) * t5 + 2048) >> 12) - t5;
  835|  4.62k|    t6a = (((3784 - 4096) * t7 -  1567         * t6 + 2048) >> 12) + t7;
  836|  4.62k|    t7a = (( 1567         * t7 + (3784 - 4096) * t6 + 2048) >> 12) + t6;
  837|       |
  838|  4.62k|    out[0 * out_s] =  CLIP(t0  + t2 );
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  839|  4.62k|    out[7 * out_s] = -CLIP(t1  + t3 );
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  840|  4.62k|    t2             =  CLIP(t0  - t2 );
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  841|  4.62k|    t3             =  CLIP(t1  - t3 );
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  842|  4.62k|    out[1 * out_s] = -CLIP(t4a + t6a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  843|  4.62k|    out[6 * out_s] =  CLIP(t5a + t7a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  844|  4.62k|    t6             =  CLIP(t4a - t6a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  845|  4.62k|    t7             =  CLIP(t5a - t7a);
  ------------------
  |  |   37|  4.62k|#define CLIP(a) iclip(a, min, max)
  ------------------
  846|       |
  847|  4.62k|    out[3 * out_s] = -(((t2 + t3) * 181 + 128) >> 8);
  848|  4.62k|    out[4 * out_s] =   ((t2 - t3) * 181 + 128) >> 8;
  849|  4.62k|    out[2 * out_s] =   ((t6 + t7) * 181 + 128) >> 8;
  850|  4.62k|    out[5 * out_s] = -(((t6 - t7) * 181 + 128) >> 8);
  851|  4.62k|}
itx_1d.c:inv_identity8_1d_c:
  995|    918|{
  996|    918|    assert(stride > 0);
  ------------------
  |  |  140|    918|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 918]
  |  |  |  Branch (140:68): [Folded, False: 918]
  |  |  ------------------
  ------------------
  997|  8.26k|    for (int i = 0; i < 8; i++)
  ------------------
  |  Branch (997:21): [True: 7.34k, False: 918]
  ------------------
  998|  7.34k|        c[stride * i] *= 2;
  999|    918|}
itx_1d.c:inv_flipadst8_1d_c:
  971|    132|                                          const int min, const int max) \
  972|    132|{ \
  973|    132|    inv_adst##sz##_1d_internal_c(c, stride, min, max, \
  974|    132|                                 &c[(sz - 1) * stride], -stride); \
  975|    132|}
itx_1d.c:inv_dct16_1d_c:
  242|  3.40k|{
  243|  3.40k|    inv_dct16_1d_internal_c(c, stride, min, max, 0);
  244|  3.40k|}
itx_1d.c:inv_dct16_1d_internal_c:
  154|  7.57k|{
  155|  7.57k|    assert(stride > 0);
  ------------------
  |  |  140|  7.57k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 7.57k]
  |  |  |  Branch (140:68): [Folded, False: 7.57k]
  |  |  ------------------
  ------------------
  156|  7.57k|    inv_dct8_1d_internal_c(c, stride << 1, min, max, tx64);
  157|       |
  158|  7.57k|    const int in1 = c[1 * stride], in3 = c[3 * stride];
  159|  7.57k|    const int in5 = c[5 * stride], in7 = c[7 * stride];
  160|       |
  161|  7.57k|    int t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
  162|  7.57k|    if (tx64) {
  ------------------
  |  Branch (162:9): [True: 2.66k, False: 4.91k]
  ------------------
  163|  2.66k|        t8a  = (in1 *   401 + 2048) >> 12;
  164|  2.66k|        t9a  = (in7 * -2598 + 2048) >> 12;
  165|  2.66k|        t10a = (in5 *  1931 + 2048) >> 12;
  166|  2.66k|        t11a = (in3 * -1189 + 2048) >> 12;
  167|  2.66k|        t12a = (in3 *  3920 + 2048) >> 12;
  168|  2.66k|        t13a = (in5 *  3612 + 2048) >> 12;
  169|  2.66k|        t14a = (in7 *  3166 + 2048) >> 12;
  170|  2.66k|        t15a = (in1 *  4076 + 2048) >> 12;
  171|  4.91k|    } else {
  172|  4.91k|        const int in9  = c[ 9 * stride], in11 = c[11 * stride];
  173|  4.91k|        const int in13 = c[13 * stride], in15 = c[15 * stride];
  174|       |
  175|  4.91k|        t8a  = ((in1  *   401         - in15 * (4076 - 4096) + 2048) >> 12) - in15;
  176|  4.91k|        t9a  =  (in9  *  1583         - in7  *  1299         + 1024) >> 11;
  177|  4.91k|        t10a = ((in5  *  1931         - in11 * (3612 - 4096) + 2048) >> 12) - in11;
  178|  4.91k|        t11a = ((in13 * (3920 - 4096) - in3  *  1189         + 2048) >> 12) + in13;
  179|  4.91k|        t12a = ((in13 *  1189         + in3  * (3920 - 4096) + 2048) >> 12) + in3;
  180|  4.91k|        t13a = ((in5  * (3612 - 4096) + in11 *  1931         + 2048) >> 12) + in5;
  181|  4.91k|        t14a =  (in9  *  1299         + in7  *  1583         + 1024) >> 11;
  182|  4.91k|        t15a = ((in1  * (4076 - 4096) + in15 *   401         + 2048) >> 12) + in1;
  183|  4.91k|    }
  184|       |
  185|  7.57k|    int t8  = CLIP(t8a  + t9a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  186|  7.57k|    int t9  = CLIP(t8a  - t9a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  187|  7.57k|    int t10 = CLIP(t11a - t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  188|  7.57k|    int t11 = CLIP(t11a + t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  189|  7.57k|    int t12 = CLIP(t12a + t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  190|  7.57k|    int t13 = CLIP(t12a - t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  191|  7.57k|    int t14 = CLIP(t15a - t14a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  192|  7.57k|    int t15 = CLIP(t15a + t14a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  193|       |
  194|  7.57k|    t9a  = ((  t14 *  1567         - t9  * (3784 - 4096)  + 2048) >> 12) - t9;
  195|  7.57k|    t14a = ((  t14 * (3784 - 4096) + t9  *  1567          + 2048) >> 12) + t14;
  196|  7.57k|    t10a = ((-(t13 * (3784 - 4096) + t10 *  1567)         + 2048) >> 12) - t13;
  197|  7.57k|    t13a = ((  t13 *  1567         - t10 * (3784 - 4096)  + 2048) >> 12) - t10;
  198|       |
  199|  7.57k|    t8a  = CLIP(t8   + t11);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  200|  7.57k|    t9   = CLIP(t9a  + t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  201|  7.57k|    t10  = CLIP(t9a  - t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  202|  7.57k|    t11a = CLIP(t8   - t11);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  203|  7.57k|    t12a = CLIP(t15  - t12);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  204|  7.57k|    t13  = CLIP(t14a - t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  205|  7.57k|    t14  = CLIP(t14a + t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  206|  7.57k|    t15a = CLIP(t15  + t12);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  207|       |
  208|  7.57k|    t10a = ((t13  - t10)  * 181 + 128) >> 8;
  209|  7.57k|    t13a = ((t13  + t10)  * 181 + 128) >> 8;
  210|  7.57k|    t11  = ((t12a - t11a) * 181 + 128) >> 8;
  211|  7.57k|    t12  = ((t12a + t11a) * 181 + 128) >> 8;
  212|       |
  213|  7.57k|    const int t0 = c[ 0 * stride];
  214|  7.57k|    const int t1 = c[ 2 * stride];
  215|  7.57k|    const int t2 = c[ 4 * stride];
  216|  7.57k|    const int t3 = c[ 6 * stride];
  217|  7.57k|    const int t4 = c[ 8 * stride];
  218|  7.57k|    const int t5 = c[10 * stride];
  219|  7.57k|    const int t6 = c[12 * stride];
  220|  7.57k|    const int t7 = c[14 * stride];
  221|       |
  222|  7.57k|    c[ 0 * stride] = CLIP(t0 + t15a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  223|  7.57k|    c[ 1 * stride] = CLIP(t1 + t14);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  224|  7.57k|    c[ 2 * stride] = CLIP(t2 + t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  225|  7.57k|    c[ 3 * stride] = CLIP(t3 + t12);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  226|  7.57k|    c[ 4 * stride] = CLIP(t4 + t11);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  227|  7.57k|    c[ 5 * stride] = CLIP(t5 + t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  228|  7.57k|    c[ 6 * stride] = CLIP(t6 + t9);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  229|  7.57k|    c[ 7 * stride] = CLIP(t7 + t8a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  230|  7.57k|    c[ 8 * stride] = CLIP(t7 - t8a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  231|  7.57k|    c[ 9 * stride] = CLIP(t6 - t9);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  232|  7.57k|    c[10 * stride] = CLIP(t5 - t10a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  233|  7.57k|    c[11 * stride] = CLIP(t4 - t11);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  234|  7.57k|    c[12 * stride] = CLIP(t3 - t12);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  235|  7.57k|    c[13 * stride] = CLIP(t2 - t13a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  236|  7.57k|    c[14 * stride] = CLIP(t1 - t14);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  237|  7.57k|    c[15 * stride] = CLIP(t0 - t15a);
  ------------------
  |  |   37|  7.57k|#define CLIP(a) iclip(a, min, max)
  ------------------
  238|  7.57k|}
itx_1d.c:inv_adst16_1d_c:
  966|  2.66k|                                const int min, const int max) \
  967|  2.66k|{ \
  968|  2.66k|    inv_adst##sz##_1d_internal_c(c, stride, min, max, c, stride); \
  969|  2.66k|} \
itx_1d.c:inv_adst16_1d_internal_c:
  857|  2.77k|{
  858|  2.77k|    assert(in_s > 0 && out_s != 0);
  ------------------
  |  |  140|  5.54k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 2.77k, False: 0]
  |  |  |  Branch (140:30): [True: 2.77k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 2.77k]
  |  |  ------------------
  ------------------
  859|  2.77k|    const int in0  = in[ 0 * in_s], in1  = in[ 1 * in_s];
  860|  2.77k|    const int in2  = in[ 2 * in_s], in3  = in[ 3 * in_s];
  861|  2.77k|    const int in4  = in[ 4 * in_s], in5  = in[ 5 * in_s];
  862|  2.77k|    const int in6  = in[ 6 * in_s], in7  = in[ 7 * in_s];
  863|  2.77k|    const int in8  = in[ 8 * in_s], in9  = in[ 9 * in_s];
  864|  2.77k|    const int in10 = in[10 * in_s], in11 = in[11 * in_s];
  865|  2.77k|    const int in12 = in[12 * in_s], in13 = in[13 * in_s];
  866|  2.77k|    const int in14 = in[14 * in_s], in15 = in[15 * in_s];
  867|       |
  868|  2.77k|    int t0  = ((in15 * (4091 - 4096) + in0  *   201         + 2048) >> 12) + in15;
  869|  2.77k|    int t1  = ((in15 *   201         - in0  * (4091 - 4096) + 2048) >> 12) - in0;
  870|  2.77k|    int t2  = ((in13 * (3973 - 4096) + in2  *   995         + 2048) >> 12) + in13;
  871|  2.77k|    int t3  = ((in13 *   995         - in2  * (3973 - 4096) + 2048) >> 12) - in2;
  872|  2.77k|    int t4  = ((in11 * (3703 - 4096) + in4  *  1751         + 2048) >> 12) + in11;
  873|  2.77k|    int t5  = ((in11 *  1751         - in4  * (3703 - 4096) + 2048) >> 12) - in4;
  874|  2.77k|    int t6  =  (in9  *  1645         + in6  *  1220         + 1024) >> 11;
  875|  2.77k|    int t7  =  (in9  *  1220         - in6  *  1645         + 1024) >> 11;
  876|  2.77k|    int t8  = ((in7  *  2751         + in8  * (3035 - 4096) + 2048) >> 12) + in8;
  877|  2.77k|    int t9  = ((in7  * (3035 - 4096) - in8  *  2751         + 2048) >> 12) + in7;
  878|  2.77k|    int t10 = ((in5  *  2106         + in10 * (3513 - 4096) + 2048) >> 12) + in10;
  879|  2.77k|    int t11 = ((in5  * (3513 - 4096) - in10 *  2106         + 2048) >> 12) + in5;
  880|  2.77k|    int t12 = ((in3  *  1380         + in12 * (3857 - 4096) + 2048) >> 12) + in12;
  881|  2.77k|    int t13 = ((in3  * (3857 - 4096) - in12 *  1380         + 2048) >> 12) + in3;
  882|  2.77k|    int t14 = ((in1  *   601         + in14 * (4052 - 4096) + 2048) >> 12) + in14;
  883|  2.77k|    int t15 = ((in1  * (4052 - 4096) - in14 *   601         + 2048) >> 12) + in1;
  884|       |
  885|  2.77k|    int t0a  = CLIP(t0 + t8 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  886|  2.77k|    int t1a  = CLIP(t1 + t9 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  887|  2.77k|    int t2a  = CLIP(t2 + t10);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  888|  2.77k|    int t3a  = CLIP(t3 + t11);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  889|  2.77k|    int t4a  = CLIP(t4 + t12);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  890|  2.77k|    int t5a  = CLIP(t5 + t13);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  891|  2.77k|    int t6a  = CLIP(t6 + t14);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  892|  2.77k|    int t7a  = CLIP(t7 + t15);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  893|  2.77k|    int t8a  = CLIP(t0 - t8 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  894|  2.77k|    int t9a  = CLIP(t1 - t9 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  895|  2.77k|    int t10a = CLIP(t2 - t10);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  896|  2.77k|    int t11a = CLIP(t3 - t11);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  897|  2.77k|    int t12a = CLIP(t4 - t12);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  898|  2.77k|    int t13a = CLIP(t5 - t13);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  899|  2.77k|    int t14a = CLIP(t6 - t14);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  900|  2.77k|    int t15a = CLIP(t7 - t15);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  901|       |
  902|  2.77k|    t8   = ((t8a  * (4017 - 4096) + t9a  *   799         + 2048) >> 12) + t8a;
  903|  2.77k|    t9   = ((t8a  *   799         - t9a  * (4017 - 4096) + 2048) >> 12) - t9a;
  904|  2.77k|    t10  = ((t10a *  2276         + t11a * (3406 - 4096) + 2048) >> 12) + t11a;
  905|  2.77k|    t11  = ((t10a * (3406 - 4096) - t11a *  2276         + 2048) >> 12) + t10a;
  906|  2.77k|    t12  = ((t13a * (4017 - 4096) - t12a *   799         + 2048) >> 12) + t13a;
  907|  2.77k|    t13  = ((t13a *   799         + t12a * (4017 - 4096) + 2048) >> 12) + t12a;
  908|  2.77k|    t14  = ((t15a *  2276         - t14a * (3406 - 4096) + 2048) >> 12) - t14a;
  909|  2.77k|    t15  = ((t15a * (3406 - 4096) + t14a *  2276         + 2048) >> 12) + t15a;
  910|       |
  911|  2.77k|    t0   = CLIP(t0a + t4a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  912|  2.77k|    t1   = CLIP(t1a + t5a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  913|  2.77k|    t2   = CLIP(t2a + t6a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  914|  2.77k|    t3   = CLIP(t3a + t7a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  915|  2.77k|    t4   = CLIP(t0a - t4a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  916|  2.77k|    t5   = CLIP(t1a - t5a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  917|  2.77k|    t6   = CLIP(t2a - t6a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  918|  2.77k|    t7   = CLIP(t3a - t7a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  919|  2.77k|    t8a  = CLIP(t8  + t12);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  920|  2.77k|    t9a  = CLIP(t9  + t13);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  921|  2.77k|    t10a = CLIP(t10 + t14);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  922|  2.77k|    t11a = CLIP(t11 + t15);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  923|  2.77k|    t12a = CLIP(t8  - t12);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  924|  2.77k|    t13a = CLIP(t9  - t13);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  925|  2.77k|    t14a = CLIP(t10 - t14);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  926|  2.77k|    t15a = CLIP(t11 - t15);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  927|       |
  928|  2.77k|    t4a  = ((t4   * (3784 - 4096) + t5   *  1567         + 2048) >> 12) + t4;
  929|  2.77k|    t5a  = ((t4   *  1567         - t5   * (3784 - 4096) + 2048) >> 12) - t5;
  930|  2.77k|    t6a  = ((t7   * (3784 - 4096) - t6   *  1567         + 2048) >> 12) + t7;
  931|  2.77k|    t7a  = ((t7   *  1567         + t6   * (3784 - 4096) + 2048) >> 12) + t6;
  932|  2.77k|    t12  = ((t12a * (3784 - 4096) + t13a *  1567         + 2048) >> 12) + t12a;
  933|  2.77k|    t13  = ((t12a *  1567         - t13a * (3784 - 4096) + 2048) >> 12) - t13a;
  934|  2.77k|    t14  = ((t15a * (3784 - 4096) - t14a *  1567         + 2048) >> 12) + t15a;
  935|  2.77k|    t15  = ((t15a *  1567         + t14a * (3784 - 4096) + 2048) >> 12) + t14a;
  936|       |
  937|  2.77k|    out[ 0 * out_s] =  CLIP(t0  + t2  );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  938|  2.77k|    out[15 * out_s] = -CLIP(t1  + t3  );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  939|  2.77k|    t2a             =  CLIP(t0  - t2  );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  940|  2.77k|    t3a             =  CLIP(t1  - t3  );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  941|  2.77k|    out[ 3 * out_s] = -CLIP(t4a + t6a );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  942|  2.77k|    out[12 * out_s] =  CLIP(t5a + t7a );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  943|  2.77k|    t6              =  CLIP(t4a - t6a );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  944|  2.77k|    t7              =  CLIP(t5a - t7a );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  945|  2.77k|    out[ 1 * out_s] = -CLIP(t8a + t10a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  946|  2.77k|    out[14 * out_s] =  CLIP(t9a + t11a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  947|  2.77k|    t10             =  CLIP(t8a - t10a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  948|  2.77k|    t11             =  CLIP(t9a - t11a);
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  949|  2.77k|    out[ 2 * out_s] =  CLIP(t12 + t14 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  950|  2.77k|    out[13 * out_s] = -CLIP(t13 + t15 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  951|  2.77k|    t14a            =  CLIP(t12 - t14 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  952|  2.77k|    t15a            =  CLIP(t13 - t15 );
  ------------------
  |  |   37|  2.77k|#define CLIP(a) iclip(a, min, max)
  ------------------
  953|       |
  954|  2.77k|    out[ 7 * out_s] = -(((t2a  + t3a)  * 181 + 128) >> 8);
  955|  2.77k|    out[ 8 * out_s] =   ((t2a  - t3a)  * 181 + 128) >> 8;
  956|  2.77k|    out[ 4 * out_s] =   ((t6   + t7)   * 181 + 128) >> 8;
  957|  2.77k|    out[11 * out_s] = -(((t6   - t7)   * 181 + 128) >> 8);
  958|  2.77k|    out[ 6 * out_s] =   ((t10  + t11)  * 181 + 128) >> 8;
  959|  2.77k|    out[ 9 * out_s] = -(((t10  - t11)  * 181 + 128) >> 8);
  960|  2.77k|    out[ 5 * out_s] = -(((t14a + t15a) * 181 + 128) >> 8);
  961|  2.77k|    out[10 * out_s] =   ((t14a - t15a) * 181 + 128) >> 8;
  962|  2.77k|}
itx_1d.c:inv_identity16_1d_c:
 1003|    182|{
 1004|    182|    assert(stride > 0);
  ------------------
  |  |  140|    182|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 182]
  |  |  |  Branch (140:68): [Folded, False: 182]
  |  |  ------------------
  ------------------
 1005|  3.09k|    for (int i = 0; i < 16; i++) {
  ------------------
  |  Branch (1005:21): [True: 2.91k, False: 182]
  ------------------
 1006|  2.91k|        const int in = c[stride * i];
 1007|  2.91k|        c[stride * i] = 2 * in + ((in * 1697 + 1024) >> 11);
 1008|  2.91k|    }
 1009|    182|}
itx_1d.c:inv_flipadst16_1d_c:
  971|    110|                                          const int min, const int max) \
  972|    110|{ \
  973|    110|    inv_adst##sz##_1d_internal_c(c, stride, min, max, \
  974|    110|                                 &c[(sz - 1) * stride], -stride); \
  975|    110|}
itx_1d.c:inv_dct32_1d_c:
  432|  1.50k|{
  433|  1.50k|    inv_dct32_1d_internal_c(c, stride, min, max, 0);
  434|  1.50k|}
itx_1d.c:inv_dct32_1d_internal_c:
  249|  4.16k|{
  250|  4.16k|    assert(stride > 0);
  ------------------
  |  |  140|  4.16k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4.16k]
  |  |  |  Branch (140:68): [Folded, False: 4.16k]
  |  |  ------------------
  ------------------
  251|  4.16k|    inv_dct16_1d_internal_c(c, stride << 1, min, max, tx64);
  252|       |
  253|  4.16k|    const int in1  = c[ 1 * stride], in3  = c[ 3 * stride];
  254|  4.16k|    const int in5  = c[ 5 * stride], in7  = c[ 7 * stride];
  255|  4.16k|    const int in9  = c[ 9 * stride], in11 = c[11 * stride];
  256|  4.16k|    const int in13 = c[13 * stride], in15 = c[15 * stride];
  257|       |
  258|  4.16k|    int t16a, t17a, t18a, t19a, t20a, t21a, t22a, t23a;
  259|  4.16k|    int t24a, t25a, t26a, t27a, t28a, t29a, t30a, t31a;
  260|  4.16k|    if (tx64) {
  ------------------
  |  Branch (260:9): [True: 2.66k, False: 1.50k]
  ------------------
  261|  2.66k|        t16a = (in1  *   201 + 2048) >> 12;
  262|  2.66k|        t17a = (in15 * -2751 + 2048) >> 12;
  263|  2.66k|        t18a = (in9  *  1751 + 2048) >> 12;
  264|  2.66k|        t19a = (in7  * -1380 + 2048) >> 12;
  265|  2.66k|        t20a = (in5  *   995 + 2048) >> 12;
  266|  2.66k|        t21a = (in11 * -2106 + 2048) >> 12;
  267|  2.66k|        t22a = (in13 *  2440 + 2048) >> 12;
  268|  2.66k|        t23a = (in3  *  -601 + 2048) >> 12;
  269|  2.66k|        t24a = (in3  *  4052 + 2048) >> 12;
  270|  2.66k|        t25a = (in13 *  3290 + 2048) >> 12;
  271|  2.66k|        t26a = (in11 *  3513 + 2048) >> 12;
  272|  2.66k|        t27a = (in5  *  3973 + 2048) >> 12;
  273|  2.66k|        t28a = (in7  *  3857 + 2048) >> 12;
  274|  2.66k|        t29a = (in9  *  3703 + 2048) >> 12;
  275|  2.66k|        t30a = (in15 *  3035 + 2048) >> 12;
  276|  2.66k|        t31a = (in1  *  4091 + 2048) >> 12;
  277|  2.66k|    } else {
  278|  1.50k|        const int in17 = c[17 * stride], in19 = c[19 * stride];
  279|  1.50k|        const int in21 = c[21 * stride], in23 = c[23 * stride];
  280|  1.50k|        const int in25 = c[25 * stride], in27 = c[27 * stride];
  281|  1.50k|        const int in29 = c[29 * stride], in31 = c[31 * stride];
  282|       |
  283|  1.50k|        t16a = ((in1  *   201         - in31 * (4091 - 4096) + 2048) >> 12) - in31;
  284|  1.50k|        t17a = ((in17 * (3035 - 4096) - in15 *  2751         + 2048) >> 12) + in17;
  285|  1.50k|        t18a = ((in9  *  1751         - in23 * (3703 - 4096) + 2048) >> 12) - in23;
  286|  1.50k|        t19a = ((in25 * (3857 - 4096) - in7  *  1380         + 2048) >> 12) + in25;
  287|  1.50k|        t20a = ((in5  *   995         - in27 * (3973 - 4096) + 2048) >> 12) - in27;
  288|  1.50k|        t21a = ((in21 * (3513 - 4096) - in11 *  2106         + 2048) >> 12) + in21;
  289|  1.50k|        t22a =  (in13 *  1220         - in19 *  1645         + 1024) >> 11;
  290|  1.50k|        t23a = ((in29 * (4052 - 4096) - in3  *   601         + 2048) >> 12) + in29;
  291|  1.50k|        t24a = ((in29 *   601         + in3  * (4052 - 4096) + 2048) >> 12) + in3;
  292|  1.50k|        t25a =  (in13 *  1645         + in19 *  1220         + 1024) >> 11;
  293|  1.50k|        t26a = ((in21 *  2106         + in11 * (3513 - 4096) + 2048) >> 12) + in11;
  294|  1.50k|        t27a = ((in5  * (3973 - 4096) + in27 *   995         + 2048) >> 12) + in5;
  295|  1.50k|        t28a = ((in25 *  1380         + in7  * (3857 - 4096) + 2048) >> 12) + in7;
  296|  1.50k|        t29a = ((in9  * (3703 - 4096) + in23 *  1751         + 2048) >> 12) + in9;
  297|  1.50k|        t30a = ((in17 *  2751         + in15 * (3035 - 4096) + 2048) >> 12) + in15;
  298|  1.50k|        t31a = ((in1  * (4091 - 4096) + in31 *   201         + 2048) >> 12) + in1;
  299|  1.50k|    }
  300|       |
  301|  4.16k|    int t16 = CLIP(t16a + t17a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  302|  4.16k|    int t17 = CLIP(t16a - t17a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  303|  4.16k|    int t18 = CLIP(t19a - t18a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  304|  4.16k|    int t19 = CLIP(t19a + t18a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  305|  4.16k|    int t20 = CLIP(t20a + t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  306|  4.16k|    int t21 = CLIP(t20a - t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  307|  4.16k|    int t22 = CLIP(t23a - t22a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  308|  4.16k|    int t23 = CLIP(t23a + t22a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  309|  4.16k|    int t24 = CLIP(t24a + t25a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  310|  4.16k|    int t25 = CLIP(t24a - t25a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  311|  4.16k|    int t26 = CLIP(t27a - t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  312|  4.16k|    int t27 = CLIP(t27a + t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  313|  4.16k|    int t28 = CLIP(t28a + t29a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  314|  4.16k|    int t29 = CLIP(t28a - t29a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  315|  4.16k|    int t30 = CLIP(t31a - t30a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  316|  4.16k|    int t31 = CLIP(t31a + t30a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  317|       |
  318|  4.16k|    t17a = ((  t30 *   799         - t17 * (4017 - 4096)  + 2048) >> 12) - t17;
  319|  4.16k|    t30a = ((  t30 * (4017 - 4096) + t17 *   799          + 2048) >> 12) + t30;
  320|  4.16k|    t18a = ((-(t29 * (4017 - 4096) + t18 *   799)         + 2048) >> 12) - t29;
  321|  4.16k|    t29a = ((  t29 *   799         - t18 * (4017 - 4096)  + 2048) >> 12) - t18;
  322|  4.16k|    t21a =  (  t26 *  1703         - t21 *  1138          + 1024) >> 11;
  323|  4.16k|    t26a =  (  t26 *  1138         + t21 *  1703          + 1024) >> 11;
  324|  4.16k|    t22a =  (-(t25 *  1138         + t22 *  1703        ) + 1024) >> 11;
  325|  4.16k|    t25a =  (  t25 *  1703         - t22 *  1138          + 1024) >> 11;
  326|       |
  327|  4.16k|    t16a = CLIP(t16  + t19);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  328|  4.16k|    t17  = CLIP(t17a + t18a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  329|  4.16k|    t18  = CLIP(t17a - t18a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  330|  4.16k|    t19a = CLIP(t16  - t19);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  331|  4.16k|    t20a = CLIP(t23  - t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  332|  4.16k|    t21  = CLIP(t22a - t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  333|  4.16k|    t22  = CLIP(t22a + t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  334|  4.16k|    t23a = CLIP(t23  + t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  335|  4.16k|    t24a = CLIP(t24  + t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  336|  4.16k|    t25  = CLIP(t25a + t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  337|  4.16k|    t26  = CLIP(t25a - t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  338|  4.16k|    t27a = CLIP(t24  - t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  339|  4.16k|    t28a = CLIP(t31  - t28);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  340|  4.16k|    t29  = CLIP(t30a - t29a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  341|  4.16k|    t30  = CLIP(t30a + t29a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  342|  4.16k|    t31a = CLIP(t31  + t28);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  343|       |
  344|  4.16k|    t18a = ((  t29  *  1567         - t18  * (3784 - 4096)  + 2048) >> 12) - t18;
  345|  4.16k|    t29a = ((  t29  * (3784 - 4096) + t18  *  1567          + 2048) >> 12) + t29;
  346|  4.16k|    t19  = ((  t28a *  1567         - t19a * (3784 - 4096)  + 2048) >> 12) - t19a;
  347|  4.16k|    t28  = ((  t28a * (3784 - 4096) + t19a *  1567          + 2048) >> 12) + t28a;
  348|  4.16k|    t20  = ((-(t27a * (3784 - 4096) + t20a *  1567)         + 2048) >> 12) - t27a;
  349|  4.16k|    t27  = ((  t27a *  1567         - t20a * (3784 - 4096)  + 2048) >> 12) - t20a;
  350|  4.16k|    t21a = ((-(t26  * (3784 - 4096) + t21  *  1567)         + 2048) >> 12) - t26;
  351|  4.16k|    t26a = ((  t26  *  1567         - t21  * (3784 - 4096)  + 2048) >> 12) - t21;
  352|       |
  353|  4.16k|    t16  = CLIP(t16a + t23a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  354|  4.16k|    t17a = CLIP(t17  + t22);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  355|  4.16k|    t18  = CLIP(t18a + t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  356|  4.16k|    t19a = CLIP(t19  + t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  357|  4.16k|    t20a = CLIP(t19  - t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  358|  4.16k|    t21  = CLIP(t18a - t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  359|  4.16k|    t22a = CLIP(t17  - t22);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  360|  4.16k|    t23  = CLIP(t16a - t23a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  361|  4.16k|    t24  = CLIP(t31a - t24a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  362|  4.16k|    t25a = CLIP(t30  - t25);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  363|  4.16k|    t26  = CLIP(t29a - t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  364|  4.16k|    t27a = CLIP(t28  - t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  365|  4.16k|    t28a = CLIP(t28  + t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  366|  4.16k|    t29  = CLIP(t29a + t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  367|  4.16k|    t30a = CLIP(t30  + t25);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  368|  4.16k|    t31  = CLIP(t31a + t24a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  369|       |
  370|  4.16k|    t20  = ((t27a - t20a) * 181 + 128) >> 8;
  371|  4.16k|    t27  = ((t27a + t20a) * 181 + 128) >> 8;
  372|  4.16k|    t21a = ((t26  - t21 ) * 181 + 128) >> 8;
  373|  4.16k|    t26a = ((t26  + t21 ) * 181 + 128) >> 8;
  374|  4.16k|    t22  = ((t25a - t22a) * 181 + 128) >> 8;
  375|  4.16k|    t25  = ((t25a + t22a) * 181 + 128) >> 8;
  376|  4.16k|    t23a = ((t24  - t23 ) * 181 + 128) >> 8;
  377|  4.16k|    t24a = ((t24  + t23 ) * 181 + 128) >> 8;
  378|       |
  379|  4.16k|    const int t0  = c[ 0 * stride];
  380|  4.16k|    const int t1  = c[ 2 * stride];
  381|  4.16k|    const int t2  = c[ 4 * stride];
  382|  4.16k|    const int t3  = c[ 6 * stride];
  383|  4.16k|    const int t4  = c[ 8 * stride];
  384|  4.16k|    const int t5  = c[10 * stride];
  385|  4.16k|    const int t6  = c[12 * stride];
  386|  4.16k|    const int t7  = c[14 * stride];
  387|  4.16k|    const int t8  = c[16 * stride];
  388|  4.16k|    const int t9  = c[18 * stride];
  389|  4.16k|    const int t10 = c[20 * stride];
  390|  4.16k|    const int t11 = c[22 * stride];
  391|  4.16k|    const int t12 = c[24 * stride];
  392|  4.16k|    const int t13 = c[26 * stride];
  393|  4.16k|    const int t14 = c[28 * stride];
  394|  4.16k|    const int t15 = c[30 * stride];
  395|       |
  396|  4.16k|    c[ 0 * stride] = CLIP(t0  + t31);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  397|  4.16k|    c[ 1 * stride] = CLIP(t1  + t30a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  398|  4.16k|    c[ 2 * stride] = CLIP(t2  + t29);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  399|  4.16k|    c[ 3 * stride] = CLIP(t3  + t28a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  400|  4.16k|    c[ 4 * stride] = CLIP(t4  + t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  401|  4.16k|    c[ 5 * stride] = CLIP(t5  + t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  402|  4.16k|    c[ 6 * stride] = CLIP(t6  + t25);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  403|  4.16k|    c[ 7 * stride] = CLIP(t7  + t24a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  404|  4.16k|    c[ 8 * stride] = CLIP(t8  + t23a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  405|  4.16k|    c[ 9 * stride] = CLIP(t9  + t22);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  406|  4.16k|    c[10 * stride] = CLIP(t10 + t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  407|  4.16k|    c[11 * stride] = CLIP(t11 + t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  408|  4.16k|    c[12 * stride] = CLIP(t12 + t19a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  409|  4.16k|    c[13 * stride] = CLIP(t13 + t18);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  410|  4.16k|    c[14 * stride] = CLIP(t14 + t17a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  411|  4.16k|    c[15 * stride] = CLIP(t15 + t16);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  412|  4.16k|    c[16 * stride] = CLIP(t15 - t16);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  413|  4.16k|    c[17 * stride] = CLIP(t14 - t17a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  414|  4.16k|    c[18 * stride] = CLIP(t13 - t18);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  415|  4.16k|    c[19 * stride] = CLIP(t12 - t19a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  416|  4.16k|    c[20 * stride] = CLIP(t11 - t20);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  417|  4.16k|    c[21 * stride] = CLIP(t10 - t21a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  418|  4.16k|    c[22 * stride] = CLIP(t9  - t22);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  419|  4.16k|    c[23 * stride] = CLIP(t8  - t23a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  420|  4.16k|    c[24 * stride] = CLIP(t7  - t24a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  421|  4.16k|    c[25 * stride] = CLIP(t6  - t25);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  422|  4.16k|    c[26 * stride] = CLIP(t5  - t26a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  423|  4.16k|    c[27 * stride] = CLIP(t4  - t27);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  424|  4.16k|    c[28 * stride] = CLIP(t3  - t28a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  425|  4.16k|    c[29 * stride] = CLIP(t2  - t29);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  426|  4.16k|    c[30 * stride] = CLIP(t1  - t30a);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  427|  4.16k|    c[31 * stride] = CLIP(t0  - t31);
  ------------------
  |  |   37|  4.16k|#define CLIP(a) iclip(a, min, max)
  ------------------
  428|  4.16k|}
itx_1d.c:inv_dct64_1d_c:
  438|  2.66k|{
  439|  2.66k|    assert(stride > 0);
  ------------------
  |  |  140|  2.66k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.66k]
  |  |  |  Branch (140:68): [Folded, False: 2.66k]
  |  |  ------------------
  ------------------
  440|  2.66k|    inv_dct32_1d_internal_c(c, stride << 1, min, max, 1);
  441|       |
  442|  2.66k|    const int in1  = c[ 1 * stride], in3  = c[ 3 * stride];
  443|  2.66k|    const int in5  = c[ 5 * stride], in7  = c[ 7 * stride];
  444|  2.66k|    const int in9  = c[ 9 * stride], in11 = c[11 * stride];
  445|  2.66k|    const int in13 = c[13 * stride], in15 = c[15 * stride];
  446|  2.66k|    const int in17 = c[17 * stride], in19 = c[19 * stride];
  447|  2.66k|    const int in21 = c[21 * stride], in23 = c[23 * stride];
  448|  2.66k|    const int in25 = c[25 * stride], in27 = c[27 * stride];
  449|  2.66k|    const int in29 = c[29 * stride], in31 = c[31 * stride];
  450|       |
  451|  2.66k|    int t32a = (in1  *   101 + 2048) >> 12;
  452|  2.66k|    int t33a = (in31 * -2824 + 2048) >> 12;
  453|  2.66k|    int t34a = (in17 *  1660 + 2048) >> 12;
  454|  2.66k|    int t35a = (in15 * -1474 + 2048) >> 12;
  455|  2.66k|    int t36a = (in9  *   897 + 2048) >> 12;
  456|  2.66k|    int t37a = (in23 * -2191 + 2048) >> 12;
  457|  2.66k|    int t38a = (in25 *  2359 + 2048) >> 12;
  458|  2.66k|    int t39a = (in7  *  -700 + 2048) >> 12;
  459|  2.66k|    int t40a = (in5  *   501 + 2048) >> 12;
  460|  2.66k|    int t41a = (in27 * -2520 + 2048) >> 12;
  461|  2.66k|    int t42a = (in21 *  2019 + 2048) >> 12;
  462|  2.66k|    int t43a = (in11 * -1092 + 2048) >> 12;
  463|  2.66k|    int t44a = (in13 *  1285 + 2048) >> 12;
  464|  2.66k|    int t45a = (in19 * -1842 + 2048) >> 12;
  465|  2.66k|    int t46a = (in29 *  2675 + 2048) >> 12;
  466|  2.66k|    int t47a = (in3  *  -301 + 2048) >> 12;
  467|  2.66k|    int t48a = (in3  *  4085 + 2048) >> 12;
  468|  2.66k|    int t49a = (in29 *  3102 + 2048) >> 12;
  469|  2.66k|    int t50a = (in19 *  3659 + 2048) >> 12;
  470|  2.66k|    int t51a = (in13 *  3889 + 2048) >> 12;
  471|  2.66k|    int t52a = (in11 *  3948 + 2048) >> 12;
  472|  2.66k|    int t53a = (in21 *  3564 + 2048) >> 12;
  473|  2.66k|    int t54a = (in27 *  3229 + 2048) >> 12;
  474|  2.66k|    int t55a = (in5  *  4065 + 2048) >> 12;
  475|  2.66k|    int t56a = (in7  *  4036 + 2048) >> 12;
  476|  2.66k|    int t57a = (in25 *  3349 + 2048) >> 12;
  477|  2.66k|    int t58a = (in23 *  3461 + 2048) >> 12;
  478|  2.66k|    int t59a = (in9  *  3996 + 2048) >> 12;
  479|  2.66k|    int t60a = (in15 *  3822 + 2048) >> 12;
  480|  2.66k|    int t61a = (in17 *  3745 + 2048) >> 12;
  481|  2.66k|    int t62a = (in31 *  2967 + 2048) >> 12;
  482|  2.66k|    int t63a = (in1  *  4095 + 2048) >> 12;
  483|       |
  484|  2.66k|    int t32 = CLIP(t32a + t33a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  485|  2.66k|    int t33 = CLIP(t32a - t33a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  486|  2.66k|    int t34 = CLIP(t35a - t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  487|  2.66k|    int t35 = CLIP(t35a + t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  488|  2.66k|    int t36 = CLIP(t36a + t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  489|  2.66k|    int t37 = CLIP(t36a - t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  490|  2.66k|    int t38 = CLIP(t39a - t38a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  491|  2.66k|    int t39 = CLIP(t39a + t38a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  492|  2.66k|    int t40 = CLIP(t40a + t41a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  493|  2.66k|    int t41 = CLIP(t40a - t41a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  494|  2.66k|    int t42 = CLIP(t43a - t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  495|  2.66k|    int t43 = CLIP(t43a + t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  496|  2.66k|    int t44 = CLIP(t44a + t45a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  497|  2.66k|    int t45 = CLIP(t44a - t45a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  498|  2.66k|    int t46 = CLIP(t47a - t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  499|  2.66k|    int t47 = CLIP(t47a + t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  500|  2.66k|    int t48 = CLIP(t48a + t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  501|  2.66k|    int t49 = CLIP(t48a - t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  502|  2.66k|    int t50 = CLIP(t51a - t50a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  503|  2.66k|    int t51 = CLIP(t51a + t50a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  504|  2.66k|    int t52 = CLIP(t52a + t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  505|  2.66k|    int t53 = CLIP(t52a - t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  506|  2.66k|    int t54 = CLIP(t55a - t54a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  507|  2.66k|    int t55 = CLIP(t55a + t54a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  508|  2.66k|    int t56 = CLIP(t56a + t57a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  509|  2.66k|    int t57 = CLIP(t56a - t57a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  510|  2.66k|    int t58 = CLIP(t59a - t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  511|  2.66k|    int t59 = CLIP(t59a + t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  512|  2.66k|    int t60 = CLIP(t60a + t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  513|  2.66k|    int t61 = CLIP(t60a - t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  514|  2.66k|    int t62 = CLIP(t63a - t62a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  515|  2.66k|    int t63 = CLIP(t63a + t62a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  516|       |
  517|  2.66k|    t33a = ((t33 * (4096 - 4076) + t62 *   401         + 2048) >> 12) - t33;
  518|  2.66k|    t34a = ((t34 *  -401         + t61 * (4096 - 4076) + 2048) >> 12) - t61;
  519|  2.66k|    t37a =  (t37 * -1299         + t58 *  1583         + 1024) >> 11;
  520|  2.66k|    t38a =  (t38 * -1583         + t57 * -1299         + 1024) >> 11;
  521|  2.66k|    t41a = ((t41 * (4096 - 3612) + t54 *  1931         + 2048) >> 12) - t41;
  522|  2.66k|    t42a = ((t42 * -1931         + t53 * (4096 - 3612) + 2048) >> 12) - t53;
  523|  2.66k|    t45a = ((t45 * -1189         + t50 * (3920 - 4096) + 2048) >> 12) + t50;
  524|  2.66k|    t46a = ((t46 * (4096 - 3920) + t49 * -1189         + 2048) >> 12) - t46;
  525|  2.66k|    t49a = ((t46 * -1189         + t49 * (3920 - 4096) + 2048) >> 12) + t49;
  526|  2.66k|    t50a = ((t45 * (3920 - 4096) + t50 *  1189         + 2048) >> 12) + t45;
  527|  2.66k|    t53a = ((t42 * (4096 - 3612) + t53 *  1931         + 2048) >> 12) - t42;
  528|  2.66k|    t54a = ((t41 *  1931         + t54 * (3612 - 4096) + 2048) >> 12) + t54;
  529|  2.66k|    t57a =  (t38 * -1299         + t57 *  1583         + 1024) >> 11;
  530|  2.66k|    t58a =  (t37 *  1583         + t58 *  1299         + 1024) >> 11;
  531|  2.66k|    t61a = ((t34 * (4096 - 4076) + t61 *   401         + 2048) >> 12) - t34;
  532|  2.66k|    t62a = ((t33 *   401         + t62 * (4076 - 4096) + 2048) >> 12) + t62;
  533|       |
  534|  2.66k|    t32a = CLIP(t32  + t35);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  535|  2.66k|    t33  = CLIP(t33a + t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  536|  2.66k|    t34  = CLIP(t33a - t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  537|  2.66k|    t35a = CLIP(t32  - t35);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  538|  2.66k|    t36a = CLIP(t39  - t36);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  539|  2.66k|    t37  = CLIP(t38a - t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  540|  2.66k|    t38  = CLIP(t38a + t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  541|  2.66k|    t39a = CLIP(t39  + t36);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  542|  2.66k|    t40a = CLIP(t40  + t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  543|  2.66k|    t41  = CLIP(t41a + t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  544|  2.66k|    t42  = CLIP(t41a - t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  545|  2.66k|    t43a = CLIP(t40  - t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  546|  2.66k|    t44a = CLIP(t47  - t44);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  547|  2.66k|    t45  = CLIP(t46a - t45a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  548|  2.66k|    t46  = CLIP(t46a + t45a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  549|  2.66k|    t47a = CLIP(t47  + t44);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  550|  2.66k|    t48a = CLIP(t48  + t51);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  551|  2.66k|    t49  = CLIP(t49a + t50a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  552|  2.66k|    t50  = CLIP(t49a - t50a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  553|  2.66k|    t51a = CLIP(t48  - t51);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  554|  2.66k|    t52a = CLIP(t55  - t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  555|  2.66k|    t53  = CLIP(t54a - t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  556|  2.66k|    t54  = CLIP(t54a + t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  557|  2.66k|    t55a = CLIP(t55  + t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  558|  2.66k|    t56a = CLIP(t56  + t59);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  559|  2.66k|    t57  = CLIP(t57a + t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  560|  2.66k|    t58  = CLIP(t57a - t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  561|  2.66k|    t59a = CLIP(t56  - t59);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  562|  2.66k|    t60a = CLIP(t63  - t60);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  563|  2.66k|    t61  = CLIP(t62a - t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  564|  2.66k|    t62  = CLIP(t62a + t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  565|  2.66k|    t63a = CLIP(t63  + t60);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  566|       |
  567|  2.66k|    t34a = ((t34  * (4096 - 4017) + t61  *   799         + 2048) >> 12) - t34;
  568|  2.66k|    t35  = ((t35a * (4096 - 4017) + t60a *   799         + 2048) >> 12) - t35a;
  569|  2.66k|    t36  = ((t36a *  -799         + t59a * (4096 - 4017) + 2048) >> 12) - t59a;
  570|  2.66k|    t37a = ((t37  *  -799         + t58  * (4096 - 4017) + 2048) >> 12) - t58;
  571|  2.66k|    t42a =  (t42  * -1138         + t53  *  1703         + 1024) >> 11;
  572|  2.66k|    t43  =  (t43a * -1138         + t52a *  1703         + 1024) >> 11;
  573|  2.66k|    t44  =  (t44a * -1703         + t51a * -1138         + 1024) >> 11;
  574|  2.66k|    t45a =  (t45  * -1703         + t50  * -1138         + 1024) >> 11;
  575|  2.66k|    t50a =  (t45  * -1138         + t50  *  1703         + 1024) >> 11;
  576|  2.66k|    t51  =  (t44a * -1138         + t51a *  1703         + 1024) >> 11;
  577|  2.66k|    t52  =  (t43a *  1703         + t52a *  1138         + 1024) >> 11;
  578|  2.66k|    t53a =  (t42  *  1703         + t53  *  1138         + 1024) >> 11;
  579|  2.66k|    t58a = ((t37  * (4096 - 4017) + t58  *   799         + 2048) >> 12) - t37;
  580|  2.66k|    t59  = ((t36a * (4096 - 4017) + t59a *   799         + 2048) >> 12) - t36a;
  581|  2.66k|    t60  = ((t35a *   799         + t60a * (4017 - 4096) + 2048) >> 12) + t60a;
  582|  2.66k|    t61a = ((t34  *   799         + t61  * (4017 - 4096) + 2048) >> 12) + t61;
  583|       |
  584|  2.66k|    t32  = CLIP(t32a + t39a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  585|  2.66k|    t33a = CLIP(t33  + t38);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  586|  2.66k|    t34  = CLIP(t34a + t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  587|  2.66k|    t35a = CLIP(t35  + t36);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  588|  2.66k|    t36a = CLIP(t35  - t36);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  589|  2.66k|    t37  = CLIP(t34a - t37a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  590|  2.66k|    t38a = CLIP(t33  - t38);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  591|  2.66k|    t39  = CLIP(t32a - t39a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  592|  2.66k|    t40  = CLIP(t47a - t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  593|  2.66k|    t41a = CLIP(t46  - t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  594|  2.66k|    t42  = CLIP(t45a - t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  595|  2.66k|    t43a = CLIP(t44  - t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  596|  2.66k|    t44a = CLIP(t44  + t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  597|  2.66k|    t45  = CLIP(t45a + t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  598|  2.66k|    t46a = CLIP(t46  + t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  599|  2.66k|    t47  = CLIP(t47a + t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  600|  2.66k|    t48  = CLIP(t48a + t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  601|  2.66k|    t49a = CLIP(t49  + t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  602|  2.66k|    t50  = CLIP(t50a + t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  603|  2.66k|    t51a = CLIP(t51  + t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  604|  2.66k|    t52a = CLIP(t51  - t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  605|  2.66k|    t53  = CLIP(t50a - t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  606|  2.66k|    t54a = CLIP(t49  - t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  607|  2.66k|    t55  = CLIP(t48a - t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  608|  2.66k|    t56  = CLIP(t63a - t56a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  609|  2.66k|    t57a = CLIP(t62  - t57);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  610|  2.66k|    t58  = CLIP(t61a - t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  611|  2.66k|    t59a = CLIP(t60  - t59);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  612|  2.66k|    t60a = CLIP(t60  + t59);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  613|  2.66k|    t61  = CLIP(t61a + t58a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  614|  2.66k|    t62a = CLIP(t62  + t57);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  615|  2.66k|    t63  = CLIP(t63a + t56a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  616|       |
  617|  2.66k|    t36  = ((t36a * (4096 - 3784) + t59a *  1567         + 2048) >> 12) - t36a;
  618|  2.66k|    t37a = ((t37  * (4096 - 3784) + t58  *  1567         + 2048) >> 12) - t37;
  619|  2.66k|    t38  = ((t38a * (4096 - 3784) + t57a *  1567         + 2048) >> 12) - t38a;
  620|  2.66k|    t39a = ((t39  * (4096 - 3784) + t56  *  1567         + 2048) >> 12) - t39;
  621|  2.66k|    t40a = ((t40  * -1567         + t55  * (4096 - 3784) + 2048) >> 12) - t55;
  622|  2.66k|    t41  = ((t41a * -1567         + t54a * (4096 - 3784) + 2048) >> 12) - t54a;
  623|  2.66k|    t42a = ((t42  * -1567         + t53  * (4096 - 3784) + 2048) >> 12) - t53;
  624|  2.66k|    t43  = ((t43a * -1567         + t52a * (4096 - 3784) + 2048) >> 12) - t52a;
  625|  2.66k|    t52  = ((t43a * (4096 - 3784) + t52a *  1567         + 2048) >> 12) - t43a;
  626|  2.66k|    t53a = ((t42  * (4096 - 3784) + t53  *  1567         + 2048) >> 12) - t42;
  627|  2.66k|    t54  = ((t41a * (4096 - 3784) + t54a *  1567         + 2048) >> 12) - t41a;
  628|  2.66k|    t55a = ((t40  * (4096 - 3784) + t55  *  1567         + 2048) >> 12) - t40;
  629|  2.66k|    t56a = ((t39  *  1567         + t56  * (3784 - 4096) + 2048) >> 12) + t56;
  630|  2.66k|    t57  = ((t38a *  1567         + t57a * (3784 - 4096) + 2048) >> 12) + t57a;
  631|  2.66k|    t58a = ((t37  *  1567         + t58  * (3784 - 4096) + 2048) >> 12) + t58;
  632|  2.66k|    t59  = ((t36a *  1567         + t59a * (3784 - 4096) + 2048) >> 12) + t59a;
  633|       |
  634|  2.66k|    t32a = CLIP(t32  + t47);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  635|  2.66k|    t33  = CLIP(t33a + t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  636|  2.66k|    t34a = CLIP(t34  + t45);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  637|  2.66k|    t35  = CLIP(t35a + t44a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  638|  2.66k|    t36a = CLIP(t36  + t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  639|  2.66k|    t37  = CLIP(t37a + t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  640|  2.66k|    t38a = CLIP(t38  + t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  641|  2.66k|    t39  = CLIP(t39a + t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  642|  2.66k|    t40  = CLIP(t39a - t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  643|  2.66k|    t41a = CLIP(t38  - t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  644|  2.66k|    t42  = CLIP(t37a - t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  645|  2.66k|    t43a = CLIP(t36  - t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  646|  2.66k|    t44  = CLIP(t35a - t44a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  647|  2.66k|    t45a = CLIP(t34  - t45);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  648|  2.66k|    t46  = CLIP(t33a - t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  649|  2.66k|    t47a = CLIP(t32  - t47);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  650|  2.66k|    t48a = CLIP(t63  - t48);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  651|  2.66k|    t49  = CLIP(t62a - t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  652|  2.66k|    t50a = CLIP(t61  - t50);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  653|  2.66k|    t51  = CLIP(t60a - t51a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  654|  2.66k|    t52a = CLIP(t59  - t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  655|  2.66k|    t53  = CLIP(t58a - t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  656|  2.66k|    t54a = CLIP(t57  - t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  657|  2.66k|    t55  = CLIP(t56a - t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  658|  2.66k|    t56  = CLIP(t56a + t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  659|  2.66k|    t57a = CLIP(t57  + t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  660|  2.66k|    t58  = CLIP(t58a + t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  661|  2.66k|    t59a = CLIP(t59  + t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  662|  2.66k|    t60  = CLIP(t60a + t51a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  663|  2.66k|    t61a = CLIP(t61  + t50);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  664|  2.66k|    t62  = CLIP(t62a + t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  665|  2.66k|    t63a = CLIP(t63  + t48);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  666|       |
  667|  2.66k|    t40a = ((t55  - t40 ) * 181 + 128) >> 8;
  668|  2.66k|    t41  = ((t54a - t41a) * 181 + 128) >> 8;
  669|  2.66k|    t42a = ((t53  - t42 ) * 181 + 128) >> 8;
  670|  2.66k|    t43  = ((t52a - t43a) * 181 + 128) >> 8;
  671|  2.66k|    t44a = ((t51  - t44 ) * 181 + 128) >> 8;
  672|  2.66k|    t45  = ((t50a - t45a) * 181 + 128) >> 8;
  673|  2.66k|    t46a = ((t49  - t46 ) * 181 + 128) >> 8;
  674|  2.66k|    t47  = ((t48a - t47a) * 181 + 128) >> 8;
  675|  2.66k|    t48  = ((t47a + t48a) * 181 + 128) >> 8;
  676|  2.66k|    t49a = ((t46  + t49 ) * 181 + 128) >> 8;
  677|  2.66k|    t50  = ((t45a + t50a) * 181 + 128) >> 8;
  678|  2.66k|    t51a = ((t44  + t51 ) * 181 + 128) >> 8;
  679|  2.66k|    t52  = ((t43a + t52a) * 181 + 128) >> 8;
  680|  2.66k|    t53a = ((t42  + t53 ) * 181 + 128) >> 8;
  681|  2.66k|    t54  = ((t41a + t54a) * 181 + 128) >> 8;
  682|  2.66k|    t55a = ((t40  + t55 ) * 181 + 128) >> 8;
  683|       |
  684|  2.66k|    const int t0  = c[ 0 * stride];
  685|  2.66k|    const int t1  = c[ 2 * stride];
  686|  2.66k|    const int t2  = c[ 4 * stride];
  687|  2.66k|    const int t3  = c[ 6 * stride];
  688|  2.66k|    const int t4  = c[ 8 * stride];
  689|  2.66k|    const int t5  = c[10 * stride];
  690|  2.66k|    const int t6  = c[12 * stride];
  691|  2.66k|    const int t7  = c[14 * stride];
  692|  2.66k|    const int t8  = c[16 * stride];
  693|  2.66k|    const int t9  = c[18 * stride];
  694|  2.66k|    const int t10 = c[20 * stride];
  695|  2.66k|    const int t11 = c[22 * stride];
  696|  2.66k|    const int t12 = c[24 * stride];
  697|  2.66k|    const int t13 = c[26 * stride];
  698|  2.66k|    const int t14 = c[28 * stride];
  699|  2.66k|    const int t15 = c[30 * stride];
  700|  2.66k|    const int t16 = c[32 * stride];
  701|  2.66k|    const int t17 = c[34 * stride];
  702|  2.66k|    const int t18 = c[36 * stride];
  703|  2.66k|    const int t19 = c[38 * stride];
  704|  2.66k|    const int t20 = c[40 * stride];
  705|  2.66k|    const int t21 = c[42 * stride];
  706|  2.66k|    const int t22 = c[44 * stride];
  707|  2.66k|    const int t23 = c[46 * stride];
  708|  2.66k|    const int t24 = c[48 * stride];
  709|  2.66k|    const int t25 = c[50 * stride];
  710|  2.66k|    const int t26 = c[52 * stride];
  711|  2.66k|    const int t27 = c[54 * stride];
  712|  2.66k|    const int t28 = c[56 * stride];
  713|  2.66k|    const int t29 = c[58 * stride];
  714|  2.66k|    const int t30 = c[60 * stride];
  715|  2.66k|    const int t31 = c[62 * stride];
  716|       |
  717|  2.66k|    c[ 0 * stride] = CLIP(t0  + t63a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  718|  2.66k|    c[ 1 * stride] = CLIP(t1  + t62);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  719|  2.66k|    c[ 2 * stride] = CLIP(t2  + t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  720|  2.66k|    c[ 3 * stride] = CLIP(t3  + t60);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  721|  2.66k|    c[ 4 * stride] = CLIP(t4  + t59a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  722|  2.66k|    c[ 5 * stride] = CLIP(t5  + t58);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  723|  2.66k|    c[ 6 * stride] = CLIP(t6  + t57a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  724|  2.66k|    c[ 7 * stride] = CLIP(t7  + t56);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  725|  2.66k|    c[ 8 * stride] = CLIP(t8  + t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  726|  2.66k|    c[ 9 * stride] = CLIP(t9  + t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  727|  2.66k|    c[10 * stride] = CLIP(t10 + t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  728|  2.66k|    c[11 * stride] = CLIP(t11 + t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  729|  2.66k|    c[12 * stride] = CLIP(t12 + t51a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  730|  2.66k|    c[13 * stride] = CLIP(t13 + t50);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  731|  2.66k|    c[14 * stride] = CLIP(t14 + t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  732|  2.66k|    c[15 * stride] = CLIP(t15 + t48);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  733|  2.66k|    c[16 * stride] = CLIP(t16 + t47);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  734|  2.66k|    c[17 * stride] = CLIP(t17 + t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  735|  2.66k|    c[18 * stride] = CLIP(t18 + t45);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  736|  2.66k|    c[19 * stride] = CLIP(t19 + t44a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  737|  2.66k|    c[20 * stride] = CLIP(t20 + t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  738|  2.66k|    c[21 * stride] = CLIP(t21 + t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  739|  2.66k|    c[22 * stride] = CLIP(t22 + t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  740|  2.66k|    c[23 * stride] = CLIP(t23 + t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  741|  2.66k|    c[24 * stride] = CLIP(t24 + t39);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  742|  2.66k|    c[25 * stride] = CLIP(t25 + t38a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  743|  2.66k|    c[26 * stride] = CLIP(t26 + t37);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  744|  2.66k|    c[27 * stride] = CLIP(t27 + t36a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  745|  2.66k|    c[28 * stride] = CLIP(t28 + t35);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  746|  2.66k|    c[29 * stride] = CLIP(t29 + t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  747|  2.66k|    c[30 * stride] = CLIP(t30 + t33);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  748|  2.66k|    c[31 * stride] = CLIP(t31 + t32a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  749|  2.66k|    c[32 * stride] = CLIP(t31 - t32a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  750|  2.66k|    c[33 * stride] = CLIP(t30 - t33);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  751|  2.66k|    c[34 * stride] = CLIP(t29 - t34a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  752|  2.66k|    c[35 * stride] = CLIP(t28 - t35);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  753|  2.66k|    c[36 * stride] = CLIP(t27 - t36a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  754|  2.66k|    c[37 * stride] = CLIP(t26 - t37);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  755|  2.66k|    c[38 * stride] = CLIP(t25 - t38a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  756|  2.66k|    c[39 * stride] = CLIP(t24 - t39);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  757|  2.66k|    c[40 * stride] = CLIP(t23 - t40a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  758|  2.66k|    c[41 * stride] = CLIP(t22 - t41);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  759|  2.66k|    c[42 * stride] = CLIP(t21 - t42a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  760|  2.66k|    c[43 * stride] = CLIP(t20 - t43);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  761|  2.66k|    c[44 * stride] = CLIP(t19 - t44a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  762|  2.66k|    c[45 * stride] = CLIP(t18 - t45);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  763|  2.66k|    c[46 * stride] = CLIP(t17 - t46a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  764|  2.66k|    c[47 * stride] = CLIP(t16 - t47);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  765|  2.66k|    c[48 * stride] = CLIP(t15 - t48);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  766|  2.66k|    c[49 * stride] = CLIP(t14 - t49a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  767|  2.66k|    c[50 * stride] = CLIP(t13 - t50);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  768|  2.66k|    c[51 * stride] = CLIP(t12 - t51a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  769|  2.66k|    c[52 * stride] = CLIP(t11 - t52);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  770|  2.66k|    c[53 * stride] = CLIP(t10 - t53a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  771|  2.66k|    c[54 * stride] = CLIP(t9  - t54);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  772|  2.66k|    c[55 * stride] = CLIP(t8  - t55a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  773|  2.66k|    c[56 * stride] = CLIP(t7  - t56);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  774|  2.66k|    c[57 * stride] = CLIP(t6  - t57a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  775|  2.66k|    c[58 * stride] = CLIP(t5  - t58);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  776|  2.66k|    c[59 * stride] = CLIP(t4  - t59a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  777|  2.66k|    c[60 * stride] = CLIP(t3  - t60);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  778|  2.66k|    c[61 * stride] = CLIP(t2  - t61a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  779|  2.66k|    c[62 * stride] = CLIP(t1  - t62);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  780|  2.66k|    c[63 * stride] = CLIP(t0  - t63a);
  ------------------
  |  |   37|  2.66k|#define CLIP(a) iclip(a, min, max)
  ------------------
  781|  2.66k|}

dav1d_itx_dsp_init_8bpc:
  220|      4|COLD void bitfn(dav1d_itx_dsp_init)(Dav1dInvTxfmDSPContext *const c, int bpc) {
  221|      4|#define assign_itx_all_fn64(w, h, pfx) \
  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  224|       |
  225|      4|#define assign_itx_all_fn32(w, h, pfx) \
  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  229|       |
  230|      4|#define assign_itx_all_fn16(w, h, pfx) \
  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  252|       |
  253|      4|#define assign_itx_all_fn84(w, h, pfx) \
  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  263|      4|
  264|      4|#if !(HAVE_ASM && TRIM_DSP_FUNCTIONS && ( \
  265|      4|  ARCH_AARCH64 || \
  266|      4|  (ARCH_ARM && (defined(__ARM_NEON) || defined(__APPLE__) || defined(_WIN32))) \
  267|      4|))
  268|      4|    c->itxfm_add[TX_4X4][WHT_WHT] = inv_txfm_add_wht_wht_4x4_c;
  269|      4|#endif
  270|      4|    assign_itx_all_fn84( 4,  4, );
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  271|      4|    assign_itx_all_fn84( 4,  8, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  272|      4|    assign_itx_all_fn84( 4, 16, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  273|      4|    assign_itx_all_fn84( 8,  4, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  274|      4|    assign_itx_all_fn84( 8,  8, );
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  275|      4|    assign_itx_all_fn84( 8, 16, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  276|      4|    assign_itx_all_fn32( 8, 32, R);
  ------------------
  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  ------------------
  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  ------------------
  277|      4|    assign_itx_all_fn84(16,  4, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  278|      4|    assign_itx_all_fn84(16,  8, R);
  ------------------
  |  |  254|      4|    assign_itx_all_fn16(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  |  |  ------------------
  |  |  255|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_FLIPADST] = \
  |  |  256|      4|        inv_txfm_add_flipadst_identity_##w##x##h##_c; \
  |  |  257|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_FLIPADST] = \
  |  |  258|      4|        inv_txfm_add_identity_flipadst_##w##x##h##_c; \
  |  |  259|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_ADST] = \
  |  |  260|      4|        inv_txfm_add_adst_identity_##w##x##h##_c; \
  |  |  261|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_ADST] = \
  |  |  262|      4|        inv_txfm_add_identity_adst_##w##x##h##_c; \
  ------------------
  279|      4|    assign_itx_all_fn16(16, 16, );
  ------------------
  |  |  231|      4|    assign_itx_all_fn32(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  |  |  ------------------
  |  |  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  |  |  ------------------
  |  |  232|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_ADST ] = \
  |  |  233|      4|        inv_txfm_add_adst_dct_##w##x##h##_c; \
  |  |  234|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_DCT ] = \
  |  |  235|      4|        inv_txfm_add_dct_adst_##w##x##h##_c; \
  |  |  236|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_ADST] = \
  |  |  237|      4|        inv_txfm_add_adst_adst_##w##x##h##_c; \
  |  |  238|      4|    c->itxfm_add[pfx##TX_##w##X##h][ADST_FLIPADST] = \
  |  |  239|      4|        inv_txfm_add_flipadst_adst_##w##x##h##_c; \
  |  |  240|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_ADST] = \
  |  |  241|      4|        inv_txfm_add_adst_flipadst_##w##x##h##_c; \
  |  |  242|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_FLIPADST] = \
  |  |  243|      4|        inv_txfm_add_flipadst_dct_##w##x##h##_c; \
  |  |  244|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_DCT] = \
  |  |  245|      4|        inv_txfm_add_dct_flipadst_##w##x##h##_c; \
  |  |  246|      4|    c->itxfm_add[pfx##TX_##w##X##h][FLIPADST_FLIPADST] = \
  |  |  247|      4|        inv_txfm_add_flipadst_flipadst_##w##x##h##_c; \
  |  |  248|      4|    c->itxfm_add[pfx##TX_##w##X##h][H_DCT] = \
  |  |  249|      4|        inv_txfm_add_dct_identity_##w##x##h##_c; \
  |  |  250|      4|    c->itxfm_add[pfx##TX_##w##X##h][V_DCT] = \
  |  |  251|      4|        inv_txfm_add_identity_dct_##w##x##h##_c
  ------------------
  280|      4|    assign_itx_all_fn32(16, 32, R);
  ------------------
  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  ------------------
  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  ------------------
  281|      4|    assign_itx_all_fn64(16, 64, R);
  ------------------
  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  ------------------
  282|      4|    assign_itx_all_fn32(32,  8, R);
  ------------------
  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  ------------------
  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  ------------------
  283|      4|    assign_itx_all_fn32(32, 16, R);
  ------------------
  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  ------------------
  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  ------------------
  284|      4|    assign_itx_all_fn32(32, 32, );
  ------------------
  |  |  226|      4|    assign_itx_all_fn64(w, h, pfx); \
  |  |  ------------------
  |  |  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  |  |  ------------------
  |  |  227|      4|    c->itxfm_add[pfx##TX_##w##X##h][IDTX] = \
  |  |  228|      4|        inv_txfm_add_identity_identity_##w##x##h##_c
  ------------------
  285|      4|    assign_itx_all_fn64(32, 64, R);
  ------------------
  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  ------------------
  286|      4|    assign_itx_all_fn64(64, 16, R);
  ------------------
  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  ------------------
  287|      4|    assign_itx_all_fn64(64, 32, R);
  ------------------
  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  ------------------
  288|      4|    assign_itx_all_fn64(64, 64, );
  ------------------
  |  |  222|      4|    c->itxfm_add[pfx##TX_##w##X##h][DCT_DCT  ] = \
  |  |  223|      4|        inv_txfm_add_dct_dct_##w##x##h##_c
  ------------------
  289|       |
  290|      4|    int all_simd = 0;
  291|       |#if HAVE_ASM
  292|       |#if ARCH_AARCH64 || ARCH_ARM
  293|       |    itx_dsp_init_arm(c, bpc, &all_simd);
  294|       |#endif
  295|       |#if ARCH_LOONGARCH64
  296|       |    itx_dsp_init_loongarch(c, bpc);
  297|       |#endif
  298|       |#if ARCH_PPC64LE
  299|       |    itx_dsp_init_ppc(c, bpc);
  300|       |#endif
  301|       |#if ARCH_RISCV
  302|       |    itx_dsp_init_riscv(c, bpc);
  303|       |#endif
  304|       |#if ARCH_X86
  305|       |    itx_dsp_init_x86(c, bpc, &all_simd);
  306|       |#endif
  307|       |#endif
  308|       |
  309|      4|    if (!all_simd)
  ------------------
  |  Branch (309:9): [True: 4, False: 0]
  ------------------
  310|      4|        dav1d_init_last_nonzero_col_from_eob_tables();
  311|      4|}
itx_tmpl.c:inv_txfm_add_dct_dct_4x4_c:
  127|     86|                                               HIGHBD_DECL_SUFFIX) \
  128|     86|{ \
  129|     86|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     86|                   HIGHBD_TAIL_SUFFIX); \
  131|     86|}
itx_tmpl.c:inv_txfm_add_c:
   47|  2.12k|{
   48|  2.12k|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[tx];
   49|  2.12k|    const int w = 4 * t_dim->w, h = 4 * t_dim->h;
   50|  2.12k|    const int has_dconly = txtp == DCT_DCT;
   51|  2.12k|    assert(w >= 4 && w <= 64);
  ------------------
  |  |  140|  4.25k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 2.12k, False: 0]
  |  |  |  Branch (140:30): [True: 2.12k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 2.12k]
  |  |  ------------------
  ------------------
   52|  2.12k|    assert(h >= 4 && h <= 64);
  ------------------
  |  |  140|  4.25k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 2.12k, False: 0]
  |  |  |  Branch (140:30): [True: 2.12k, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 2.12k]
  |  |  ------------------
  ------------------
   53|  2.12k|    assert(eob >= 0);
  ------------------
  |  |  140|  2.12k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.12k]
  |  |  |  Branch (140:68): [Folded, False: 2.12k]
  |  |  ------------------
  ------------------
   54|       |
   55|  2.12k|    const int is_rect2 = w * 2 == h || h * 2 == w;
  ------------------
  |  Branch (55:26): [True: 176, False: 1.95k]
  |  Branch (55:40): [True: 274, False: 1.67k]
  ------------------
   56|  2.12k|    const int rnd = (1 << shift) >> 1;
   57|       |
   58|  2.12k|    if (eob < has_dconly) {
  ------------------
  |  Branch (58:9): [True: 190, False: 1.93k]
  ------------------
   59|    190|        int dc = coeff[0];
   60|    190|        coeff[0] = 0;
   61|    190|        if (is_rect2)
  ------------------
  |  Branch (61:13): [True: 66, False: 124]
  ------------------
   62|     66|            dc = (dc * 181 + 128) >> 8;
   63|    190|        dc = (dc * 181 + 128) >> 8;
   64|    190|        dc = (dc + rnd) >> shift;
   65|    190|        dc = (dc * 181 + 128 + 2048) >> 12;
   66|  2.53k|        for (int y = 0; y < h; y++, dst += PXSTRIDE(stride))
  ------------------
  |  |   53|  2.34k|#define PXSTRIDE(x) (x)
  ------------------
  |  Branch (66:25): [True: 2.34k, False: 190]
  ------------------
   67|  43.1k|            for (int x = 0; x < w; x++)
  ------------------
  |  Branch (67:29): [True: 40.7k, False: 2.34k]
  ------------------
   68|  40.7k|                dst[x] = iclip_pixel(dst[x] + dc);
  ------------------
  |  |   49|  40.7k|#define iclip_pixel iclip_u8
  ------------------
   69|    190|        return;
   70|    190|    }
   71|       |
   72|  1.93k|    const uint8_t *const txtps = dav1d_tx1d_types[txtp];
   73|  1.93k|    const itx_1d_fn first_1d_fn = dav1d_tx1d_fns[t_dim->lw][txtps[0]];
   74|  1.93k|    const itx_1d_fn second_1d_fn = dav1d_tx1d_fns[t_dim->lh][txtps[1]];
   75|  1.93k|    const int sh = imin(h, 32), sw = imin(w, 32);
   76|  1.93k|#if BITDEPTH == 8
   77|  1.93k|    const int row_clip_min = INT16_MIN;
   78|  1.93k|    const int col_clip_min = INT16_MIN;
   79|       |#else
   80|       |    const int row_clip_min = (int) ((unsigned) ~bitdepth_max << 7);
   81|       |    const int col_clip_min = (int) ((unsigned) ~bitdepth_max << 5);
   82|       |#endif
   83|  1.93k|    const int row_clip_max = ~row_clip_min;
   84|  1.93k|    const int col_clip_max = ~col_clip_min;
   85|       |
   86|  1.93k|    int32_t tmp[64 * 64], *c = tmp;
   87|  1.93k|    int last_nonzero_col; // in first 1d itx
   88|  1.93k|    if (txtps[1] == IDENTITY && txtps[0] != IDENTITY) {
  ------------------
  |  Branch (88:9): [True: 200, False: 1.73k]
  |  Branch (88:33): [True: 140, False: 60]
  ------------------
   89|    140|        last_nonzero_col = imin(sh - 1, eob);
   90|  1.79k|    } else if (txtps[0] == IDENTITY && txtps[1] != IDENTITY) {
  ------------------
  |  Branch (90:16): [True: 124, False: 1.67k]
  |  Branch (90:40): [True: 64, False: 60]
  ------------------
   91|     64|        last_nonzero_col = eob >> (t_dim->lw + 2);
   92|  1.73k|    } else {
   93|  1.73k|        last_nonzero_col = dav1d_last_nonzero_col_from_eob[tx][eob];
   94|  1.73k|    }
   95|  1.93k|    assert(last_nonzero_col < sh);
  ------------------
  |  |  140|  1.93k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 1.93k]
  |  |  |  Branch (140:68): [Folded, False: 1.93k]
  |  |  ------------------
  ------------------
   96|  9.83k|    for (int y = 0; y <= last_nonzero_col; y++, c += w) {
  ------------------
  |  Branch (96:21): [True: 7.89k, False: 1.93k]
  ------------------
   97|  7.89k|        if (is_rect2)
  ------------------
  |  Branch (97:13): [True: 1.55k, False: 6.34k]
  ------------------
   98|  17.5k|            for (int x = 0; x < sw; x++)
  ------------------
  |  Branch (98:29): [True: 16.0k, False: 1.55k]
  ------------------
   99|  16.0k|                c[x] = (coeff[y + x * sh] * 181 + 128) >> 8;
  100|  6.34k|        else
  101|  81.9k|            for (int x = 0; x < sw; x++)
  ------------------
  |  Branch (101:29): [True: 75.5k, False: 6.34k]
  ------------------
  102|  75.5k|                c[x] = coeff[y + x * sh];
  103|  7.89k|        first_1d_fn(c, 1, row_clip_min, row_clip_max);
  104|  7.89k|    }
  105|  1.93k|    if (last_nonzero_col + 1 < sh)
  ------------------
  |  Branch (105:9): [True: 1.50k, False: 432]
  ------------------
  106|  1.50k|        memset(c, 0, sizeof(*c) * (sh - last_nonzero_col - 1) * w);
  107|       |
  108|  1.93k|    memset(coeff, 0, sizeof(*coeff) * sw * sh);
  109|   259k|    for (int i = 0; i < w * sh; i++)
  ------------------
  |  Branch (109:21): [True: 257k, False: 1.93k]
  ------------------
  110|   257k|        tmp[i] = iclip((tmp[i] + rnd) >> shift, col_clip_min, col_clip_max);
  111|       |
  112|  21.5k|    for (int x = 0; x < w; x++)
  ------------------
  |  Branch (112:21): [True: 19.6k, False: 1.93k]
  ------------------
  113|  19.6k|        second_1d_fn(&tmp[x], w, col_clip_min, col_clip_max);
  114|       |
  115|  1.93k|    c = tmp;
  116|  20.6k|    for (int y = 0; y < h; y++, dst += PXSTRIDE(stride))
  ------------------
  |  |   53|  18.6k|#define PXSTRIDE(x) (x)
  ------------------
  |  Branch (116:21): [True: 18.6k, False: 1.93k]
  ------------------
  117|   346k|        for (int x = 0; x < w; x++)
  ------------------
  |  Branch (117:25): [True: 327k, False: 18.6k]
  ------------------
  118|   327k|            dst[x] = iclip_pixel(dst[x] + ((*c++ + 8) >> 4));
  ------------------
  |  |   49|   327k|#define iclip_pixel iclip_u8
  ------------------
  119|  1.93k|}
itx_tmpl.c:inv_txfm_add_identity_identity_4x4_c:
  127|     28|                                               HIGHBD_DECL_SUFFIX) \
  128|     28|{ \
  129|     28|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     28|                   HIGHBD_TAIL_SUFFIX); \
  131|     28|}
itx_tmpl.c:inv_txfm_add_adst_dct_4x4_c:
  127|     90|                                               HIGHBD_DECL_SUFFIX) \
  128|     90|{ \
  129|     90|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     90|                   HIGHBD_TAIL_SUFFIX); \
  131|     90|}
itx_tmpl.c:inv_txfm_add_dct_adst_4x4_c:
  127|     78|                                               HIGHBD_DECL_SUFFIX) \
  128|     78|{ \
  129|     78|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     78|                   HIGHBD_TAIL_SUFFIX); \
  131|     78|}
itx_tmpl.c:inv_txfm_add_adst_adst_4x4_c:
  127|    114|                                               HIGHBD_DECL_SUFFIX) \
  128|    114|{ \
  129|    114|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|    114|                   HIGHBD_TAIL_SUFFIX); \
  131|    114|}
itx_tmpl.c:inv_txfm_add_flipadst_dct_4x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_4x4_c:
  127|     32|                                               HIGHBD_DECL_SUFFIX) \
  128|     32|{ \
  129|     32|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     32|                   HIGHBD_TAIL_SUFFIX); \
  131|     32|}
itx_tmpl.c:inv_txfm_add_identity_dct_4x4_c:
  127|     22|                                               HIGHBD_DECL_SUFFIX) \
  128|     22|{ \
  129|     22|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     22|                   HIGHBD_TAIL_SUFFIX); \
  131|     22|}
itx_tmpl.c:inv_txfm_add_identity_flipadst_4x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_adst_identity_4x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_4x8_c:
  127|     30|                                               HIGHBD_DECL_SUFFIX) \
  128|     30|{ \
  129|     30|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     30|                   HIGHBD_TAIL_SUFFIX); \
  131|     30|}
itx_tmpl.c:inv_txfm_add_adst_dct_4x8_c:
  127|     26|                                               HIGHBD_DECL_SUFFIX) \
  128|     26|{ \
  129|     26|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     26|                   HIGHBD_TAIL_SUFFIX); \
  131|     26|}
itx_tmpl.c:inv_txfm_add_dct_adst_4x8_c:
  127|     14|                                               HIGHBD_DECL_SUFFIX) \
  128|     14|{ \
  129|     14|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     14|                   HIGHBD_TAIL_SUFFIX); \
  131|     14|}
itx_tmpl.c:inv_txfm_add_adst_adst_4x8_c:
  127|     24|                                               HIGHBD_DECL_SUFFIX) \
  128|     24|{ \
  129|     24|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     24|                   HIGHBD_TAIL_SUFFIX); \
  131|     24|}
itx_tmpl.c:inv_txfm_add_flipadst_flipadst_4x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_4x8_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_identity_dct_4x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_4x16_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_identity_identity_4x16_c:
  127|      6|                                               HIGHBD_DECL_SUFFIX) \
  128|      6|{ \
  129|      6|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      6|                   HIGHBD_TAIL_SUFFIX); \
  131|      6|}
itx_tmpl.c:inv_txfm_add_adst_dct_4x16_c:
  127|      6|                                               HIGHBD_DECL_SUFFIX) \
  128|      6|{ \
  129|      6|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      6|                   HIGHBD_TAIL_SUFFIX); \
  131|      6|}
itx_tmpl.c:inv_txfm_add_dct_adst_4x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_adst_adst_4x16_c:
  127|     10|                                               HIGHBD_DECL_SUFFIX) \
  128|     10|{ \
  129|     10|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     10|                   HIGHBD_TAIL_SUFFIX); \
  131|     10|}
itx_tmpl.c:inv_txfm_add_identity_dct_4x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_identity_flipadst_4x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_identity_adst_4x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_8x4_c:
  127|     52|                                               HIGHBD_DECL_SUFFIX) \
  128|     52|{ \
  129|     52|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     52|                   HIGHBD_TAIL_SUFFIX); \
  131|     52|}
itx_tmpl.c:inv_txfm_add_identity_identity_8x4_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_adst_dct_8x4_c:
  127|     36|                                               HIGHBD_DECL_SUFFIX) \
  128|     36|{ \
  129|     36|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     36|                   HIGHBD_TAIL_SUFFIX); \
  131|     36|}
itx_tmpl.c:inv_txfm_add_dct_adst_8x4_c:
  127|     32|                                               HIGHBD_DECL_SUFFIX) \
  128|     32|{ \
  129|     32|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     32|                   HIGHBD_TAIL_SUFFIX); \
  131|     32|}
itx_tmpl.c:inv_txfm_add_adst_adst_8x4_c:
  127|     30|                                               HIGHBD_DECL_SUFFIX) \
  128|     30|{ \
  129|     30|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     30|                   HIGHBD_TAIL_SUFFIX); \
  131|     30|}
itx_tmpl.c:inv_txfm_add_adst_flipadst_8x4_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_flipadst_dct_8x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_8x4_c:
  127|     18|                                               HIGHBD_DECL_SUFFIX) \
  128|     18|{ \
  129|     18|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     18|                   HIGHBD_TAIL_SUFFIX); \
  131|     18|}
itx_tmpl.c:inv_txfm_add_identity_dct_8x4_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_identity_adst_8x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_8x8_c:
  127|    158|                                               HIGHBD_DECL_SUFFIX) \
  128|    158|{ \
  129|    158|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|    158|                   HIGHBD_TAIL_SUFFIX); \
  131|    158|}
itx_tmpl.c:inv_txfm_add_identity_identity_8x8_c:
  127|     14|                                               HIGHBD_DECL_SUFFIX) \
  128|     14|{ \
  129|     14|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     14|                   HIGHBD_TAIL_SUFFIX); \
  131|     14|}
itx_tmpl.c:inv_txfm_add_adst_dct_8x8_c:
  127|    148|                                               HIGHBD_DECL_SUFFIX) \
  128|    148|{ \
  129|    148|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|    148|                   HIGHBD_TAIL_SUFFIX); \
  131|    148|}
itx_tmpl.c:inv_txfm_add_dct_adst_8x8_c:
  127|    152|                                               HIGHBD_DECL_SUFFIX) \
  128|    152|{ \
  129|    152|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|    152|                   HIGHBD_TAIL_SUFFIX); \
  131|    152|}
itx_tmpl.c:inv_txfm_add_adst_adst_8x8_c:
  127|    168|                                               HIGHBD_DECL_SUFFIX) \
  128|    168|{ \
  129|    168|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|    168|                   HIGHBD_TAIL_SUFFIX); \
  131|    168|}
itx_tmpl.c:inv_txfm_add_flipadst_adst_8x8_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_adst_flipadst_8x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_flipadst_dct_8x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_flipadst_8x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_8x8_c:
  127|     62|                                               HIGHBD_DECL_SUFFIX) \
  128|     62|{ \
  129|     62|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     62|                   HIGHBD_TAIL_SUFFIX); \
  131|     62|}
itx_tmpl.c:inv_txfm_add_identity_dct_8x8_c:
  127|     20|                                               HIGHBD_DECL_SUFFIX) \
  128|     20|{ \
  129|     20|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     20|                   HIGHBD_TAIL_SUFFIX); \
  131|     20|}
itx_tmpl.c:inv_txfm_add_flipadst_identity_8x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_identity_flipadst_8x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_8x16_c:
  127|     16|                                               HIGHBD_DECL_SUFFIX) \
  128|     16|{ \
  129|     16|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     16|                   HIGHBD_TAIL_SUFFIX); \
  131|     16|}
itx_tmpl.c:inv_txfm_add_adst_dct_8x16_c:
  127|      6|                                               HIGHBD_DECL_SUFFIX) \
  128|      6|{ \
  129|      6|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      6|                   HIGHBD_TAIL_SUFFIX); \
  131|      6|}
itx_tmpl.c:inv_txfm_add_dct_adst_8x16_c:
  127|     12|                                               HIGHBD_DECL_SUFFIX) \
  128|     12|{ \
  129|     12|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     12|                   HIGHBD_TAIL_SUFFIX); \
  131|     12|}
itx_tmpl.c:inv_txfm_add_adst_adst_8x16_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_flipadst_dct_8x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_flipadst_8x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_flipadst_flipadst_8x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_8x32_c:
  127|     24|                                               HIGHBD_DECL_SUFFIX) \
  128|     24|{ \
  129|     24|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     24|                   HIGHBD_TAIL_SUFFIX); \
  131|     24|}
itx_tmpl.c:inv_txfm_add_dct_dct_16x4_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_identity_identity_16x4_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_adst_dct_16x4_c:
  127|     18|                                               HIGHBD_DECL_SUFFIX) \
  128|     18|{ \
  129|     18|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     18|                   HIGHBD_TAIL_SUFFIX); \
  131|     18|}
itx_tmpl.c:inv_txfm_add_dct_adst_16x4_c:
  127|     20|                                               HIGHBD_DECL_SUFFIX) \
  128|     20|{ \
  129|     20|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     20|                   HIGHBD_TAIL_SUFFIX); \
  131|     20|}
itx_tmpl.c:inv_txfm_add_adst_adst_16x4_c:
  127|     14|                                               HIGHBD_DECL_SUFFIX) \
  128|     14|{ \
  129|     14|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     14|                   HIGHBD_TAIL_SUFFIX); \
  131|     14|}
itx_tmpl.c:inv_txfm_add_flipadst_adst_16x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_16x4_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_identity_dct_16x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_identity_flipadst_16x4_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_16x8_c:
  127|     18|                                               HIGHBD_DECL_SUFFIX) \
  128|     18|{ \
  129|     18|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     18|                   HIGHBD_TAIL_SUFFIX); \
  131|     18|}
itx_tmpl.c:inv_txfm_add_adst_dct_16x8_c:
  127|     32|                                               HIGHBD_DECL_SUFFIX) \
  128|     32|{ \
  129|     32|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     32|                   HIGHBD_TAIL_SUFFIX); \
  131|     32|}
itx_tmpl.c:inv_txfm_add_dct_adst_16x8_c:
  127|     10|                                               HIGHBD_DECL_SUFFIX) \
  128|     10|{ \
  129|     10|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     10|                   HIGHBD_TAIL_SUFFIX); \
  131|     10|}
itx_tmpl.c:inv_txfm_add_adst_adst_16x8_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_adst_flipadst_16x8_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_identity_16x8_c:
  127|      8|                                               HIGHBD_DECL_SUFFIX) \
  128|      8|{ \
  129|      8|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      8|                   HIGHBD_TAIL_SUFFIX); \
  131|      8|}
itx_tmpl.c:inv_txfm_add_dct_dct_16x16_c:
  127|     84|                                               HIGHBD_DECL_SUFFIX) \
  128|     84|{ \
  129|     84|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     84|                   HIGHBD_TAIL_SUFFIX); \
  131|     84|}
itx_tmpl.c:inv_txfm_add_identity_identity_16x16_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_adst_dct_16x16_c:
  127|     64|                                               HIGHBD_DECL_SUFFIX) \
  128|     64|{ \
  129|     64|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     64|                   HIGHBD_TAIL_SUFFIX); \
  131|     64|}
itx_tmpl.c:inv_txfm_add_dct_adst_16x16_c:
  127|     52|                                               HIGHBD_DECL_SUFFIX) \
  128|     52|{ \
  129|     52|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     52|                   HIGHBD_TAIL_SUFFIX); \
  131|     52|}
itx_tmpl.c:inv_txfm_add_adst_adst_16x16_c:
  127|     42|                                               HIGHBD_DECL_SUFFIX) \
  128|     42|{ \
  129|     42|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     42|                   HIGHBD_TAIL_SUFFIX); \
  131|     42|}
itx_tmpl.c:inv_txfm_add_flipadst_adst_16x16_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_adst_flipadst_16x16_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_flipadst_dct_16x16_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_dct_identity_16x16_c:
  127|      4|                                               HIGHBD_DECL_SUFFIX) \
  128|      4|{ \
  129|      4|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      4|                   HIGHBD_TAIL_SUFFIX); \
  131|      4|}
itx_tmpl.c:inv_txfm_add_dct_dct_16x32_c:
  127|     22|                                               HIGHBD_DECL_SUFFIX) \
  128|     22|{ \
  129|     22|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     22|                   HIGHBD_TAIL_SUFFIX); \
  131|     22|}
itx_tmpl.c:inv_txfm_add_dct_dct_16x64_c:
  127|      2|                                               HIGHBD_DECL_SUFFIX) \
  128|      2|{ \
  129|      2|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|      2|                   HIGHBD_TAIL_SUFFIX); \
  131|      2|}
itx_tmpl.c:inv_txfm_add_dct_dct_32x8_c:
  127|     20|                                               HIGHBD_DECL_SUFFIX) \
  128|     20|{ \
  129|     20|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     20|                   HIGHBD_TAIL_SUFFIX); \
  131|     20|}
itx_tmpl.c:inv_txfm_add_dct_dct_32x16_c:
  127|     12|                                               HIGHBD_DECL_SUFFIX) \
  128|     12|{ \
  129|     12|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     12|                   HIGHBD_TAIL_SUFFIX); \
  131|     12|}
itx_tmpl.c:inv_txfm_add_dct_dct_32x32_c:
  127|     28|                                               HIGHBD_DECL_SUFFIX) \
  128|     28|{ \
  129|     28|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     28|                   HIGHBD_TAIL_SUFFIX); \
  131|     28|}
itx_tmpl.c:inv_txfm_add_dct_dct_64x64_c:
  127|     38|                                               HIGHBD_DECL_SUFFIX) \
  128|     38|{ \
  129|     38|    inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
  130|     38|                   HIGHBD_TAIL_SUFFIX); \
  131|     38|}

dav1d_copy_lpf_8bpc:
  106|      4|{
  107|      4|    const int have_tt = f->c->n_tc > 1;
  108|      4|    const int resize = f->frame_hdr->width[0] != f->frame_hdr->width[1];
  109|      4|    const int offset = 8 * !!sby;
  110|      4|    const ptrdiff_t *const src_stride = f->cur.stride;
  111|      4|    const ptrdiff_t *const lr_stride = f->sr_cur.p.stride;
  112|      4|    const int tt_off = have_tt * sby * (4 << f->seq_hdr->sb128);
  113|      4|    pixel *const dst[3] = {
  114|      4|        f->lf.lr_lpf_line[0] + tt_off * PXSTRIDE(lr_stride[0]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  115|      4|        f->lf.lr_lpf_line[1] + tt_off * PXSTRIDE(lr_stride[1]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  116|      4|        f->lf.lr_lpf_line[2] + tt_off * PXSTRIDE(lr_stride[1])
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  117|      4|    };
  118|       |
  119|       |    // TODO Also check block level restore type to reduce copying.
  120|      4|    const int restore_planes = f->lf.restore_planes;
  121|       |
  122|      4|    if (f->seq_hdr->cdef || restore_planes & LR_RESTORE_Y) {
  ------------------
  |  Branch (122:9): [True: 4, False: 0]
  |  Branch (122:29): [True: 0, False: 0]
  ------------------
  123|      4|        const int h = f->cur.p.h;
  124|      4|        const int w = f->bw << 2;
  125|      4|        const int row_h = imin((sby + 1) << (6 + f->seq_hdr->sb128), h - 1);
  126|      4|        const int y_stripe = (sby << (6 + f->seq_hdr->sb128)) - offset;
  127|      4|        if (restore_planes & LR_RESTORE_Y || !resize)
  ------------------
  |  Branch (127:13): [True: 0, False: 4]
  |  Branch (127:46): [True: 4, False: 0]
  ------------------
  128|      4|            backup_lpf(f, dst[0], lr_stride[0],
  129|      4|                       src[0] - offset * PXSTRIDE(src_stride[0]), src_stride[0],
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  130|      4|                       0, f->seq_hdr->sb128, y_stripe, row_h, w, h, 0, 1);
  131|      4|        if (have_tt && resize) {
  ------------------
  |  Branch (131:13): [True: 4, False: 0]
  |  Branch (131:24): [True: 0, False: 4]
  ------------------
  132|      0|            const ptrdiff_t cdef_off_y = sby * 4 * PXSTRIDE(src_stride[0]);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  133|      0|            backup_lpf(f, f->lf.cdef_lpf_line[0] + cdef_off_y, src_stride[0],
  134|      0|                       src[0] - offset * PXSTRIDE(src_stride[0]), src_stride[0],
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  135|      0|                       0, f->seq_hdr->sb128, y_stripe, row_h, w, h, 0, 0);
  136|      0|        }
  137|      4|    }
  138|      4|    if ((f->seq_hdr->cdef || restore_planes & (LR_RESTORE_U | LR_RESTORE_V)) &&
  ------------------
  |  Branch (138:10): [True: 4, False: 0]
  |  Branch (138:30): [True: 0, False: 0]
  ------------------
  139|      4|        f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400)
  ------------------
  |  Branch (139:9): [True: 4, False: 0]
  ------------------
  140|      4|    {
  141|      4|        const int ss_ver = f->sr_cur.p.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  142|      4|        const int ss_hor = f->sr_cur.p.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  143|      4|        const int h = (f->cur.p.h + ss_ver) >> ss_ver;
  144|      4|        const int w = f->bw << (2 - ss_hor);
  145|      4|        const int row_h = imin((sby + 1) << ((6 - ss_ver) + f->seq_hdr->sb128), h - 1);
  146|      4|        const int offset_uv = offset >> ss_ver;
  147|      4|        const int y_stripe = (sby << ((6 - ss_ver) + f->seq_hdr->sb128)) - offset_uv;
  148|      4|        const ptrdiff_t cdef_off_uv = sby * 4 * PXSTRIDE(src_stride[1]);
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  149|      4|        if (f->seq_hdr->cdef || restore_planes & LR_RESTORE_U) {
  ------------------
  |  Branch (149:13): [True: 4, False: 0]
  |  Branch (149:33): [True: 0, False: 0]
  ------------------
  150|      4|            if (restore_planes & LR_RESTORE_U || !resize)
  ------------------
  |  Branch (150:17): [True: 0, False: 4]
  |  Branch (150:50): [True: 4, False: 0]
  ------------------
  151|      4|                backup_lpf(f, dst[1], lr_stride[1],
  152|      4|                           src[1] - offset_uv * PXSTRIDE(src_stride[1]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  153|      4|                           src_stride[1], ss_ver, f->seq_hdr->sb128, y_stripe,
  154|      4|                           row_h, w, h, ss_hor, 1);
  155|      4|            if (have_tt && resize)
  ------------------
  |  Branch (155:17): [True: 4, False: 0]
  |  Branch (155:28): [True: 0, False: 4]
  ------------------
  156|      0|                backup_lpf(f, f->lf.cdef_lpf_line[1] + cdef_off_uv, src_stride[1],
  157|      0|                           src[1] - offset_uv * PXSTRIDE(src_stride[1]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  158|      0|                           src_stride[1], ss_ver, f->seq_hdr->sb128, y_stripe,
  159|      0|                           row_h, w, h, ss_hor, 0);
  160|      4|        }
  161|      4|        if (f->seq_hdr->cdef || restore_planes & LR_RESTORE_V) {
  ------------------
  |  Branch (161:13): [True: 4, False: 0]
  |  Branch (161:33): [True: 0, False: 0]
  ------------------
  162|      4|            if (restore_planes & LR_RESTORE_V || !resize)
  ------------------
  |  Branch (162:17): [True: 0, False: 4]
  |  Branch (162:50): [True: 4, False: 0]
  ------------------
  163|      4|                backup_lpf(f, dst[2], lr_stride[1],
  164|      4|                           src[2] - offset_uv * PXSTRIDE(src_stride[1]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
  165|      4|                           src_stride[1], ss_ver, f->seq_hdr->sb128, y_stripe,
  166|      4|                           row_h, w, h, ss_hor, 1);
  167|      4|            if (have_tt && resize)
  ------------------
  |  Branch (167:17): [True: 4, False: 0]
  |  Branch (167:28): [True: 0, False: 4]
  ------------------
  168|      0|                backup_lpf(f, f->lf.cdef_lpf_line[2] + cdef_off_uv, src_stride[1],
  169|      0|                           src[2] - offset_uv * PXSTRIDE(src_stride[1]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  170|      0|                           src_stride[1], ss_ver, f->seq_hdr->sb128, y_stripe,
  171|      0|                           row_h, w, h, ss_hor, 0);
  172|      4|        }
  173|      4|    }
  174|      4|}
lf_apply_tmpl.c:backup_lpf:
   47|     12|{
   48|     12|    const int cdef_backup = !lr_backup;
   49|     12|    const int dst_w = f->frame_hdr->super_res.enabled ?
  ------------------
  |  Branch (49:23): [True: 0, False: 12]
  ------------------
   50|     12|                      (f->frame_hdr->width[1] + ss_hor) >> ss_hor : src_w;
   51|       |
   52|       |    // The first stripe of the frame is shorter by 8 luma pixel rows.
   53|     12|    int stripe_h = ((64 << (cdef_backup & sb128)) - 8 * !row) >> ss_ver;
   54|     12|    src += (stripe_h - 2) * PXSTRIDE(src_stride);
  ------------------
  |  |   53|     12|#define PXSTRIDE(x) (x)
  ------------------
   55|       |
   56|     12|    if (f->c->n_tc == 1) {
  ------------------
  |  Branch (56:9): [True: 0, False: 12]
  ------------------
   57|      0|        if (row) {
  ------------------
  |  Branch (57:13): [True: 0, False: 0]
  ------------------
   58|      0|            const int top = 4 << sb128;
   59|       |            // Copy the top part of the stored loop filtered pixels from the
   60|       |            // previous sb row needed above the first stripe of this sb row.
   61|      0|            pixel_copy(&dst[PXSTRIDE(dst_stride) *  0],
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                          pixel_copy(&dst[PXSTRIDE(dst_stride) *  0],
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   62|      0|                       &dst[PXSTRIDE(dst_stride) *  top],      dst_w);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   63|      0|            pixel_copy(&dst[PXSTRIDE(dst_stride) *  1],
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                          pixel_copy(&dst[PXSTRIDE(dst_stride) *  1],
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   64|      0|                       &dst[PXSTRIDE(dst_stride) * (top + 1)], dst_w);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   65|      0|            pixel_copy(&dst[PXSTRIDE(dst_stride) *  2],
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                          pixel_copy(&dst[PXSTRIDE(dst_stride) *  2],
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   66|      0|                       &dst[PXSTRIDE(dst_stride) * (top + 2)], dst_w);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   67|      0|            pixel_copy(&dst[PXSTRIDE(dst_stride) *  3],
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                          pixel_copy(&dst[PXSTRIDE(dst_stride) *  3],
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   68|      0|                       &dst[PXSTRIDE(dst_stride) * (top + 3)], dst_w);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   69|      0|        }
   70|      0|        dst += 4 * PXSTRIDE(dst_stride);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   71|      0|    }
   72|       |
   73|     12|    if (lr_backup && (f->frame_hdr->width[0] != f->frame_hdr->width[1])) {
  ------------------
  |  Branch (73:9): [True: 12, False: 0]
  |  Branch (73:22): [True: 0, False: 12]
  ------------------
   74|      0|        while (row + stripe_h <= row_h) {
  ------------------
  |  Branch (74:16): [True: 0, False: 0]
  ------------------
   75|      0|            const int n_lines = 4 - (row + stripe_h + 1 == h);
   76|      0|            f->dsp->mc.resize(dst, dst_stride, src, src_stride,
   77|      0|                              dst_w, n_lines, src_w, f->resize_step[ss_hor],
   78|      0|                              f->resize_start[ss_hor] HIGHBD_CALL_SUFFIX);
   79|      0|            row += stripe_h; // unmodified stripe_h for the 1st stripe
   80|      0|            stripe_h = 64 >> ss_ver;
   81|      0|            src += stripe_h * PXSTRIDE(src_stride);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   82|      0|            dst += n_lines * PXSTRIDE(dst_stride);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   83|      0|            if (n_lines == 3) {
  ------------------
  |  Branch (83:17): [True: 0, False: 0]
  ------------------
   84|      0|                pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], dst_w);
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                              pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], dst_w);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   85|      0|                dst += PXSTRIDE(dst_stride);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
   86|      0|            }
   87|      0|        }
   88|     12|    } else {
   89|     30|        while (row + stripe_h <= row_h) {
  ------------------
  |  Branch (89:16): [True: 18, False: 12]
  ------------------
   90|     18|            const int n_lines = 4 - (row + stripe_h + 1 == h);
   91|     90|            for (int i = 0; i < 4; i++) {
  ------------------
  |  Branch (91:29): [True: 72, False: 18]
  ------------------
   92|     72|                pixel_copy(dst, i == n_lines ? &dst[-PXSTRIDE(dst_stride)] :
  ------------------
  |  |   47|     72|#define pixel_copy memcpy
  ------------------
                              pixel_copy(dst, i == n_lines ? &dst[-PXSTRIDE(dst_stride)] :
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  |  Branch (92:33): [True: 0, False: 72]
  ------------------
   93|     72|                                               src, src_w);
   94|     72|                dst += PXSTRIDE(dst_stride);
  ------------------
  |  |   53|     72|#define PXSTRIDE(x) (x)
  ------------------
   95|     72|                src += PXSTRIDE(src_stride);
  ------------------
  |  |   53|     72|#define PXSTRIDE(x) (x)
  ------------------
   96|     72|            }
   97|     18|            row += stripe_h; // unmodified stripe_h for the 1st stripe
   98|     18|            stripe_h = 64 >> ss_ver;
   99|     18|            src += (stripe_h - 4) * PXSTRIDE(src_stride);
  ------------------
  |  |   53|     18|#define PXSTRIDE(x) (x)
  ------------------
  100|     18|        }
  101|     12|    }
  102|     12|}

dav1d_calc_eih:
  385|      4|void dav1d_calc_eih(Av1FilterLUT *const lim_lut, const int filter_sharpness) {
  386|       |    // set E/I/H values from loopfilter level
  387|      4|    const int sharp = filter_sharpness;
  388|    260|    for (int level = 0; level < 64; level++) {
  ------------------
  |  Branch (388:25): [True: 256, False: 4]
  ------------------
  389|    256|        int limit = level;
  390|       |
  391|    256|        if (sharp > 0) {
  ------------------
  |  Branch (391:13): [True: 0, False: 256]
  ------------------
  392|      0|            limit >>= (sharp + 3) >> 2;
  393|      0|            limit = imin(limit, 9 - sharp);
  394|      0|        }
  395|    256|        limit = imax(limit, 1);
  396|       |
  397|    256|        lim_lut->i[level] = limit;
  398|    256|        lim_lut->e[level] = 2 * (level + 2) + limit;
  399|    256|    }
  400|      4|    lim_lut->sharp[0] = (sharp + 3) >> 2;
  401|      4|    lim_lut->sharp[1] = sharp ? 9 - sharp : 0xff;
  ------------------
  |  Branch (401:25): [True: 0, False: 4]
  ------------------
  402|      4|}
dav1d_calc_lf_values:
  441|      4|{
  442|      4|    const int n_seg = hdr->segmentation.enabled ? 8 : 1;
  ------------------
  |  Branch (442:23): [True: 2, False: 2]
  ------------------
  443|       |
  444|      4|    if (!hdr->loopfilter.level_y[0] && !hdr->loopfilter.level_y[1]) {
  ------------------
  |  Branch (444:9): [True: 4, False: 0]
  |  Branch (444:40): [True: 4, False: 0]
  ------------------
  445|      4|        memset(lflvl_values, 0, sizeof(*lflvl_values) * n_seg);
  446|      4|        return;
  447|      4|    }
  448|       |
  449|      0|    const Dav1dLoopfilterModeRefDeltas *const mr_deltas =
  450|      0|        hdr->loopfilter.mode_ref_delta_enabled ?
  ------------------
  |  Branch (450:9): [True: 0, False: 0]
  ------------------
  451|      0|        &hdr->loopfilter.mode_ref_deltas : NULL;
  452|      0|    for (int s = 0; s < n_seg; s++) {
  ------------------
  |  Branch (452:21): [True: 0, False: 0]
  ------------------
  453|      0|        const Dav1dSegmentationData *const segd =
  454|      0|            hdr->segmentation.enabled ? &hdr->segmentation.seg_data.d[s] : NULL;
  ------------------
  |  Branch (454:13): [True: 0, False: 0]
  ------------------
  455|       |
  456|      0|        calc_lf_value(lflvl_values[s][0], hdr->loopfilter.level_y[0],
  457|      0|                      lf_delta[0], segd ? segd->delta_lf_y_v : 0, mr_deltas);
  ------------------
  |  Branch (457:36): [True: 0, False: 0]
  ------------------
  458|      0|        calc_lf_value(lflvl_values[s][1], hdr->loopfilter.level_y[1],
  459|      0|                      lf_delta[hdr->delta.lf.multi ? 1 : 0],
  ------------------
  |  Branch (459:32): [True: 0, False: 0]
  ------------------
  460|      0|                      segd ? segd->delta_lf_y_h : 0, mr_deltas);
  ------------------
  |  Branch (460:23): [True: 0, False: 0]
  ------------------
  461|      0|        calc_lf_value_chroma(lflvl_values[s][2], hdr->loopfilter.level_u,
  462|      0|                             lf_delta[hdr->delta.lf.multi ? 2 : 0],
  ------------------
  |  Branch (462:39): [True: 0, False: 0]
  ------------------
  463|      0|                             segd ? segd->delta_lf_u : 0, mr_deltas);
  ------------------
  |  Branch (463:30): [True: 0, False: 0]
  ------------------
  464|      0|        calc_lf_value_chroma(lflvl_values[s][3], hdr->loopfilter.level_v,
  465|      0|                             lf_delta[hdr->delta.lf.multi ? 3 : 0],
  ------------------
  |  Branch (465:39): [True: 0, False: 0]
  ------------------
  466|      0|                             segd ? segd->delta_lf_v : 0, mr_deltas);
  ------------------
  |  Branch (466:30): [True: 0, False: 0]
  ------------------
  467|      0|    }
  468|      0|}

dav1d_default_settings:
   71|      9|COLD void dav1d_default_settings(Dav1dSettings *const s) {
   72|      9|    s->n_threads = 0;
   73|      9|    s->max_frame_delay = 0;
   74|      9|    s->apply_grain = 1;
   75|      9|    s->allocator.cookie = NULL;
   76|      9|    s->allocator.alloc_picture_callback = dav1d_default_picture_alloc;
   77|      9|    s->allocator.release_picture_callback = dav1d_default_picture_release;
   78|       |    s->logger.cookie = NULL;
   79|      9|    s->logger.callback = dav1d_log_default_callback;
   80|      9|    s->operating_point = 0;
   81|      9|    s->all_layers = 1; // just until the tests are adjusted
   82|      9|    s->frame_size_limit = 0;
   83|      9|    s->strict_std_compliance = 0;
   84|      9|    s->output_invisible_frames = 0;
   85|      9|    s->inloop_filters = DAV1D_INLOOPFILTER_ALL;
   86|      9|    s->decode_frame_type = DAV1D_DECODEFRAMETYPE_ALL;
   87|      9|}
dav1d_open:
  140|      9|COLD int dav1d_open(Dav1dContext **const c_out, const Dav1dSettings *const s) {
  141|      9|    static pthread_once_t initted = PTHREAD_ONCE_INIT;
  142|      9|    pthread_once(&initted, init_internal);
  143|       |
  144|      9|    validate_input_or_ret(c_out != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|      9|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  145|      9|    validate_input_or_ret(s != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|      9|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  146|      9|    validate_input_or_ret(s->n_threads >= 0 &&
  ------------------
  |  |   52|     18|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  147|      9|                          s->n_threads <= DAV1D_MAX_THREADS, DAV1D_ERR(EINVAL));
  148|      9|    validate_input_or_ret(s->max_frame_delay >= 0 &&
  ------------------
  |  |   52|     18|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  149|      9|                          s->max_frame_delay <= DAV1D_MAX_FRAME_DELAY, DAV1D_ERR(EINVAL));
  150|      9|    validate_input_or_ret(s->allocator.alloc_picture_callback != NULL,
  ------------------
  |  |   52|      9|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  151|      9|                          DAV1D_ERR(EINVAL));
  152|      9|    validate_input_or_ret(s->allocator.release_picture_callback != NULL,
  ------------------
  |  |   52|      9|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  153|      9|                          DAV1D_ERR(EINVAL));
  154|      9|    validate_input_or_ret(s->operating_point >= 0 &&
  ------------------
  |  |   52|     18|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  155|      9|                          s->operating_point <= 31, DAV1D_ERR(EINVAL));
  156|      9|    validate_input_or_ret(s->decode_frame_type >= DAV1D_DECODEFRAMETYPE_ALL &&
  ------------------
  |  |   52|     18|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  157|      9|                          s->decode_frame_type <= DAV1D_DECODEFRAMETYPE_KEY, DAV1D_ERR(EINVAL));
  158|       |
  159|      9|    pthread_attr_t thread_attr;
  160|      9|    if (pthread_attr_init(&thread_attr)) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (160:9): [True: 0, False: 9]
  ------------------
  161|      9|    size_t stack_size = 1024 * 1024 + get_stack_size_internal(&thread_attr);
  162|       |
  163|      9|    pthread_attr_setstacksize(&thread_attr, stack_size);
  164|       |
  165|      9|    Dav1dContext *const c = *c_out = dav1d_alloc_aligned(ALLOC_COMMON_CTX, sizeof(*c), 64);
  ------------------
  |  |  134|      9|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
  166|      9|    if (!c) goto error;
  ------------------
  |  Branch (166:9): [True: 0, False: 9]
  ------------------
  167|      9|    memset(c, 0, sizeof(*c));
  168|       |
  169|      9|    c->allocator = s->allocator;
  170|      9|    c->logger = s->logger;
  171|      9|    c->apply_grain = s->apply_grain;
  172|      9|    c->operating_point = s->operating_point;
  173|      9|    c->all_layers = s->all_layers;
  174|      9|    c->frame_size_limit = s->frame_size_limit;
  175|      9|    c->strict_std_compliance = s->strict_std_compliance;
  176|      9|    c->output_invisible_frames = s->output_invisible_frames;
  177|      9|    c->inloop_filters = s->inloop_filters;
  178|      9|    c->decode_frame_type = s->decode_frame_type;
  179|       |
  180|      9|    dav1d_data_props_set_defaults(&c->cached_error_props);
  181|       |
  182|      9|    if (dav1d_mem_pool_init(ALLOC_OBU_HDR, &c->seq_hdr_pool) ||
  ------------------
  |  |  131|     18|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  183|      9|        dav1d_mem_pool_init(ALLOC_OBU_HDR, &c->frame_hdr_pool) ||
  ------------------
  |  |  131|     18|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  184|      9|        dav1d_mem_pool_init(ALLOC_SEGMAP, &c->segmap_pool) ||
  ------------------
  |  |  131|     18|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  185|      9|        dav1d_mem_pool_init(ALLOC_REFMVS, &c->refmvs_pool) ||
  ------------------
  |  |  131|     18|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  186|      9|        dav1d_mem_pool_init(ALLOC_PIC_CTX, &c->pic_ctx_pool) ||
  ------------------
  |  |  131|     18|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  187|      9|        dav1d_mem_pool_init(ALLOC_CDF, &c->cdf_pool))
  ------------------
  |  |  131|      9|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  188|      0|    {
  189|      0|        goto error;
  190|      0|    }
  191|       |
  192|      9|    if (c->allocator.alloc_picture_callback   == dav1d_default_picture_alloc &&
  ------------------
  |  Branch (192:9): [True: 9, False: 0]
  ------------------
  193|      9|        c->allocator.release_picture_callback == dav1d_default_picture_release)
  ------------------
  |  Branch (193:9): [True: 9, False: 0]
  ------------------
  194|      9|    {
  195|      9|        if (c->allocator.cookie) goto error;
  ------------------
  |  Branch (195:13): [True: 0, False: 9]
  ------------------
  196|      9|        if (dav1d_mem_pool_init(ALLOC_PIC, &c->picture_pool)) goto error;
  ------------------
  |  |  131|      9|#define dav1d_mem_pool_init(type, pool) dav1d_mem_pool_init(pool)
  |  |  ------------------
  |  |  |  Branch (131:41): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  197|      9|        c->allocator.cookie = c->picture_pool;
  198|      9|    } else if (c->allocator.alloc_picture_callback   == dav1d_default_picture_alloc ||
  ------------------
  |  Branch (198:16): [True: 0, False: 0]
  ------------------
  199|      0|               c->allocator.release_picture_callback == dav1d_default_picture_release)
  ------------------
  |  Branch (199:16): [True: 0, False: 0]
  ------------------
  200|      0|    {
  201|      0|        goto error;
  202|      0|    }
  203|       |
  204|       |    /* On 32-bit systems extremely large frame sizes can cause overflows in
  205|       |     * dav1d_decode_frame() malloc size calculations. Prevent that from occuring
  206|       |     * by enforcing a maximum frame size limit, chosen to roughly correspond to
  207|       |     * the largest size possible to decode without exhausting virtual memory. */
  208|      9|    if (sizeof(size_t) < 8 && s->frame_size_limit - 1 >= 8192 * 8192) {
  ------------------
  |  Branch (208:9): [Folded, False: 9]
  |  Branch (208:31): [True: 0, False: 0]
  ------------------
  209|      0|        c->frame_size_limit = 8192 * 8192;
  210|      0|        if (s->frame_size_limit)
  ------------------
  |  Branch (210:13): [True: 0, False: 0]
  ------------------
  211|      0|            dav1d_log(c, "Frame size limit reduced from %u to %u.\n",
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
  212|      0|                      s->frame_size_limit, c->frame_size_limit);
  213|      0|    }
  214|       |
  215|      9|    c->flush = &c->flush_mem;
  216|      9|    atomic_init(c->flush, 0);
  217|       |
  218|      9|    get_num_threads(c, s, &c->n_tc, &c->n_fc);
  219|       |
  220|      9|    c->fc = dav1d_alloc_aligned(ALLOC_THREAD_CTX, sizeof(*c->fc) * c->n_fc, 32);
  ------------------
  |  |  134|      9|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
  221|      9|    if (!c->fc) goto error;
  ------------------
  |  Branch (221:9): [True: 0, False: 9]
  ------------------
  222|      9|    memset(c->fc, 0, sizeof(*c->fc) * c->n_fc);
  223|       |
  224|      9|    c->tc = dav1d_alloc_aligned(ALLOC_THREAD_CTX, sizeof(*c->tc) * c->n_tc, 64);
  ------------------
  |  |  134|      9|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
  225|      9|    if (!c->tc) goto error;
  ------------------
  |  Branch (225:9): [True: 0, False: 9]
  ------------------
  226|      9|    memset(c->tc, 0, sizeof(*c->tc) * c->n_tc);
  227|      9|    if (c->n_tc > 1) {
  ------------------
  |  Branch (227:9): [True: 9, False: 0]
  ------------------
  228|      9|        if (pthread_mutex_init(&c->task_thread.lock, NULL)) goto error;
  ------------------
  |  Branch (228:13): [True: 0, False: 9]
  ------------------
  229|      9|        if (pthread_cond_init(&c->task_thread.cond, NULL)) {
  ------------------
  |  Branch (229:13): [True: 0, False: 9]
  ------------------
  230|      0|            pthread_mutex_destroy(&c->task_thread.lock);
  231|      0|            goto error;
  232|      0|        }
  233|      9|        if (pthread_cond_init(&c->task_thread.delayed_fg.cond, NULL)) {
  ------------------
  |  Branch (233:13): [True: 0, False: 9]
  ------------------
  234|      0|            pthread_cond_destroy(&c->task_thread.cond);
  235|      0|            pthread_mutex_destroy(&c->task_thread.lock);
  236|      0|            goto error;
  237|      0|        }
  238|      9|        c->task_thread.cur = c->n_fc;
  239|      9|        atomic_init(&c->task_thread.reset_task_cur, UINT_MAX);
  240|      9|        atomic_init(&c->task_thread.cond_signaled, 0);
  241|      9|        c->task_thread.inited = 1;
  242|      9|    }
  243|       |
  244|      9|    if (c->n_fc > 1) {
  ------------------
  |  Branch (244:9): [True: 9, False: 0]
  ------------------
  245|      9|        const size_t out_delayed_sz = sizeof(*c->frame_thread.out_delayed) * c->n_fc;
  246|      9|        c->frame_thread.out_delayed =
  247|      9|            dav1d_malloc(ALLOC_THREAD_CTX, out_delayed_sz);
  ------------------
  |  |  132|      9|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
  248|      9|        if (!c->frame_thread.out_delayed) goto error;
  ------------------
  |  Branch (248:13): [True: 0, False: 9]
  ------------------
  249|      9|        memset(c->frame_thread.out_delayed, 0, out_delayed_sz);
  250|      9|    }
  251|     63|    for (unsigned n = 0; n < c->n_fc; n++) {
  ------------------
  |  Branch (251:26): [True: 54, False: 9]
  ------------------
  252|     54|        Dav1dFrameContext *const f = &c->fc[n];
  253|     54|        if (c->n_tc > 1) {
  ------------------
  |  Branch (253:13): [True: 54, False: 0]
  ------------------
  254|     54|            if (pthread_mutex_init(&f->task_thread.lock, NULL)) goto error;
  ------------------
  |  Branch (254:17): [True: 0, False: 54]
  ------------------
  255|     54|            if (pthread_cond_init(&f->task_thread.cond, NULL)) {
  ------------------
  |  Branch (255:17): [True: 0, False: 54]
  ------------------
  256|      0|                pthread_mutex_destroy(&f->task_thread.lock);
  257|      0|                goto error;
  258|      0|            }
  259|     54|            if (pthread_mutex_init(&f->task_thread.pending_tasks.lock, NULL)) {
  ------------------
  |  Branch (259:17): [True: 0, False: 54]
  ------------------
  260|      0|                pthread_cond_destroy(&f->task_thread.cond);
  261|      0|                pthread_mutex_destroy(&f->task_thread.lock);
  262|      0|                goto error;
  263|      0|            }
  264|     54|        }
  265|     54|        f->c = c;
  266|     54|        f->task_thread.ttd = &c->task_thread;
  267|     54|        f->lf.last_sharpness = -1;
  268|     54|    }
  269|       |
  270|    297|    for (unsigned m = 0; m < c->n_tc; m++) {
  ------------------
  |  Branch (270:26): [True: 288, False: 9]
  ------------------
  271|    288|        Dav1dTaskContext *const t = &c->tc[m];
  272|    288|        t->f = &c->fc[0];
  273|    288|        t->task_thread.ttd = &c->task_thread;
  274|    288|        t->c = c;
  275|    288|        memset(t->cf_16bpc, 0, sizeof(t->cf_16bpc));
  276|    288|        if (c->n_tc > 1) {
  ------------------
  |  Branch (276:13): [True: 288, False: 0]
  ------------------
  277|    288|            if (pthread_mutex_init(&t->task_thread.td.lock, NULL)) goto error;
  ------------------
  |  Branch (277:17): [True: 0, False: 288]
  ------------------
  278|    288|            if (pthread_cond_init(&t->task_thread.td.cond, NULL)) {
  ------------------
  |  Branch (278:17): [True: 0, False: 288]
  ------------------
  279|      0|                pthread_mutex_destroy(&t->task_thread.td.lock);
  280|      0|                goto error;
  281|      0|            }
  282|    288|            if (pthread_create(&t->task_thread.td.thread, &thread_attr, dav1d_worker_task, t)) {
  ------------------
  |  Branch (282:17): [True: 0, False: 288]
  ------------------
  283|      0|                pthread_cond_destroy(&t->task_thread.td.cond);
  284|      0|                pthread_mutex_destroy(&t->task_thread.td.lock);
  285|      0|                goto error;
  286|      0|            }
  287|    288|            t->task_thread.td.inited = 1;
  288|    288|        }
  289|    288|    }
  290|      9|    dav1d_pal_dsp_init(&c->pal_dsp);
  291|      9|    dav1d_refmvs_dsp_init(&c->refmvs_dsp);
  292|       |
  293|      9|    pthread_attr_destroy(&thread_attr);
  294|       |
  295|      9|    return 0;
  296|       |
  297|      0|error:
  298|      0|    if (c) close_internal(c_out, 0);
  ------------------
  |  Branch (298:9): [True: 0, False: 0]
  ------------------
  299|      0|    pthread_attr_destroy(&thread_attr);
  300|      0|    return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  301|      9|}
dav1d_send_data:
  439|     15|{
  440|     15|    validate_input_or_ret(c != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|     15|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 15]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  441|     15|    validate_input_or_ret(in != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|     15|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 15]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  442|       |
  443|     15|    if (in->data) {
  ------------------
  |  Branch (443:9): [True: 9, False: 6]
  ------------------
  444|      9|        validate_input_or_ret(in->sz > 0 && in->sz <= SIZE_MAX / 2, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|     18|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  |  Branch (52:11): [True: 9, False: 0]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  445|      9|        c->drain = 0;
  446|      9|    }
  447|     15|    if (c->in.data)
  ------------------
  |  Branch (447:9): [True: 0, False: 15]
  ------------------
  448|      0|        return DAV1D_ERR(EAGAIN);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  449|     15|    dav1d_data_ref(&c->in, in);
  450|       |
  451|     15|    int res = gen_picture(c);
  452|     15|    if (!res)
  ------------------
  |  Branch (452:9): [True: 12, False: 3]
  ------------------
  453|     12|        dav1d_data_unref_internal(in);
  454|       |
  455|     15|    return res;
  456|     15|}
dav1d_get_picture:
  459|    108|{
  460|    108|    validate_input_or_ret(c != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|    108|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 108]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  461|    108|    validate_input_or_ret(out != NULL, DAV1D_ERR(EINVAL));
  ------------------
  |  |   52|    108|    if (!(x)) { \
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 0, False: 108]
  |  |  ------------------
  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  ------------------
  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   54|      0|                    #x, __func__); \
  |  |   55|      0|        debug_abort(); \
  |  |  ------------------
  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|        return r; \
  |  |   57|      0|    }
  ------------------
  462|       |
  463|    108|    const int drain = c->drain;
  464|    108|    c->drain = 1;
  465|       |
  466|    108|    int res = gen_picture(c);
  467|    108|    if (res < 0)
  ------------------
  |  Branch (467:9): [True: 0, False: 108]
  ------------------
  468|      0|        return res;
  469|       |
  470|    108|    if (c->cached_error) {
  ------------------
  |  Branch (470:9): [True: 0, False: 108]
  ------------------
  471|      0|        const int res = c->cached_error;
  472|      0|        c->cached_error = 0;
  473|      0|        return res;
  474|      0|    }
  475|       |
  476|    108|    if (output_picture_ready(c, c->n_fc == 1))
  ------------------
  |  Branch (476:9): [True: 0, False: 108]
  ------------------
  477|      0|        return output_image(c, out);
  478|       |
  479|    108|    if (c->n_fc > 1 && drain)
  ------------------
  |  Branch (479:9): [True: 108, False: 0]
  |  Branch (479:24): [True: 102, False: 6]
  ------------------
  480|    102|        return drain_picture(c, out);
  481|       |
  482|      6|    return DAV1D_ERR(EAGAIN);
  ------------------
  |  |   58|      6|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  483|    108|}
dav1d_flush:
  526|      9|void dav1d_flush(Dav1dContext *const c) {
  527|      9|    dav1d_data_unref_internal(&c->in);
  528|      9|    if (c->out.p.frame_hdr)
  ------------------
  |  Branch (528:9): [True: 0, False: 9]
  ------------------
  529|      0|        dav1d_thread_picture_unref(&c->out);
  530|      9|    if (c->cache.p.frame_hdr)
  ------------------
  |  Branch (530:9): [True: 0, False: 9]
  ------------------
  531|      0|        dav1d_thread_picture_unref(&c->cache);
  532|       |
  533|      9|    c->drain = 0;
  534|      9|    c->cached_error = 0;
  535|       |
  536|     81|    for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (536:21): [True: 72, False: 9]
  ------------------
  537|     72|        if (c->refs[i].p.p.frame_hdr)
  ------------------
  |  Branch (537:13): [True: 32, False: 40]
  ------------------
  538|     32|            dav1d_thread_picture_unref(&c->refs[i].p);
  539|     72|        dav1d_ref_dec(&c->refs[i].segmap);
  540|     72|        dav1d_ref_dec(&c->refs[i].refmvs);
  541|     72|        dav1d_cdf_thread_unref(&c->cdf[i]);
  542|     72|    }
  543|      9|    c->frame_hdr = NULL;
  544|      9|    c->seq_hdr = NULL;
  545|      9|    dav1d_ref_dec(&c->seq_hdr_ref);
  546|       |
  547|      9|    c->mastering_display = NULL;
  548|      9|    c->content_light = NULL;
  549|      9|    c->itut_t35 = NULL;
  550|      9|    c->n_itut_t35 = 0;
  551|      9|    dav1d_ref_dec(&c->mastering_display_ref);
  552|      9|    dav1d_ref_dec(&c->content_light_ref);
  553|      9|    dav1d_ref_dec(&c->itut_t35_ref);
  554|       |
  555|      9|    dav1d_data_props_unref_internal(&c->cached_error_props);
  556|       |
  557|      9|    if (c->n_fc == 1 && c->n_tc == 1) return;
  ------------------
  |  Branch (557:9): [True: 0, False: 9]
  |  Branch (557:25): [True: 0, False: 0]
  ------------------
  558|      9|    atomic_store(c->flush, 1);
  559|       |
  560|      9|    if (c->n_tc > 1) {
  ------------------
  |  Branch (560:9): [True: 9, False: 0]
  ------------------
  561|      9|        pthread_mutex_lock(&c->task_thread.lock);
  562|       |        // stop running tasks in worker threads
  563|    297|        for (unsigned i = 0; i < c->n_tc; i++) {
  ------------------
  |  Branch (563:30): [True: 288, False: 9]
  ------------------
  564|    288|            Dav1dTaskContext *const tc = &c->tc[i];
  565|    288|            while (!tc->task_thread.flushed) {
  ------------------
  |  Branch (565:20): [True: 0, False: 288]
  ------------------
  566|      0|                pthread_cond_wait(&tc->task_thread.td.cond, &c->task_thread.lock);
  567|      0|            }
  568|    288|        }
  569|     63|        for (unsigned i = 0; i < c->n_fc; i++) {
  ------------------
  |  Branch (569:30): [True: 54, False: 9]
  ------------------
  570|     54|            c->fc[i].task_thread.task_head = NULL;
  571|     54|            c->fc[i].task_thread.task_tail = NULL;
  572|     54|            c->fc[i].task_thread.task_cur_prev = NULL;
  573|     54|            c->fc[i].task_thread.pending_tasks.head = NULL;
  574|     54|            c->fc[i].task_thread.pending_tasks.tail = NULL;
  575|     54|            atomic_init(&c->fc[i].task_thread.pending_tasks.merge, 0);
  576|     54|        }
  577|      9|        atomic_init(&c->task_thread.first, 0);
  578|      9|        c->task_thread.cur = c->n_fc;
  579|      9|        atomic_store(&c->task_thread.reset_task_cur, UINT_MAX);
  580|      9|        atomic_store(&c->task_thread.cond_signaled, 0);
  581|      9|        pthread_mutex_unlock(&c->task_thread.lock);
  582|      9|    }
  583|       |
  584|      9|    if (c->n_fc > 1) {
  ------------------
  |  Branch (584:9): [True: 9, False: 0]
  ------------------
  585|     63|        for (unsigned n = 0, next = c->frame_thread.next; n < c->n_fc; n++, next++) {
  ------------------
  |  Branch (585:59): [True: 54, False: 9]
  ------------------
  586|     54|            if (next == c->n_fc) next = 0;
  ------------------
  |  Branch (586:17): [True: 4, False: 50]
  ------------------
  587|     54|            Dav1dFrameContext *const f = &c->fc[next];
  588|     54|            dav1d_decode_frame_exit(f, -1);
  589|     54|            f->n_tile_data = 0;
  590|     54|            f->task_thread.retval = 0;
  591|     54|            f->task_thread.error = 0;
  592|     54|            Dav1dThreadPicture *out_delayed = &c->frame_thread.out_delayed[next];
  593|     54|            if (out_delayed->p.frame_hdr) {
  ------------------
  |  Branch (593:17): [True: 0, False: 54]
  ------------------
  594|      0|                dav1d_thread_picture_unref(out_delayed);
  595|      0|            }
  596|     54|        }
  597|      9|        c->frame_thread.next = 0;
  598|      9|    }
  599|       |    atomic_store(c->flush, 0);
  600|      9|}
dav1d_close:
  602|      9|COLD void dav1d_close(Dav1dContext **const c_out) {
  603|      9|    validate_input(c_out != NULL);
  ------------------
  |  |   59|      9|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|      9|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  604|       |#if TRACK_HEAP_ALLOCATIONS
  605|       |    dav1d_log_alloc_stats(*c_out);
  606|       |#endif
  607|      9|    close_internal(c_out, 1);
  608|      9|}
dav1d_data_create:
  731|      9|uint8_t *dav1d_data_create(Dav1dData *const buf, const size_t sz) {
  732|      9|    return dav1d_data_create_internal(buf, sz);
  733|      9|}
dav1d_data_unref:
  756|      3|void dav1d_data_unref(Dav1dData *const buf) {
  757|      3|    dav1d_data_unref_internal(buf);
  758|      3|}
lib.c:get_num_threads:
  111|      9|{
  112|       |    /* ceil(sqrt(n)) */
  113|      9|    static const uint8_t fc_lut[49] = {
  114|      9|        1,                                     /*     1 */
  115|      9|        2, 2, 2,                               /*  2- 4 */
  116|      9|        3, 3, 3, 3, 3,                         /*  5- 9 */
  117|      9|        4, 4, 4, 4, 4, 4, 4,                   /* 10-16 */
  118|      9|        5, 5, 5, 5, 5, 5, 5, 5, 5,             /* 17-25 */
  119|      9|        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,       /* 26-36 */
  120|      9|        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 37-49 */
  121|      9|    };
  122|      9|    *n_tc = s->n_threads ? s->n_threads :
  ------------------
  |  Branch (122:13): [True: 0, False: 9]
  ------------------
  123|      9|        iclip(dav1d_num_logical_processors(c), 1, DAV1D_MAX_THREADS);
  ------------------
  |  |   46|      9|#define DAV1D_MAX_THREADS 256
  ------------------
  124|      9|    *n_fc = s->max_frame_delay ? umin(s->max_frame_delay, *n_tc) :
  ------------------
  |  Branch (124:13): [True: 0, False: 9]
  ------------------
  125|      9|            *n_tc < 50 ? fc_lut[*n_tc - 1] : 8; // min(8, ceil(sqrt(n)))
  ------------------
  |  Branch (125:13): [True: 9, False: 0]
  ------------------
  126|      9|}
lib.c:init_internal:
   53|      1|static COLD void init_internal(void) {
   54|      1|    dav1d_init_cpu();
   55|      1|    dav1d_init_ii_wedge_masks();
   56|      1|    dav1d_init_intra_edge_tree();
   57|      1|    dav1d_init_qm_tables();
   58|      1|    dav1d_init_thread();
  ------------------
  |  |  144|      1|#define dav1d_init_thread() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (144:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
   59|      1|}
lib.c:get_stack_size_internal:
   93|      9|static COLD size_t get_stack_size_internal(const pthread_attr_t *const thread_attr) {
   94|       |    /* glibc has an issue where the size of the TLS is subtracted from the stack
   95|       |     * size instead of allocated separately. As a result the specified stack
   96|       |     * size may be insufficient when used in an application with large amounts
   97|       |     * of TLS data. The following is a workaround to compensate for that.
   98|       |     * See https://sourceware.org/bugzilla/show_bug.cgi?id=11787 */
   99|      9|    size_t (*const get_minstack)(const pthread_attr_t*) =
  100|      9|        dlsym(RTLD_DEFAULT, "__pthread_get_minstack");
  101|      9|    if (get_minstack)
  ------------------
  |  Branch (101:9): [True: 9, False: 0]
  ------------------
  102|      9|        return get_minstack(thread_attr) - PTHREAD_STACK_MIN;
  103|      0|    return 0;
  104|      9|}
lib.c:gen_picture:
  413|    123|{
  414|    123|    Dav1dData *const in = &c->in;
  415|       |
  416|    123|    if (output_picture_ready(c, 0))
  ------------------
  |  Branch (416:9): [True: 0, False: 123]
  ------------------
  417|      0|        return 0;
  418|       |
  419|    147|    while (in->sz > 0) {
  ------------------
  |  Branch (419:12): [True: 27, False: 120]
  ------------------
  420|     27|        const ptrdiff_t res = dav1d_parse_obus(c, in);
  421|     27|        if (res < 0) {
  ------------------
  |  Branch (421:13): [True: 3, False: 24]
  ------------------
  422|      3|            dav1d_data_unref_internal(in);
  423|     24|        } else {
  424|     24|            assert((size_t)res <= in->sz);
  ------------------
  |  |  140|     24|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 24]
  |  |  |  Branch (140:68): [Folded, False: 24]
  |  |  ------------------
  ------------------
  425|     24|            in->sz -= res;
  426|     24|            in->data += res;
  427|     24|            if (!in->sz) dav1d_data_unref_internal(in);
  ------------------
  |  Branch (427:17): [True: 6, False: 18]
  ------------------
  428|     24|        }
  429|     27|        if (output_picture_ready(c, 0))
  ------------------
  |  Branch (429:13): [True: 0, False: 27]
  ------------------
  430|      0|            break;
  431|     27|        if (res < 0)
  ------------------
  |  Branch (431:13): [True: 3, False: 24]
  ------------------
  432|      3|            return (int)res;
  433|     27|    }
  434|       |
  435|    120|    return 0;
  436|    123|}
lib.c:output_picture_ready:
  332|    356|static int output_picture_ready(Dav1dContext *const c, const int drain) {
  333|    356|    if (c->cached_error) return 1;
  ------------------
  |  Branch (333:9): [True: 0, False: 356]
  ------------------
  334|    356|    if (!c->all_layers && c->max_spatial_id) {
  ------------------
  |  Branch (334:9): [True: 356, False: 0]
  |  Branch (334:27): [True: 0, False: 356]
  ------------------
  335|      0|        if (c->out.p.data[0] && c->cache.p.data[0]) {
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  |  Branch (335:33): [True: 0, False: 0]
  ------------------
  336|      0|            if (c->max_spatial_id == c->cache.p.frame_hdr->spatial_id ||
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|      0|                c->out.flags & PICTURE_FLAG_NEW_TEMPORAL_UNIT)
  ------------------
  |  Branch (337:17): [True: 0, False: 0]
  ------------------
  338|      0|                return 1;
  339|      0|            dav1d_thread_picture_unref(&c->cache);
  340|      0|            dav1d_thread_picture_move_ref(&c->cache, &c->out);
  341|      0|            return 0;
  342|      0|        } else if (c->cache.p.data[0] && drain) {
  ------------------
  |  Branch (342:20): [True: 0, False: 0]
  |  Branch (342:42): [True: 0, False: 0]
  ------------------
  343|      0|            return 1;
  344|      0|        } else if (c->out.p.data[0]) {
  ------------------
  |  Branch (344:20): [True: 0, False: 0]
  ------------------
  345|      0|            dav1d_thread_picture_move_ref(&c->cache, &c->out);
  346|      0|            return 0;
  347|      0|        }
  348|      0|    }
  349|       |
  350|    356|    return !!c->out.p.data[0];
  351|    356|}
lib.c:drain_picture:
  353|    102|static int drain_picture(Dav1dContext *const c, Dav1dPicture *const out) {
  354|    102|    unsigned drain_count = 0;
  355|    102|    int drained = 0;
  356|    612|    do {
  357|    612|        const unsigned next = c->frame_thread.next;
  358|    612|        Dav1dFrameContext *const f = &c->fc[next];
  359|    612|        pthread_mutex_lock(&c->task_thread.lock);
  360|    616|        while (f->n_tile_data > 0)
  ------------------
  |  Branch (360:16): [True: 4, False: 612]
  ------------------
  361|      4|            pthread_cond_wait(&f->task_thread.cond,
  362|      4|                              &f->task_thread.ttd->lock);
  363|    612|        Dav1dThreadPicture *const out_delayed =
  364|    612|            &c->frame_thread.out_delayed[next];
  365|    612|        if (out_delayed->p.data[0] || atomic_load(&f->task_thread.error)) {
  ------------------
  |  Branch (365:13): [True: 4, False: 608]
  |  Branch (365:39): [True: 0, False: 608]
  ------------------
  366|      4|            unsigned first = atomic_load(&c->task_thread.first);
  367|      4|            if (first + 1U < c->n_fc)
  ------------------
  |  Branch (367:17): [True: 4, False: 0]
  ------------------
  368|      4|                atomic_fetch_add(&c->task_thread.first, 1U);
  369|      0|            else
  370|      4|                atomic_store(&c->task_thread.first, 0);
  371|      4|            atomic_compare_exchange_strong(&c->task_thread.reset_task_cur,
  372|      4|                                           &first, UINT_MAX);
  373|      4|            if (c->task_thread.cur && c->task_thread.cur < c->n_fc)
  ------------------
  |  Branch (373:17): [True: 4, False: 0]
  |  Branch (373:39): [True: 0, False: 4]
  ------------------
  374|      0|                c->task_thread.cur--;
  375|      4|            drained = 1;
  376|    608|        } else if (drained) {
  ------------------
  |  Branch (376:20): [True: 0, False: 608]
  ------------------
  377|      0|            pthread_mutex_unlock(&c->task_thread.lock);
  378|      0|            break;
  379|      0|        }
  380|    612|        if (++c->frame_thread.next == c->n_fc)
  ------------------
  |  Branch (380:13): [True: 102, False: 510]
  ------------------
  381|    102|            c->frame_thread.next = 0;
  382|    612|        pthread_mutex_unlock(&c->task_thread.lock);
  383|    612|        const int error = f->task_thread.retval;
  384|    612|        if (error) {
  ------------------
  |  Branch (384:13): [True: 4, False: 608]
  ------------------
  385|      4|            f->task_thread.retval = 0;
  386|      4|            dav1d_data_props_copy(&c->cached_error_props, &out_delayed->p.m);
  387|      4|            dav1d_thread_picture_unref(out_delayed);
  388|      4|            return error;
  389|      4|        }
  390|    608|        if (out_delayed->p.data[0]) {
  ------------------
  |  Branch (390:13): [True: 0, False: 608]
  ------------------
  391|      0|            const unsigned progress =
  392|      0|                atomic_load_explicit(&out_delayed->progress[1],
  393|      0|                                     memory_order_relaxed);
  394|      0|            if ((out_delayed->visible || c->output_invisible_frames) &&
  ------------------
  |  Branch (394:18): [True: 0, False: 0]
  |  Branch (394:42): [True: 0, False: 0]
  ------------------
  395|      0|                progress != FRAME_ERROR)
  ------------------
  |  |   35|      0|#define FRAME_ERROR (UINT_MAX - 1)
  ------------------
  |  Branch (395:17): [True: 0, False: 0]
  ------------------
  396|      0|            {
  397|      0|                dav1d_thread_picture_ref(&c->out, out_delayed);
  398|      0|                c->event_flags |= dav1d_picture_get_event_flags(out_delayed);
  399|      0|            }
  400|      0|            dav1d_thread_picture_unref(out_delayed);
  401|      0|            if (output_picture_ready(c, 0))
  ------------------
  |  Branch (401:17): [True: 0, False: 0]
  ------------------
  402|      0|                return output_image(c, out);
  403|      0|        }
  404|    608|    } while (++drain_count < c->n_fc);
  ------------------
  |  Branch (404:14): [True: 510, False: 98]
  ------------------
  405|       |
  406|     98|    if (output_picture_ready(c, 1))
  ------------------
  |  Branch (406:9): [True: 0, False: 98]
  ------------------
  407|      0|        return output_image(c, out);
  408|       |
  409|     98|    return DAV1D_ERR(EAGAIN);
  ------------------
  |  |   58|     98|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  410|     98|}
lib.c:close_internal:
  610|      9|static COLD void close_internal(Dav1dContext **const c_out, int flush) {
  611|      9|    Dav1dContext *const c = *c_out;
  612|      9|    if (!c) return;
  ------------------
  |  Branch (612:9): [True: 0, False: 9]
  ------------------
  613|       |
  614|      9|    if (flush) dav1d_flush(c);
  ------------------
  |  Branch (614:9): [True: 9, False: 0]
  ------------------
  615|       |
  616|      9|    if (c->tc) {
  ------------------
  |  Branch (616:9): [True: 9, False: 0]
  ------------------
  617|      9|        struct TaskThreadData *ttd = &c->task_thread;
  618|      9|        if (ttd->inited) {
  ------------------
  |  Branch (618:13): [True: 9, False: 0]
  ------------------
  619|      9|            pthread_mutex_lock(&ttd->lock);
  620|    297|            for (unsigned n = 0; n < c->n_tc && c->tc[n].task_thread.td.inited; n++)
  ------------------
  |  Branch (620:34): [True: 288, False: 9]
  |  Branch (620:49): [True: 288, False: 0]
  ------------------
  621|    288|                c->tc[n].task_thread.die = 1;
  622|      9|            pthread_cond_broadcast(&ttd->cond);
  623|      9|            pthread_mutex_unlock(&ttd->lock);
  624|    297|            for (unsigned n = 0; n < c->n_tc; n++) {
  ------------------
  |  Branch (624:34): [True: 288, False: 9]
  ------------------
  625|    288|                Dav1dTaskContext *const pf = &c->tc[n];
  626|    288|                if (!pf->task_thread.td.inited) break;
  ------------------
  |  Branch (626:21): [True: 0, False: 288]
  ------------------
  627|    288|                pthread_join(pf->task_thread.td.thread, NULL);
  628|    288|                pthread_cond_destroy(&pf->task_thread.td.cond);
  629|    288|                pthread_mutex_destroy(&pf->task_thread.td.lock);
  630|    288|            }
  631|      9|            pthread_cond_destroy(&ttd->delayed_fg.cond);
  632|      9|            pthread_cond_destroy(&ttd->cond);
  633|      9|            pthread_mutex_destroy(&ttd->lock);
  634|      9|        }
  635|      9|        dav1d_free_aligned(c->tc);
  ------------------
  |  |  136|      9|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  636|      9|    }
  637|       |
  638|     63|    for (unsigned n = 0; c->fc && n < c->n_fc; n++) {
  ------------------
  |  Branch (638:26): [True: 63, False: 0]
  |  Branch (638:35): [True: 54, False: 9]
  ------------------
  639|     54|        Dav1dFrameContext *const f = &c->fc[n];
  640|       |
  641|       |        // clean-up threading stuff
  642|     54|        if (c->n_fc > 1) {
  ------------------
  |  Branch (642:13): [True: 54, False: 0]
  ------------------
  643|     54|            dav1d_free(f->tile_thread.lowest_pixel_mem);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  644|     54|            dav1d_free(f->frame_thread.b);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  645|     54|            dav1d_free_aligned(f->frame_thread.cbi);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  646|     54|            dav1d_free_aligned(f->frame_thread.pal_idx);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  647|     54|            dav1d_free_aligned(f->frame_thread.cf);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  648|     54|            dav1d_free(f->frame_thread.tile_start_off);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  649|     54|            dav1d_free_aligned(f->frame_thread.pal);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  650|     54|        }
  651|     54|        if (c->n_tc > 1) {
  ------------------
  |  Branch (651:13): [True: 54, False: 0]
  ------------------
  652|     54|            pthread_mutex_destroy(&f->task_thread.pending_tasks.lock);
  653|     54|            pthread_cond_destroy(&f->task_thread.cond);
  654|     54|            pthread_mutex_destroy(&f->task_thread.lock);
  655|     54|        }
  656|     54|        dav1d_free(f->frame_thread.frame_progress);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  657|     54|        dav1d_free(f->task_thread.tasks);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  658|     54|        dav1d_free(f->task_thread.tile_tasks[0]);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  659|     54|        dav1d_free_aligned(f->ts);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  660|     54|        dav1d_free_aligned(f->ipred_edge[0]);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  661|     54|        dav1d_free(f->a);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  662|     54|        dav1d_free(f->tile);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  663|     54|        dav1d_free(f->lf.mask);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  664|     54|        dav1d_free(f->lf.level);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  665|     54|        dav1d_free(f->lf.lr_mask);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  666|     54|        dav1d_free(f->lf.tx_lpf_right_edge[0]);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  667|     54|        dav1d_free(f->lf.start_of_tile_row);
  ------------------
  |  |  135|     54|#define dav1d_free(ptr) free(ptr)
  ------------------
  668|     54|        dav1d_free_aligned(f->rf.r);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  669|     54|        dav1d_free_aligned(f->lf.cdef_line_buf);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  670|     54|        dav1d_free_aligned(f->lf.lr_line_buf);
  ------------------
  |  |  136|     54|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  671|     54|    }
  672|      9|    dav1d_free_aligned(c->fc);
  ------------------
  |  |  136|      9|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  673|      9|    if (c->n_fc > 1 && c->frame_thread.out_delayed) {
  ------------------
  |  Branch (673:9): [True: 9, False: 0]
  |  Branch (673:24): [True: 9, False: 0]
  ------------------
  674|     63|        for (unsigned n = 0; n < c->n_fc; n++)
  ------------------
  |  Branch (674:30): [True: 54, False: 9]
  ------------------
  675|     54|            if (c->frame_thread.out_delayed[n].p.frame_hdr)
  ------------------
  |  Branch (675:17): [True: 0, False: 54]
  ------------------
  676|      0|                dav1d_thread_picture_unref(&c->frame_thread.out_delayed[n]);
  677|      9|        dav1d_free(c->frame_thread.out_delayed);
  ------------------
  |  |  135|      9|#define dav1d_free(ptr) free(ptr)
  ------------------
  678|      9|    }
  679|      9|    for (int n = 0; n < c->n_tile_data; n++)
  ------------------
  |  Branch (679:21): [True: 0, False: 9]
  ------------------
  680|      0|        dav1d_data_unref_internal(&c->tile[n].data);
  681|      9|    dav1d_free(c->tile);
  ------------------
  |  |  135|      9|#define dav1d_free(ptr) free(ptr)
  ------------------
  682|     81|    for (int n = 0; n < 8; n++) {
  ------------------
  |  Branch (682:21): [True: 72, False: 9]
  ------------------
  683|     72|        dav1d_cdf_thread_unref(&c->cdf[n]);
  684|     72|        if (c->refs[n].p.p.frame_hdr)
  ------------------
  |  Branch (684:13): [True: 0, False: 72]
  ------------------
  685|      0|            dav1d_thread_picture_unref(&c->refs[n].p);
  686|     72|        dav1d_ref_dec(&c->refs[n].refmvs);
  687|     72|        dav1d_ref_dec(&c->refs[n].segmap);
  688|     72|    }
  689|      9|    dav1d_ref_dec(&c->seq_hdr_ref);
  690|      9|    dav1d_ref_dec(&c->frame_hdr_ref);
  691|       |
  692|      9|    dav1d_ref_dec(&c->mastering_display_ref);
  693|      9|    dav1d_ref_dec(&c->content_light_ref);
  694|      9|    dav1d_ref_dec(&c->itut_t35_ref);
  695|       |
  696|      9|    dav1d_mem_pool_end(c->seq_hdr_pool);
  697|      9|    dav1d_mem_pool_end(c->frame_hdr_pool);
  698|      9|    dav1d_mem_pool_end(c->segmap_pool);
  699|      9|    dav1d_mem_pool_end(c->refmvs_pool);
  700|      9|    dav1d_mem_pool_end(c->cdf_pool);
  701|      9|    dav1d_mem_pool_end(c->picture_pool);
  702|      9|    dav1d_mem_pool_end(c->pic_ctx_pool);
  703|       |
  704|      9|    dav1d_freep_aligned(c_out);
  705|      9|}

dav1d_log_default_callback:
   42|      9|{
   43|       |    vfprintf(stderr, format, ap);
   44|      9|}
dav1d_log:
   46|      9|COLD void dav1d_log(Dav1dContext *const c, const char *const format, ...) {
   47|      9|    assert(c != NULL);
  ------------------
  |  |  140|      9|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 9]
  |  |  |  Branch (140:68): [Folded, False: 9]
  |  |  ------------------
  ------------------
   48|       |
   49|      9|    if (!c->logger.callback)
  ------------------
  |  Branch (49:9): [True: 0, False: 9]
  ------------------
   50|      0|        return;
   51|       |
   52|      9|    va_list ap;
   53|      9|    va_start(ap, format);
   54|      9|    c->logger.callback(c->logger.cookie, format, ap);
   55|       |    va_end(ap);
   56|      9|}

dav1d_loop_filter_dsp_init_8bpc:
  259|      4|COLD void bitfn(dav1d_loop_filter_dsp_init)(Dav1dLoopFilterDSPContext *const c) {
  260|      4|    c->loop_filter_sb[0][0] = loop_filter_h_sb128y_c;
  261|      4|    c->loop_filter_sb[0][1] = loop_filter_v_sb128y_c;
  262|      4|    c->loop_filter_sb[1][0] = loop_filter_h_sb128uv_c;
  263|      4|    c->loop_filter_sb[1][1] = loop_filter_v_sb128uv_c;
  264|       |
  265|       |#if HAVE_ASM
  266|       |#if ARCH_AARCH64 || ARCH_ARM
  267|       |    loop_filter_dsp_init_arm(c);
  268|       |#elif ARCH_LOONGARCH64
  269|       |    loop_filter_dsp_init_loongarch(c);
  270|       |#elif ARCH_PPC64LE
  271|       |    loop_filter_dsp_init_ppc(c);
  272|       |#elif ARCH_X86
  273|       |    loop_filter_dsp_init_x86(c);
  274|       |#endif
  275|       |#endif
  276|      4|}

dav1d_loop_restoration_dsp_init_8bpc:
 1367|      4|{
 1368|      4|    c->wiener[0] = c->wiener[1] = wiener_c;
 1369|      4|    c->sgr[0] = sgr_5x5_c;
 1370|      4|    c->sgr[1] = sgr_3x3_c;
 1371|      4|    c->sgr[2] = sgr_mix_c;
 1372|       |
 1373|       |#if HAVE_ASM
 1374|       |#if ARCH_AARCH64 || ARCH_ARM
 1375|       |    loop_restoration_dsp_init_arm(c, bpc);
 1376|       |#elif ARCH_LOONGARCH64
 1377|       |    loop_restoration_dsp_init_loongarch(c, bpc);
 1378|       |#elif ARCH_PPC64LE
 1379|       |    loop_restoration_dsp_init_ppc(c, bpc);
 1380|       |#elif ARCH_X86
 1381|       |    loop_restoration_dsp_init_x86(c, bpc);
 1382|       |#endif
 1383|       |#endif
 1384|      4|}

dav1d_mc_dsp_init_8bpc:
  960|      4|COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
  961|      4|#define init_mc_fns(type, name) do { \
  962|      4|    c->mc        [type] = put_##name##_c; \
  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  964|      4|    c->mct       [type] = prep_##name##_c; \
  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  966|      4|} while (0)
  967|       |
  968|      4|    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  969|      4|    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  970|      4|    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  971|      4|    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  972|      4|    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  973|      4|    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  974|      4|    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  975|      4|    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  976|      4|    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  977|      4|    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
  ------------------
  |  |  961|      4|#define init_mc_fns(type, name) do { \
  |  |  962|      4|    c->mc        [type] = put_##name##_c; \
  |  |  963|      4|    c->mc_scaled [type] = put_##name##_scaled_c; \
  |  |  964|      4|    c->mct       [type] = prep_##name##_c; \
  |  |  965|      4|    c->mct_scaled[type] = prep_##name##_scaled_c; \
  |  |  966|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (966:10): [Folded, False: 4]
  |  |  ------------------
  ------------------
  978|       |
  979|      4|    c->avg      = avg_c;
  980|      4|    c->w_avg    = w_avg_c;
  981|      4|    c->mask     = mask_c;
  982|      4|    c->blend    = blend_c;
  983|      4|    c->blend_v  = blend_v_c;
  984|      4|    c->blend_h  = blend_h_c;
  985|      4|    c->w_mask[0] = w_mask_444_c;
  986|      4|    c->w_mask[1] = w_mask_422_c;
  987|      4|    c->w_mask[2] = w_mask_420_c;
  988|      4|    c->warp8x8  = warp_affine_8x8_c;
  989|      4|    c->warp8x8t = warp_affine_8x8t_c;
  990|      4|    c->emu_edge = emu_edge_c;
  991|      4|    c->resize   = resize_c;
  992|       |
  993|       |#if HAVE_ASM
  994|       |#if ARCH_AARCH64 || ARCH_ARM
  995|       |    mc_dsp_init_arm(c);
  996|       |#elif ARCH_LOONGARCH64
  997|       |    mc_dsp_init_loongarch(c);
  998|       |#elif ARCH_PPC64LE
  999|       |    mc_dsp_init_ppc(c);
 1000|       |#elif ARCH_RISCV
 1001|       |    mc_dsp_init_riscv(c);
 1002|       |#elif ARCH_X86
 1003|       |    mc_dsp_init_x86(c);
 1004|       |#endif
 1005|       |#endif
 1006|      4|}
mc_tmpl.c:put_c:
   54|    172|{
   55|  4.05k|    do {
   56|  4.05k|        pixel_copy(dst, src, w);
  ------------------
  |  |   47|  4.05k|#define pixel_copy memcpy
  ------------------
   57|       |
   58|  4.05k|        dst += dst_stride;
   59|  4.05k|        src += src_stride;
   60|  4.05k|    } while (--h);
  ------------------
  |  Branch (60:14): [True: 3.88k, False: 172]
  ------------------
   61|    172|}
mc_tmpl.c:put_bilin_c:
  438|    320|{
  439|    320|    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
  ------------------
  |  |   40|    320|#define get_intermediate_bits(bitdepth_max) 4
  ------------------
  440|    320|    const int intermediate_rnd = (1 << intermediate_bits) >> 1;
  441|    320|    dst_stride = PXSTRIDE(dst_stride);
  ------------------
  |  |   53|    320|#define PXSTRIDE(x) (x)
  ------------------
  442|    320|    src_stride = PXSTRIDE(src_stride);
  ------------------
  |  |   53|    320|#define PXSTRIDE(x) (x)
  ------------------
  443|       |
  444|    320|    if (mx) {
  ------------------
  |  Branch (444:9): [True: 100, False: 220]
  ------------------
  445|    100|        if (my) {
  ------------------
  |  Branch (445:13): [True: 40, False: 60]
  ------------------
  446|     40|            int16_t mid[128 * 129], *mid_ptr = mid;
  447|     40|            int tmp_h = h + 1;
  448|       |
  449|    424|            do {
  450|  4.76k|                for (int x = 0; x < w; x++)
  ------------------
  |  Branch (450:33): [True: 4.33k, False: 424]
  ------------------
  451|  4.33k|                    mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,
  ------------------
  |  |  420|  4.33k|    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
  |  |  ------------------
  |  |  |  |  417|  4.33k|    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
  |  |  ------------------
  ------------------
  452|    424|                                                  4 - intermediate_bits);
  453|       |
  454|    424|                mid_ptr += 128;
  455|    424|                src += src_stride;
  456|    424|            } while (--tmp_h);
  ------------------
  |  Branch (456:22): [True: 384, False: 40]
  ------------------
  457|       |
  458|     40|            mid_ptr = mid;
  459|    384|            do {
  460|  4.35k|                for (int x = 0; x < w; x++)
  ------------------
  |  Branch (460:33): [True: 3.96k, False: 384]
  ------------------
  461|  3.96k|                    dst[x] = FILTER_BILIN_CLIP(mid_ptr, x, my, 128,
  ------------------
  |  |  423|  3.96k|    iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
  |  |  ------------------
  |  |  |  |   49|  3.96k|#define iclip_pixel iclip_u8
  |  |  ------------------
  |  |                   iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
  |  |  ------------------
  |  |  |  |  420|  3.96k|    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  3.96k|    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  462|    384|                                               4 + intermediate_bits);
  463|       |
  464|    384|                mid_ptr += 128;
  465|    384|                dst += dst_stride;
  466|    384|            } while (--h);
  ------------------
  |  Branch (466:22): [True: 344, False: 40]
  ------------------
  467|     60|        } else {
  468|  1.53k|            do {
  469|  85.5k|                for (int x = 0; x < w; x++) {
  ------------------
  |  Branch (469:33): [True: 83.9k, False: 1.53k]
  ------------------
  470|  83.9k|                    const int px = FILTER_BILIN_RND(src, x, mx, 1,
  ------------------
  |  |  420|  83.9k|    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
  |  |  ------------------
  |  |  |  |  417|  83.9k|    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
  |  |  ------------------
  ------------------
  471|  83.9k|                                                    4 - intermediate_bits);
  472|  83.9k|                    dst[x] = iclip_pixel((px + intermediate_rnd) >> intermediate_bits);
  ------------------
  |  |   49|  83.9k|#define iclip_pixel iclip_u8
  ------------------
  473|  83.9k|                }
  474|       |
  475|  1.53k|                dst += dst_stride;
  476|  1.53k|                src += src_stride;
  477|  1.53k|            } while (--h);
  ------------------
  |  Branch (477:22): [True: 1.47k, False: 60]
  ------------------
  478|     60|        }
  479|    220|    } else if (my) {
  ------------------
  |  Branch (479:16): [True: 48, False: 172]
  ------------------
  480|    528|        do {
  481|  19.2k|            for (int x = 0; x < w; x++)
  ------------------
  |  Branch (481:29): [True: 18.7k, False: 528]
  ------------------
  482|  18.7k|                dst[x] = FILTER_BILIN_CLIP(src, x, my, src_stride, 4);
  ------------------
  |  |  423|  18.7k|    iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
  |  |  ------------------
  |  |  |  |   49|  18.7k|#define iclip_pixel iclip_u8
  |  |  ------------------
  |  |                   iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
  |  |  ------------------
  |  |  |  |  420|  18.7k|    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
  |  |  |  |  ------------------
  |  |  |  |  |  |  417|  18.7k|    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  483|       |
  484|    528|            dst += dst_stride;
  485|    528|            src += src_stride;
  486|    528|        } while (--h);
  ------------------
  |  Branch (486:18): [True: 480, False: 48]
  ------------------
  487|     48|    } else
  488|    172|        put_c(dst, dst_stride, src, src_stride, w, h);
  489|    320|}
mc_tmpl.c:emu_edge_c:
  873|     20|{
  874|       |    // find offset in reference of visible block to copy
  875|     20|    ref += iclip((int) y, 0, (int) ih - 1) * PXSTRIDE(ref_stride) +
  ------------------
  |  |   53|     20|#define PXSTRIDE(x) (x)
  ------------------
  876|     20|           iclip((int) x, 0, (int) iw - 1);
  877|       |
  878|       |    // number of pixels to extend (left, right, top, bottom)
  879|     20|    const int left_ext = iclip((int) -x, 0, (int) bw - 1);
  880|     20|    const int right_ext = iclip((int) (x + bw - iw), 0, (int) bw - 1);
  881|     20|    assert(left_ext + right_ext < bw);
  ------------------
  |  |  140|     20|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 20]
  |  |  |  Branch (140:68): [Folded, False: 20]
  |  |  ------------------
  ------------------
  882|     20|    const int top_ext = iclip((int) -y, 0, (int) bh - 1);
  883|     20|    const int bottom_ext = iclip((int) (y + bh - ih), 0, (int) bh - 1);
  884|     20|    assert(top_ext + bottom_ext < bh);
  ------------------
  |  |  140|     20|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 20]
  |  |  |  Branch (140:68): [Folded, False: 20]
  |  |  ------------------
  ------------------
  885|       |
  886|       |    // copy visible portion first
  887|     20|    pixel *blk = dst + top_ext * PXSTRIDE(dst_stride);
  ------------------
  |  |   53|     20|#define PXSTRIDE(x) (x)
  ------------------
  888|     20|    const int center_w = (int) (bw - left_ext - right_ext);
  889|     20|    const int center_h = (int) (bh - top_ext - bottom_ext);
  890|    724|    for (int y = 0; y < center_h; y++) {
  ------------------
  |  Branch (890:21): [True: 704, False: 20]
  ------------------
  891|    704|        pixel_copy(blk + left_ext, ref, center_w);
  ------------------
  |  |   47|    704|#define pixel_copy memcpy
  ------------------
  892|       |        // extend left edge for this line
  893|    704|        if (left_ext)
  ------------------
  |  Branch (893:13): [True: 512, False: 192]
  ------------------
  894|    512|            pixel_set(blk, blk[left_ext], left_ext);
  ------------------
  |  |   48|    512|#define pixel_set memset
  ------------------
  895|       |        // extend right edge for this line
  896|    704|        if (right_ext)
  ------------------
  |  Branch (896:13): [True: 0, False: 704]
  ------------------
  897|      0|            pixel_set(blk + left_ext + center_w, blk[left_ext + center_w - 1],
  ------------------
  |  |   48|      0|#define pixel_set memset
  ------------------
  898|      0|                      right_ext);
  899|    704|        ref += PXSTRIDE(ref_stride);
  ------------------
  |  |   53|    704|#define PXSTRIDE(x) (x)
  ------------------
  900|    704|        blk += PXSTRIDE(dst_stride);
  ------------------
  |  |   53|    704|#define PXSTRIDE(x) (x)
  ------------------
  901|    704|    }
  902|       |
  903|       |    // copy top
  904|     20|    blk = dst + top_ext * PXSTRIDE(dst_stride);
  ------------------
  |  |   53|     20|#define PXSTRIDE(x) (x)
  ------------------
  905|     56|    for (int y = 0; y < top_ext; y++) {
  ------------------
  |  Branch (905:21): [True: 36, False: 20]
  ------------------
  906|     36|        pixel_copy(dst, blk, bw);
  ------------------
  |  |   47|     36|#define pixel_copy memcpy
  ------------------
  907|     36|        dst += PXSTRIDE(dst_stride);
  ------------------
  |  |   53|     36|#define PXSTRIDE(x) (x)
  ------------------
  908|     36|    }
  909|       |
  910|       |    // copy bottom
  911|     20|    dst += center_h * PXSTRIDE(dst_stride);
  ------------------
  |  |   53|     20|#define PXSTRIDE(x) (x)
  ------------------
  912|     20|    for (int y = 0; y < bottom_ext; y++) {
  ------------------
  |  Branch (912:21): [True: 0, False: 20]
  ------------------
  913|      0|        pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], bw);
  ------------------
  |  |   47|      0|#define pixel_copy memcpy
  ------------------
                      pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], bw);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  914|      0|        dst += PXSTRIDE(dst_stride);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
  915|      0|    }
  916|     20|}

dav1d_mem_pool_push:
  224|     27|void dav1d_mem_pool_push(Dav1dMemPool *const pool, void *const ptr) {
  225|     27|    pthread_mutex_lock(&pool->lock);
  226|     27|    Dav1dMemPoolBuffer *const buf = (Dav1dMemPoolBuffer*)((uintptr_t)ptr - 64);
  227|     27|    const int ref_cnt = --pool->ref_cnt;
  228|     27|    if (!pool->end) {
  ------------------
  |  Branch (228:9): [True: 27, False: 0]
  ------------------
  229|     27|        buf->next = pool->buf;
  230|     27|        pool->buf = buf;
  231|     27|        pthread_mutex_unlock(&pool->lock);
  232|     27|        assert(ref_cnt > 0);
  ------------------
  |  |  140|     27|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 27]
  |  |  |  Branch (140:68): [Folded, False: 27]
  |  |  ------------------
  ------------------
  233|     27|    } else {
  234|      0|        pthread_mutex_unlock(&pool->lock);
  235|      0|        dav1d_free_aligned(buf);
  ------------------
  |  |  136|      0|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  236|      0|        if (!ref_cnt) mem_pool_destroy(pool);
  ------------------
  |  Branch (236:13): [True: 0, False: 0]
  ------------------
  237|      0|    }
  238|     27|}
dav1d_mem_pool_pop:
  240|     27|void *dav1d_mem_pool_pop(Dav1dMemPool *const pool, const size_t size) {
  241|     27|    pthread_mutex_lock(&pool->lock);
  242|     27|    Dav1dMemPoolBuffer *buf = pool->buf;
  243|     27|    pool->ref_cnt++;
  244|       |
  245|     27|    if (buf) {
  ------------------
  |  Branch (245:9): [True: 0, False: 27]
  ------------------
  246|      0|        pool->buf = buf->next;
  247|      0|        pthread_mutex_unlock(&pool->lock);
  248|      0|        if (buf->size != size) {
  ------------------
  |  Branch (248:13): [True: 0, False: 0]
  ------------------
  249|       |            /* Reallocate if the size has changed */
  250|      0|            dav1d_free_aligned(buf);
  ------------------
  |  |  136|      0|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  251|      0|            goto alloc;
  252|      0|        }
  253|       |#if TRACK_HEAP_ALLOCATIONS
  254|       |        dav1d_track_reuse(pool->type);
  255|       |#endif
  256|     27|    } else {
  257|     27|        pthread_mutex_unlock(&pool->lock);
  258|     27|alloc:
  259|     27|        buf = dav1d_alloc_aligned(pool->type, size + 64, 64);
  ------------------
  |  |  134|     27|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
  260|     27|        if (!buf) {
  ------------------
  |  Branch (260:13): [True: 0, False: 27]
  ------------------
  261|      0|            pthread_mutex_lock(&pool->lock);
  262|      0|            const int ref_cnt = --pool->ref_cnt;
  263|      0|            pthread_mutex_unlock(&pool->lock);
  264|      0|            if (!ref_cnt) mem_pool_destroy(pool);
  ------------------
  |  Branch (264:17): [True: 0, False: 0]
  ------------------
  265|      0|            return NULL;
  266|      0|        }
  267|     27|        buf->size = size;
  268|     27|    }
  269|       |
  270|     27|    return (void*)((uintptr_t)buf + 64);
  271|     27|}
dav1d_mem_pool_init:
  275|     63|{
  276|     63|    Dav1dMemPool *const pool = dav1d_malloc(ALLOC_COMMON_CTX,
  ------------------
  |  |  132|     63|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
  277|     63|                                            sizeof(Dav1dMemPool));
  278|     63|    if (pool) {
  ------------------
  |  Branch (278:9): [True: 63, False: 0]
  ------------------
  279|     63|        if (!pthread_mutex_init(&pool->lock, NULL)) {
  ------------------
  |  Branch (279:13): [True: 63, False: 0]
  ------------------
  280|     63|            pool->buf = NULL;
  281|     63|            pool->ref_cnt = 1;
  282|     63|            pool->end = 0;
  283|       |#if TRACK_HEAP_ALLOCATIONS
  284|       |            pool->type = type;
  285|       |#endif
  286|     63|            *ppool = pool;
  287|     63|            return 0;
  288|     63|        }
  289|      0|        dav1d_free(pool);
  ------------------
  |  |  135|      0|#define dav1d_free(ptr) free(ptr)
  ------------------
  290|      0|    }
  291|      0|    *ppool = NULL;
  292|      0|    return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  293|     63|}
dav1d_mem_pool_end:
  295|     63|COLD void dav1d_mem_pool_end(Dav1dMemPool *const pool) {
  296|     63|    if (pool) {
  ------------------
  |  Branch (296:9): [True: 63, False: 0]
  ------------------
  297|     63|        pthread_mutex_lock(&pool->lock);
  298|     63|        Dav1dMemPoolBuffer *buf = pool->buf;
  299|     63|        const int ref_cnt = --pool->ref_cnt;
  300|     63|        pool->buf = NULL;
  301|     63|        pool->end = 1;
  302|     63|        pthread_mutex_unlock(&pool->lock);
  303|       |
  304|     90|        while (buf) {
  ------------------
  |  Branch (304:16): [True: 27, False: 63]
  ------------------
  305|     27|            void *const ptr = buf;
  306|     27|            buf = buf->next;
  307|     27|            dav1d_free_aligned(ptr);
  ------------------
  |  |  136|     27|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  308|     27|        }
  309|     63|        if (!ref_cnt) mem_pool_destroy(pool);
  ------------------
  |  Branch (309:13): [True: 63, False: 0]
  ------------------
  310|     63|    }
  311|     63|}
mem.c:mem_pool_destroy:
  219|     63|static COLD void mem_pool_destroy(Dav1dMemPool *const pool) {
  220|     63|    pthread_mutex_destroy(&pool->lock);
  221|     63|    dav1d_free(pool);
  ------------------
  |  |  135|     63|#define dav1d_free(ptr) free(ptr)
  ------------------
  222|     63|}

lib.c:dav1d_alloc_aligned_internal:
   89|     27|static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
   90|     27|    assert(!(align & (align - 1)));
  ------------------
  |  |  140|     27|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 27]
  |  |  |  Branch (140:68): [Folded, False: 27]
  |  |  ------------------
  ------------------
   91|       |#ifdef _WIN32
   92|       |    return _aligned_malloc(sz, align);
   93|       |#elif HAVE_POSIX_MEMALIGN
   94|     27|    void *ptr;
   95|     27|    if (posix_memalign(&ptr, align, sz)) return NULL;
  ------------------
  |  Branch (95:9): [True: 0, False: 27]
  ------------------
   96|     27|    return ptr;
   97|       |#elif HAVE_MEMALIGN
   98|       |    return memalign(align, sz);
   99|       |#elif HAVE_ALIGNED_ALLOC
  100|       |    // The C11 standard specifies that the size parameter
  101|       |    // must be an integral multiple of alignment.
  102|       |    return aligned_alloc(align, ROUND_UP(sz, align));
  103|       |#else
  104|       |    void *const buf = malloc(sz + align + sizeof(void *));
  105|       |    if (!buf) return NULL;
  106|       |
  107|       |    void *const ptr = (void *)(((uintptr_t)buf + sizeof(void *) + align - 1) & ~(align - 1));
  108|       |    ((void **)ptr)[-1] = buf;
  109|       |    return ptr;
  110|       |#endif
  111|     27|}
lib.c:dav1d_free_aligned_internal:
  113|    513|static inline void dav1d_free_aligned_internal(void *ptr) {
  114|       |#ifdef _WIN32
  115|       |    _aligned_free(ptr);
  116|       |#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
  117|       |    free(ptr);
  118|       |#else
  119|       |    if (ptr) free(((void **)ptr)[-1]);
  120|       |#endif
  121|    513|}
lib.c:dav1d_freep_aligned:
  144|      9|static inline void dav1d_freep_aligned(void *ptr) {
  145|      9|    void **mem = (void **) ptr;
  146|      9|    if (*mem) {
  ------------------
  |  Branch (146:9): [True: 9, False: 0]
  ------------------
  147|      9|        dav1d_free_aligned(*mem);
  ------------------
  |  |  136|      9|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  148|       |        *mem = NULL;
  149|      9|    }
  150|      9|}
mem.c:dav1d_free_aligned_internal:
  113|     27|static inline void dav1d_free_aligned_internal(void *ptr) {
  114|       |#ifdef _WIN32
  115|       |    _aligned_free(ptr);
  116|       |#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
  117|       |    free(ptr);
  118|       |#else
  119|       |    if (ptr) free(((void **)ptr)[-1]);
  120|       |#endif
  121|     27|}
mem.c:dav1d_alloc_aligned_internal:
   89|     27|static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
   90|     27|    assert(!(align & (align - 1)));
  ------------------
  |  |  140|     27|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 27]
  |  |  |  Branch (140:68): [Folded, False: 27]
  |  |  ------------------
  ------------------
   91|       |#ifdef _WIN32
   92|       |    return _aligned_malloc(sz, align);
   93|       |#elif HAVE_POSIX_MEMALIGN
   94|     27|    void *ptr;
   95|     27|    if (posix_memalign(&ptr, align, sz)) return NULL;
  ------------------
  |  Branch (95:9): [True: 0, False: 27]
  ------------------
   96|     27|    return ptr;
   97|       |#elif HAVE_MEMALIGN
   98|       |    return memalign(align, sz);
   99|       |#elif HAVE_ALIGNED_ALLOC
  100|       |    // The C11 standard specifies that the size parameter
  101|       |    // must be an integral multiple of alignment.
  102|       |    return aligned_alloc(align, ROUND_UP(sz, align));
  103|       |#else
  104|       |    void *const buf = malloc(sz + align + sizeof(void *));
  105|       |    if (!buf) return NULL;
  106|       |
  107|       |    void *const ptr = (void *)(((uintptr_t)buf + sizeof(void *) + align - 1) & ~(align - 1));
  108|       |    ((void **)ptr)[-1] = buf;
  109|       |    return ptr;
  110|       |#endif
  111|     27|}
ref.c:dav1d_alloc_aligned_internal:
   89|      9|static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
   90|      9|    assert(!(align & (align - 1)));
  ------------------
  |  |  140|      9|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 9]
  |  |  |  Branch (140:68): [Folded, False: 9]
  |  |  ------------------
  ------------------
   91|       |#ifdef _WIN32
   92|       |    return _aligned_malloc(sz, align);
   93|       |#elif HAVE_POSIX_MEMALIGN
   94|      9|    void *ptr;
   95|      9|    if (posix_memalign(&ptr, align, sz)) return NULL;
  ------------------
  |  Branch (95:9): [True: 0, False: 9]
  ------------------
   96|      9|    return ptr;
   97|       |#elif HAVE_MEMALIGN
   98|       |    return memalign(align, sz);
   99|       |#elif HAVE_ALIGNED_ALLOC
  100|       |    // The C11 standard specifies that the size parameter
  101|       |    // must be an integral multiple of alignment.
  102|       |    return aligned_alloc(align, ROUND_UP(sz, align));
  103|       |#else
  104|       |    void *const buf = malloc(sz + align + sizeof(void *));
  105|       |    if (!buf) return NULL;
  106|       |
  107|       |    void *const ptr = (void *)(((uintptr_t)buf + sizeof(void *) + align - 1) & ~(align - 1));
  108|       |    ((void **)ptr)[-1] = buf;
  109|       |    return ptr;
  110|       |#endif
  111|      9|}
ref.c:dav1d_free_aligned_internal:
  113|      9|static inline void dav1d_free_aligned_internal(void *ptr) {
  114|       |#ifdef _WIN32
  115|       |    _aligned_free(ptr);
  116|       |#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
  117|       |    free(ptr);
  118|       |#else
  119|       |    if (ptr) free(((void **)ptr)[-1]);
  120|       |#endif
  121|      9|}
refmvs.c:dav1d_free_aligned_internal:
  113|      4|static inline void dav1d_free_aligned_internal(void *ptr) {
  114|       |#ifdef _WIN32
  115|       |    _aligned_free(ptr);
  116|       |#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
  117|       |    free(ptr);
  118|       |#else
  119|       |    if (ptr) free(((void **)ptr)[-1]);
  120|       |#endif
  121|      4|}
refmvs.c:dav1d_alloc_aligned_internal:
   89|      4|static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
   90|      4|    assert(!(align & (align - 1)));
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
   91|       |#ifdef _WIN32
   92|       |    return _aligned_malloc(sz, align);
   93|       |#elif HAVE_POSIX_MEMALIGN
   94|      4|    void *ptr;
   95|      4|    if (posix_memalign(&ptr, align, sz)) return NULL;
  ------------------
  |  Branch (95:9): [True: 0, False: 4]
  ------------------
   96|      4|    return ptr;
   97|       |#elif HAVE_MEMALIGN
   98|       |    return memalign(align, sz);
   99|       |#elif HAVE_ALIGNED_ALLOC
  100|       |    // The C11 standard specifies that the size parameter
  101|       |    // must be an integral multiple of alignment.
  102|       |    return aligned_alloc(align, ROUND_UP(sz, align));
  103|       |#else
  104|       |    void *const buf = malloc(sz + align + sizeof(void *));
  105|       |    if (!buf) return NULL;
  106|       |
  107|       |    void *const ptr = (void *)(((uintptr_t)buf + sizeof(void *) + align - 1) & ~(align - 1));
  108|       |    ((void **)ptr)[-1] = buf;
  109|       |    return ptr;
  110|       |#endif
  111|      4|}
decode.c:dav1d_free_aligned_internal:
  113|     32|static inline void dav1d_free_aligned_internal(void *ptr) {
  114|       |#ifdef _WIN32
  115|       |    _aligned_free(ptr);
  116|       |#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
  117|       |    free(ptr);
  118|       |#else
  119|       |    if (ptr) free(((void **)ptr)[-1]);
  120|       |#endif
  121|     32|}
decode.c:dav1d_alloc_aligned_internal:
   89|     32|static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
   90|     32|    assert(!(align & (align - 1)));
  ------------------
  |  |  140|     32|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 32]
  |  |  |  Branch (140:68): [Folded, False: 32]
  |  |  ------------------
  ------------------
   91|       |#ifdef _WIN32
   92|       |    return _aligned_malloc(sz, align);
   93|       |#elif HAVE_POSIX_MEMALIGN
   94|     32|    void *ptr;
   95|     32|    if (posix_memalign(&ptr, align, sz)) return NULL;
  ------------------
  |  Branch (95:9): [True: 0, False: 32]
  ------------------
   96|     32|    return ptr;
   97|       |#elif HAVE_MEMALIGN
   98|       |    return memalign(align, sz);
   99|       |#elif HAVE_ALIGNED_ALLOC
  100|       |    // The C11 standard specifies that the size parameter
  101|       |    // must be an integral multiple of alignment.
  102|       |    return aligned_alloc(align, ROUND_UP(sz, align));
  103|       |#else
  104|       |    void *const buf = malloc(sz + align + sizeof(void *));
  105|       |    if (!buf) return NULL;
  106|       |
  107|       |    void *const ptr = (void *)(((uintptr_t)buf + sizeof(void *) + align - 1) & ~(align - 1));
  108|       |    ((void **)ptr)[-1] = buf;
  109|       |    return ptr;
  110|       |#endif
  111|     32|}

dav1d_msac_decode_bool_equi_c:
   99|  48.7k|unsigned dav1d_msac_decode_bool_equi_c(MsacContext *const s) {
  100|  48.7k|    const unsigned r = s->rng;
  101|  48.7k|    ec_win dif = s->dif;
  102|  48.7k|    assert((dif >> (EC_WIN_SIZE - 16)) < r);
  ------------------
  |  |  140|  48.7k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 48.7k]
  |  |  |  Branch (140:68): [Folded, False: 48.7k]
  |  |  ------------------
  ------------------
  103|       |    // When the probability is 1/2, f = 16384 >> EC_PROB_SHIFT = 256 and we can
  104|       |    // replace the multiply with a simple shift.
  105|  48.7k|    unsigned v = ((r >> 8) << 7) + EC_MIN_PROB;
  ------------------
  |  |   37|  48.7k|#define EC_MIN_PROB 4  // must be <= (1<<EC_PROB_SHIFT)/16
  ------------------
  106|  48.7k|    const ec_win vw = (ec_win)v << (EC_WIN_SIZE - 16);
  ------------------
  |  |   39|  48.7k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
  107|  48.7k|    const unsigned ret = dif >= vw;
  108|  48.7k|    dif -= ret * vw;
  109|  48.7k|    v += ret * (r - 2 * v);
  110|  48.7k|    ctx_norm(s, dif, v);
  111|  48.7k|    return !ret;
  112|  48.7k|}
dav1d_msac_decode_bool_c:
  117|  25.6k|unsigned dav1d_msac_decode_bool_c(MsacContext *const s, const unsigned f) {
  118|  25.6k|    const unsigned r = s->rng;
  119|  25.6k|    ec_win dif = s->dif;
  120|  25.6k|    assert((dif >> (EC_WIN_SIZE - 16)) < r);
  ------------------
  |  |  140|  25.6k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 25.6k]
  |  |  |  Branch (140:68): [Folded, False: 25.6k]
  |  |  ------------------
  ------------------
  121|  25.6k|    unsigned v = ((r >> 8) * (f >> EC_PROB_SHIFT) >> (7 - EC_PROB_SHIFT)) + EC_MIN_PROB;
  ------------------
  |  |   36|  25.6k|#define EC_PROB_SHIFT 6
  ------------------
                  unsigned v = ((r >> 8) * (f >> EC_PROB_SHIFT) >> (7 - EC_PROB_SHIFT)) + EC_MIN_PROB;
  ------------------
  |  |   36|  25.6k|#define EC_PROB_SHIFT 6
  ------------------
                  unsigned v = ((r >> 8) * (f >> EC_PROB_SHIFT) >> (7 - EC_PROB_SHIFT)) + EC_MIN_PROB;
  ------------------
  |  |   37|  25.6k|#define EC_MIN_PROB 4  // must be <= (1<<EC_PROB_SHIFT)/16
  ------------------
  122|  25.6k|    const ec_win vw = (ec_win)v << (EC_WIN_SIZE - 16);
  ------------------
  |  |   39|  25.6k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
  123|  25.6k|    const unsigned ret = dif >= vw;
  124|  25.6k|    dif -= ret * vw;
  125|  25.6k|    v += ret * (r - 2 * v);
  126|  25.6k|    ctx_norm(s, dif, v);
  127|  25.6k|    return !ret;
  128|  25.6k|}
dav1d_msac_decode_symbol_adapt_c:
  135|   137k|{
  136|   137k|    const unsigned c = s->dif >> (EC_WIN_SIZE - 16), r = s->rng >> 8;
  ------------------
  |  |   39|   137k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
  137|   137k|    unsigned u, v = s->rng, val = -1;
  138|       |
  139|   137k|    assert(n_symbols <= 15);
  ------------------
  |  |  140|   137k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 137k]
  |  |  |  Branch (140:68): [Folded, False: 137k]
  |  |  ------------------
  ------------------
  140|   137k|    assert(cdf[n_symbols] <= 32);
  ------------------
  |  |  140|   137k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 137k]
  |  |  |  Branch (140:68): [Folded, False: 137k]
  |  |  ------------------
  ------------------
  141|       |
  142|   283k|    do {
  143|   283k|        val++;
  144|   283k|        u = v;
  145|   283k|        v = r * (cdf[val] >> EC_PROB_SHIFT);
  ------------------
  |  |   36|   283k|#define EC_PROB_SHIFT 6
  ------------------
  146|   283k|        v >>= 7 - EC_PROB_SHIFT;
  ------------------
  |  |   36|   283k|#define EC_PROB_SHIFT 6
  ------------------
  147|   283k|        v += EC_MIN_PROB * ((unsigned)n_symbols - val);
  ------------------
  |  |   37|   283k|#define EC_MIN_PROB 4  // must be <= (1<<EC_PROB_SHIFT)/16
  ------------------
  148|   283k|    } while (c < v);
  ------------------
  |  Branch (148:14): [True: 146k, False: 137k]
  ------------------
  149|       |
  150|   137k|    assert(u <= s->rng);
  ------------------
  |  |  140|   137k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 137k]
  |  |  |  Branch (140:68): [Folded, False: 137k]
  |  |  ------------------
  ------------------
  151|       |
  152|   137k|    ctx_norm(s, s->dif - ((ec_win)v << (EC_WIN_SIZE - 16)), u - v);
  ------------------
  |  |   39|   137k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
  153|       |
  154|   137k|    if (s->allow_update_cdf) {
  ------------------
  |  Branch (154:9): [True: 71.7k, False: 65.5k]
  ------------------
  155|  71.7k|        const unsigned count = cdf[n_symbols];
  156|  71.7k|        const unsigned rate = 4 + (count >> 4) + (n_symbols > 2);
  157|  71.7k|        unsigned i;
  158|   142k|        for (i = 0; i < val; i++)
  ------------------
  |  Branch (158:21): [True: 71.2k, False: 71.7k]
  ------------------
  159|  71.2k|            cdf[i] += (32768 - cdf[i]) >> rate;
  160|   231k|        for (; i < n_symbols; i++)
  ------------------
  |  Branch (160:16): [True: 159k, False: 71.7k]
  ------------------
  161|   159k|            cdf[i] -= cdf[i] >> rate;
  162|  71.7k|        cdf[n_symbols] = count + (count < 32);
  163|  71.7k|    }
  164|       |
  165|   137k|    return val;
  166|   137k|}
dav1d_msac_decode_bool_adapt_c:
  170|  25.6k|{
  171|  25.6k|    const unsigned bit = dav1d_msac_decode_bool(s, *cdf);
  ------------------
  |  |   88|  25.6k|#define dav1d_msac_decode_bool           dav1d_msac_decode_bool_c
  ------------------
  172|       |
  173|  25.6k|    if (s->allow_update_cdf) {
  ------------------
  |  Branch (173:9): [True: 6.35k, False: 19.2k]
  ------------------
  174|       |        // update_cdf() specialized for boolean CDFs
  175|  6.35k|        const unsigned count = cdf[1];
  176|  6.35k|        const int rate = 4 + (count >> 4);
  177|  6.35k|        if (bit)
  ------------------
  |  Branch (177:13): [True: 2.81k, False: 3.53k]
  ------------------
  178|  2.81k|            cdf[0] += (32768 - cdf[0]) >> rate;
  179|  3.53k|        else
  180|  3.53k|            cdf[0] -= cdf[0] >> rate;
  181|  6.35k|        cdf[1] = count + (count < 32);
  182|  6.35k|    }
  183|       |
  184|  25.6k|    return bit;
  185|  25.6k|}
dav1d_msac_decode_hi_tok_c:
  187|  9.16k|unsigned dav1d_msac_decode_hi_tok_c(MsacContext *const s, uint16_t *const cdf) {
  188|  9.16k|    unsigned tok_br = dav1d_msac_decode_symbol_adapt4(s, cdf, 3);
  ------------------
  |  |   73|  9.16k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  189|  9.16k|    unsigned tok = 3 + tok_br;
  190|  9.16k|    if (tok_br == 3) {
  ------------------
  |  Branch (190:9): [True: 2.65k, False: 6.51k]
  ------------------
  191|  2.65k|        tok_br = dav1d_msac_decode_symbol_adapt4(s, cdf, 3);
  ------------------
  |  |   73|  2.65k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  192|  2.65k|        tok = 6 + tok_br;
  193|  2.65k|        if (tok_br == 3) {
  ------------------
  |  Branch (193:13): [True: 1.16k, False: 1.48k]
  ------------------
  194|  1.16k|            tok_br = dav1d_msac_decode_symbol_adapt4(s, cdf, 3);
  ------------------
  |  |   73|  1.16k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  195|  1.16k|            tok = 9 + tok_br;
  196|  1.16k|            if (tok_br == 3)
  ------------------
  |  Branch (196:17): [True: 634, False: 532]
  ------------------
  197|    634|                tok = 12 + dav1d_msac_decode_symbol_adapt4(s, cdf, 3);
  ------------------
  |  |   73|    634|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  198|  1.16k|        }
  199|  2.65k|    }
  200|  9.16k|    return tok;
  201|  9.16k|}
dav1d_msac_init:
  206|      4|{
  207|      4|    s->buf_pos = data;
  208|      4|    s->buf_end = data + sz;
  209|      4|    s->dif = 0;
  210|      4|    s->rng = 0x8000;
  211|      4|    s->cnt = -15;
  212|      4|    s->allow_update_cdf = !disable_cdf_update_flag;
  213|      4|    ctx_refill(s);
  214|       |
  215|       |#if ARCH_X86_64 && HAVE_ASM
  216|       |    s->symbol_adapt16 = dav1d_msac_decode_symbol_adapt_c;
  217|       |
  218|       |    msac_init_x86(s);
  219|       |#endif
  220|      4|}
msac.c:ctx_norm:
   87|   211k|{
   88|   211k|    const int d = 15 ^ (31 ^ clz(rng));
   89|   211k|    const int cnt = s->cnt;
   90|   211k|    assert(rng <= 65535U);
  ------------------
  |  |  140|   211k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 211k]
  |  |  |  Branch (140:68): [Folded, False: 211k]
  |  |  ------------------
  ------------------
   91|   211k|    s->dif = dif << d;
   92|   211k|    s->rng = rng << d;
   93|   211k|    s->cnt = cnt - d;
   94|       |    // unsigned compare avoids redundant refills at eob
   95|   211k|    if ((unsigned)cnt < (unsigned)d)
  ------------------
  |  Branch (95:9): [True: 4.25k, False: 207k]
  ------------------
   96|  4.25k|        ctx_refill(s);
   97|   211k|}
msac.c:ctx_refill:
   41|  4.25k|static inline void ctx_refill(MsacContext *const s) {
   42|  4.25k|    const uint8_t *buf_pos = s->buf_pos;
   43|  4.25k|    const uint8_t *buf_end = s->buf_end;
   44|  4.25k|    int c = EC_WIN_SIZE - s->cnt - 24;
  ------------------
  |  |   39|  4.25k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
   45|  4.25k|    ec_win dif = s->dif;
   46|  25.5k|    do {
   47|  25.5k|        if (buf_pos >= buf_end) {
  ------------------
  |  Branch (47:13): [True: 6, False: 25.5k]
  ------------------
   48|       |            // set remaining bits to 1;
   49|      6|            dif |= ~(~(ec_win)0xff << c);
   50|      6|            break;
   51|      6|        }
   52|  25.5k|        dif |= (ec_win)(*buf_pos++ ^ 0xff) << c;
   53|  25.5k|        c -= 8;
   54|  25.5k|    } while (c >= 0);
  ------------------
  |  Branch (54:14): [True: 21.2k, False: 4.24k]
  ------------------
   55|  4.25k|    s->dif = dif;
   56|  4.25k|    s->cnt = EC_WIN_SIZE - c - 24;
  ------------------
  |  |   39|  4.25k|#define EC_WIN_SIZE (sizeof(ec_win) << 3)
  ------------------
   57|  4.25k|    s->buf_pos = buf_pos;
   58|  4.25k|}

decode.c:dav1d_msac_decode_bools:
   94|    266|static inline unsigned dav1d_msac_decode_bools(MsacContext *const s, unsigned n) {
   95|    266|    unsigned v = 0;
   96|    282|    while (n--)
  ------------------
  |  Branch (96:12): [True: 16, False: 266]
  ------------------
   97|     16|        v = (v << 1) | dav1d_msac_decode_bool_equi(s);
  ------------------
  |  |   85|     16|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
   98|    266|    return v;
   99|    266|}
decode.c:dav1d_msac_decode_uniform:
  101|     10|static inline int dav1d_msac_decode_uniform(MsacContext *const s, const unsigned n) {
  102|     10|    assert(n > 0);
  ------------------
  |  |  140|     10|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 10]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
  103|     10|    const int l = ulog2(n) + 1;
  104|     10|    assert(l > 1);
  ------------------
  |  |  140|     10|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 10]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
  105|     10|    const unsigned m = (1 << l) - n;
  106|     10|    const unsigned v = dav1d_msac_decode_bools(s, l - 1);
  107|     10|    return v < m ? v : (v << 1) - m + dav1d_msac_decode_bool_equi(s);
  ------------------
  |  |   85|      6|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (107:12): [True: 4, False: 6]
  ------------------
  108|     10|}
recon_tmpl.c:dav1d_msac_decode_bools:
   94|  2.96k|static inline unsigned dav1d_msac_decode_bools(MsacContext *const s, unsigned n) {
   95|  2.96k|    unsigned v = 0;
   96|  10.1k|    while (n--)
  ------------------
  |  Branch (96:12): [True: 7.16k, False: 2.96k]
  ------------------
   97|  7.16k|        v = (v << 1) | dav1d_msac_decode_bool_equi(s);
  ------------------
  |  |   85|  7.16k|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
   98|  2.96k|    return v;
   99|  2.96k|}

dav1d_parse_obus:
 1169|     27|ptrdiff_t dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in) {
 1170|     27|    GetBits gb;
 1171|     27|    int res;
 1172|       |
 1173|     27|    dav1d_init_get_bits(&gb, in->data, in->sz);
 1174|       |
 1175|       |    // obu header
 1176|     27|    const int obu_forbidden_bit = dav1d_get_bit(&gb);
 1177|     27|    if (c->strict_std_compliance && obu_forbidden_bit) goto error;
  ------------------
  |  Branch (1177:9): [True: 0, False: 27]
  |  Branch (1177:37): [True: 0, False: 0]
  ------------------
 1178|     27|    const enum Dav1dObuType type = dav1d_get_bits(&gb, 4);
 1179|     27|    const int has_extension = dav1d_get_bit(&gb);
 1180|     27|    const int has_length_field = dav1d_get_bit(&gb);
 1181|     27|    dav1d_get_bit(&gb); // reserved
 1182|       |
 1183|     27|    int temporal_id = 0, spatial_id = 0;
 1184|     27|    if (has_extension) {
  ------------------
  |  Branch (1184:9): [True: 1, False: 26]
  ------------------
 1185|      1|        temporal_id = dav1d_get_bits(&gb, 3);
 1186|      1|        spatial_id = dav1d_get_bits(&gb, 2);
 1187|      1|        dav1d_get_bits(&gb, 3); // reserved
 1188|      1|    }
 1189|       |
 1190|     27|    if (has_length_field) {
  ------------------
  |  Branch (1190:9): [True: 21, False: 6]
  ------------------
 1191|     21|        const size_t len = dav1d_get_uleb128(&gb);
 1192|     21|        if (len > (size_t)(gb.ptr_end - gb.ptr)) goto error;
  ------------------
  |  Branch (1192:13): [True: 0, False: 21]
  ------------------
 1193|     21|        gb.ptr_end = gb.ptr + len;
 1194|     21|    }
 1195|     27|    if (gb.error) goto error;
  ------------------
  |  Branch (1195:9): [True: 1, False: 26]
  ------------------
 1196|       |
 1197|       |    // We must have read a whole number of bytes at this point (1 byte
 1198|       |    // for the header and whole bytes at a time when reading the
 1199|       |    // leb128 length field).
 1200|     26|    assert(gb.bits_left == 0);
  ------------------
  |  |  140|     26|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 26]
  |  |  |  Branch (140:68): [Folded, False: 26]
  |  |  ------------------
  ------------------
 1201|       |
 1202|       |    // skip obu not belonging to the selected temporal/spatial layer
 1203|     26|    if (type != DAV1D_OBU_SEQ_HDR && type != DAV1D_OBU_TD &&
  ------------------
  |  Branch (1203:9): [True: 19, False: 7]
  |  Branch (1203:38): [True: 12, False: 7]
  ------------------
 1204|     12|        has_extension && c->operating_point_idc != 0)
  ------------------
  |  Branch (1204:9): [True: 0, False: 12]
  |  Branch (1204:26): [True: 0, False: 0]
  ------------------
 1205|      0|    {
 1206|      0|        const int in_temporal_layer = (c->operating_point_idc >> temporal_id) & 1;
 1207|      0|        const int in_spatial_layer = (c->operating_point_idc >> (spatial_id + 8)) & 1;
 1208|      0|        if (!in_temporal_layer || !in_spatial_layer)
  ------------------
  |  Branch (1208:13): [True: 0, False: 0]
  |  Branch (1208:35): [True: 0, False: 0]
  ------------------
 1209|      0|            return gb.ptr_end - gb.ptr_start;
 1210|      0|    }
 1211|       |
 1212|     26|    switch (type) {
 1213|      7|    case DAV1D_OBU_SEQ_HDR: {
  ------------------
  |  Branch (1213:5): [True: 7, False: 19]
  ------------------
 1214|      7|        Dav1dRef *ref = dav1d_ref_create_using_pool(c->seq_hdr_pool,
 1215|      7|                                                    sizeof(Dav1dSequenceHeader));
 1216|      7|        if (!ref) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (1216:13): [True: 0, False: 7]
  ------------------
 1217|      7|        Dav1dSequenceHeader *seq_hdr = ref->data;
 1218|      7|        if ((res = parse_seq_hdr(seq_hdr, &gb, c->strict_std_compliance)) < 0) {
  ------------------
  |  Branch (1218:13): [True: 0, False: 7]
  ------------------
 1219|      0|            dav1d_log(c, "Error parsing sequence header\n");
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
 1220|      0|            dav1d_ref_dec(&ref);
 1221|      0|            goto error;
 1222|      0|        }
 1223|       |
 1224|      7|        const int op_idx =
 1225|      7|            c->operating_point < seq_hdr->num_operating_points ? c->operating_point : 0;
  ------------------
  |  Branch (1225:13): [True: 7, False: 0]
  ------------------
 1226|      7|        c->operating_point_idc = seq_hdr->operating_points[op_idx].idc;
 1227|      7|        const unsigned spatial_mask = c->operating_point_idc >> 8;
 1228|      7|        c->max_spatial_id = spatial_mask ? ulog2(spatial_mask) : 0;
  ------------------
  |  Branch (1228:29): [True: 0, False: 7]
  ------------------
 1229|       |
 1230|       |        // If we have read a sequence header which is different from
 1231|       |        // the old one, this is a new video sequence and can't use any
 1232|       |        // previous state. Free that state.
 1233|       |
 1234|      7|        if (!c->seq_hdr) {
  ------------------
  |  Branch (1234:13): [True: 7, False: 0]
  ------------------
 1235|      7|            c->frame_hdr = NULL;
 1236|      7|            c->frame_flags |= PICTURE_FLAG_NEW_SEQUENCE;
 1237|       |        // see 7.5, operating_parameter_info is allowed to change in
 1238|       |        // sequence headers of a single sequence
 1239|      7|        } else if (memcmp(seq_hdr, c->seq_hdr, offsetof(Dav1dSequenceHeader, operating_parameter_info))) {
  ------------------
  |  Branch (1239:20): [True: 0, False: 0]
  ------------------
 1240|      0|            c->frame_hdr = NULL;
 1241|      0|            c->mastering_display = NULL;
 1242|      0|            c->content_light = NULL;
 1243|      0|            dav1d_ref_dec(&c->mastering_display_ref);
 1244|      0|            dav1d_ref_dec(&c->content_light_ref);
 1245|      0|            for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (1245:29): [True: 0, False: 0]
  ------------------
 1246|      0|                if (c->refs[i].p.p.frame_hdr)
  ------------------
  |  Branch (1246:21): [True: 0, False: 0]
  ------------------
 1247|      0|                    dav1d_thread_picture_unref(&c->refs[i].p);
 1248|      0|                dav1d_ref_dec(&c->refs[i].segmap);
 1249|      0|                dav1d_ref_dec(&c->refs[i].refmvs);
 1250|      0|                dav1d_cdf_thread_unref(&c->cdf[i]);
 1251|      0|            }
 1252|      0|            c->frame_flags |= PICTURE_FLAG_NEW_SEQUENCE;
 1253|       |        // If operating_parameter_info changed, signal it
 1254|      0|        } else if (memcmp(seq_hdr->operating_parameter_info, c->seq_hdr->operating_parameter_info,
  ------------------
  |  Branch (1254:20): [True: 0, False: 0]
  ------------------
 1255|      0|                          sizeof(seq_hdr->operating_parameter_info)))
 1256|      0|        {
 1257|      0|            c->frame_flags |= PICTURE_FLAG_NEW_OP_PARAMS_INFO;
 1258|      0|        }
 1259|      7|        dav1d_ref_dec(&c->seq_hdr_ref);
 1260|      7|        c->seq_hdr_ref = ref;
 1261|      7|        c->seq_hdr = seq_hdr;
 1262|      7|        break;
 1263|      7|    }
 1264|      0|    case DAV1D_OBU_REDUNDANT_FRAME_HDR:
  ------------------
  |  Branch (1264:5): [True: 0, False: 26]
  ------------------
 1265|      0|        if (c->frame_hdr) break;
  ------------------
  |  Branch (1265:13): [True: 0, False: 0]
  ------------------
 1266|       |        // fall-through
 1267|      6|    case DAV1D_OBU_FRAME:
  ------------------
  |  Branch (1267:5): [True: 6, False: 20]
  ------------------
 1268|      6|    case DAV1D_OBU_FRAME_HDR:
  ------------------
  |  Branch (1268:5): [True: 0, False: 26]
  ------------------
 1269|      6|        if (!c->seq_hdr) goto error;
  ------------------
  |  Branch (1269:13): [True: 0, False: 6]
  ------------------
 1270|      6|        if (!c->frame_hdr_ref) {
  ------------------
  |  Branch (1270:13): [True: 6, False: 0]
  ------------------
 1271|      6|            c->frame_hdr_ref = dav1d_ref_create_using_pool(c->frame_hdr_pool,
 1272|      6|                                                           sizeof(Dav1dFrameHeader));
 1273|      6|            if (!c->frame_hdr_ref) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (1273:17): [True: 0, False: 6]
  ------------------
 1274|      6|        }
 1275|       |#ifndef NDEBUG
 1276|       |        // ensure that the reference is writable
 1277|       |        assert(dav1d_ref_is_writable(c->frame_hdr_ref));
 1278|       |#endif
 1279|      6|        c->frame_hdr = c->frame_hdr_ref->data;
 1280|      6|        memset(c->frame_hdr, 0, sizeof(*c->frame_hdr));
 1281|      6|        c->frame_hdr->temporal_id = temporal_id;
 1282|      6|        c->frame_hdr->spatial_id = spatial_id;
 1283|      6|        if ((res = parse_frame_hdr(c, &gb)) < 0) {
  ------------------
  |  Branch (1283:13): [True: 0, False: 6]
  ------------------
 1284|      0|            c->frame_hdr = NULL;
 1285|      0|            goto error;
 1286|      0|        }
 1287|      6|        for (int n = 0; n < c->n_tile_data; n++)
  ------------------
  |  Branch (1287:25): [True: 0, False: 6]
  ------------------
 1288|      0|            dav1d_data_unref_internal(&c->tile[n].data);
 1289|      6|        c->n_tile_data = 0;
 1290|      6|        c->n_tiles = 0;
 1291|      6|        if (type != DAV1D_OBU_FRAME) {
  ------------------
  |  Branch (1291:13): [True: 0, False: 6]
  ------------------
 1292|       |            // This is actually a frame header OBU so read the
 1293|       |            // trailing bit and check for overrun.
 1294|      0|            if (check_trailing_bits(&gb, c->strict_std_compliance) < 0) {
  ------------------
  |  Branch (1294:17): [True: 0, False: 0]
  ------------------
 1295|      0|                c->frame_hdr = NULL;
 1296|      0|                goto error;
 1297|      0|            }
 1298|      0|        }
 1299|       |
 1300|      6|        if (c->frame_size_limit && (int64_t)c->frame_hdr->width[1] *
  ------------------
  |  Branch (1300:13): [True: 6, False: 0]
  |  Branch (1300:36): [True: 2, False: 4]
  ------------------
 1301|      6|            c->frame_hdr->height > c->frame_size_limit)
 1302|      2|        {
 1303|      2|            dav1d_log(c, "Frame size %dx%d exceeds limit %u\n", c->frame_hdr->width[1],
  ------------------
  |  |   39|      2|#define dav1d_log dav1d_log
  ------------------
 1304|      2|                      c->frame_hdr->height, c->frame_size_limit);
 1305|      2|            c->frame_hdr = NULL;
 1306|      2|            return DAV1D_ERR(ERANGE);
  ------------------
  |  |   58|      2|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 1307|      2|        }
 1308|       |
 1309|      4|        if (type != DAV1D_OBU_FRAME)
  ------------------
  |  Branch (1309:13): [True: 0, False: 4]
  ------------------
 1310|      0|            break;
 1311|       |        // OBU_FRAMEs shouldn't be signaled with show_existing_frame
 1312|      4|        if (c->frame_hdr->show_existing_frame) {
  ------------------
  |  Branch (1312:13): [True: 0, False: 4]
  ------------------
 1313|      0|            c->frame_hdr = NULL;
 1314|      0|            goto error;
 1315|      0|        }
 1316|       |
 1317|       |        // This is the frame header at the start of a frame OBU.
 1318|       |        // There's no trailing bit at the end to skip, but we do need
 1319|       |        // to align to the next byte.
 1320|      4|        dav1d_bytealign_get_bits(&gb);
 1321|       |        // fall-through
 1322|      4|    case DAV1D_OBU_TILE_GRP: {
  ------------------
  |  Branch (1322:5): [True: 0, False: 26]
  ------------------
 1323|      4|        if (!c->frame_hdr) goto error;
  ------------------
  |  Branch (1323:13): [True: 0, False: 4]
  ------------------
 1324|      4|        if (c->n_tile_data_alloc < c->n_tile_data + 1) {
  ------------------
  |  Branch (1324:13): [True: 4, False: 0]
  ------------------
 1325|      4|            if ((c->n_tile_data + 1) > INT_MAX / (int)sizeof(*c->tile)) goto error;
  ------------------
  |  Branch (1325:17): [True: 0, False: 4]
  ------------------
 1326|      4|            struct Dav1dTileGroup *tile = dav1d_realloc(ALLOC_TILE, c->tile,
  ------------------
  |  |  133|      4|#define dav1d_realloc(type, ptr, sz) realloc(ptr, sz)
  ------------------
 1327|      4|                                                        (c->n_tile_data + 1) * sizeof(*c->tile));
 1328|      4|            if (!tile) goto error;
  ------------------
  |  Branch (1328:17): [True: 0, False: 4]
  ------------------
 1329|      4|            c->tile = tile;
 1330|      4|            memset(c->tile + c->n_tile_data, 0, sizeof(*c->tile));
 1331|      4|            c->n_tile_data_alloc = c->n_tile_data + 1;
 1332|      4|        }
 1333|      4|        parse_tile_hdr(c, &gb);
 1334|       |        // Align to the next byte boundary and check for overrun.
 1335|      4|        dav1d_bytealign_get_bits(&gb);
 1336|      4|        if (gb.error) goto error;
  ------------------
  |  Branch (1336:13): [True: 0, False: 4]
  ------------------
 1337|       |
 1338|      4|        dav1d_data_ref(&c->tile[c->n_tile_data].data, in);
 1339|      4|        c->tile[c->n_tile_data].data.data = gb.ptr;
 1340|      4|        c->tile[c->n_tile_data].data.sz = (size_t)(gb.ptr_end - gb.ptr);
 1341|       |        // ensure tile groups are in order and sane, see 6.10.1
 1342|      4|        if (c->tile[c->n_tile_data].start > c->tile[c->n_tile_data].end ||
  ------------------
  |  Branch (1342:13): [True: 0, False: 4]
  ------------------
 1343|      4|            c->tile[c->n_tile_data].start != c->n_tiles)
  ------------------
  |  Branch (1343:13): [True: 0, False: 4]
  ------------------
 1344|      0|        {
 1345|      0|            for (int i = 0; i <= c->n_tile_data; i++)
  ------------------
  |  Branch (1345:29): [True: 0, False: 0]
  ------------------
 1346|      0|                dav1d_data_unref_internal(&c->tile[i].data);
 1347|      0|            c->n_tile_data = 0;
 1348|      0|            c->n_tiles = 0;
 1349|      0|            goto error;
 1350|      0|        }
 1351|      4|        c->n_tiles += 1 + c->tile[c->n_tile_data].end -
 1352|      4|                          c->tile[c->n_tile_data].start;
 1353|      4|        c->n_tile_data++;
 1354|      4|        break;
 1355|      4|    }
 1356|      0|    case DAV1D_OBU_METADATA: {
  ------------------
  |  Branch (1356:5): [True: 0, False: 26]
  ------------------
 1357|      0|#define DEBUG_OBU_METADATA 0
 1358|       |#if DEBUG_OBU_METADATA
 1359|       |        const uint8_t *const init_ptr = gb.ptr;
 1360|       |#endif
 1361|       |        // obu metadta type field
 1362|      0|        const enum ObuMetaType meta_type = dav1d_get_uleb128(&gb);
 1363|      0|        if (gb.error) goto error;
  ------------------
  |  Branch (1363:13): [True: 0, False: 0]
  ------------------
 1364|       |
 1365|      0|        switch (meta_type) {
 1366|      0|        case OBU_META_HDR_CLL: {
  ------------------
  |  Branch (1366:9): [True: 0, False: 0]
  ------------------
 1367|      0|            Dav1dRef *ref = dav1d_ref_create(ALLOC_OBU_META,
  ------------------
  |  |   49|      0|#define dav1d_ref_create(type, size) dav1d_ref_create(size)
  ------------------
 1368|      0|                                             sizeof(Dav1dContentLightLevel));
 1369|      0|            if (!ref) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (1369:17): [True: 0, False: 0]
  ------------------
 1370|      0|            Dav1dContentLightLevel *const content_light = ref->data;
 1371|       |
 1372|      0|            content_light->max_content_light_level = dav1d_get_bits(&gb, 16);
 1373|       |#if DEBUG_OBU_METADATA
 1374|       |            printf("CLLOBU: max-content-light-level: %d [off=%td]\n",
 1375|       |                   content_light->max_content_light_level,
 1376|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1377|       |#endif
 1378|      0|            content_light->max_frame_average_light_level = dav1d_get_bits(&gb, 16);
 1379|       |#if DEBUG_OBU_METADATA
 1380|       |            printf("CLLOBU: max-frame-average-light-level: %d [off=%td]\n",
 1381|       |                   content_light->max_frame_average_light_level,
 1382|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1383|       |#endif
 1384|       |
 1385|      0|            if (check_trailing_bits(&gb, c->strict_std_compliance) < 0) {
  ------------------
  |  Branch (1385:17): [True: 0, False: 0]
  ------------------
 1386|      0|                dav1d_ref_dec(&ref);
 1387|      0|                goto error;
 1388|      0|            }
 1389|       |
 1390|      0|            dav1d_ref_dec(&c->content_light_ref);
 1391|      0|            c->content_light = content_light;
 1392|      0|            c->content_light_ref = ref;
 1393|      0|            break;
 1394|      0|        }
 1395|      0|        case OBU_META_HDR_MDCV: {
  ------------------
  |  Branch (1395:9): [True: 0, False: 0]
  ------------------
 1396|      0|            Dav1dRef *ref = dav1d_ref_create(ALLOC_OBU_META,
  ------------------
  |  |   49|      0|#define dav1d_ref_create(type, size) dav1d_ref_create(size)
  ------------------
 1397|      0|                                             sizeof(Dav1dMasteringDisplay));
 1398|      0|            if (!ref) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (1398:17): [True: 0, False: 0]
  ------------------
 1399|      0|            Dav1dMasteringDisplay *const mastering_display = ref->data;
 1400|       |
 1401|      0|            for (int i = 0; i < 3; i++) {
  ------------------
  |  Branch (1401:29): [True: 0, False: 0]
  ------------------
 1402|      0|                mastering_display->primaries[i][0] = dav1d_get_bits(&gb, 16);
 1403|      0|                mastering_display->primaries[i][1] = dav1d_get_bits(&gb, 16);
 1404|       |#if DEBUG_OBU_METADATA
 1405|       |                printf("MDCVOBU: primaries[%d]: (%d, %d) [off=%td]\n", i,
 1406|       |                       mastering_display->primaries[i][0],
 1407|       |                       mastering_display->primaries[i][1],
 1408|       |                       (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1409|       |#endif
 1410|      0|            }
 1411|      0|            mastering_display->white_point[0] = dav1d_get_bits(&gb, 16);
 1412|       |#if DEBUG_OBU_METADATA
 1413|       |            printf("MDCVOBU: white-point-x: %d [off=%td]\n",
 1414|       |                   mastering_display->white_point[0],
 1415|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1416|       |#endif
 1417|      0|            mastering_display->white_point[1] = dav1d_get_bits(&gb, 16);
 1418|       |#if DEBUG_OBU_METADATA
 1419|       |            printf("MDCVOBU: white-point-y: %d [off=%td]\n",
 1420|       |                   mastering_display->white_point[1],
 1421|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1422|       |#endif
 1423|      0|            mastering_display->max_luminance = dav1d_get_bits(&gb, 32);
 1424|       |#if DEBUG_OBU_METADATA
 1425|       |            printf("MDCVOBU: max-luminance: %d [off=%td]\n",
 1426|       |                   mastering_display->max_luminance,
 1427|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1428|       |#endif
 1429|      0|            mastering_display->min_luminance = dav1d_get_bits(&gb, 32);
 1430|       |#if DEBUG_OBU_METADATA
 1431|       |            printf("MDCVOBU: min-luminance: %d [off=%td]\n",
 1432|       |                   mastering_display->min_luminance,
 1433|       |                   (gb.ptr - init_ptr) * 8 - gb.bits_left);
 1434|       |#endif
 1435|      0|            if (check_trailing_bits(&gb, c->strict_std_compliance) < 0) {
  ------------------
  |  Branch (1435:17): [True: 0, False: 0]
  ------------------
 1436|      0|                dav1d_ref_dec(&ref);
 1437|      0|                goto error;
 1438|      0|            }
 1439|       |
 1440|      0|            dav1d_ref_dec(&c->mastering_display_ref);
 1441|      0|            c->mastering_display = mastering_display;
 1442|      0|            c->mastering_display_ref = ref;
 1443|      0|            break;
 1444|      0|        }
 1445|      0|        case OBU_META_ITUT_T35: {
  ------------------
  |  Branch (1445:9): [True: 0, False: 0]
  ------------------
 1446|      0|            ptrdiff_t payload_size = gb.ptr_end - gb.ptr;
 1447|       |            // Don't take into account all the trailing bits for payload_size
 1448|      0|            while (payload_size > 0 && !gb.ptr[payload_size - 1])
  ------------------
  |  Branch (1448:20): [True: 0, False: 0]
  |  Branch (1448:40): [True: 0, False: 0]
  ------------------
 1449|      0|                payload_size--; // trailing_zero_bit x 8
 1450|      0|            payload_size--; // trailing_one_bit + trailing_zero_bit x 7
 1451|       |
 1452|      0|            int country_code_extension_byte = 0;
 1453|      0|            const int country_code = dav1d_get_bits(&gb, 8);
 1454|      0|            payload_size--;
 1455|      0|            if (country_code == 0xFF) {
  ------------------
  |  Branch (1455:17): [True: 0, False: 0]
  ------------------
 1456|      0|                country_code_extension_byte = dav1d_get_bits(&gb, 8);
 1457|      0|                payload_size--;
 1458|      0|            }
 1459|       |
 1460|      0|            if (payload_size <= 0 || gb.ptr[payload_size] != 0x80) {
  ------------------
  |  Branch (1460:17): [True: 0, False: 0]
  |  Branch (1460:38): [True: 0, False: 0]
  ------------------
 1461|      0|                dav1d_log(c, "Malformed ITU-T T.35 metadata message format\n");
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
 1462|      0|                break;
 1463|      0|            }
 1464|       |
 1465|      0|            if ((c->n_itut_t35 + 1) > INT_MAX / (int)sizeof(*c->itut_t35)) goto error;
  ------------------
  |  Branch (1465:17): [True: 0, False: 0]
  ------------------
 1466|      0|            struct Dav1dITUTT35 *itut_t35 = dav1d_realloc(ALLOC_OBU_META, c->itut_t35,
  ------------------
  |  |  133|      0|#define dav1d_realloc(type, ptr, sz) realloc(ptr, sz)
  ------------------
 1467|      0|                                                          (c->n_itut_t35 + 1) * sizeof(*c->itut_t35));
 1468|      0|            if (!itut_t35) goto error;
  ------------------
  |  Branch (1468:17): [True: 0, False: 0]
  ------------------
 1469|      0|            c->itut_t35 = itut_t35;
 1470|      0|            memset(c->itut_t35 + c->n_itut_t35, 0, sizeof(*c->itut_t35));
 1471|       |
 1472|      0|            struct itut_t35_ctx_context *itut_t35_ctx;
 1473|      0|            if (!c->n_itut_t35) {
  ------------------
  |  Branch (1473:17): [True: 0, False: 0]
  ------------------
 1474|      0|                assert(!c->itut_t35_ref);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1475|      0|                itut_t35_ctx = dav1d_malloc(ALLOC_OBU_META, sizeof(struct itut_t35_ctx_context));
  ------------------
  |  |  132|      0|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 1476|      0|                if (!itut_t35_ctx) goto error;
  ------------------
  |  Branch (1476:21): [True: 0, False: 0]
  ------------------
 1477|      0|                c->itut_t35_ref = dav1d_ref_init(&itut_t35_ctx->ref, c->itut_t35,
 1478|      0|                                                 dav1d_picture_free_itut_t35, itut_t35_ctx, 0);
 1479|      0|            } else {
 1480|      0|                assert(c->itut_t35_ref && atomic_load(&c->itut_t35_ref->ref_cnt) == 1);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1481|      0|                itut_t35_ctx = c->itut_t35_ref->user_data;
 1482|      0|                c->itut_t35_ref->const_data = (uint8_t *)c->itut_t35;
 1483|      0|            }
 1484|      0|            itut_t35_ctx->itut_t35 = c->itut_t35;
 1485|      0|            itut_t35_ctx->n_itut_t35 = c->n_itut_t35 + 1;
 1486|       |
 1487|      0|            Dav1dITUTT35 *const itut_t35_metadata = &c->itut_t35[c->n_itut_t35];
 1488|      0|            itut_t35_metadata->payload = dav1d_malloc(ALLOC_OBU_META, payload_size);
  ------------------
  |  |  132|      0|#define dav1d_malloc(type, sz) malloc(sz)
  ------------------
 1489|      0|            if (!itut_t35_metadata->payload) goto error;
  ------------------
  |  Branch (1489:17): [True: 0, False: 0]
  ------------------
 1490|       |
 1491|      0|            itut_t35_metadata->country_code = country_code;
 1492|      0|            itut_t35_metadata->country_code_extension_byte = country_code_extension_byte;
 1493|      0|            itut_t35_metadata->payload_size = payload_size;
 1494|       |
 1495|       |            // We know that we've read a whole number of bytes and that the
 1496|       |            // payload is within the OBU boundaries, so just use memcpy()
 1497|      0|            assert(gb.bits_left == 0);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1498|      0|            memcpy(itut_t35_metadata->payload, gb.ptr, payload_size);
 1499|       |
 1500|      0|            c->n_itut_t35++;
 1501|      0|            break;
 1502|      0|        }
 1503|      0|        case OBU_META_SCALABILITY:
  ------------------
  |  Branch (1503:9): [True: 0, False: 0]
  ------------------
 1504|      0|        case OBU_META_TIMECODE:
  ------------------
  |  Branch (1504:9): [True: 0, False: 0]
  ------------------
 1505|       |            // ignore metadata OBUs we don't care about
 1506|      0|            break;
 1507|      0|        default:
  ------------------
  |  Branch (1507:9): [True: 0, False: 0]
  ------------------
 1508|       |            // print a warning but don't fail for unknown types
 1509|      0|            if (meta_type > 31) // Types 6 to 31 are "Unregistered user private", so ignore them.
  ------------------
  |  Branch (1509:17): [True: 0, False: 0]
  ------------------
 1510|      0|                dav1d_log(c, "Unknown Metadata OBU type %d\n", meta_type);
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
 1511|      0|            break;
 1512|      0|        }
 1513|       |
 1514|      0|        break;
 1515|      0|    }
 1516|      7|    case DAV1D_OBU_TD:
  ------------------
  |  Branch (1516:5): [True: 7, False: 19]
  ------------------
 1517|      7|        c->frame_flags |= PICTURE_FLAG_NEW_TEMPORAL_UNIT;
 1518|      7|        break;
 1519|      0|    case DAV1D_OBU_PADDING:
  ------------------
  |  Branch (1519:5): [True: 0, False: 26]
  ------------------
 1520|       |        // ignore OBUs we don't care about
 1521|      0|        break;
 1522|      6|    default:
  ------------------
  |  Branch (1522:5): [True: 6, False: 20]
  ------------------
 1523|       |        // print a warning but don't fail for unknown types
 1524|      6|        dav1d_log(c, "Unknown OBU type %d of size %td\n", type, gb.ptr_end - gb.ptr);
  ------------------
  |  |   39|      6|#define dav1d_log dav1d_log
  ------------------
 1525|      6|        break;
 1526|     26|    }
 1527|       |
 1528|     24|    if (c->seq_hdr && c->frame_hdr) {
  ------------------
  |  Branch (1528:9): [True: 15, False: 9]
  |  Branch (1528:23): [True: 4, False: 11]
  ------------------
 1529|      4|        if (c->frame_hdr->show_existing_frame) {
  ------------------
  |  Branch (1529:13): [True: 0, False: 4]
  ------------------
 1530|      0|            if (!c->refs[c->frame_hdr->existing_frame_idx].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (1530:17): [True: 0, False: 0]
  ------------------
 1531|      0|            switch (c->refs[c->frame_hdr->existing_frame_idx].p.p.frame_hdr->frame_type) {
 1532|      0|            case DAV1D_FRAME_TYPE_INTER:
  ------------------
  |  Branch (1532:13): [True: 0, False: 0]
  ------------------
 1533|      0|            case DAV1D_FRAME_TYPE_SWITCH:
  ------------------
  |  Branch (1533:13): [True: 0, False: 0]
  ------------------
 1534|      0|                if (c->decode_frame_type > DAV1D_DECODEFRAMETYPE_REFERENCE)
  ------------------
  |  Branch (1534:21): [True: 0, False: 0]
  ------------------
 1535|      0|                    goto skip;
 1536|      0|                break;
 1537|      0|            case DAV1D_FRAME_TYPE_INTRA:
  ------------------
  |  Branch (1537:13): [True: 0, False: 0]
  ------------------
 1538|      0|                if (c->decode_frame_type > DAV1D_DECODEFRAMETYPE_INTRA)
  ------------------
  |  Branch (1538:21): [True: 0, False: 0]
  ------------------
 1539|      0|                    goto skip;
 1540|       |                // fall-through
 1541|      0|            default:
  ------------------
  |  Branch (1541:13): [True: 0, False: 0]
  ------------------
 1542|      0|                break;
 1543|      0|            }
 1544|      0|            if (!c->refs[c->frame_hdr->existing_frame_idx].p.p.data[0]) goto error;
  ------------------
  |  Branch (1544:17): [True: 0, False: 0]
  ------------------
 1545|      0|            if (c->strict_std_compliance &&
  ------------------
  |  Branch (1545:17): [True: 0, False: 0]
  ------------------
 1546|      0|                !c->refs[c->frame_hdr->existing_frame_idx].p.showable)
  ------------------
  |  Branch (1546:17): [True: 0, False: 0]
  ------------------
 1547|      0|            {
 1548|      0|                goto error;
 1549|      0|            }
 1550|      0|            if (c->n_fc == 1) {
  ------------------
  |  Branch (1550:17): [True: 0, False: 0]
  ------------------
 1551|      0|                dav1d_thread_picture_ref(&c->out,
 1552|      0|                                         &c->refs[c->frame_hdr->existing_frame_idx].p);
 1553|      0|                dav1d_picture_copy_props(&c->out.p,
 1554|      0|                                         c->content_light, c->content_light_ref,
 1555|      0|                                         c->mastering_display, c->mastering_display_ref,
 1556|      0|                                         c->itut_t35, c->itut_t35_ref, c->n_itut_t35,
 1557|      0|                                         &in->m);
 1558|       |                // Must be removed from the context after being attached to the frame
 1559|      0|                dav1d_ref_dec(&c->itut_t35_ref);
 1560|      0|                c->itut_t35 = NULL;
 1561|      0|                c->n_itut_t35 = 0;
 1562|      0|                c->event_flags |= dav1d_picture_get_event_flags(&c->refs[c->frame_hdr->existing_frame_idx].p);
 1563|      0|            } else {
 1564|      0|                pthread_mutex_lock(&c->task_thread.lock);
 1565|       |                // need to append this to the frame output queue
 1566|      0|                const unsigned next = c->frame_thread.next++;
 1567|      0|                if (c->frame_thread.next == c->n_fc)
  ------------------
  |  Branch (1567:21): [True: 0, False: 0]
  ------------------
 1568|      0|                    c->frame_thread.next = 0;
 1569|       |
 1570|      0|                Dav1dFrameContext *const f = &c->fc[next];
 1571|      0|                while (f->n_tile_data > 0)
  ------------------
  |  Branch (1571:24): [True: 0, False: 0]
  ------------------
 1572|      0|                    pthread_cond_wait(&f->task_thread.cond,
 1573|      0|                                      &f->task_thread.ttd->lock);
 1574|      0|                Dav1dThreadPicture *const out_delayed =
 1575|      0|                    &c->frame_thread.out_delayed[next];
 1576|      0|                if (out_delayed->p.data[0] || atomic_load(&f->task_thread.error)) {
  ------------------
  |  Branch (1576:21): [True: 0, False: 0]
  |  Branch (1576:47): [True: 0, False: 0]
  ------------------
 1577|      0|                    unsigned first = atomic_load(&c->task_thread.first);
 1578|      0|                    if (first + 1U < c->n_fc)
  ------------------
  |  Branch (1578:25): [True: 0, False: 0]
  ------------------
 1579|      0|                        atomic_fetch_add(&c->task_thread.first, 1U);
 1580|      0|                    else
 1581|      0|                        atomic_store(&c->task_thread.first, 0);
 1582|      0|                    atomic_compare_exchange_strong(&c->task_thread.reset_task_cur,
 1583|      0|                                                   &first, UINT_MAX);
 1584|      0|                    if (c->task_thread.cur && c->task_thread.cur < c->n_fc)
  ------------------
  |  Branch (1584:25): [True: 0, False: 0]
  |  Branch (1584:47): [True: 0, False: 0]
  ------------------
 1585|      0|                        c->task_thread.cur--;
 1586|      0|                }
 1587|      0|                const int error = f->task_thread.retval;
 1588|      0|                if (error) {
  ------------------
  |  Branch (1588:21): [True: 0, False: 0]
  ------------------
 1589|      0|                    c->cached_error = error;
 1590|      0|                    f->task_thread.retval = 0;
 1591|      0|                    dav1d_data_props_copy(&c->cached_error_props, &out_delayed->p.m);
 1592|      0|                    dav1d_thread_picture_unref(out_delayed);
 1593|      0|                } else if (out_delayed->p.data[0]) {
  ------------------
  |  Branch (1593:28): [True: 0, False: 0]
  ------------------
 1594|      0|                    const unsigned progress = atomic_load_explicit(&out_delayed->progress[1],
 1595|      0|                                                                   memory_order_relaxed);
 1596|      0|                    if ((out_delayed->visible || c->output_invisible_frames) &&
  ------------------
  |  Branch (1596:26): [True: 0, False: 0]
  |  Branch (1596:50): [True: 0, False: 0]
  ------------------
 1597|      0|                        progress != FRAME_ERROR)
  ------------------
  |  |   35|      0|#define FRAME_ERROR (UINT_MAX - 1)
  ------------------
  |  Branch (1597:25): [True: 0, False: 0]
  ------------------
 1598|      0|                    {
 1599|      0|                        dav1d_thread_picture_ref(&c->out, out_delayed);
 1600|      0|                        c->event_flags |= dav1d_picture_get_event_flags(out_delayed);
 1601|      0|                    }
 1602|      0|                    dav1d_thread_picture_unref(out_delayed);
 1603|      0|                }
 1604|      0|                dav1d_thread_picture_ref(out_delayed,
 1605|      0|                                         &c->refs[c->frame_hdr->existing_frame_idx].p);
 1606|      0|                out_delayed->visible = 1;
 1607|      0|                dav1d_picture_copy_props(&out_delayed->p,
 1608|      0|                                         c->content_light, c->content_light_ref,
 1609|      0|                                         c->mastering_display, c->mastering_display_ref,
 1610|      0|                                         c->itut_t35, c->itut_t35_ref, c->n_itut_t35,
 1611|      0|                                         &in->m);
 1612|       |                // Must be removed from the context after being attached to the frame
 1613|      0|                dav1d_ref_dec(&c->itut_t35_ref);
 1614|      0|                c->itut_t35 = NULL;
 1615|      0|                c->n_itut_t35 = 0;
 1616|       |
 1617|      0|                pthread_mutex_unlock(&c->task_thread.lock);
 1618|      0|            }
 1619|      0|            if (c->refs[c->frame_hdr->existing_frame_idx].p.p.frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY) {
  ------------------
  |  Branch (1619:17): [True: 0, False: 0]
  ------------------
 1620|      0|                const int r = c->frame_hdr->existing_frame_idx;
 1621|      0|                c->refs[r].p.showable = 0;
 1622|      0|                for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (1622:33): [True: 0, False: 0]
  ------------------
 1623|      0|                    if (i == r) continue;
  ------------------
  |  Branch (1623:25): [True: 0, False: 0]
  ------------------
 1624|       |
 1625|      0|                    if (c->refs[i].p.p.frame_hdr)
  ------------------
  |  Branch (1625:25): [True: 0, False: 0]
  ------------------
 1626|      0|                        dav1d_thread_picture_unref(&c->refs[i].p);
 1627|      0|                    dav1d_thread_picture_ref(&c->refs[i].p, &c->refs[r].p);
 1628|       |
 1629|      0|                    dav1d_cdf_thread_unref(&c->cdf[i]);
 1630|      0|                    dav1d_cdf_thread_ref(&c->cdf[i], &c->cdf[r]);
 1631|       |
 1632|      0|                    dav1d_ref_dec(&c->refs[i].segmap);
 1633|      0|                    c->refs[i].segmap = c->refs[r].segmap;
 1634|      0|                    if (c->refs[r].segmap)
  ------------------
  |  Branch (1634:25): [True: 0, False: 0]
  ------------------
 1635|      0|                        dav1d_ref_inc(c->refs[r].segmap);
 1636|      0|                    dav1d_ref_dec(&c->refs[i].refmvs);
 1637|      0|                }
 1638|      0|            }
 1639|      0|            c->frame_hdr = NULL;
 1640|      4|        } else if (c->n_tiles == c->frame_hdr->tiling.cols * c->frame_hdr->tiling.rows) {
  ------------------
  |  Branch (1640:20): [True: 4, False: 0]
  ------------------
 1641|      4|            switch (c->frame_hdr->frame_type) {
 1642|      0|            case DAV1D_FRAME_TYPE_INTER:
  ------------------
  |  Branch (1642:13): [True: 0, False: 4]
  ------------------
 1643|      0|            case DAV1D_FRAME_TYPE_SWITCH:
  ------------------
  |  Branch (1643:13): [True: 0, False: 4]
  ------------------
 1644|      0|                if (c->decode_frame_type > DAV1D_DECODEFRAMETYPE_REFERENCE ||
  ------------------
  |  Branch (1644:21): [True: 0, False: 0]
  ------------------
 1645|      0|                    (c->decode_frame_type == DAV1D_DECODEFRAMETYPE_REFERENCE &&
  ------------------
  |  Branch (1645:22): [True: 0, False: 0]
  ------------------
 1646|      0|                     !c->frame_hdr->refresh_frame_flags))
  ------------------
  |  Branch (1646:22): [True: 0, False: 0]
  ------------------
 1647|      0|                    goto skip;
 1648|      0|                break;
 1649|      0|            case DAV1D_FRAME_TYPE_INTRA:
  ------------------
  |  Branch (1649:13): [True: 0, False: 4]
  ------------------
 1650|      0|                if (c->decode_frame_type > DAV1D_DECODEFRAMETYPE_INTRA ||
  ------------------
  |  Branch (1650:21): [True: 0, False: 0]
  ------------------
 1651|      0|                    (c->decode_frame_type == DAV1D_DECODEFRAMETYPE_REFERENCE &&
  ------------------
  |  Branch (1651:22): [True: 0, False: 0]
  ------------------
 1652|      0|                     !c->frame_hdr->refresh_frame_flags))
  ------------------
  |  Branch (1652:22): [True: 0, False: 0]
  ------------------
 1653|      0|                    goto skip;
 1654|       |                // fall-through
 1655|      4|            default:
  ------------------
  |  Branch (1655:13): [True: 4, False: 0]
  ------------------
 1656|      4|                break;
 1657|      4|            }
 1658|      4|            if (!c->n_tile_data)
  ------------------
  |  Branch (1658:17): [True: 0, False: 4]
  ------------------
 1659|      0|                goto error;
 1660|      4|            if ((res = dav1d_submit_frame(c)) < 0)
  ------------------
  |  Branch (1660:17): [True: 0, False: 4]
  ------------------
 1661|      0|                return res;
 1662|      4|            assert(!c->n_tile_data);
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1663|      4|            c->frame_hdr = NULL;
 1664|      4|            c->n_tiles = 0;
 1665|      4|        }
 1666|      4|    }
 1667|       |
 1668|     24|    return gb.ptr_end - gb.ptr_start;
 1669|       |
 1670|      0|skip:
 1671|       |    // update refs with only the headers in case we skip the frame
 1672|      0|    for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (1672:21): [True: 0, False: 0]
  ------------------
 1673|      0|        if (c->frame_hdr->refresh_frame_flags & (1 << i)) {
  ------------------
  |  Branch (1673:13): [True: 0, False: 0]
  ------------------
 1674|      0|            dav1d_thread_picture_unref(&c->refs[i].p);
 1675|      0|            c->refs[i].p.p.frame_hdr = c->frame_hdr;
 1676|      0|            c->refs[i].p.p.seq_hdr = c->seq_hdr;
 1677|      0|            c->refs[i].p.p.frame_hdr_ref = c->frame_hdr_ref;
 1678|      0|            c->refs[i].p.p.seq_hdr_ref = c->seq_hdr_ref;
 1679|      0|            dav1d_ref_inc(c->frame_hdr_ref);
 1680|      0|            dav1d_ref_inc(c->seq_hdr_ref);
 1681|      0|        }
 1682|      0|    }
 1683|       |
 1684|      0|    dav1d_ref_dec(&c->frame_hdr_ref);
 1685|      0|    c->frame_hdr = NULL;
 1686|      0|    c->n_tiles = 0;
 1687|       |
 1688|      0|    return gb.ptr_end - gb.ptr_start;
 1689|       |
 1690|      1|error:
 1691|      1|    dav1d_data_props_copy(&c->cached_error_props, &in->m);
 1692|      1|    dav1d_log(c, gb.error ? "Overrun in OBU bit buffer\n" :
  ------------------
  |  |   39|      1|#define dav1d_log dav1d_log
  ------------------
  |  Branch (1692:18): [True: 1, False: 0]
  ------------------
 1693|      1|                            "Error parsing OBU data\n");
 1694|      1|    return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      1|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 1695|     24|}
obu.c:parse_seq_hdr:
   75|      7|{
   76|      7|#define DEBUG_SEQ_HDR 0
   77|       |
   78|       |#if DEBUG_SEQ_HDR
   79|       |    const unsigned init_bit_pos = dav1d_get_bits_pos(gb);
   80|       |#endif
   81|       |
   82|      7|    memset(hdr, 0, sizeof(*hdr));
   83|      7|    hdr->profile = dav1d_get_bits(gb, 3);
   84|      7|    if (hdr->profile > 2) goto error;
  ------------------
  |  Branch (84:9): [True: 0, False: 7]
  ------------------
   85|       |#if DEBUG_SEQ_HDR
   86|       |    printf("SEQHDR: post-profile: off=%u\n",
   87|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
   88|       |#endif
   89|       |
   90|      7|    hdr->still_picture = dav1d_get_bit(gb);
   91|      7|    hdr->reduced_still_picture_header = dav1d_get_bit(gb);
   92|      7|    if (hdr->reduced_still_picture_header && !hdr->still_picture) goto error;
  ------------------
  |  Branch (92:9): [True: 7, False: 0]
  |  Branch (92:46): [True: 0, False: 7]
  ------------------
   93|       |#if DEBUG_SEQ_HDR
   94|       |    printf("SEQHDR: post-stillpicture_flags: off=%u\n",
   95|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
   96|       |#endif
   97|       |
   98|      7|    if (hdr->reduced_still_picture_header) {
  ------------------
  |  Branch (98:9): [True: 7, False: 0]
  ------------------
   99|      7|        hdr->num_operating_points = 1;
  100|      7|        hdr->operating_points[0].major_level = dav1d_get_bits(gb, 3);
  101|      7|        hdr->operating_points[0].minor_level = dav1d_get_bits(gb, 2);
  102|      7|        hdr->operating_points[0].initial_display_delay = 10;
  103|      7|    } else {
  104|      0|        hdr->timing_info_present = dav1d_get_bit(gb);
  105|      0|        if (hdr->timing_info_present) {
  ------------------
  |  Branch (105:13): [True: 0, False: 0]
  ------------------
  106|      0|            hdr->num_units_in_tick = dav1d_get_bits(gb, 32);
  107|      0|            hdr->time_scale = dav1d_get_bits(gb, 32);
  108|      0|            if (strict_std_compliance && (!hdr->num_units_in_tick || !hdr->time_scale))
  ------------------
  |  Branch (108:17): [True: 0, False: 0]
  |  Branch (108:43): [True: 0, False: 0]
  |  Branch (108:70): [True: 0, False: 0]
  ------------------
  109|      0|                goto error;
  110|      0|            hdr->equal_picture_interval = dav1d_get_bit(gb);
  111|      0|            if (hdr->equal_picture_interval) {
  ------------------
  |  Branch (111:17): [True: 0, False: 0]
  ------------------
  112|      0|                const unsigned num_ticks_per_picture = dav1d_get_vlc(gb);
  113|      0|                if (num_ticks_per_picture == UINT32_MAX)
  ------------------
  |  Branch (113:21): [True: 0, False: 0]
  ------------------
  114|      0|                    goto error;
  115|      0|                hdr->num_ticks_per_picture = num_ticks_per_picture + 1;
  116|      0|            }
  117|       |
  118|      0|            hdr->decoder_model_info_present = dav1d_get_bit(gb);
  119|      0|            if (hdr->decoder_model_info_present) {
  ------------------
  |  Branch (119:17): [True: 0, False: 0]
  ------------------
  120|      0|                hdr->encoder_decoder_buffer_delay_length = dav1d_get_bits(gb, 5) + 1;
  121|      0|                hdr->num_units_in_decoding_tick = dav1d_get_bits(gb, 32);
  122|      0|                if (strict_std_compliance && !hdr->num_units_in_decoding_tick)
  ------------------
  |  Branch (122:21): [True: 0, False: 0]
  |  Branch (122:46): [True: 0, False: 0]
  ------------------
  123|      0|                    goto error;
  124|      0|                hdr->buffer_removal_delay_length = dav1d_get_bits(gb, 5) + 1;
  125|      0|                hdr->frame_presentation_delay_length = dav1d_get_bits(gb, 5) + 1;
  126|      0|            }
  127|      0|        }
  128|       |#if DEBUG_SEQ_HDR
  129|       |        printf("SEQHDR: post-timinginfo: off=%u\n",
  130|       |               dav1d_get_bits_pos(gb) - init_bit_pos);
  131|       |#endif
  132|       |
  133|      0|        hdr->display_model_info_present = dav1d_get_bit(gb);
  134|      0|        hdr->num_operating_points = dav1d_get_bits(gb, 5) + 1;
  135|      0|        for (int i = 0; i < hdr->num_operating_points; i++) {
  ------------------
  |  Branch (135:25): [True: 0, False: 0]
  ------------------
  136|      0|            struct Dav1dSequenceHeaderOperatingPoint *const op =
  137|      0|                &hdr->operating_points[i];
  138|      0|            op->idc = dav1d_get_bits(gb, 12);
  139|      0|            if (op->idc && (!(op->idc & 0xff) || !(op->idc & 0xf00)))
  ------------------
  |  Branch (139:17): [True: 0, False: 0]
  |  Branch (139:29): [True: 0, False: 0]
  |  Branch (139:50): [True: 0, False: 0]
  ------------------
  140|      0|                goto error;
  141|      0|            op->major_level = 2 + dav1d_get_bits(gb, 3);
  142|      0|            op->minor_level = dav1d_get_bits(gb, 2);
  143|      0|            if (op->major_level > 3)
  ------------------
  |  Branch (143:17): [True: 0, False: 0]
  ------------------
  144|      0|                op->tier = dav1d_get_bit(gb);
  145|      0|            if (hdr->decoder_model_info_present) {
  ------------------
  |  Branch (145:17): [True: 0, False: 0]
  ------------------
  146|      0|                op->decoder_model_param_present = dav1d_get_bit(gb);
  147|      0|                if (op->decoder_model_param_present) {
  ------------------
  |  Branch (147:21): [True: 0, False: 0]
  ------------------
  148|      0|                    struct Dav1dSequenceHeaderOperatingParameterInfo *const opi =
  149|      0|                        &hdr->operating_parameter_info[i];
  150|      0|                    opi->decoder_buffer_delay =
  151|      0|                        dav1d_get_bits(gb, hdr->encoder_decoder_buffer_delay_length);
  152|      0|                    opi->encoder_buffer_delay =
  153|      0|                        dav1d_get_bits(gb, hdr->encoder_decoder_buffer_delay_length);
  154|      0|                    opi->low_delay_mode = dav1d_get_bit(gb);
  155|      0|                }
  156|      0|            }
  157|      0|            if (hdr->display_model_info_present)
  ------------------
  |  Branch (157:17): [True: 0, False: 0]
  ------------------
  158|      0|                op->display_model_param_present = dav1d_get_bit(gb);
  159|      0|            op->initial_display_delay =
  160|      0|                op->display_model_param_present ? dav1d_get_bits(gb, 4) + 1 : 10;
  ------------------
  |  Branch (160:17): [True: 0, False: 0]
  ------------------
  161|      0|        }
  162|       |#if DEBUG_SEQ_HDR
  163|       |        printf("SEQHDR: post-operating-points: off=%u\n",
  164|       |               dav1d_get_bits_pos(gb) - init_bit_pos);
  165|       |#endif
  166|      0|    }
  167|       |
  168|      7|    hdr->width_n_bits = dav1d_get_bits(gb, 4) + 1;
  169|      7|    hdr->height_n_bits = dav1d_get_bits(gb, 4) + 1;
  170|      7|    hdr->max_width = dav1d_get_bits(gb, hdr->width_n_bits) + 1;
  171|      7|    hdr->max_height = dav1d_get_bits(gb, hdr->height_n_bits) + 1;
  172|       |#if DEBUG_SEQ_HDR
  173|       |    printf("SEQHDR: post-size: off=%u\n",
  174|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
  175|       |#endif
  176|      7|    if (!hdr->reduced_still_picture_header) {
  ------------------
  |  Branch (176:9): [True: 0, False: 7]
  ------------------
  177|      0|        hdr->frame_id_numbers_present = dav1d_get_bit(gb);
  178|      0|        if (hdr->frame_id_numbers_present) {
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  ------------------
  179|      0|            hdr->delta_frame_id_n_bits = dav1d_get_bits(gb, 4) + 2;
  180|      0|            hdr->frame_id_n_bits = dav1d_get_bits(gb, 3) + hdr->delta_frame_id_n_bits + 1;
  181|      0|        }
  182|      0|    }
  183|       |#if DEBUG_SEQ_HDR
  184|       |    printf("SEQHDR: post-frame-id-numbers-present: off=%u\n",
  185|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
  186|       |#endif
  187|       |
  188|      7|    hdr->sb128 = dav1d_get_bit(gb);
  189|      7|    hdr->filter_intra = dav1d_get_bit(gb);
  190|      7|    hdr->intra_edge_filter = dav1d_get_bit(gb);
  191|      7|    if (hdr->reduced_still_picture_header) {
  ------------------
  |  Branch (191:9): [True: 7, False: 0]
  ------------------
  192|      7|        hdr->screen_content_tools = DAV1D_ADAPTIVE;
  193|      7|        hdr->force_integer_mv = DAV1D_ADAPTIVE;
  194|      7|    } else {
  195|      0|        hdr->inter_intra = dav1d_get_bit(gb);
  196|      0|        hdr->masked_compound = dav1d_get_bit(gb);
  197|      0|        hdr->warped_motion = dav1d_get_bit(gb);
  198|      0|        hdr->dual_filter = dav1d_get_bit(gb);
  199|      0|        hdr->order_hint = dav1d_get_bit(gb);
  200|      0|        if (hdr->order_hint) {
  ------------------
  |  Branch (200:13): [True: 0, False: 0]
  ------------------
  201|      0|            hdr->jnt_comp = dav1d_get_bit(gb);
  202|      0|            hdr->ref_frame_mvs = dav1d_get_bit(gb);
  203|      0|        }
  204|      0|        hdr->screen_content_tools = dav1d_get_bit(gb) ? DAV1D_ADAPTIVE : dav1d_get_bit(gb);
  ------------------
  |  Branch (204:37): [True: 0, False: 0]
  ------------------
  205|       |    #if DEBUG_SEQ_HDR
  206|       |        printf("SEQHDR: post-screentools: off=%u\n",
  207|       |               dav1d_get_bits_pos(gb) - init_bit_pos);
  208|       |    #endif
  209|      0|        hdr->force_integer_mv = hdr->screen_content_tools ?
  ------------------
  |  Branch (209:33): [True: 0, False: 0]
  ------------------
  210|      0|                                dav1d_get_bit(gb) ? DAV1D_ADAPTIVE : dav1d_get_bit(gb) : 2;
  ------------------
  |  Branch (210:33): [True: 0, False: 0]
  ------------------
  211|      0|        if (hdr->order_hint)
  ------------------
  |  Branch (211:13): [True: 0, False: 0]
  ------------------
  212|      0|            hdr->order_hint_n_bits = dav1d_get_bits(gb, 3) + 1;
  213|      0|    }
  214|      7|    hdr->super_res = dav1d_get_bit(gb);
  215|      7|    hdr->cdef = dav1d_get_bit(gb);
  216|      7|    hdr->restoration = dav1d_get_bit(gb);
  217|       |#if DEBUG_SEQ_HDR
  218|       |    printf("SEQHDR: post-featurebits: off=%u\n",
  219|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
  220|       |#endif
  221|       |
  222|      7|    hdr->hbd = dav1d_get_bit(gb);
  223|      7|    if (hdr->profile == 2 && hdr->hbd)
  ------------------
  |  Branch (223:9): [True: 0, False: 7]
  |  Branch (223:30): [True: 0, False: 0]
  ------------------
  224|      0|        hdr->hbd += dav1d_get_bit(gb);
  225|      7|    if (hdr->profile != 1)
  ------------------
  |  Branch (225:9): [True: 7, False: 0]
  ------------------
  226|      7|        hdr->monochrome = dav1d_get_bit(gb);
  227|      7|    hdr->color_description_present = dav1d_get_bit(gb);
  228|      7|    if (hdr->color_description_present) {
  ------------------
  |  Branch (228:9): [True: 7, False: 0]
  ------------------
  229|      7|        hdr->pri = dav1d_get_bits(gb, 8);
  230|      7|        hdr->trc = dav1d_get_bits(gb, 8);
  231|      7|        hdr->mtrx = dav1d_get_bits(gb, 8);
  232|      7|    } else {
  233|      0|        hdr->pri = DAV1D_COLOR_PRI_UNKNOWN;
  234|      0|        hdr->trc = DAV1D_TRC_UNKNOWN;
  235|      0|        hdr->mtrx = DAV1D_MC_UNKNOWN;
  236|      0|    }
  237|      7|    if (hdr->monochrome) {
  ------------------
  |  Branch (237:9): [True: 0, False: 7]
  ------------------
  238|      0|        hdr->color_range = dav1d_get_bit(gb);
  239|      0|        hdr->layout = DAV1D_PIXEL_LAYOUT_I400;
  240|      0|        hdr->ss_hor = hdr->ss_ver = 1;
  241|      0|        hdr->chr = DAV1D_CHR_UNKNOWN;
  242|      7|    } else if (hdr->pri == DAV1D_COLOR_PRI_BT709 &&
  ------------------
  |  Branch (242:16): [True: 7, False: 0]
  ------------------
  243|      7|               hdr->trc == DAV1D_TRC_SRGB &&
  ------------------
  |  Branch (243:16): [True: 7, False: 0]
  ------------------
  244|      7|               hdr->mtrx == DAV1D_MC_IDENTITY)
  ------------------
  |  Branch (244:16): [True: 0, False: 7]
  ------------------
  245|      0|    {
  246|      0|        hdr->layout = DAV1D_PIXEL_LAYOUT_I444;
  247|      0|        hdr->color_range = 1;
  248|      0|        if (hdr->profile != 1 && !(hdr->profile == 2 && hdr->hbd == 2))
  ------------------
  |  Branch (248:13): [True: 0, False: 0]
  |  Branch (248:36): [True: 0, False: 0]
  |  Branch (248:57): [True: 0, False: 0]
  ------------------
  249|      0|            goto error;
  250|      7|    } else {
  251|      7|        hdr->color_range = dav1d_get_bit(gb);
  252|      7|        switch (hdr->profile) {
  ------------------
  |  Branch (252:17): [True: 7, False: 0]
  ------------------
  253|      7|        case 0: hdr->layout = DAV1D_PIXEL_LAYOUT_I420;
  ------------------
  |  Branch (253:9): [True: 7, False: 0]
  ------------------
  254|      7|                hdr->ss_hor = hdr->ss_ver = 1;
  255|      7|                break;
  256|      0|        case 1: hdr->layout = DAV1D_PIXEL_LAYOUT_I444;
  ------------------
  |  Branch (256:9): [True: 0, False: 7]
  ------------------
  257|      0|                break;
  258|      0|        case 2:
  ------------------
  |  Branch (258:9): [True: 0, False: 7]
  ------------------
  259|      0|            if (hdr->hbd == 2) {
  ------------------
  |  Branch (259:17): [True: 0, False: 0]
  ------------------
  260|      0|                hdr->ss_hor = dav1d_get_bit(gb);
  261|      0|                if (hdr->ss_hor)
  ------------------
  |  Branch (261:21): [True: 0, False: 0]
  ------------------
  262|      0|                    hdr->ss_ver = dav1d_get_bit(gb);
  263|      0|            } else
  264|      0|                hdr->ss_hor = 1;
  265|      0|            hdr->layout = hdr->ss_hor ?
  ------------------
  |  Branch (265:27): [True: 0, False: 0]
  ------------------
  266|      0|                          hdr->ss_ver ? DAV1D_PIXEL_LAYOUT_I420 :
  ------------------
  |  Branch (266:27): [True: 0, False: 0]
  ------------------
  267|      0|                                        DAV1D_PIXEL_LAYOUT_I422 :
  268|      0|                                        DAV1D_PIXEL_LAYOUT_I444;
  269|      0|            break;
  270|      7|        }
  271|      7|        hdr->chr = (hdr->ss_hor & hdr->ss_ver) ?
  ------------------
  |  Branch (271:20): [True: 7, False: 0]
  ------------------
  272|      7|                   dav1d_get_bits(gb, 2) : DAV1D_CHR_UNKNOWN;
  273|      7|    }
  274|      7|    if (strict_std_compliance &&
  ------------------
  |  Branch (274:9): [True: 0, False: 7]
  ------------------
  275|      0|        hdr->mtrx == DAV1D_MC_IDENTITY && hdr->layout != DAV1D_PIXEL_LAYOUT_I444)
  ------------------
  |  Branch (275:9): [True: 0, False: 0]
  |  Branch (275:43): [True: 0, False: 0]
  ------------------
  276|      0|    {
  277|      0|        goto error;
  278|      0|    }
  279|      7|    if (!hdr->monochrome)
  ------------------
  |  Branch (279:9): [True: 7, False: 0]
  ------------------
  280|      7|        hdr->separate_uv_delta_q = dav1d_get_bit(gb);
  281|       |#if DEBUG_SEQ_HDR
  282|       |    printf("SEQHDR: post-colorinfo: off=%u\n",
  283|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
  284|       |#endif
  285|       |
  286|      7|    hdr->film_grain_present = dav1d_get_bit(gb);
  287|       |#if DEBUG_SEQ_HDR
  288|       |    printf("SEQHDR: post-filmgrain: off=%u\n",
  289|       |           dav1d_get_bits_pos(gb) - init_bit_pos);
  290|       |#endif
  291|       |
  292|       |    // We needn't bother flushing the OBU here: we'll check we didn't
  293|       |    // overrun in the caller and will then discard gb, so there's no
  294|       |    // point in setting its position properly.
  295|       |
  296|      7|    return check_trailing_bits(gb, strict_std_compliance);
  297|       |
  298|      0|error:
  299|      0|    return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  300|      7|}
obu.c:parse_frame_hdr:
  409|      6|static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb) {
  410|      6|#define DEBUG_FRAME_HDR 0
  411|       |
  412|       |#if DEBUG_FRAME_HDR
  413|       |    const uint8_t *const init_ptr = gb->ptr;
  414|       |#endif
  415|      6|    const Dav1dSequenceHeader *const seqhdr = c->seq_hdr;
  416|      6|    Dav1dFrameHeader *const hdr = c->frame_hdr;
  417|       |
  418|      6|    if (!seqhdr->reduced_still_picture_header)
  ------------------
  |  Branch (418:9): [True: 0, False: 6]
  ------------------
  419|      0|        hdr->show_existing_frame = dav1d_get_bit(gb);
  420|       |#if DEBUG_FRAME_HDR
  421|       |    printf("HDR: post-show_existing_frame: off=%td\n",
  422|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  423|       |#endif
  424|      6|    if (hdr->show_existing_frame) {
  ------------------
  |  Branch (424:9): [True: 0, False: 6]
  ------------------
  425|      0|        hdr->existing_frame_idx = dav1d_get_bits(gb, 3);
  426|      0|        if (seqhdr->decoder_model_info_present && !seqhdr->equal_picture_interval)
  ------------------
  |  Branch (426:13): [True: 0, False: 0]
  |  Branch (426:51): [True: 0, False: 0]
  ------------------
  427|      0|            hdr->frame_presentation_delay = dav1d_get_bits(gb, seqhdr->frame_presentation_delay_length);
  428|      0|        if (seqhdr->frame_id_numbers_present) {
  ------------------
  |  Branch (428:13): [True: 0, False: 0]
  ------------------
  429|      0|            hdr->frame_id = dav1d_get_bits(gb, seqhdr->frame_id_n_bits);
  430|      0|            Dav1dFrameHeader *const ref_frame_hdr = c->refs[hdr->existing_frame_idx].p.p.frame_hdr;
  431|      0|            if (!ref_frame_hdr || ref_frame_hdr->frame_id != hdr->frame_id) goto error;
  ------------------
  |  Branch (431:17): [True: 0, False: 0]
  |  Branch (431:35): [True: 0, False: 0]
  ------------------
  432|      0|        }
  433|      0|        return 0;
  434|      0|    }
  435|       |
  436|      6|    if (seqhdr->reduced_still_picture_header) {
  ------------------
  |  Branch (436:9): [True: 6, False: 0]
  ------------------
  437|      6|        hdr->frame_type = DAV1D_FRAME_TYPE_KEY;
  438|      6|        hdr->show_frame = 1;
  439|      6|    } else {
  440|      0|        hdr->frame_type = dav1d_get_bits(gb, 2);
  441|      0|        hdr->show_frame = dav1d_get_bit(gb);
  442|      0|    }
  443|      6|    if (hdr->show_frame) {
  ------------------
  |  Branch (443:9): [True: 6, False: 0]
  ------------------
  444|      6|        if (seqhdr->decoder_model_info_present && !seqhdr->equal_picture_interval)
  ------------------
  |  Branch (444:13): [True: 0, False: 6]
  |  Branch (444:51): [True: 0, False: 0]
  ------------------
  445|      0|            hdr->frame_presentation_delay = dav1d_get_bits(gb, seqhdr->frame_presentation_delay_length);
  446|      6|        hdr->showable_frame = hdr->frame_type != DAV1D_FRAME_TYPE_KEY;
  447|      6|    } else
  448|      0|        hdr->showable_frame = dav1d_get_bit(gb);
  449|      6|    hdr->error_resilient_mode =
  450|      6|        (hdr->frame_type == DAV1D_FRAME_TYPE_KEY && hdr->show_frame) ||
  ------------------
  |  Branch (450:10): [True: 6, False: 0]
  |  Branch (450:53): [True: 6, False: 0]
  ------------------
  451|      0|        hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ||
  ------------------
  |  Branch (451:9): [True: 0, False: 0]
  ------------------
  452|      0|        seqhdr->reduced_still_picture_header || dav1d_get_bit(gb);
  ------------------
  |  Branch (452:9): [True: 0, False: 0]
  |  Branch (452:49): [True: 0, False: 0]
  ------------------
  453|       |#if DEBUG_FRAME_HDR
  454|       |    printf("HDR: post-frametype_bits: off=%td\n",
  455|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  456|       |#endif
  457|      6|    hdr->disable_cdf_update = dav1d_get_bit(gb);
  458|      6|    hdr->allow_screen_content_tools = seqhdr->screen_content_tools == DAV1D_ADAPTIVE ?
  ------------------
  |  Branch (458:39): [True: 6, False: 0]
  ------------------
  459|      6|                                      dav1d_get_bit(gb) : seqhdr->screen_content_tools;
  460|      6|    if (hdr->allow_screen_content_tools)
  ------------------
  |  Branch (460:9): [True: 6, False: 0]
  ------------------
  461|      6|        hdr->force_integer_mv = seqhdr->force_integer_mv == DAV1D_ADAPTIVE ?
  ------------------
  |  Branch (461:33): [True: 6, False: 0]
  ------------------
  462|      6|                                dav1d_get_bit(gb) : seqhdr->force_integer_mv;
  463|       |
  464|      6|    if (IS_KEY_OR_INTRA(hdr))
  ------------------
  |  |   43|      6|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (43:5): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  465|      6|        hdr->force_integer_mv = 1;
  466|       |
  467|      6|    if (seqhdr->frame_id_numbers_present)
  ------------------
  |  Branch (467:9): [True: 0, False: 6]
  ------------------
  468|      0|        hdr->frame_id = dav1d_get_bits(gb, seqhdr->frame_id_n_bits);
  469|       |
  470|      6|    if (!seqhdr->reduced_still_picture_header)
  ------------------
  |  Branch (470:9): [True: 0, False: 6]
  ------------------
  471|      0|        hdr->frame_size_override = hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ? 1 : dav1d_get_bit(gb);
  ------------------
  |  Branch (471:36): [True: 0, False: 0]
  ------------------
  472|       |#if DEBUG_FRAME_HDR
  473|       |    printf("HDR: post-frame_size_override_flag: off=%td\n",
  474|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  475|       |#endif
  476|      6|    if (seqhdr->order_hint)
  ------------------
  |  Branch (476:9): [True: 0, False: 6]
  ------------------
  477|      0|        hdr->frame_offset = dav1d_get_bits(gb, seqhdr->order_hint_n_bits);
  478|      6|    hdr->primary_ref_frame = !hdr->error_resilient_mode && IS_INTER_OR_SWITCH(hdr) ?
  ------------------
  |  |   36|      0|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (478:30): [True: 0, False: 6]
  ------------------
  479|      6|                             dav1d_get_bits(gb, 3) : DAV1D_PRIMARY_REF_NONE;
  ------------------
  |  |   45|     12|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  480|       |
  481|      6|    if (seqhdr->decoder_model_info_present) {
  ------------------
  |  Branch (481:9): [True: 0, False: 6]
  ------------------
  482|      0|        hdr->buffer_removal_time_present = dav1d_get_bit(gb);
  483|      0|        if (hdr->buffer_removal_time_present) {
  ------------------
  |  Branch (483:13): [True: 0, False: 0]
  ------------------
  484|      0|            for (int i = 0; i < c->seq_hdr->num_operating_points; i++) {
  ------------------
  |  Branch (484:29): [True: 0, False: 0]
  ------------------
  485|      0|                const struct Dav1dSequenceHeaderOperatingPoint *const seqop = &seqhdr->operating_points[i];
  486|      0|                struct Dav1dFrameHeaderOperatingPoint *const op = &hdr->operating_points[i];
  487|      0|                if (seqop->decoder_model_param_present) {
  ------------------
  |  Branch (487:21): [True: 0, False: 0]
  ------------------
  488|      0|                    int in_temporal_layer = (seqop->idc >> hdr->temporal_id) & 1;
  489|      0|                    int in_spatial_layer  = (seqop->idc >> (hdr->spatial_id + 8)) & 1;
  490|      0|                    if (!seqop->idc || (in_temporal_layer && in_spatial_layer))
  ------------------
  |  Branch (490:25): [True: 0, False: 0]
  |  Branch (490:41): [True: 0, False: 0]
  |  Branch (490:62): [True: 0, False: 0]
  ------------------
  491|      0|                        op->buffer_removal_time = dav1d_get_bits(gb, seqhdr->buffer_removal_delay_length);
  492|      0|                }
  493|      0|            }
  494|      0|        }
  495|      0|    }
  496|       |
  497|      6|    if (IS_KEY_OR_INTRA(hdr)) {
  ------------------
  |  |   43|      6|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (43:5): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  498|      6|        hdr->refresh_frame_flags = (hdr->frame_type == DAV1D_FRAME_TYPE_KEY &&
  ------------------
  |  Branch (498:37): [True: 6, False: 0]
  ------------------
  499|      6|                                    hdr->show_frame) ? 0xff : dav1d_get_bits(gb, 8);
  ------------------
  |  Branch (499:37): [True: 6, False: 0]
  ------------------
  500|      6|        if (hdr->refresh_frame_flags != 0xff && hdr->error_resilient_mode && seqhdr->order_hint)
  ------------------
  |  Branch (500:13): [True: 0, False: 6]
  |  Branch (500:49): [True: 0, False: 0]
  |  Branch (500:78): [True: 0, False: 0]
  ------------------
  501|      0|            for (int i = 0; i < 8; i++)
  ------------------
  |  Branch (501:29): [True: 0, False: 0]
  ------------------
  502|      0|                dav1d_get_bits(gb, seqhdr->order_hint_n_bits);
  503|      6|        if (c->strict_std_compliance &&
  ------------------
  |  Branch (503:13): [True: 0, False: 6]
  ------------------
  504|      0|            hdr->frame_type == DAV1D_FRAME_TYPE_INTRA && hdr->refresh_frame_flags == 0xff)
  ------------------
  |  Branch (504:13): [True: 0, False: 0]
  |  Branch (504:58): [True: 0, False: 0]
  ------------------
  505|      0|        {
  506|      0|            goto error;
  507|      0|        }
  508|      6|        if (read_frame_size(c, gb, 0) < 0) goto error;
  ------------------
  |  Branch (508:13): [True: 0, False: 6]
  ------------------
  509|      6|        if (hdr->allow_screen_content_tools && !hdr->super_res.enabled)
  ------------------
  |  Branch (509:13): [True: 6, False: 0]
  |  Branch (509:48): [True: 6, False: 0]
  ------------------
  510|      6|            hdr->allow_intrabc = dav1d_get_bit(gb);
  511|      6|    } else {
  512|      0|        hdr->refresh_frame_flags = hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ? 0xff :
  ------------------
  |  Branch (512:36): [True: 0, False: 0]
  ------------------
  513|      0|                                   dav1d_get_bits(gb, 8);
  514|      0|        if (hdr->error_resilient_mode && seqhdr->order_hint)
  ------------------
  |  Branch (514:13): [True: 0, False: 0]
  |  Branch (514:42): [True: 0, False: 0]
  ------------------
  515|      0|            for (int i = 0; i < 8; i++)
  ------------------
  |  Branch (515:29): [True: 0, False: 0]
  ------------------
  516|      0|                dav1d_get_bits(gb, seqhdr->order_hint_n_bits);
  517|      0|        if (seqhdr->order_hint) {
  ------------------
  |  Branch (517:13): [True: 0, False: 0]
  ------------------
  518|      0|            hdr->frame_ref_short_signaling = dav1d_get_bit(gb);
  519|      0|            if (hdr->frame_ref_short_signaling) {
  ------------------
  |  Branch (519:17): [True: 0, False: 0]
  ------------------
  520|      0|                hdr->refidx[0] = dav1d_get_bits(gb, 3);
  521|      0|                hdr->refidx[1] = hdr->refidx[2] = -1;
  522|      0|                hdr->refidx[3] = dav1d_get_bits(gb, 3);
  523|       |
  524|       |                /* +1 allows for unconditional stores, as unused
  525|       |                 * values can be dumped into frame_offset[-1]. */
  526|      0|                int frame_offset_mem[8+1];
  527|      0|                int *const frame_offset = &frame_offset_mem[1];
  528|      0|                int earliest_ref = -1;
  529|      0|                for (int i = 0, earliest_offset = INT_MAX; i < 8; i++) {
  ------------------
  |  Branch (529:60): [True: 0, False: 0]
  ------------------
  530|      0|                    const Dav1dFrameHeader *const refhdr = c->refs[i].p.p.frame_hdr;
  531|      0|                    if (!refhdr) goto error;
  ------------------
  |  Branch (531:25): [True: 0, False: 0]
  ------------------
  532|      0|                    const int diff = get_poc_diff(seqhdr->order_hint_n_bits,
  533|      0|                                                  refhdr->frame_offset,
  534|      0|                                                  hdr->frame_offset);
  535|      0|                    frame_offset[i] = diff;
  536|      0|                    if (diff < earliest_offset) {
  ------------------
  |  Branch (536:25): [True: 0, False: 0]
  ------------------
  537|      0|                        earliest_offset = diff;
  538|      0|                        earliest_ref = i;
  539|      0|                    }
  540|      0|                }
  541|      0|                frame_offset[hdr->refidx[0]] = INT_MIN; // = reference frame is used
  542|      0|                frame_offset[hdr->refidx[3]] = INT_MIN;
  543|      0|                assert(earliest_ref >= 0);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  544|       |
  545|      0|                int refidx = -1;
  546|      0|                for (int i = 0, latest_offset = 0; i < 8; i++) {
  ------------------
  |  Branch (546:52): [True: 0, False: 0]
  ------------------
  547|      0|                    const int hint = frame_offset[i];
  548|      0|                    if (hint >= latest_offset) {
  ------------------
  |  Branch (548:25): [True: 0, False: 0]
  ------------------
  549|      0|                        latest_offset = hint;
  550|      0|                        refidx = i;
  551|      0|                    }
  552|      0|                }
  553|      0|                frame_offset[refidx] = INT_MIN;
  554|      0|                hdr->refidx[6] = refidx;
  555|       |
  556|      0|                for (int i = 4; i < 6; i++) {
  ------------------
  |  Branch (556:33): [True: 0, False: 0]
  ------------------
  557|       |                    /* Unsigned compares to handle negative values. */
  558|      0|                    unsigned earliest_offset = UINT8_MAX;
  559|      0|                    refidx = -1;
  560|      0|                    for (int j = 0; j < 8; j++) {
  ------------------
  |  Branch (560:37): [True: 0, False: 0]
  ------------------
  561|      0|                        const unsigned hint = frame_offset[j];
  562|      0|                        if (hint < earliest_offset) {
  ------------------
  |  Branch (562:29): [True: 0, False: 0]
  ------------------
  563|      0|                            earliest_offset = hint;
  564|      0|                            refidx = j;
  565|      0|                        }
  566|      0|                    }
  567|      0|                    frame_offset[refidx] = INT_MIN;
  568|      0|                    hdr->refidx[i] = refidx;
  569|      0|                }
  570|       |
  571|      0|                for (int i = 1; i < 7; i++) {
  ------------------
  |  Branch (571:33): [True: 0, False: 0]
  ------------------
  572|      0|                    refidx = hdr->refidx[i];
  573|      0|                    if (refidx < 0) {
  ------------------
  |  Branch (573:25): [True: 0, False: 0]
  ------------------
  574|      0|                        unsigned latest_offset = ~UINT8_MAX;
  575|      0|                        for (int j = 0; j < 8; j++) {
  ------------------
  |  Branch (575:41): [True: 0, False: 0]
  ------------------
  576|      0|                            const unsigned hint = frame_offset[j];
  577|      0|                            if (hint >= latest_offset) {
  ------------------
  |  Branch (577:33): [True: 0, False: 0]
  ------------------
  578|      0|                                latest_offset = hint;
  579|      0|                                refidx = j;
  580|      0|                            }
  581|      0|                        }
  582|      0|                        frame_offset[refidx] = INT_MIN;
  583|      0|                        hdr->refidx[i] = refidx >= 0 ? refidx : earliest_ref;
  ------------------
  |  Branch (583:42): [True: 0, False: 0]
  ------------------
  584|      0|                    }
  585|      0|                }
  586|      0|            }
  587|      0|        }
  588|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (588:25): [True: 0, False: 0]
  ------------------
  589|      0|            if (!hdr->frame_ref_short_signaling)
  ------------------
  |  Branch (589:17): [True: 0, False: 0]
  ------------------
  590|      0|                hdr->refidx[i] = dav1d_get_bits(gb, 3);
  591|      0|            if (seqhdr->frame_id_numbers_present) {
  ------------------
  |  Branch (591:17): [True: 0, False: 0]
  ------------------
  592|      0|                const unsigned delta_ref_frame_id = dav1d_get_bits(gb, seqhdr->delta_frame_id_n_bits) + 1;
  593|      0|                const unsigned ref_frame_id = (hdr->frame_id + (1 << seqhdr->frame_id_n_bits) - delta_ref_frame_id) & ((1 << seqhdr->frame_id_n_bits) - 1);
  594|      0|                Dav1dFrameHeader *const ref_frame_hdr = c->refs[hdr->refidx[i]].p.p.frame_hdr;
  595|      0|                if (!ref_frame_hdr || ref_frame_hdr->frame_id != ref_frame_id) goto error;
  ------------------
  |  Branch (595:21): [True: 0, False: 0]
  |  Branch (595:39): [True: 0, False: 0]
  ------------------
  596|      0|            }
  597|      0|        }
  598|      0|        const int use_ref = !hdr->error_resilient_mode &&
  ------------------
  |  Branch (598:29): [True: 0, False: 0]
  ------------------
  599|      0|                            hdr->frame_size_override;
  ------------------
  |  Branch (599:29): [True: 0, False: 0]
  ------------------
  600|      0|        if (read_frame_size(c, gb, use_ref) < 0) goto error;
  ------------------
  |  Branch (600:13): [True: 0, False: 0]
  ------------------
  601|      0|        if (!hdr->force_integer_mv)
  ------------------
  |  Branch (601:13): [True: 0, False: 0]
  ------------------
  602|      0|            hdr->hp = dav1d_get_bit(gb);
  603|      0|        hdr->subpel_filter_mode = dav1d_get_bit(gb) ? DAV1D_FILTER_SWITCHABLE :
  ------------------
  |  Branch (603:35): [True: 0, False: 0]
  ------------------
  604|      0|                                                      dav1d_get_bits(gb, 2);
  605|      0|        hdr->switchable_motion_mode = dav1d_get_bit(gb);
  606|      0|        if (!hdr->error_resilient_mode && seqhdr->ref_frame_mvs &&
  ------------------
  |  Branch (606:13): [True: 0, False: 0]
  |  Branch (606:43): [True: 0, False: 0]
  ------------------
  607|      0|            seqhdr->order_hint && IS_INTER_OR_SWITCH(hdr))
  ------------------
  |  |   36|      0|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (607:13): [True: 0, False: 0]
  ------------------
  608|      0|        {
  609|      0|            hdr->use_ref_frame_mvs = dav1d_get_bit(gb);
  610|      0|        }
  611|      0|    }
  612|       |#if DEBUG_FRAME_HDR
  613|       |    printf("HDR: post-frametype-specific-bits: off=%td\n",
  614|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  615|       |#endif
  616|       |
  617|      6|    if (!seqhdr->reduced_still_picture_header && !hdr->disable_cdf_update)
  ------------------
  |  Branch (617:9): [True: 0, False: 6]
  |  Branch (617:50): [True: 0, False: 0]
  ------------------
  618|      0|        hdr->refresh_context = !dav1d_get_bit(gb);
  619|       |#if DEBUG_FRAME_HDR
  620|       |    printf("HDR: post-refresh_context: off=%td\n",
  621|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  622|       |#endif
  623|       |
  624|       |    // tile data
  625|      6|    hdr->tiling.uniform = dav1d_get_bit(gb);
  626|      6|    const int sbsz_min1 = (64 << seqhdr->sb128) - 1;
  627|      6|    const int sbsz_log2 = 6 + seqhdr->sb128;
  628|      6|    const int sbw = (hdr->width[0] + sbsz_min1) >> sbsz_log2;
  629|      6|    const int sbh = (hdr->height + sbsz_min1) >> sbsz_log2;
  630|      6|    const int max_tile_width_sb = 4096 >> sbsz_log2;
  631|      6|    const int max_tile_area_sb = 4096 * 2304 >> (2 * sbsz_log2);
  632|      6|    hdr->tiling.min_log2_cols = tile_log2(max_tile_width_sb, sbw);
  633|      6|    hdr->tiling.max_log2_cols = tile_log2(1, imin(sbw, DAV1D_MAX_TILE_COLS));
  ------------------
  |  |   41|      6|#define DAV1D_MAX_TILE_COLS 64
  ------------------
  634|      6|    hdr->tiling.max_log2_rows = tile_log2(1, imin(sbh, DAV1D_MAX_TILE_ROWS));
  ------------------
  |  |   42|      6|#define DAV1D_MAX_TILE_ROWS 64
  ------------------
  635|      6|    const int min_log2_tiles = imax(tile_log2(max_tile_area_sb, sbw * sbh),
  636|      6|                              hdr->tiling.min_log2_cols);
  637|      6|    if (hdr->tiling.uniform) {
  ------------------
  |  Branch (637:9): [True: 6, False: 0]
  ------------------
  638|      6|        for (hdr->tiling.log2_cols = hdr->tiling.min_log2_cols;
  639|      6|             hdr->tiling.log2_cols < hdr->tiling.max_log2_cols && dav1d_get_bit(gb);
  ------------------
  |  Branch (639:14): [True: 6, False: 0]
  |  Branch (639:67): [True: 0, False: 6]
  ------------------
  640|      6|             hdr->tiling.log2_cols++) ;
  641|      6|        const int tile_w = 1 + ((sbw - 1) >> hdr->tiling.log2_cols);
  642|      6|        hdr->tiling.cols = 0;
  643|     12|        for (int sbx = 0; sbx < sbw; sbx += tile_w, hdr->tiling.cols++)
  ------------------
  |  Branch (643:27): [True: 6, False: 6]
  ------------------
  644|      6|            hdr->tiling.col_start_sb[hdr->tiling.cols] = sbx;
  645|      6|        hdr->tiling.min_log2_rows =
  646|      6|            imax(min_log2_tiles - hdr->tiling.log2_cols, 0);
  647|       |
  648|      6|        for (hdr->tiling.log2_rows = hdr->tiling.min_log2_rows;
  649|      6|             hdr->tiling.log2_rows < hdr->tiling.max_log2_rows && dav1d_get_bit(gb);
  ------------------
  |  Branch (649:14): [True: 6, False: 0]
  |  Branch (649:67): [True: 0, False: 6]
  ------------------
  650|      6|             hdr->tiling.log2_rows++) ;
  651|      6|        const int tile_h = 1 + ((sbh - 1) >> hdr->tiling.log2_rows);
  652|      6|        hdr->tiling.rows = 0;
  653|     12|        for (int sby = 0; sby < sbh; sby += tile_h, hdr->tiling.rows++)
  ------------------
  |  Branch (653:27): [True: 6, False: 6]
  ------------------
  654|      6|            hdr->tiling.row_start_sb[hdr->tiling.rows] = sby;
  655|      6|    } else {
  656|      0|        hdr->tiling.cols = 0;
  657|      0|        int widest_tile = 0, max_tile_area_sb = sbw * sbh;
  658|      0|        for (int sbx = 0; sbx < sbw && hdr->tiling.cols < DAV1D_MAX_TILE_COLS; hdr->tiling.cols++) {
  ------------------
  |  |   41|      0|#define DAV1D_MAX_TILE_COLS 64
  ------------------
  |  Branch (658:27): [True: 0, False: 0]
  |  Branch (658:40): [True: 0, False: 0]
  ------------------
  659|      0|            const int tile_width_sb = imin(sbw - sbx, max_tile_width_sb);
  660|      0|            const int tile_w = (tile_width_sb > 1) ? 1 + dav1d_get_uniform(gb, tile_width_sb) : 1;
  ------------------
  |  Branch (660:32): [True: 0, False: 0]
  ------------------
  661|      0|            hdr->tiling.col_start_sb[hdr->tiling.cols] = sbx;
  662|      0|            sbx += tile_w;
  663|      0|            widest_tile = imax(widest_tile, tile_w);
  664|      0|        }
  665|      0|        hdr->tiling.log2_cols = tile_log2(1, hdr->tiling.cols);
  666|      0|        if (min_log2_tiles) max_tile_area_sb >>= min_log2_tiles + 1;
  ------------------
  |  Branch (666:13): [True: 0, False: 0]
  ------------------
  667|      0|        const int max_tile_height_sb = imax(max_tile_area_sb / widest_tile, 1);
  668|       |
  669|      0|        hdr->tiling.rows = 0;
  670|      0|        for (int sby = 0; sby < sbh && hdr->tiling.rows < DAV1D_MAX_TILE_ROWS; hdr->tiling.rows++) {
  ------------------
  |  |   42|      0|#define DAV1D_MAX_TILE_ROWS 64
  ------------------
  |  Branch (670:27): [True: 0, False: 0]
  |  Branch (670:40): [True: 0, False: 0]
  ------------------
  671|      0|            const int tile_height_sb = imin(sbh - sby, max_tile_height_sb);
  672|      0|            const int tile_h = (tile_height_sb > 1) ? 1 + dav1d_get_uniform(gb, tile_height_sb) : 1;
  ------------------
  |  Branch (672:32): [True: 0, False: 0]
  ------------------
  673|      0|            hdr->tiling.row_start_sb[hdr->tiling.rows] = sby;
  674|      0|            sby += tile_h;
  675|      0|        }
  676|      0|        hdr->tiling.log2_rows = tile_log2(1, hdr->tiling.rows);
  677|      0|    }
  678|      6|    hdr->tiling.col_start_sb[hdr->tiling.cols] = sbw;
  679|      6|    hdr->tiling.row_start_sb[hdr->tiling.rows] = sbh;
  680|      6|    if (hdr->tiling.log2_cols || hdr->tiling.log2_rows) {
  ------------------
  |  Branch (680:9): [True: 0, False: 6]
  |  Branch (680:34): [True: 0, False: 6]
  ------------------
  681|      0|        hdr->tiling.update = dav1d_get_bits(gb, hdr->tiling.log2_cols + hdr->tiling.log2_rows);
  682|      0|        if (hdr->tiling.update >= hdr->tiling.cols * hdr->tiling.rows)
  ------------------
  |  Branch (682:13): [True: 0, False: 0]
  ------------------
  683|      0|            goto error;
  684|      0|        hdr->tiling.n_bytes = dav1d_get_bits(gb, 2) + 1;
  685|      0|    }
  686|       |#if DEBUG_FRAME_HDR
  687|       |    printf("HDR: post-tiling: off=%td\n",
  688|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  689|       |#endif
  690|       |
  691|       |    // quant data
  692|      6|    hdr->quant.yac = dav1d_get_bits(gb, 8);
  693|      6|    if (dav1d_get_bit(gb))
  ------------------
  |  Branch (693:9): [True: 3, False: 3]
  ------------------
  694|      3|        hdr->quant.ydc_delta = dav1d_get_sbits(gb, 7);
  695|      6|    if (!seqhdr->monochrome) {
  ------------------
  |  Branch (695:9): [True: 6, False: 0]
  ------------------
  696|       |        // If the sequence header says that delta_q might be different
  697|       |        // for U, V, we must check whether it actually is for this
  698|       |        // frame.
  699|      6|        const int diff_uv_delta = seqhdr->separate_uv_delta_q ? dav1d_get_bit(gb) : 0;
  ------------------
  |  Branch (699:35): [True: 0, False: 6]
  ------------------
  700|      6|        if (dav1d_get_bit(gb))
  ------------------
  |  Branch (700:13): [True: 3, False: 3]
  ------------------
  701|      3|            hdr->quant.udc_delta = dav1d_get_sbits(gb, 7);
  702|      6|        if (dav1d_get_bit(gb))
  ------------------
  |  Branch (702:13): [True: 3, False: 3]
  ------------------
  703|      3|            hdr->quant.uac_delta = dav1d_get_sbits(gb, 7);
  704|      6|        if (diff_uv_delta) {
  ------------------
  |  Branch (704:13): [True: 0, False: 6]
  ------------------
  705|      0|            if (dav1d_get_bit(gb))
  ------------------
  |  Branch (705:17): [True: 0, False: 0]
  ------------------
  706|      0|                hdr->quant.vdc_delta = dav1d_get_sbits(gb, 7);
  707|      0|            if (dav1d_get_bit(gb))
  ------------------
  |  Branch (707:17): [True: 0, False: 0]
  ------------------
  708|      0|                hdr->quant.vac_delta = dav1d_get_sbits(gb, 7);
  709|      6|        } else {
  710|      6|            hdr->quant.vdc_delta = hdr->quant.udc_delta;
  711|      6|            hdr->quant.vac_delta = hdr->quant.uac_delta;
  712|      6|        }
  713|      6|    }
  714|       |#if DEBUG_FRAME_HDR
  715|       |    printf("HDR: post-quant: off=%td\n",
  716|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  717|       |#endif
  718|      6|    hdr->quant.qm = dav1d_get_bit(gb);
  719|      6|    if (hdr->quant.qm) {
  ------------------
  |  Branch (719:9): [True: 3, False: 3]
  ------------------
  720|      3|        hdr->quant.qm_y = dav1d_get_bits(gb, 4);
  721|      3|        hdr->quant.qm_u = dav1d_get_bits(gb, 4);
  722|      3|        hdr->quant.qm_v = seqhdr->separate_uv_delta_q ? dav1d_get_bits(gb, 4) :
  ------------------
  |  Branch (722:27): [True: 0, False: 3]
  ------------------
  723|      3|                                                        hdr->quant.qm_u;
  724|      3|    }
  725|       |#if DEBUG_FRAME_HDR
  726|       |    printf("HDR: post-qm: off=%td\n",
  727|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  728|       |#endif
  729|       |
  730|       |    // segmentation data
  731|      6|    hdr->segmentation.enabled = dav1d_get_bit(gb);
  732|      6|    if (hdr->segmentation.enabled) {
  ------------------
  |  Branch (732:9): [True: 3, False: 3]
  ------------------
  733|      3|        if (hdr->primary_ref_frame == DAV1D_PRIMARY_REF_NONE) {
  ------------------
  |  |   45|      3|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  |  Branch (733:13): [True: 3, False: 0]
  ------------------
  734|      3|            hdr->segmentation.update_map = 1;
  735|      3|            hdr->segmentation.update_data = 1;
  736|      3|        } else {
  737|      0|            hdr->segmentation.update_map = dav1d_get_bit(gb);
  738|      0|            if (hdr->segmentation.update_map)
  ------------------
  |  Branch (738:17): [True: 0, False: 0]
  ------------------
  739|      0|                hdr->segmentation.temporal = dav1d_get_bit(gb);
  740|      0|            hdr->segmentation.update_data = dav1d_get_bit(gb);
  741|      0|        }
  742|       |
  743|      3|        if (hdr->segmentation.update_data) {
  ------------------
  |  Branch (743:13): [True: 3, False: 0]
  ------------------
  744|      3|            hdr->segmentation.seg_data.last_active_segid = -1;
  745|     27|            for (int i = 0; i < DAV1D_MAX_SEGMENTS; i++) {
  ------------------
  |  |   43|     27|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  |  Branch (745:29): [True: 24, False: 3]
  ------------------
  746|     24|                Dav1dSegmentationData *const seg =
  747|     24|                    &hdr->segmentation.seg_data.d[i];
  748|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (748:21): [True: 15, False: 9]
  ------------------
  749|     15|                    seg->delta_q = dav1d_get_sbits(gb, 9);
  750|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  751|     15|                }
  752|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (752:21): [True: 18, False: 6]
  ------------------
  753|     18|                    seg->delta_lf_y_v = dav1d_get_sbits(gb, 7);
  754|     18|                    hdr->segmentation.seg_data.last_active_segid = i;
  755|     18|                }
  756|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (756:21): [True: 15, False: 9]
  ------------------
  757|     15|                    seg->delta_lf_y_h = dav1d_get_sbits(gb, 7);
  758|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  759|     15|                }
  760|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (760:21): [True: 15, False: 9]
  ------------------
  761|     15|                    seg->delta_lf_u = dav1d_get_sbits(gb, 7);
  762|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  763|     15|                }
  764|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (764:21): [True: 15, False: 9]
  ------------------
  765|     15|                    seg->delta_lf_v = dav1d_get_sbits(gb, 7);
  766|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  767|     15|                }
  768|     24|                if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (768:21): [True: 15, False: 9]
  ------------------
  769|     15|                    seg->ref = dav1d_get_bits(gb, 3);
  770|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  771|     15|                    hdr->segmentation.seg_data.preskip = 1;
  772|     15|                } else {
  773|      9|                    seg->ref = -1;
  774|      9|                }
  775|     24|                if ((seg->skip = dav1d_get_bit(gb))) {
  ------------------
  |  Branch (775:21): [True: 0, False: 24]
  ------------------
  776|      0|                    hdr->segmentation.seg_data.last_active_segid = i;
  777|      0|                    hdr->segmentation.seg_data.preskip = 1;
  778|      0|                }
  779|     24|                if ((seg->globalmv = dav1d_get_bit(gb))) {
  ------------------
  |  Branch (779:21): [True: 15, False: 9]
  ------------------
  780|     15|                    hdr->segmentation.seg_data.last_active_segid = i;
  781|     15|                    hdr->segmentation.seg_data.preskip = 1;
  782|     15|                }
  783|     24|            }
  784|      3|        } else {
  785|       |            // segmentation.update_data was false so we should copy
  786|       |            // segmentation data from the reference frame.
  787|      0|            assert(hdr->primary_ref_frame != DAV1D_PRIMARY_REF_NONE);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  788|      0|            const int pri_ref = hdr->refidx[hdr->primary_ref_frame];
  789|      0|            if (!c->refs[pri_ref].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (789:17): [True: 0, False: 0]
  ------------------
  790|      0|            hdr->segmentation.seg_data =
  791|      0|                c->refs[pri_ref].p.p.frame_hdr->segmentation.seg_data;
  792|      0|        }
  793|      3|    } else {
  794|     27|        for (int i = 0; i < DAV1D_MAX_SEGMENTS; i++)
  ------------------
  |  |   43|     27|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  |  Branch (794:25): [True: 24, False: 3]
  ------------------
  795|     24|            hdr->segmentation.seg_data.d[i].ref = -1;
  796|      3|    }
  797|       |#if DEBUG_FRAME_HDR
  798|       |    printf("HDR: post-segmentation: off=%td\n",
  799|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  800|       |#endif
  801|       |
  802|       |    // delta q
  803|      6|    if (hdr->quant.yac) {
  ------------------
  |  Branch (803:9): [True: 6, False: 0]
  ------------------
  804|      6|        hdr->delta.q.present = dav1d_get_bit(gb);
  805|      6|        if (hdr->delta.q.present) {
  ------------------
  |  Branch (805:13): [True: 0, False: 6]
  ------------------
  806|      0|            hdr->delta.q.res_log2 = dav1d_get_bits(gb, 2);
  807|      0|            if (!hdr->allow_intrabc) {
  ------------------
  |  Branch (807:17): [True: 0, False: 0]
  ------------------
  808|      0|                hdr->delta.lf.present = dav1d_get_bit(gb);
  809|      0|                if (hdr->delta.lf.present) {
  ------------------
  |  Branch (809:21): [True: 0, False: 0]
  ------------------
  810|      0|                    hdr->delta.lf.res_log2 = dav1d_get_bits(gb, 2);
  811|      0|                    hdr->delta.lf.multi = dav1d_get_bit(gb);
  812|      0|                }
  813|      0|            }
  814|      0|        }
  815|      6|    }
  816|       |#if DEBUG_FRAME_HDR
  817|       |    printf("HDR: post-delta_q_lf_flags: off=%td\n",
  818|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  819|       |#endif
  820|       |
  821|       |    // derive lossless flags
  822|      6|    const int delta_lossless = !hdr->quant.ydc_delta && !hdr->quant.udc_delta &&
  ------------------
  |  Branch (822:32): [True: 3, False: 3]
  |  Branch (822:57): [True: 3, False: 0]
  ------------------
  823|      3|        !hdr->quant.uac_delta && !hdr->quant.vdc_delta && !hdr->quant.vac_delta;
  ------------------
  |  Branch (823:9): [True: 3, False: 0]
  |  Branch (823:34): [True: 3, False: 0]
  |  Branch (823:59): [True: 3, False: 0]
  ------------------
  824|      6|    hdr->all_lossless = 1;
  825|     54|    for (int i = 0; i < DAV1D_MAX_SEGMENTS; i++) {
  ------------------
  |  |   43|     54|#define DAV1D_MAX_SEGMENTS 8
  ------------------
  |  Branch (825:21): [True: 48, False: 6]
  ------------------
  826|     48|        hdr->segmentation.qidx[i] = hdr->segmentation.enabled ?
  ------------------
  |  Branch (826:37): [True: 24, False: 24]
  ------------------
  827|     24|            iclip_u8(hdr->quant.yac + hdr->segmentation.seg_data.d[i].delta_q) :
  828|     48|            hdr->quant.yac;
  829|     48|        hdr->segmentation.lossless[i] =
  830|     48|            !hdr->segmentation.qidx[i] && delta_lossless;
  ------------------
  |  Branch (830:13): [True: 0, False: 48]
  |  Branch (830:43): [True: 0, False: 0]
  ------------------
  831|     48|        hdr->all_lossless &= hdr->segmentation.lossless[i];
  832|     48|    }
  833|       |
  834|       |    // loopfilter
  835|      6|    if (hdr->all_lossless || hdr->allow_intrabc) {
  ------------------
  |  Branch (835:9): [True: 0, False: 6]
  |  Branch (835:30): [True: 6, False: 0]
  ------------------
  836|      6|        hdr->loopfilter.mode_ref_delta_enabled = 1;
  837|      6|        hdr->loopfilter.mode_ref_delta_update = 1;
  838|      6|        hdr->loopfilter.mode_ref_deltas = default_mode_ref_deltas;
  839|      6|    } else {
  840|      0|        hdr->loopfilter.level_y[0] = dav1d_get_bits(gb, 6);
  841|      0|        hdr->loopfilter.level_y[1] = dav1d_get_bits(gb, 6);
  842|      0|        if (!seqhdr->monochrome &&
  ------------------
  |  Branch (842:13): [True: 0, False: 0]
  ------------------
  843|      0|            (hdr->loopfilter.level_y[0] || hdr->loopfilter.level_y[1]))
  ------------------
  |  Branch (843:14): [True: 0, False: 0]
  |  Branch (843:44): [True: 0, False: 0]
  ------------------
  844|      0|        {
  845|      0|            hdr->loopfilter.level_u = dav1d_get_bits(gb, 6);
  846|      0|            hdr->loopfilter.level_v = dav1d_get_bits(gb, 6);
  847|      0|        }
  848|      0|        hdr->loopfilter.sharpness = dav1d_get_bits(gb, 3);
  849|       |
  850|      0|        if (hdr->primary_ref_frame == DAV1D_PRIMARY_REF_NONE) {
  ------------------
  |  |   45|      0|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  |  Branch (850:13): [True: 0, False: 0]
  ------------------
  851|      0|            hdr->loopfilter.mode_ref_deltas = default_mode_ref_deltas;
  852|      0|        } else {
  853|      0|            const int ref = hdr->refidx[hdr->primary_ref_frame];
  854|      0|            if (!c->refs[ref].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (854:17): [True: 0, False: 0]
  ------------------
  855|      0|            hdr->loopfilter.mode_ref_deltas =
  856|      0|                c->refs[ref].p.p.frame_hdr->loopfilter.mode_ref_deltas;
  857|      0|        }
  858|      0|        hdr->loopfilter.mode_ref_delta_enabled = dav1d_get_bit(gb);
  859|      0|        if (hdr->loopfilter.mode_ref_delta_enabled) {
  ------------------
  |  Branch (859:13): [True: 0, False: 0]
  ------------------
  860|      0|            hdr->loopfilter.mode_ref_delta_update = dav1d_get_bit(gb);
  861|      0|            if (hdr->loopfilter.mode_ref_delta_update) {
  ------------------
  |  Branch (861:17): [True: 0, False: 0]
  ------------------
  862|      0|                for (int i = 0; i < 8; i++)
  ------------------
  |  Branch (862:33): [True: 0, False: 0]
  ------------------
  863|      0|                    if (dav1d_get_bit(gb))
  ------------------
  |  Branch (863:25): [True: 0, False: 0]
  ------------------
  864|      0|                        hdr->loopfilter.mode_ref_deltas.ref_delta[i] =
  865|      0|                            dav1d_get_sbits(gb, 7);
  866|      0|                for (int i = 0; i < 2; i++)
  ------------------
  |  Branch (866:33): [True: 0, False: 0]
  ------------------
  867|      0|                    if (dav1d_get_bit(gb))
  ------------------
  |  Branch (867:25): [True: 0, False: 0]
  ------------------
  868|      0|                        hdr->loopfilter.mode_ref_deltas.mode_delta[i] =
  869|      0|                            dav1d_get_sbits(gb, 7);
  870|      0|            }
  871|      0|        }
  872|      0|    }
  873|       |#if DEBUG_FRAME_HDR
  874|       |    printf("HDR: post-lpf: off=%td\n",
  875|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  876|       |#endif
  877|       |
  878|       |    // cdef
  879|      6|    if (!hdr->all_lossless && seqhdr->cdef && !hdr->allow_intrabc) {
  ------------------
  |  Branch (879:9): [True: 6, False: 0]
  |  Branch (879:31): [True: 6, False: 0]
  |  Branch (879:47): [True: 0, False: 6]
  ------------------
  880|      0|        hdr->cdef.damping = dav1d_get_bits(gb, 2) + 3;
  881|      0|        hdr->cdef.n_bits = dav1d_get_bits(gb, 2);
  882|      0|        for (int i = 0; i < (1 << hdr->cdef.n_bits); i++) {
  ------------------
  |  Branch (882:25): [True: 0, False: 0]
  ------------------
  883|      0|            hdr->cdef.y_strength[i] = dav1d_get_bits(gb, 6);
  884|      0|            if (!seqhdr->monochrome)
  ------------------
  |  Branch (884:17): [True: 0, False: 0]
  ------------------
  885|      0|                hdr->cdef.uv_strength[i] = dav1d_get_bits(gb, 6);
  886|      0|        }
  887|      0|    }
  888|       |#if DEBUG_FRAME_HDR
  889|       |    printf("HDR: post-cdef: off=%td\n",
  890|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  891|       |#endif
  892|       |
  893|       |    // restoration
  894|      6|    if ((!hdr->all_lossless || hdr->super_res.enabled) &&
  ------------------
  |  Branch (894:10): [True: 6, False: 0]
  |  Branch (894:32): [True: 0, False: 0]
  ------------------
  895|      6|        seqhdr->restoration && !hdr->allow_intrabc)
  ------------------
  |  Branch (895:9): [True: 6, False: 0]
  |  Branch (895:32): [True: 0, False: 6]
  ------------------
  896|      0|    {
  897|      0|        hdr->restoration.type[0] = dav1d_get_bits(gb, 2);
  898|      0|        if (!seqhdr->monochrome) {
  ------------------
  |  Branch (898:13): [True: 0, False: 0]
  ------------------
  899|      0|            hdr->restoration.type[1] = dav1d_get_bits(gb, 2);
  900|      0|            hdr->restoration.type[2] = dav1d_get_bits(gb, 2);
  901|      0|        }
  902|       |
  903|      0|        if (hdr->restoration.type[0] || hdr->restoration.type[1] ||
  ------------------
  |  Branch (903:13): [True: 0, False: 0]
  |  Branch (903:41): [True: 0, False: 0]
  ------------------
  904|      0|            hdr->restoration.type[2])
  ------------------
  |  Branch (904:13): [True: 0, False: 0]
  ------------------
  905|      0|        {
  906|       |            // Log2 of the restoration unit size.
  907|      0|            hdr->restoration.unit_size[0] = 6 + seqhdr->sb128;
  908|      0|            if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (908:17): [True: 0, False: 0]
  ------------------
  909|      0|                hdr->restoration.unit_size[0]++;
  910|      0|                if (!seqhdr->sb128)
  ------------------
  |  Branch (910:21): [True: 0, False: 0]
  ------------------
  911|      0|                    hdr->restoration.unit_size[0] += dav1d_get_bit(gb);
  912|      0|            }
  913|      0|            hdr->restoration.unit_size[1] = hdr->restoration.unit_size[0];
  914|      0|            if ((hdr->restoration.type[1] || hdr->restoration.type[2]) &&
  ------------------
  |  Branch (914:18): [True: 0, False: 0]
  |  Branch (914:46): [True: 0, False: 0]
  ------------------
  915|      0|                seqhdr->ss_hor == 1 && seqhdr->ss_ver == 1)
  ------------------
  |  Branch (915:17): [True: 0, False: 0]
  |  Branch (915:40): [True: 0, False: 0]
  ------------------
  916|      0|            {
  917|      0|                hdr->restoration.unit_size[1] -= dav1d_get_bit(gb);
  918|      0|            }
  919|      0|        } else {
  920|      0|            hdr->restoration.unit_size[0] = 8;
  921|      0|        }
  922|      0|    }
  923|       |#if DEBUG_FRAME_HDR
  924|       |    printf("HDR: post-restoration: off=%td\n",
  925|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  926|       |#endif
  927|       |
  928|      6|    if (!hdr->all_lossless)
  ------------------
  |  Branch (928:9): [True: 6, False: 0]
  ------------------
  929|      6|        hdr->txfm_mode = dav1d_get_bit(gb) ? DAV1D_TX_SWITCHABLE : DAV1D_TX_LARGEST;
  ------------------
  |  Branch (929:26): [True: 3, False: 3]
  ------------------
  930|       |#if DEBUG_FRAME_HDR
  931|       |    printf("HDR: post-txfmmode: off=%td\n",
  932|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  933|       |#endif
  934|      6|    if (IS_INTER_OR_SWITCH(hdr))
  ------------------
  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 6]
  |  |  ------------------
  ------------------
  935|      0|        hdr->switchable_comp_refs = dav1d_get_bit(gb);
  936|       |#if DEBUG_FRAME_HDR
  937|       |    printf("HDR: post-refmode: off=%td\n",
  938|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  939|       |#endif
  940|      6|    if (hdr->switchable_comp_refs && IS_INTER_OR_SWITCH(hdr) && seqhdr->order_hint) {
  ------------------
  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (940:9): [True: 0, False: 6]
  |  Branch (940:65): [True: 0, False: 0]
  ------------------
  941|      0|        const int poc = hdr->frame_offset;
  942|      0|        int off_before = -1, off_after = -1;
  943|      0|        int off_before_idx, off_after_idx;
  944|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (944:25): [True: 0, False: 0]
  ------------------
  945|      0|            if (!c->refs[hdr->refidx[i]].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (945:17): [True: 0, False: 0]
  ------------------
  946|      0|            const int refpoc = c->refs[hdr->refidx[i]].p.p.frame_hdr->frame_offset;
  947|       |
  948|      0|            const int diff = get_poc_diff(seqhdr->order_hint_n_bits, refpoc, poc);
  949|      0|            if (diff > 0) {
  ------------------
  |  Branch (949:17): [True: 0, False: 0]
  ------------------
  950|      0|                if (off_after < 0 || get_poc_diff(seqhdr->order_hint_n_bits,
  ------------------
  |  Branch (950:21): [True: 0, False: 0]
  |  Branch (950:38): [True: 0, False: 0]
  ------------------
  951|      0|                                                  off_after, refpoc) > 0)
  952|      0|                {
  953|      0|                    off_after = refpoc;
  954|      0|                    off_after_idx = i;
  955|      0|                }
  956|      0|            } else if (diff < 0 && (off_before < 0 ||
  ------------------
  |  Branch (956:24): [True: 0, False: 0]
  |  Branch (956:37): [True: 0, False: 0]
  ------------------
  957|      0|                                    get_poc_diff(seqhdr->order_hint_n_bits,
  ------------------
  |  Branch (957:37): [True: 0, False: 0]
  ------------------
  958|      0|                                                 refpoc, off_before) > 0))
  959|      0|            {
  960|      0|                off_before = refpoc;
  961|      0|                off_before_idx = i;
  962|      0|            }
  963|      0|        }
  964|       |
  965|      0|        if ((off_before | off_after) >= 0) {
  ------------------
  |  Branch (965:13): [True: 0, False: 0]
  ------------------
  966|      0|            hdr->skip_mode_refs[0] = imin(off_before_idx, off_after_idx);
  967|      0|            hdr->skip_mode_refs[1] = imax(off_before_idx, off_after_idx);
  968|      0|            hdr->skip_mode_allowed = 1;
  969|      0|        } else if (off_before >= 0) {
  ------------------
  |  Branch (969:20): [True: 0, False: 0]
  ------------------
  970|      0|            int off_before2 = -1;
  971|      0|            int off_before2_idx;
  972|      0|            for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (972:29): [True: 0, False: 0]
  ------------------
  973|      0|                if (!c->refs[hdr->refidx[i]].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (973:21): [True: 0, False: 0]
  ------------------
  974|      0|                const int refpoc = c->refs[hdr->refidx[i]].p.p.frame_hdr->frame_offset;
  975|      0|                if (get_poc_diff(seqhdr->order_hint_n_bits,
  ------------------
  |  Branch (975:21): [True: 0, False: 0]
  ------------------
  976|      0|                                 refpoc, off_before) < 0) {
  977|      0|                    if (off_before2 < 0 || get_poc_diff(seqhdr->order_hint_n_bits,
  ------------------
  |  Branch (977:25): [True: 0, False: 0]
  |  Branch (977:44): [True: 0, False: 0]
  ------------------
  978|      0|                                                        refpoc, off_before2) > 0)
  979|      0|                    {
  980|      0|                        off_before2 = refpoc;
  981|      0|                        off_before2_idx = i;
  982|      0|                    }
  983|      0|                }
  984|      0|            }
  985|       |
  986|      0|            if (off_before2 >= 0) {
  ------------------
  |  Branch (986:17): [True: 0, False: 0]
  ------------------
  987|      0|                hdr->skip_mode_refs[0] = imin(off_before_idx, off_before2_idx);
  988|      0|                hdr->skip_mode_refs[1] = imax(off_before_idx, off_before2_idx);
  989|      0|                hdr->skip_mode_allowed = 1;
  990|      0|            }
  991|      0|        }
  992|      0|    }
  993|      6|    if (hdr->skip_mode_allowed)
  ------------------
  |  Branch (993:9): [True: 0, False: 6]
  ------------------
  994|      0|        hdr->skip_mode_enabled = dav1d_get_bit(gb);
  995|       |#if DEBUG_FRAME_HDR
  996|       |    printf("HDR: post-extskip: off=%td\n",
  997|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
  998|       |#endif
  999|      6|    if (!hdr->error_resilient_mode && IS_INTER_OR_SWITCH(hdr) && seqhdr->warped_motion)
  ------------------
  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (999:9): [True: 0, False: 6]
  |  Branch (999:66): [True: 0, False: 0]
  ------------------
 1000|      0|        hdr->warp_motion = dav1d_get_bit(gb);
 1001|       |#if DEBUG_FRAME_HDR
 1002|       |    printf("HDR: post-warpmotionbit: off=%td\n",
 1003|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
 1004|       |#endif
 1005|      6|    hdr->reduced_txtp_set = dav1d_get_bit(gb);
 1006|       |#if DEBUG_FRAME_HDR
 1007|       |    printf("HDR: post-reducedtxtpset: off=%td\n",
 1008|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
 1009|       |#endif
 1010|       |
 1011|     48|    for (int i = 0; i < 7; i++)
  ------------------
  |  Branch (1011:21): [True: 42, False: 6]
  ------------------
 1012|     42|        hdr->gmv[i] = dav1d_default_wm_params;
 1013|       |
 1014|      6|    if (IS_INTER_OR_SWITCH(hdr)) {
  ------------------
  |  |   36|      6|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (36:5): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1015|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (1015:25): [True: 0, False: 0]
  ------------------
 1016|      0|            hdr->gmv[i].type = !dav1d_get_bit(gb) ? DAV1D_WM_TYPE_IDENTITY :
  ------------------
  |  Branch (1016:32): [True: 0, False: 0]
  ------------------
 1017|      0|                                dav1d_get_bit(gb) ? DAV1D_WM_TYPE_ROT_ZOOM :
  ------------------
  |  Branch (1017:33): [True: 0, False: 0]
  ------------------
 1018|      0|                                dav1d_get_bit(gb) ? DAV1D_WM_TYPE_TRANSLATION :
  ------------------
  |  Branch (1018:33): [True: 0, False: 0]
  ------------------
 1019|      0|                                                    DAV1D_WM_TYPE_AFFINE;
 1020|       |
 1021|      0|            if (hdr->gmv[i].type == DAV1D_WM_TYPE_IDENTITY) continue;
  ------------------
  |  Branch (1021:17): [True: 0, False: 0]
  ------------------
 1022|       |
 1023|      0|            const Dav1dWarpedMotionParams *ref_gmv;
 1024|      0|            if (hdr->primary_ref_frame == DAV1D_PRIMARY_REF_NONE) {
  ------------------
  |  |   45|      0|#define DAV1D_PRIMARY_REF_NONE 7
  ------------------
  |  Branch (1024:17): [True: 0, False: 0]
  ------------------
 1025|      0|                ref_gmv = &dav1d_default_wm_params;
 1026|      0|            } else {
 1027|      0|                const int pri_ref = hdr->refidx[hdr->primary_ref_frame];
 1028|      0|                if (!c->refs[pri_ref].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (1028:21): [True: 0, False: 0]
  ------------------
 1029|      0|                ref_gmv = &c->refs[pri_ref].p.p.frame_hdr->gmv[i];
 1030|      0|            }
 1031|      0|            int32_t *const mat = hdr->gmv[i].matrix;
 1032|      0|            const int32_t *const ref_mat = ref_gmv->matrix;
 1033|      0|            int bits, shift;
 1034|       |
 1035|      0|            if (hdr->gmv[i].type >= DAV1D_WM_TYPE_ROT_ZOOM) {
  ------------------
  |  Branch (1035:17): [True: 0, False: 0]
  ------------------
 1036|      0|                mat[2] = (1 << 16) + 2 *
 1037|      0|                    dav1d_get_bits_subexp(gb, (ref_mat[2] - (1 << 16)) >> 1, 12);
 1038|      0|                mat[3] = 2 * dav1d_get_bits_subexp(gb, ref_mat[3] >> 1, 12);
 1039|       |
 1040|      0|                bits = 12;
 1041|      0|                shift = 10;
 1042|      0|            } else {
 1043|      0|                bits = 9 - !hdr->hp;
 1044|      0|                shift = 13 + !hdr->hp;
 1045|      0|            }
 1046|       |
 1047|      0|            if (hdr->gmv[i].type == DAV1D_WM_TYPE_AFFINE) {
  ------------------
  |  Branch (1047:17): [True: 0, False: 0]
  ------------------
 1048|      0|                mat[4] = 2 * dav1d_get_bits_subexp(gb, ref_mat[4] >> 1, 12);
 1049|      0|                mat[5] = (1 << 16) + 2 *
 1050|      0|                    dav1d_get_bits_subexp(gb, (ref_mat[5] - (1 << 16)) >> 1, 12);
 1051|      0|            } else {
 1052|      0|                mat[4] = -mat[3];
 1053|      0|                mat[5] = mat[2];
 1054|      0|            }
 1055|       |
 1056|      0|            mat[0] = dav1d_get_bits_subexp(gb, ref_mat[0] >> shift, bits) * (1 << shift);
 1057|      0|            mat[1] = dav1d_get_bits_subexp(gb, ref_mat[1] >> shift, bits) * (1 << shift);
 1058|      0|        }
 1059|      0|    }
 1060|       |#if DEBUG_FRAME_HDR
 1061|       |    printf("HDR: post-gmv: off=%td\n",
 1062|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
 1063|       |#endif
 1064|       |
 1065|      6|    if (seqhdr->film_grain_present && (hdr->show_frame || hdr->showable_frame)) {
  ------------------
  |  Branch (1065:9): [True: 0, False: 6]
  |  Branch (1065:40): [True: 0, False: 0]
  |  Branch (1065:59): [True: 0, False: 0]
  ------------------
 1066|      0|        hdr->film_grain.present = dav1d_get_bit(gb);
 1067|      0|        if (hdr->film_grain.present) {
  ------------------
  |  Branch (1067:13): [True: 0, False: 0]
  ------------------
 1068|      0|            const unsigned seed = dav1d_get_bits(gb, 16);
 1069|      0|            hdr->film_grain.update = hdr->frame_type != DAV1D_FRAME_TYPE_INTER || dav1d_get_bit(gb);
  ------------------
  |  Branch (1069:38): [True: 0, False: 0]
  |  Branch (1069:83): [True: 0, False: 0]
  ------------------
 1070|      0|            if (!hdr->film_grain.update) {
  ------------------
  |  Branch (1070:17): [True: 0, False: 0]
  ------------------
 1071|      0|                const int refidx = dav1d_get_bits(gb, 3);
 1072|      0|                int i;
 1073|      0|                for (i = 0; i < 7; i++)
  ------------------
  |  Branch (1073:29): [True: 0, False: 0]
  ------------------
 1074|      0|                    if (hdr->refidx[i] == refidx)
  ------------------
  |  Branch (1074:25): [True: 0, False: 0]
  ------------------
 1075|      0|                        break;
 1076|      0|                if (i == 7 || !c->refs[refidx].p.p.frame_hdr) goto error;
  ------------------
  |  Branch (1076:21): [True: 0, False: 0]
  |  Branch (1076:31): [True: 0, False: 0]
  ------------------
 1077|      0|                hdr->film_grain.data = c->refs[refidx].p.p.frame_hdr->film_grain.data;
 1078|      0|                hdr->film_grain.data.seed = seed;
 1079|      0|            } else {
 1080|      0|                Dav1dFilmGrainData *const fgd = &hdr->film_grain.data;
 1081|      0|                fgd->seed = seed;
 1082|       |
 1083|      0|                fgd->num_y_points = dav1d_get_bits(gb, 4);
 1084|      0|                if (fgd->num_y_points > 14) goto error;
  ------------------
  |  Branch (1084:21): [True: 0, False: 0]
  ------------------
 1085|      0|                for (int i = 0; i < fgd->num_y_points; i++) {
  ------------------
  |  Branch (1085:33): [True: 0, False: 0]
  ------------------
 1086|      0|                    fgd->y_points[i][0] = dav1d_get_bits(gb, 8);
 1087|      0|                    if (i && fgd->y_points[i - 1][0] >= fgd->y_points[i][0])
  ------------------
  |  Branch (1087:25): [True: 0, False: 0]
  |  Branch (1087:30): [True: 0, False: 0]
  ------------------
 1088|      0|                        goto error;
 1089|      0|                    fgd->y_points[i][1] = dav1d_get_bits(gb, 8);
 1090|      0|                }
 1091|       |
 1092|      0|                if (!seqhdr->monochrome)
  ------------------
  |  Branch (1092:21): [True: 0, False: 0]
  ------------------
 1093|      0|                    fgd->chroma_scaling_from_luma = dav1d_get_bit(gb);
 1094|      0|                if (seqhdr->monochrome || fgd->chroma_scaling_from_luma ||
  ------------------
  |  Branch (1094:21): [True: 0, False: 0]
  |  Branch (1094:43): [True: 0, False: 0]
  ------------------
 1095|      0|                    (seqhdr->ss_ver == 1 && seqhdr->ss_hor == 1 && !fgd->num_y_points))
  ------------------
  |  Branch (1095:22): [True: 0, False: 0]
  |  Branch (1095:45): [True: 0, False: 0]
  |  Branch (1095:68): [True: 0, False: 0]
  ------------------
 1096|      0|                {
 1097|      0|                    fgd->num_uv_points[0] = fgd->num_uv_points[1] = 0;
 1098|      0|                } else for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1098:41): [True: 0, False: 0]
  ------------------
 1099|      0|                    fgd->num_uv_points[pl] = dav1d_get_bits(gb, 4);
 1100|      0|                    if (fgd->num_uv_points[pl] > 10) goto error;
  ------------------
  |  Branch (1100:25): [True: 0, False: 0]
  ------------------
 1101|      0|                    for (int i = 0; i < fgd->num_uv_points[pl]; i++) {
  ------------------
  |  Branch (1101:37): [True: 0, False: 0]
  ------------------
 1102|      0|                        fgd->uv_points[pl][i][0] = dav1d_get_bits(gb, 8);
 1103|      0|                        if (i && fgd->uv_points[pl][i - 1][0] >= fgd->uv_points[pl][i][0])
  ------------------
  |  Branch (1103:29): [True: 0, False: 0]
  |  Branch (1103:34): [True: 0, False: 0]
  ------------------
 1104|      0|                            goto error;
 1105|      0|                        fgd->uv_points[pl][i][1] = dav1d_get_bits(gb, 8);
 1106|      0|                    }
 1107|      0|                }
 1108|       |
 1109|      0|                if (seqhdr->ss_hor == 1 && seqhdr->ss_ver == 1 &&
  ------------------
  |  Branch (1109:21): [True: 0, False: 0]
  |  Branch (1109:44): [True: 0, False: 0]
  ------------------
 1110|      0|                    !!fgd->num_uv_points[0] != !!fgd->num_uv_points[1])
  ------------------
  |  Branch (1110:21): [True: 0, False: 0]
  ------------------
 1111|      0|                {
 1112|      0|                    goto error;
 1113|      0|                }
 1114|       |
 1115|      0|                fgd->scaling_shift = dav1d_get_bits(gb, 2) + 8;
 1116|      0|                fgd->ar_coeff_lag = dav1d_get_bits(gb, 2);
 1117|      0|                const int num_y_pos = 2 * fgd->ar_coeff_lag * (fgd->ar_coeff_lag + 1);
 1118|      0|                if (fgd->num_y_points)
  ------------------
  |  Branch (1118:21): [True: 0, False: 0]
  ------------------
 1119|      0|                    for (int i = 0; i < num_y_pos; i++)
  ------------------
  |  Branch (1119:37): [True: 0, False: 0]
  ------------------
 1120|      0|                        fgd->ar_coeffs_y[i] = dav1d_get_bits(gb, 8) - 128;
 1121|      0|                for (int pl = 0; pl < 2; pl++)
  ------------------
  |  Branch (1121:34): [True: 0, False: 0]
  ------------------
 1122|      0|                    if (fgd->num_uv_points[pl] || fgd->chroma_scaling_from_luma) {
  ------------------
  |  Branch (1122:25): [True: 0, False: 0]
  |  Branch (1122:51): [True: 0, False: 0]
  ------------------
 1123|      0|                        const int num_uv_pos = num_y_pos + !!fgd->num_y_points;
 1124|      0|                        for (int i = 0; i < num_uv_pos; i++)
  ------------------
  |  Branch (1124:41): [True: 0, False: 0]
  ------------------
 1125|      0|                            fgd->ar_coeffs_uv[pl][i] = dav1d_get_bits(gb, 8) - 128;
 1126|      0|                        if (!fgd->num_y_points)
  ------------------
  |  Branch (1126:29): [True: 0, False: 0]
  ------------------
 1127|      0|                            fgd->ar_coeffs_uv[pl][num_uv_pos] = 0;
 1128|      0|                    }
 1129|      0|                fgd->ar_coeff_shift = dav1d_get_bits(gb, 2) + 6;
 1130|      0|                fgd->grain_scale_shift = dav1d_get_bits(gb, 2);
 1131|      0|                for (int pl = 0; pl < 2; pl++)
  ------------------
  |  Branch (1131:34): [True: 0, False: 0]
  ------------------
 1132|      0|                    if (fgd->num_uv_points[pl]) {
  ------------------
  |  Branch (1132:25): [True: 0, False: 0]
  ------------------
 1133|      0|                        fgd->uv_mult[pl] = dav1d_get_bits(gb, 8) - 128;
 1134|      0|                        fgd->uv_luma_mult[pl] = dav1d_get_bits(gb, 8) - 128;
 1135|      0|                        fgd->uv_offset[pl] = dav1d_get_bits(gb, 9) - 256;
 1136|      0|                    }
 1137|      0|                fgd->overlap_flag = dav1d_get_bit(gb);
 1138|      0|                fgd->clip_to_restricted_range = dav1d_get_bit(gb);
 1139|      0|            }
 1140|      0|        }
 1141|      0|    }
 1142|       |#if DEBUG_FRAME_HDR
 1143|       |    printf("HDR: post-filmgrain: off=%td\n",
 1144|       |           (gb->ptr - init_ptr) * 8 - gb->bits_left);
 1145|       |#endif
 1146|       |
 1147|      6|    return 0;
 1148|       |
 1149|      0|error:
 1150|      0|    dav1d_log(c, "Error parsing frame header\n");
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
 1151|      0|    return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
 1152|      6|}
obu.c:read_frame_size:
  343|      6|{
  344|      6|    const Dav1dSequenceHeader *const seqhdr = c->seq_hdr;
  345|      6|    Dav1dFrameHeader *const hdr = c->frame_hdr;
  346|       |
  347|      6|    if (use_ref) {
  ------------------
  |  Branch (347:9): [True: 0, False: 6]
  ------------------
  348|      0|        for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (348:25): [True: 0, False: 0]
  ------------------
  349|      0|            if (dav1d_get_bit(gb)) {
  ------------------
  |  Branch (349:17): [True: 0, False: 0]
  ------------------
  350|      0|                const Dav1dThreadPicture *const ref =
  351|      0|                    &c->refs[c->frame_hdr->refidx[i]].p;
  352|      0|                if (!ref->p.frame_hdr) return -1;
  ------------------
  |  Branch (352:21): [True: 0, False: 0]
  ------------------
  353|      0|                hdr->width[1] = ref->p.frame_hdr->width[1];
  354|      0|                hdr->height = ref->p.frame_hdr->height;
  355|      0|                hdr->render_width = ref->p.frame_hdr->render_width;
  356|      0|                hdr->render_height = ref->p.frame_hdr->render_height;
  357|      0|                hdr->super_res.enabled = seqhdr->super_res && dav1d_get_bit(gb);
  ------------------
  |  Branch (357:42): [True: 0, False: 0]
  |  Branch (357:63): [True: 0, False: 0]
  ------------------
  358|      0|                if (hdr->super_res.enabled) {
  ------------------
  |  Branch (358:21): [True: 0, False: 0]
  ------------------
  359|      0|                    const int d = hdr->super_res.width_scale_denominator =
  360|      0|                        9 + dav1d_get_bits(gb, 3);
  361|      0|                    hdr->width[0] = imax((hdr->width[1] * 8 + (d >> 1)) / d,
  362|      0|                                         imin(16, hdr->width[1]));
  363|      0|                } else {
  364|      0|                    hdr->super_res.width_scale_denominator = 8;
  365|      0|                    hdr->width[0] = hdr->width[1];
  366|      0|                }
  367|      0|                return 0;
  368|      0|            }
  369|      0|        }
  370|      0|    }
  371|       |
  372|      6|    if (hdr->frame_size_override) {
  ------------------
  |  Branch (372:9): [True: 0, False: 6]
  ------------------
  373|      0|        hdr->width[1] = dav1d_get_bits(gb, seqhdr->width_n_bits) + 1;
  374|      0|        hdr->height = dav1d_get_bits(gb, seqhdr->height_n_bits) + 1;
  375|      6|    } else {
  376|      6|        hdr->width[1] = seqhdr->max_width;
  377|      6|        hdr->height = seqhdr->max_height;
  378|      6|    }
  379|      6|    hdr->super_res.enabled = seqhdr->super_res && dav1d_get_bit(gb);
  ------------------
  |  Branch (379:30): [True: 0, False: 6]
  |  Branch (379:51): [True: 0, False: 0]
  ------------------
  380|      6|    if (hdr->super_res.enabled) {
  ------------------
  |  Branch (380:9): [True: 0, False: 6]
  ------------------
  381|      0|        const int d = hdr->super_res.width_scale_denominator = 9 + dav1d_get_bits(gb, 3);
  382|      0|        hdr->width[0] = imax((hdr->width[1] * 8 + (d >> 1)) / d, imin(16, hdr->width[1]));
  383|      6|    } else {
  384|      6|        hdr->super_res.width_scale_denominator = 8;
  385|      6|        hdr->width[0] = hdr->width[1];
  386|      6|    }
  387|      6|    hdr->have_render_size = dav1d_get_bit(gb);
  388|      6|    if (hdr->have_render_size) {
  ------------------
  |  Branch (388:9): [True: 3, False: 3]
  ------------------
  389|      3|        hdr->render_width = dav1d_get_bits(gb, 16) + 1;
  390|      3|        hdr->render_height = dav1d_get_bits(gb, 16) + 1;
  391|      3|    } else {
  392|      3|        hdr->render_width = hdr->width[1];
  393|      3|        hdr->render_height = hdr->height;
  394|      3|    }
  395|      6|    return 0;
  396|      6|}
obu.c:tile_log2:
  398|     24|static inline int tile_log2(const int sz, const int tgt) {
  399|     24|    int k;
  400|     72|    for (k = 0; (sz << k) < tgt; k++) ;
  ------------------
  |  Branch (400:17): [True: 48, False: 24]
  ------------------
  401|     24|    return k;
  402|     24|}
obu.c:check_trailing_bits:
   50|      7|{
   51|      7|    const int trailing_one_bit = dav1d_get_bit(gb);
   52|       |
   53|      7|    if (gb->error)
  ------------------
  |  Branch (53:9): [True: 0, False: 7]
  ------------------
   54|      0|        return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
   55|       |
   56|      7|    if (!strict_std_compliance)
  ------------------
  |  Branch (56:9): [True: 7, False: 0]
  ------------------
   57|      7|        return 0;
   58|       |
   59|      0|    if (!trailing_one_bit || gb->state)
  ------------------
  |  Branch (59:9): [True: 0, False: 0]
  |  Branch (59:30): [True: 0, False: 0]
  ------------------
   60|      0|        return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
   61|       |
   62|      0|    ptrdiff_t size = gb->ptr_end - gb->ptr;
   63|      0|    while (size > 0 && gb->ptr[size - 1] == 0)
  ------------------
  |  Branch (63:12): [True: 0, False: 0]
  |  Branch (63:24): [True: 0, False: 0]
  ------------------
   64|      0|        size--;
   65|       |
   66|      0|    if (size)
  ------------------
  |  Branch (66:9): [True: 0, False: 0]
  ------------------
   67|      0|        return DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
   68|       |
   69|      0|    return 0;
   70|      0|}
obu.c:parse_tile_hdr:
 1154|      4|static void parse_tile_hdr(Dav1dContext *const c, GetBits *const gb) {
 1155|      4|    const int n_tiles = c->frame_hdr->tiling.cols * c->frame_hdr->tiling.rows;
 1156|      4|    const int have_tile_pos = n_tiles > 1 ? dav1d_get_bit(gb) : 0;
  ------------------
  |  Branch (1156:31): [True: 0, False: 4]
  ------------------
 1157|       |
 1158|      4|    if (have_tile_pos) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 4]
  ------------------
 1159|      0|        const int n_bits = c->frame_hdr->tiling.log2_cols +
 1160|      0|                           c->frame_hdr->tiling.log2_rows;
 1161|      0|        c->tile[c->n_tile_data].start = dav1d_get_bits(gb, n_bits);
 1162|      0|        c->tile[c->n_tile_data].end = dav1d_get_bits(gb, n_bits);
 1163|      4|    } else {
 1164|      4|        c->tile[c->n_tile_data].start = 0;
 1165|      4|        c->tile[c->n_tile_data].end = n_tiles - 1;
 1166|      4|    }
 1167|      4|}

dav1d_pal_dsp_init:
   71|      9|COLD void dav1d_pal_dsp_init(Dav1dPalDSPContext *const c) {
   72|      9|    c->pal_idx_finish = pal_idx_finish_c;
   73|       |
   74|       |#if HAVE_ASM
   75|       |#if ARCH_RISCV
   76|       |    pal_dsp_init_riscv(c);
   77|       |#elif ARCH_X86
   78|       |    pal_dsp_init_x86(c);
   79|       |#endif
   80|       |#endif
   81|      9|}
pal.c:pal_idx_finish_c:
   40|     10|{
   41|     10|    assert(bw >= 4 && bw <= 64 && !(bw & (bw - 1)));
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
   42|     10|    assert(bh >= 4 && bh <= 64 && !(bh & (bh - 1)));
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
   43|     10|    assert(w  >= 4 && w <= bw && !(w & 3));
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
   44|     10|    assert(h  >= 4 && h <= bh && !(h & 3));
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:30): [True: 10, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 10]
  |  |  ------------------
  ------------------
   45|       |
   46|     10|    const int dst_w = w / 2;
   47|     10|    const int dst_bw = bw / 2;
   48|       |
   49|    130|    for (int y = 0; y < h; y++, src += bw, dst += dst_bw) {
  ------------------
  |  Branch (49:21): [True: 120, False: 10]
  ------------------
   50|  1.46k|        for (int x = 0; x < dst_w; x++)
  ------------------
  |  Branch (50:25): [True: 1.34k, False: 120]
  ------------------
   51|  1.34k|            dst[x] = src[x * 2 + 0] | (src[x * 2 + 1] << 4);
   52|    120|        if (dst_w < dst_bw)
  ------------------
  |  Branch (52:13): [True: 0, False: 120]
  ------------------
   53|      0|            memset(dst + dst_w, src[w - 1] * 0x11, dst_bw - dst_w);
   54|    120|    }
   55|       |
   56|     10|    if (h < bh) {
  ------------------
  |  Branch (56:9): [True: 0, False: 10]
  ------------------
   57|      0|        const uint8_t *const last_row = &dst[-dst_bw];
   58|      0|        for (int y = h; y < bh; y++, dst += dst_bw)
  ------------------
  |  Branch (58:25): [True: 0, False: 0]
  ------------------
   59|      0|            memcpy(dst, last_row, dst_bw);
   60|      0|    }
   61|     10|}

dav1d_default_picture_alloc:
   46|      4|int dav1d_default_picture_alloc(Dav1dPicture *const p, void *const cookie) {
   47|      4|    const int hbd = p->p.bpc > 8;
   48|      4|    const int aligned_w = (p->p.w + 127) & ~127;
   49|      4|    const int aligned_h = (p->p.h + 127) & ~127;
   50|      4|    const int has_chroma = p->p.layout != DAV1D_PIXEL_LAYOUT_I400;
   51|      4|    const int ss_ver = p->p.layout == DAV1D_PIXEL_LAYOUT_I420;
   52|      4|    const int ss_hor = p->p.layout != DAV1D_PIXEL_LAYOUT_I444;
   53|      4|    ptrdiff_t y_stride = aligned_w << hbd;
   54|      4|    ptrdiff_t uv_stride = has_chroma ? y_stride >> ss_hor : 0;
  ------------------
  |  Branch (54:27): [True: 4, False: 0]
  ------------------
   55|       |    /* Due to how mapping of addresses to sets works in most L1 and L2 cache
   56|       |     * implementations, strides of multiples of certain power-of-two numbers
   57|       |     * may cause multiple rows of the same superblock to map to the same set,
   58|       |     * causing evictions of previous rows resulting in a reduction in cache
   59|       |     * hit rate. Avoid that by slightly padding the stride when necessary. */
   60|      4|    if (!(y_stride & 1023))
  ------------------
  |  Branch (60:9): [True: 0, False: 4]
  ------------------
   61|      0|        y_stride += DAV1D_PICTURE_ALIGNMENT;
  ------------------
  |  |   44|      0|#define DAV1D_PICTURE_ALIGNMENT 64
  ------------------
   62|      4|    if (!(uv_stride & 1023) && has_chroma)
  ------------------
  |  Branch (62:9): [True: 0, False: 4]
  |  Branch (62:32): [True: 0, False: 0]
  ------------------
   63|      0|        uv_stride += DAV1D_PICTURE_ALIGNMENT;
  ------------------
  |  |   44|      0|#define DAV1D_PICTURE_ALIGNMENT 64
  ------------------
   64|      4|    p->stride[0] = y_stride;
   65|      4|    p->stride[1] = uv_stride;
   66|      4|    const size_t y_sz = y_stride * aligned_h;
   67|      4|    const size_t uv_sz = uv_stride * (aligned_h >> ss_ver);
   68|      4|    const size_t pic_size = y_sz + 2 * uv_sz;
   69|       |
   70|      4|    uint8_t *const buf = dav1d_mem_pool_pop(cookie, pic_size + DAV1D_PICTURE_ALIGNMENT);
  ------------------
  |  |   44|      4|#define DAV1D_PICTURE_ALIGNMENT 64
  ------------------
   71|      4|    if (!buf) return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (71:9): [True: 0, False: 4]
  ------------------
   72|      4|    p->allocator_data = buf;
   73|      4|    p->data[0] = buf;
   74|      4|    p->data[1] = has_chroma ? buf + y_sz : NULL;
  ------------------
  |  Branch (74:18): [True: 4, False: 0]
  ------------------
   75|      4|    p->data[2] = has_chroma ? buf + y_sz + uv_sz : NULL;
  ------------------
  |  Branch (75:18): [True: 4, False: 0]
  ------------------
   76|       |
   77|      4|    return 0;
   78|      4|}
dav1d_default_picture_release:
   80|      4|void dav1d_default_picture_release(Dav1dPicture *const p, void *const cookie) {
   81|      4|    dav1d_mem_pool_push(cookie, p->allocator_data);
   82|      4|}
dav1d_picture_copy_props:
  164|      4|{
  165|      4|    dav1d_data_props_copy(&p->m, props);
  166|       |
  167|      4|    dav1d_ref_dec(&p->content_light_ref);
  168|      4|    p->content_light_ref = content_light_ref;
  169|      4|    p->content_light = content_light;
  170|      4|    if (content_light_ref) dav1d_ref_inc(content_light_ref);
  ------------------
  |  Branch (170:9): [True: 0, False: 4]
  ------------------
  171|       |
  172|      4|    dav1d_ref_dec(&p->mastering_display_ref);
  173|      4|    p->mastering_display_ref = mastering_display_ref;
  174|      4|    p->mastering_display = mastering_display;
  175|      4|    if (mastering_display_ref) dav1d_ref_inc(mastering_display_ref);
  ------------------
  |  Branch (175:9): [True: 0, False: 4]
  ------------------
  176|       |
  177|      4|    dav1d_ref_dec(&p->itut_t35_ref);
  178|      4|    p->itut_t35_ref = itut_t35_ref;
  179|      4|    p->itut_t35 = itut_t35;
  180|      4|    p->n_itut_t35 = n_itut_t35;
  181|      4|    if (itut_t35_ref) dav1d_ref_inc(itut_t35_ref);
  ------------------
  |  Branch (181:9): [True: 0, False: 4]
  ------------------
  182|      4|}
dav1d_thread_picture_alloc:
  186|      4|{
  187|      4|    Dav1dThreadPicture *const p = &f->sr_cur;
  188|       |
  189|      4|    const int res = picture_alloc(c, &p->p, f->frame_hdr->width[1], f->frame_hdr->height,
  190|      4|                                  f->seq_hdr, f->seq_hdr_ref,
  191|      4|                                  f->frame_hdr, f->frame_hdr_ref,
  192|      4|                                  bpc, &f->tile[0].data.m, &c->allocator,
  193|      4|                                  (void **) &p->progress);
  194|      4|    if (res) return res;
  ------------------
  |  Branch (194:9): [True: 0, False: 4]
  ------------------
  195|       |
  196|       |    // Don't clear these flags from c->frame_flags if the frame is not going to be output.
  197|       |    // This way they will be added to the next visible frame too.
  198|      4|    const int flags_mask = ((f->frame_hdr->show_frame || c->output_invisible_frames) &&
  ------------------
  |  Branch (198:30): [True: 4, False: 0]
  |  Branch (198:58): [True: 0, False: 0]
  ------------------
  199|      4|                            c->max_spatial_id == f->frame_hdr->spatial_id)
  ------------------
  |  Branch (199:29): [True: 4, False: 0]
  ------------------
  200|      4|                           ? 0 : (PICTURE_FLAG_NEW_SEQUENCE | PICTURE_FLAG_NEW_OP_PARAMS_INFO);
  201|      4|    p->flags = c->frame_flags;
  202|      4|    c->frame_flags &= flags_mask;
  203|       |
  204|      4|    p->visible = f->frame_hdr->show_frame;
  205|      4|    p->showable = f->frame_hdr->showable_frame;
  206|       |
  207|      4|    if (p->visible) {
  ------------------
  |  Branch (207:9): [True: 4, False: 0]
  ------------------
  208|       |        // Only add HDR10+ and T35 metadata when show frame flag is enabled
  209|      4|        dav1d_picture_copy_props(&p->p, c->content_light, c->content_light_ref,
  210|      4|                                 c->mastering_display, c->mastering_display_ref,
  211|      4|                                 c->itut_t35, c->itut_t35_ref, c->n_itut_t35,
  212|      4|                                 &f->tile[0].data.m);
  213|       |
  214|       |        // Must be removed from the context after being attached to the frame
  215|      4|        dav1d_ref_dec(&c->itut_t35_ref);
  216|      4|        c->itut_t35 = NULL;
  217|      4|        c->n_itut_t35 = 0;
  218|      4|    } else {
  219|      0|        dav1d_data_props_copy(&p->p.m, &f->tile[0].data.m);
  220|      0|    }
  221|       |
  222|      4|    if (c->n_fc > 1) {
  ------------------
  |  Branch (222:9): [True: 4, False: 0]
  ------------------
  223|      4|        atomic_init(&p->progress[0], 0);
  224|       |        atomic_init(&p->progress[1], 0);
  225|      4|    }
  226|      4|    return res;
  227|      4|}
dav1d_picture_ref:
  248|     40|void dav1d_picture_ref(Dav1dPicture *const dst, const Dav1dPicture *const src) {
  249|     40|    assert(dst != NULL);
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 40]
  |  |  |  Branch (140:68): [Folded, False: 40]
  |  |  ------------------
  ------------------
  250|     40|    assert(dst->data[0] == NULL);
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 40]
  |  |  |  Branch (140:68): [Folded, False: 40]
  |  |  ------------------
  ------------------
  251|     40|    assert(src != NULL);
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 40]
  |  |  |  Branch (140:68): [Folded, False: 40]
  |  |  ------------------
  ------------------
  252|       |
  253|     40|    if (src->ref) {
  ------------------
  |  Branch (253:9): [True: 40, False: 0]
  ------------------
  254|     40|        assert(src->data[0] != NULL);
  ------------------
  |  |  140|     40|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 40]
  |  |  |  Branch (140:68): [Folded, False: 40]
  |  |  ------------------
  ------------------
  255|     40|        dav1d_ref_inc(src->ref);
  256|     40|    }
  257|     40|    if (src->frame_hdr_ref) dav1d_ref_inc(src->frame_hdr_ref);
  ------------------
  |  Branch (257:9): [True: 40, False: 0]
  ------------------
  258|     40|    if (src->seq_hdr_ref) dav1d_ref_inc(src->seq_hdr_ref);
  ------------------
  |  Branch (258:9): [True: 40, False: 0]
  ------------------
  259|     40|    if (src->m.user_data.ref) dav1d_ref_inc(src->m.user_data.ref);
  ------------------
  |  Branch (259:9): [True: 0, False: 40]
  ------------------
  260|     40|    if (src->content_light_ref) dav1d_ref_inc(src->content_light_ref);
  ------------------
  |  Branch (260:9): [True: 0, False: 40]
  ------------------
  261|     40|    if (src->mastering_display_ref) dav1d_ref_inc(src->mastering_display_ref);
  ------------------
  |  Branch (261:9): [True: 0, False: 40]
  ------------------
  262|     40|    if (src->itut_t35_ref) dav1d_ref_inc(src->itut_t35_ref);
  ------------------
  |  Branch (262:9): [True: 0, False: 40]
  ------------------
  263|     40|    *dst = *src;
  264|     40|}
dav1d_thread_picture_ref:
  280|     36|{
  281|     36|    dav1d_picture_ref(&dst->p, &src->p);
  282|     36|    dst->visible = src->visible;
  283|     36|    dst->showable = src->showable;
  284|     36|    dst->progress = src->progress;
  285|     36|    dst->flags = src->flags;
  286|     36|}
dav1d_picture_unref_internal:
  299|    152|void dav1d_picture_unref_internal(Dav1dPicture *const p) {
  300|    152|    validate_input(p != NULL);
  ------------------
  |  |   59|    152|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|    152|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 152]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  301|       |
  302|    152|    if (p->ref) {
  ------------------
  |  Branch (302:9): [True: 44, False: 108]
  ------------------
  303|     44|        validate_input(p->data[0] != NULL);
  ------------------
  |  |   59|     44|#define validate_input(x) validate_input_or_ret(x, )
  |  |  ------------------
  |  |  |  |   52|     44|    if (!(x)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (52:9): [True: 0, False: 44]
  |  |  |  |  ------------------
  |  |  |  |   53|      0|        debug_print("Input validation check \'%s\' failed in %s!\n", \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define debug_print(...) do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (35:39): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   54|      0|                    #x, __func__); \
  |  |  |  |   55|      0|        debug_abort(); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define debug_abort() do {} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (36:36): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        return r; \
  |  |  |  |   57|      0|    }
  |  |  ------------------
  ------------------
  304|     44|        dav1d_ref_dec(&p->ref);
  305|     44|    }
  306|    152|    dav1d_ref_dec(&p->seq_hdr_ref);
  307|    152|    dav1d_ref_dec(&p->frame_hdr_ref);
  308|    152|    dav1d_ref_dec(&p->m.user_data.ref);
  309|    152|    dav1d_ref_dec(&p->content_light_ref);
  310|    152|    dav1d_ref_dec(&p->mastering_display_ref);
  311|    152|    dav1d_ref_dec(&p->itut_t35_ref);
  312|    152|    memset(p, 0, sizeof(*p));
  313|    152|    dav1d_data_props_set_defaults(&p->m);
  314|    152|}
dav1d_thread_picture_unref:
  316|     94|void dav1d_thread_picture_unref(Dav1dThreadPicture *const p) {
  317|     94|    dav1d_picture_unref_internal(&p->p);
  318|       |
  319|       |    p->progress = NULL;
  320|     94|}
picture.c:picture_alloc:
  117|      4|{
  118|      4|    if (p->data[0]) {
  ------------------
  |  Branch (118:9): [True: 0, False: 4]
  ------------------
  119|      0|        dav1d_log(c, "Picture already allocated!\n");
  ------------------
  |  |   39|      0|#define dav1d_log dav1d_log
  ------------------
  120|      0|        return -1;
  121|      0|    }
  122|      4|    assert(bpc > 0 && bpc <= 16);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 4, False: 0]
  |  |  |  Branch (140:30): [True: 4, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
  123|       |
  124|      4|    size_t extra = c->n_fc > 1 ? sizeof(atomic_int) * 2 : 0;
  ------------------
  |  Branch (124:20): [True: 4, False: 0]
  ------------------
  125|      4|    struct pic_ctx_context *pic_ctx = dav1d_mem_pool_pop(c->pic_ctx_pool, extra +
  126|      4|                                                         sizeof(struct pic_ctx_context));
  127|      4|    if (!pic_ctx)
  ------------------
  |  Branch (127:9): [True: 0, False: 4]
  ------------------
  128|      0|        return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  129|       |
  130|      4|    p->p.w = w;
  131|      4|    p->p.h = h;
  132|      4|    p->seq_hdr = seq_hdr;
  133|      4|    p->frame_hdr = frame_hdr;
  134|      4|    p->p.layout = seq_hdr->layout;
  135|      4|    p->p.bpc = bpc;
  136|      4|    dav1d_data_props_set_defaults(&p->m);
  137|      4|    const int res = p_allocator->alloc_picture_callback(p, p_allocator->cookie);
  138|      4|    if (res < 0) {
  ------------------
  |  Branch (138:9): [True: 0, False: 4]
  ------------------
  139|      0|        dav1d_mem_pool_push(c->pic_ctx_pool, pic_ctx);
  140|      0|        return res;
  141|      0|    }
  142|       |
  143|      4|    pic_ctx->allocator = *p_allocator;
  144|      4|    pic_ctx->pic = *p;
  145|      4|    p->ref = dav1d_ref_init(&pic_ctx->ref, pic_ctx, free_buffer, c->pic_ctx_pool, 0);
  146|       |
  147|      4|    p->seq_hdr_ref = seq_hdr_ref;
  148|      4|    if (seq_hdr_ref) dav1d_ref_inc(seq_hdr_ref);
  ------------------
  |  Branch (148:9): [True: 4, False: 0]
  ------------------
  149|       |
  150|      4|    p->frame_hdr_ref = frame_hdr_ref;
  151|      4|    if (frame_hdr_ref) dav1d_ref_inc(frame_hdr_ref);
  ------------------
  |  Branch (151:9): [True: 4, False: 0]
  ------------------
  152|       |
  153|      4|    if (extra && extra_ptr)
  ------------------
  |  Branch (153:9): [True: 4, False: 0]
  |  Branch (153:18): [True: 4, False: 0]
  ------------------
  154|      4|        *extra_ptr = &pic_ctx->extra_data;
  155|       |
  156|      4|    return 0;
  157|      4|}
picture.c:free_buffer:
   91|      4|static void free_buffer(const uint8_t *const data, void *const user_data) {
   92|      4|    struct pic_ctx_context *pic_ctx = (struct pic_ctx_context*)data;
   93|       |
   94|      4|    pic_ctx->allocator.release_picture_callback(&pic_ctx->pic,
   95|      4|                                                pic_ctx->allocator.cookie);
   96|      4|    dav1d_mem_pool_push(user_data, pic_ctx);
   97|      4|}

dav1d_init_qm_tables:
 1648|      1|COLD void dav1d_init_qm_tables(void) {
 1649|       |    // This function is guaranteed to be called only once
 1650|       |
 1651|     16|    for (int i = 0; i < 15; i++)
  ------------------
  |  Branch (1651:21): [True: 15, False: 1]
  ------------------
 1652|     45|        for (int j = 0; j < 2; j++) {
  ------------------
  |  Branch (1652:25): [True: 30, False: 15]
  ------------------
 1653|       |            // note that the w/h in the assignment is inverted, this is on purpose
 1654|       |            // because we store coefficients transposed
 1655|     30|            dav1d_qm_tbl[i][j][RTX_4X8  ] = qm_tbl_8x4[i][j];
 1656|     30|            dav1d_qm_tbl[i][j][RTX_8X4  ] = qm_tbl_4x8[i][j];
 1657|     30|            dav1d_qm_tbl[i][j][RTX_4X16 ] = qm_tbl_16x4[i][j];
 1658|     30|            dav1d_qm_tbl[i][j][RTX_16X4 ] = qm_tbl_4x16[i][j];
 1659|     30|            dav1d_qm_tbl[i][j][RTX_8X16 ] = qm_tbl_16x8[i][j];
 1660|     30|            dav1d_qm_tbl[i][j][RTX_16X8 ] = qm_tbl_8x16[i][j];
 1661|     30|            dav1d_qm_tbl[i][j][RTX_8X32 ] = qm_tbl_32x8[i][j];
 1662|     30|            dav1d_qm_tbl[i][j][RTX_32X8 ] = qm_tbl_8x32[i][j];
 1663|     30|            dav1d_qm_tbl[i][j][RTX_16X32] = qm_tbl_32x16[i][j];
 1664|     30|            dav1d_qm_tbl[i][j][RTX_32X16] = qm_tbl_16x32[i][j];
 1665|       |
 1666|     30|            dav1d_qm_tbl[i][j][ TX_4X4  ] = qm_tbl_4x4[i][j];
 1667|     30|            dav1d_qm_tbl[i][j][ TX_8X8  ] = qm_tbl_8x8[i][j];
 1668|     30|            dav1d_qm_tbl[i][j][ TX_16X16] = qm_tbl_16x16[i][j];
 1669|     30|            dav1d_qm_tbl[i][j][ TX_32X32] = qm_tbl_32x32[i][j];
 1670|       |
 1671|     30|            untriangle(qm_tbl_32x32[i][j], qm_tbl_32x32_t[i][j], 32);
 1672|     30|            subsample(qm_tbl_4x4[i][j],   &qm_tbl_32x32[i][j][32*3+3], 32, 8, 8);
 1673|     30|            subsample(qm_tbl_8x4[i][j],   &qm_tbl_32x16[i][j][32*1+1], 16, 4, 4);
 1674|     30|            subsample(qm_tbl_8x8[i][j],   &qm_tbl_32x32[i][j][32*1+1], 32, 4, 4);
 1675|     30|            subsample(qm_tbl_16x4[i][j],  &qm_tbl_32x16[i][j][32*1+0], 16, 2, 4);
 1676|     30|            subsample(qm_tbl_16x8[i][j],  &qm_tbl_32x16[i][j][32*0+0], 16, 2, 2);
 1677|     30|            subsample(qm_tbl_16x16[i][j], &qm_tbl_32x32[i][j][32*0+0], 32, 2, 2);
 1678|     30|            subsample(qm_tbl_32x8[i][j],  &qm_tbl_32x16[i][j][32*0+0], 16, 1, 2);
 1679|     30|            transpose(qm_tbl_4x8[i][j], qm_tbl_8x4[i][j], 8, 4);
 1680|     30|            transpose(qm_tbl_4x16[i][j], qm_tbl_16x4[i][j], 16, 4);
 1681|     30|            transpose(qm_tbl_8x16[i][j], qm_tbl_16x8[i][j], 16, 8);
 1682|     30|            transpose(qm_tbl_8x32[i][j], qm_tbl_32x8[i][j], 32, 8);
 1683|     30|            transpose(qm_tbl_16x32[i][j], qm_tbl_32x16[i][j], 32, 16);
 1684|       |
 1685|     30|            dav1d_qm_tbl[i][j][ TX_64X64] = dav1d_qm_tbl[i][j][ TX_32X32];
 1686|     30|            dav1d_qm_tbl[i][j][RTX_64X32] = dav1d_qm_tbl[i][j][ TX_32X32];
 1687|     30|            dav1d_qm_tbl[i][j][RTX_64X16] = dav1d_qm_tbl[i][j][RTX_32X16];
 1688|     30|            dav1d_qm_tbl[i][j][RTX_32X64] = dav1d_qm_tbl[i][j][ TX_32X32];
 1689|     30|            dav1d_qm_tbl[i][j][RTX_16X64] = dav1d_qm_tbl[i][j][RTX_16X32];
 1690|     30|        }
 1691|       |
 1692|       |    // dav1d_qm_tbl[15][*][*] == NULL
 1693|      1|}
qm.c:untriangle:
 1635|     30|static void untriangle(uint8_t *dst, const uint8_t *src, const int sz) {
 1636|    990|    for (int y = 0; y < sz; y++) {
  ------------------
  |  Branch (1636:21): [True: 960, False: 30]
  ------------------
 1637|    960|        memcpy(dst, src, y + 1);
 1638|    960|        const uint8_t *src_ptr = &src[y];
 1639|  15.8k|        for (int x = y + 1; x < sz; x++) {
  ------------------
  |  Branch (1639:29): [True: 14.8k, False: 960]
  ------------------
 1640|  14.8k|            src_ptr += x;
 1641|  14.8k|            dst[x] = *src_ptr;
 1642|  14.8k|        }
 1643|    960|        dst += sz;
 1644|    960|        src += y + 1;
 1645|    960|    }
 1646|     30|}
qm.c:subsample:
 1621|    210|{
 1622|  1.77k|    for (int y = 0; y < h; y += vstep)
  ------------------
  |  Branch (1622:21): [True: 1.56k, False: 210]
  ------------------
 1623|  26.0k|        for (int x = 0; x < 32; x += hstep)
  ------------------
  |  Branch (1623:25): [True: 24.4k, False: 1.56k]
  ------------------
 1624|  24.4k|            *dst++ = src[y * 32 + x];
 1625|    210|}
qm.c:transpose:
 1629|    150|{
 1630|  1.35k|    for (int y = 0, y_off = 0; y < h; y++, y_off += w)
  ------------------
  |  Branch (1630:32): [True: 1.20k, False: 150]
  ------------------
 1631|  30.9k|        for (int x = 0, x_off = 0; x < w; x++, x_off += h)
  ------------------
  |  Branch (1631:36): [True: 29.7k, False: 1.20k]
  ------------------
 1632|  29.7k|            dst[x_off + y] = src[y_off + x];
 1633|    150|}

dav1d_read_coef_blocks_8bpc:
  826|  2.65k|{
  827|  2.65k|    const Dav1dFrameContext *const f = t->f;
  828|  2.65k|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  829|  2.65k|    const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  830|  2.65k|    const int bx4 = t->bx & 31, by4 = t->by & 31;
  831|  2.65k|    const int cbx4 = bx4 >> ss_hor, cby4 = by4 >> ss_ver;
  832|  2.65k|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
  833|  2.65k|    const int bw4 = b_dim[0], bh4 = b_dim[1];
  834|  2.65k|    const int cbw4 = (bw4 + ss_hor) >> ss_hor, cbh4 = (bh4 + ss_ver) >> ss_ver;
  835|  2.65k|    const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400 &&
  ------------------
  |  Branch (835:28): [True: 2.65k, False: 0]
  ------------------
  836|  2.65k|                           (bw4 > ss_hor || t->bx & 1) &&
  ------------------
  |  Branch (836:29): [True: 2.14k, False: 512]
  |  Branch (836:45): [True: 256, False: 256]
  ------------------
  837|  2.40k|                           (bh4 > ss_ver || t->by & 1);
  ------------------
  |  Branch (837:29): [True: 1.87k, False: 524]
  |  Branch (837:45): [True: 262, False: 262]
  ------------------
  838|       |
  839|  2.65k|    if (b->skip) {
  ------------------
  |  Branch (839:9): [True: 420, False: 2.23k]
  ------------------
  840|    420|        BlockContext *const a = t->a;
  841|    420|        dav1d_memset_pow2[b_dim[2]](&a->lcoef[bx4], 0x40);
  842|    420|        dav1d_memset_pow2[b_dim[3]](&t->l.lcoef[by4], 0x40);
  843|    420|        if (has_chroma) {
  ------------------
  |  Branch (843:13): [True: 314, False: 106]
  ------------------
  844|    314|            dav1d_memset_pow2_fn memset_cw = dav1d_memset_pow2[ulog2(cbw4)];
  845|    314|            dav1d_memset_pow2_fn memset_ch = dav1d_memset_pow2[ulog2(cbh4)];
  846|    314|            memset_cw(&a->ccoef[0][cbx4], 0x40);
  847|    314|            memset_cw(&a->ccoef[1][cbx4], 0x40);
  848|    314|            memset_ch(&t->l.ccoef[0][cby4], 0x40);
  849|    314|            memset_ch(&t->l.ccoef[1][cby4], 0x40);
  850|    314|        }
  851|    420|        return;
  852|    420|    }
  853|       |
  854|  2.23k|    Dav1dTileState *const ts = t->ts;
  855|  2.23k|    const int w4 = imin(bw4, f->bw - t->bx), h4 = imin(bh4, f->bh - t->by);
  856|  2.23k|    const int cw4 = (w4 + ss_hor) >> ss_hor, ch4 = (h4 + ss_ver) >> ss_ver;
  857|  2.23k|    assert(t->frame_thread.pass == 1);
  ------------------
  |  |  140|  2.23k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.23k]
  |  |  |  Branch (140:68): [Folded, False: 2.23k]
  |  |  ------------------
  ------------------
  858|  2.23k|    assert(!b->skip);
  ------------------
  |  |  140|  2.23k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.23k]
  |  |  |  Branch (140:68): [Folded, False: 2.23k]
  |  |  ------------------
  ------------------
  859|  2.23k|    const TxfmInfo *const uv_t_dim = &dav1d_txfm_dimensions[b->uvtx];
  860|  2.23k|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[b->intra ? b->tx : b->max_ytx];
  ------------------
  |  Branch (860:58): [True: 1.82k, False: 414]
  ------------------
  861|  2.23k|    const uint16_t tx_split[2] = { b->tx_split0, b->tx_split1 };
  862|       |
  863|  4.56k|    for (int init_y = 0; init_y < h4; init_y += 16) {
  ------------------
  |  Branch (863:26): [True: 2.33k, False: 2.23k]
  ------------------
  864|  2.33k|        const int sub_h4 = imin(h4, 16 + init_y);
  865|  4.86k|        for (int init_x = 0; init_x < w4; init_x += 16) {
  ------------------
  |  Branch (865:30): [True: 2.53k, False: 2.33k]
  ------------------
  866|  2.53k|            const int sub_w4 = imin(w4, init_x + 16);
  867|  2.53k|            int y_off = !!init_y, y, x;
  868|  5.82k|            for (y = init_y, t->by += init_y; y < sub_h4;
  ------------------
  |  Branch (868:47): [True: 3.29k, False: 2.53k]
  ------------------
  869|  3.29k|                 y += t_dim->h, t->by += t_dim->h, y_off++)
  870|  3.29k|            {
  871|  3.29k|                int x_off = !!init_x;
  872|  8.29k|                for (x = init_x, t->bx += init_x; x < sub_w4;
  ------------------
  |  Branch (872:51): [True: 5.00k, False: 3.29k]
  ------------------
  873|  5.00k|                     x += t_dim->w, t->bx += t_dim->w, x_off++)
  874|  5.00k|                {
  875|  5.00k|                    if (!b->intra) {
  ------------------
  |  Branch (875:25): [True: 544, False: 4.46k]
  ------------------
  876|    544|                        read_coef_tree(t, bs, b, b->max_ytx, 0, tx_split,
  877|    544|                                       x_off, y_off, NULL);
  878|  4.46k|                    } else {
  879|  4.46k|                        uint8_t cf_ctx = 0x40;
  880|  4.46k|                        enum TxfmType txtp;
  881|  4.46k|                        const int eob =
  882|  4.46k|                            decode_coefs(t, &t->a->lcoef[bx4 + x],
  883|  4.46k|                                         &t->l.lcoef[by4 + y], b->tx, bs, b, 1,
  884|  4.46k|                                         0, ts->frame_thread[1].cf, &txtp, &cf_ctx);
  885|  4.46k|                        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  4.46k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 4.46k]
  |  |  ------------------
  |  |   35|  4.46k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  4.46k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  886|      0|                            printf("Post-y-cf-blk[tx=%d,txtp=%d,eob=%d]: r=%d\n",
  887|      0|                                   b->tx, txtp, eob, ts->msac.rng);
  888|  4.46k|                        *ts->frame_thread[1].cbi++ = eob * (1 << 5) + txtp;
  889|  4.46k|                        ts->frame_thread[1].cf += imin(t_dim->w, 8) * imin(t_dim->h, 8) * 16;
  890|  4.46k|                        dav1d_memset_likely_pow2(&t->a->lcoef[bx4 + x], cf_ctx, imin(t_dim->w, f->bw - t->bx));
  891|  4.46k|                        dav1d_memset_likely_pow2(&t->l.lcoef[by4 + y], cf_ctx, imin(t_dim->h, f->bh - t->by));
  892|  4.46k|                    }
  893|  5.00k|                }
  894|  3.29k|                t->bx -= x;
  895|  3.29k|            }
  896|  2.53k|            t->by -= y;
  897|       |
  898|  2.53k|            if (!has_chroma) continue;
  ------------------
  |  Branch (898:17): [True: 412, False: 2.12k]
  ------------------
  899|       |
  900|  2.12k|            const int sub_ch4 = imin(ch4, (init_y + 16) >> ss_ver);
  901|  2.12k|            const int sub_cw4 = imin(cw4, (init_x + 16) >> ss_hor);
  902|  6.36k|            for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (902:30): [True: 4.24k, False: 2.12k]
  ------------------
  903|  8.48k|                for (y = init_y >> ss_ver, t->by += init_y; y < sub_ch4;
  ------------------
  |  Branch (903:61): [True: 4.24k, False: 4.24k]
  ------------------
  904|  4.24k|                     y += uv_t_dim->h, t->by += uv_t_dim->h << ss_ver)
  905|  4.24k|                {
  906|  8.48k|                    for (x = init_x >> ss_hor, t->bx += init_x; x < sub_cw4;
  ------------------
  |  Branch (906:65): [True: 4.24k, False: 4.24k]
  ------------------
  907|  4.24k|                         x += uv_t_dim->w, t->bx += uv_t_dim->w << ss_hor)
  908|  4.24k|                    {
  909|  4.24k|                        uint8_t cf_ctx = 0x40;
  910|  4.24k|                        enum TxfmType txtp;
  911|  4.24k|                        if (!b->intra)
  ------------------
  |  Branch (911:29): [True: 972, False: 3.27k]
  ------------------
  912|    972|                            txtp = t->scratch.txtp_map[(by4 + (y << ss_ver)) * 32 +
  913|    972|                                                        bx4 + (x << ss_hor)];
  914|  4.24k|                        const int eob =
  915|  4.24k|                            decode_coefs(t, &t->a->ccoef[pl][cbx4 + x],
  916|  4.24k|                                         &t->l.ccoef[pl][cby4 + y], b->uvtx, bs,
  917|  4.24k|                                         b, b->intra, 1 + pl, ts->frame_thread[1].cf,
  918|  4.24k|                                         &txtp, &cf_ctx);
  919|  4.24k|                        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|  4.24k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 4.24k]
  |  |  ------------------
  |  |   35|  4.24k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  4.24k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  920|      0|                            printf("Post-uv-cf-blk[pl=%d,tx=%d,"
  921|      0|                                   "txtp=%d,eob=%d]: r=%d\n",
  922|      0|                                   pl, b->uvtx, txtp, eob, ts->msac.rng);
  923|  4.24k|                        *ts->frame_thread[1].cbi++ = eob * (1 << 5) + txtp;
  924|  4.24k|                        ts->frame_thread[1].cf += uv_t_dim->w * uv_t_dim->h * 16;
  925|  4.24k|                        int ctw = imin(uv_t_dim->w, (f->bw - t->bx + ss_hor) >> ss_hor);
  926|  4.24k|                        int cth = imin(uv_t_dim->h, (f->bh - t->by + ss_ver) >> ss_ver);
  927|  4.24k|                        dav1d_memset_likely_pow2(&t->a->ccoef[pl][cbx4 + x], cf_ctx, ctw);
  928|  4.24k|                        dav1d_memset_likely_pow2(&t->l.ccoef[pl][cby4 + y], cf_ctx, cth);
  929|  4.24k|                    }
  930|  4.24k|                    t->bx -= x << ss_hor;
  931|  4.24k|                }
  932|  4.24k|                t->by -= y << ss_ver;
  933|  4.24k|            }
  934|  2.12k|        }
  935|  2.33k|    }
  936|  2.23k|}
dav1d_recon_b_intra_8bpc:
 1179|  1.35k|{
 1180|  1.35k|    Dav1dTileState *const ts = t->ts;
 1181|  1.35k|    const Dav1dFrameContext *const f = t->f;
 1182|  1.35k|    const Dav1dDSPContext *const dsp = f->dsp;
 1183|  1.35k|    const int bx4 = t->bx & 31, by4 = t->by & 31;
 1184|  1.35k|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 1185|  1.35k|    const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
 1186|  1.35k|    const int cbx4 = bx4 >> ss_hor, cby4 = by4 >> ss_ver;
 1187|  1.35k|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
 1188|  1.35k|    const int bw4 = b_dim[0], bh4 = b_dim[1];
 1189|  1.35k|    const int w4 = imin(bw4, f->bw - t->bx), h4 = imin(bh4, f->bh - t->by);
 1190|  1.35k|    const int cw4 = (w4 + ss_hor) >> ss_hor, ch4 = (h4 + ss_ver) >> ss_ver;
 1191|  1.35k|    const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400 &&
  ------------------
  |  Branch (1191:28): [True: 1.35k, False: 0]
  ------------------
 1192|  1.35k|                           (bw4 > ss_hor || t->bx & 1) &&
  ------------------
  |  Branch (1192:29): [True: 1.06k, False: 288]
  |  Branch (1192:45): [True: 140, False: 148]
  ------------------
 1193|  1.20k|                           (bh4 > ss_ver || t->by & 1);
  ------------------
  |  Branch (1193:29): [True: 924, False: 278]
  |  Branch (1193:45): [True: 136, False: 142]
  ------------------
 1194|  1.35k|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[b->tx];
 1195|  1.35k|    const TxfmInfo *const uv_t_dim = &dav1d_txfm_dimensions[b->uvtx];
 1196|       |
 1197|       |    // coefficient coding
 1198|  1.35k|    pixel *const edge = bitfn(t->scratch.edge) + 128;
  ------------------
  |  |   51|  1.35k|#define bitfn(x) x##_8bpc
  ------------------
 1199|  1.35k|    const int cbw4 = (bw4 + ss_hor) >> ss_hor, cbh4 = (bh4 + ss_ver) >> ss_ver;
 1200|       |
 1201|  1.35k|    const int intra_edge_filter_flag = f->seq_hdr->intra_edge_filter << 10;
 1202|       |
 1203|  2.72k|    for (int init_y = 0; init_y < h4; init_y += 16) {
  ------------------
  |  Branch (1203:26): [True: 1.37k, False: 1.35k]
  ------------------
 1204|  1.37k|        const int sub_h4 = imin(h4, 16 + init_y);
 1205|  1.37k|        const int sub_ch4 = imin(ch4, (init_y + 16) >> ss_ver);
 1206|  2.79k|        for (int init_x = 0; init_x < w4; init_x += 16) {
  ------------------
  |  Branch (1206:30): [True: 1.42k, False: 1.37k]
  ------------------
 1207|  1.42k|            if (b->pal_sz[0]) {
  ------------------
  |  Branch (1207:17): [True: 8, False: 1.41k]
  ------------------
 1208|      8|                pixel *dst = ((pixel *) f->cur.data[0]) +
 1209|      8|                             4 * (t->by * PXSTRIDE(f->cur.stride[0]) + t->bx);
  ------------------
  |  |   53|      8|#define PXSTRIDE(x) (x)
  ------------------
 1210|      8|                const uint8_t *pal_idx;
 1211|      8|                if (t->frame_thread.pass) {
  ------------------
  |  Branch (1211:21): [True: 8, False: 0]
  ------------------
 1212|      8|                    const int p = t->frame_thread.pass & 1;
 1213|      8|                    assert(ts->frame_thread[p].pal_idx);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 8]
  |  |  |  Branch (140:68): [Folded, False: 8]
  |  |  ------------------
  ------------------
 1214|      8|                    pal_idx = ts->frame_thread[p].pal_idx;
 1215|      8|                    ts->frame_thread[p].pal_idx += bw4 * bh4 * 8;
 1216|      8|                } else {
 1217|      0|                    pal_idx = t->scratch.pal_idx_y;
 1218|      0|                }
 1219|      8|                const pixel *const pal = t->frame_thread.pass ?
  ------------------
  |  Branch (1219:42): [True: 8, False: 0]
  ------------------
 1220|      8|                    f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 1221|      8|                                        ((t->bx >> 1) + (t->by & 1))][0] :
 1222|      8|                    bytefn(t->scratch.pal)[0];
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      8|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1223|      8|                f->dsp->ipred.pal_pred(dst, f->cur.stride[0], pal,
 1224|      8|                                       pal_idx, bw4 * 4, bh4 * 4);
 1225|      8|                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|      8|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 8]
  |  |  ------------------
  |  |   35|      8|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      8|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1226|      0|                    hex_dump(dst, PXSTRIDE(f->cur.stride[0]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1227|      0|                             bw4 * 4, bh4 * 4, "y-pal-pred");
 1228|      8|            }
 1229|       |
 1230|  1.42k|            const int intra_flags = (sm_flag(t->a, bx4) |
 1231|  1.42k|                                     sm_flag(&t->l, by4) |
 1232|  1.42k|                                     intra_edge_filter_flag);
 1233|  1.42k|            const int sb_has_tr = init_x + 16 < w4 ? 1 : init_y ? 0 :
  ------------------
  |  Branch (1233:35): [True: 48, False: 1.37k]
  |  Branch (1233:58): [True: 24, False: 1.35k]
  ------------------
 1234|  1.37k|                              intra_edge_flags & EDGE_I444_TOP_HAS_RIGHT;
 1235|  1.42k|            const int sb_has_bl = init_x ? 0 : init_y + 16 < h4 ? 1 :
  ------------------
  |  Branch (1235:35): [True: 48, False: 1.37k]
  |  Branch (1235:48): [True: 24, False: 1.35k]
  ------------------
 1236|  1.37k|                              intra_edge_flags & EDGE_I444_LEFT_HAS_BOTTOM;
 1237|  1.42k|            int y, x;
 1238|  1.42k|            const int sub_w4 = imin(w4, init_x + 16);
 1239|  3.44k|            for (y = init_y, t->by += init_y; y < sub_h4;
  ------------------
  |  Branch (1239:47): [True: 2.01k, False: 1.42k]
  ------------------
 1240|  2.01k|                 y += t_dim->h, t->by += t_dim->h)
 1241|  2.01k|            {
 1242|  2.01k|                pixel *dst = ((pixel *) f->cur.data[0]) +
 1243|  2.01k|                               4 * (t->by * PXSTRIDE(f->cur.stride[0]) +
  ------------------
  |  |   53|  2.01k|#define PXSTRIDE(x) (x)
  ------------------
 1244|  2.01k|                                    t->bx + init_x);
 1245|  5.50k|                for (x = init_x, t->bx += init_x; x < sub_w4;
  ------------------
  |  Branch (1245:51): [True: 3.48k, False: 2.01k]
  ------------------
 1246|  3.48k|                     x += t_dim->w, t->bx += t_dim->w)
 1247|  3.48k|                {
 1248|  3.48k|                    if (b->pal_sz[0]) goto skip_y_pred;
  ------------------
  |  Branch (1248:25): [True: 30, False: 3.45k]
  ------------------
 1249|       |
 1250|  3.45k|                    int angle = b->y_angle;
 1251|  3.45k|                    const enum EdgeFlags edge_flags =
 1252|  3.45k|                        (((y > init_y || !sb_has_tr) && (x + t_dim->w >= sub_w4)) ?
  ------------------
  |  Branch (1252:28): [True: 1.41k, False: 2.04k]
  |  Branch (1252:42): [True: 860, False: 1.18k]
  |  Branch (1252:57): [True: 1.14k, False: 1.12k]
  ------------------
 1253|  2.31k|                             0 : EDGE_I444_TOP_HAS_RIGHT) |
 1254|  3.45k|                        ((x > init_x || (!sb_has_bl && y + t_dim->h >= sub_h4)) ?
  ------------------
  |  Branch (1254:27): [True: 1.45k, False: 2.00k]
  |  Branch (1254:42): [True: 1.31k, False: 690]
  |  Branch (1254:56): [True: 846, False: 470]
  ------------------
 1255|  2.29k|                             0 : EDGE_I444_LEFT_HAS_BOTTOM);
 1256|  3.45k|                    const pixel *top_sb_edge = NULL;
 1257|  3.45k|                    if (!(t->by & (f->sb_step - 1))) {
  ------------------
  |  Branch (1257:25): [True: 460, False: 2.99k]
  ------------------
 1258|    460|                        top_sb_edge = f->ipred_edge[0];
 1259|    460|                        const int sby = t->by >> f->sb_shift;
 1260|    460|                        top_sb_edge += f->sb128w * 128 * (sby - 1);
 1261|    460|                    }
 1262|  3.45k|                    const enum IntraPredMode m =
 1263|  3.45k|                        bytefn(dav1d_prepare_intra_edges)(t->bx,
  ------------------
  |  |   87|  3.45k|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|  3.45k|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1264|  3.45k|                                                          t->bx > ts->tiling.col_start,
 1265|  3.45k|                                                          t->by,
 1266|  3.45k|                                                          t->by > ts->tiling.row_start,
 1267|  3.45k|                                                          ts->tiling.col_end,
 1268|  3.45k|                                                          ts->tiling.row_end,
 1269|  3.45k|                                                          edge_flags, dst,
 1270|  3.45k|                                                          f->cur.stride[0], top_sb_edge,
 1271|  3.45k|                                                          b->y_mode, &angle,
 1272|  3.45k|                                                          t_dim->w, t_dim->h,
 1273|  3.45k|                                                          f->seq_hdr->intra_edge_filter,
 1274|  3.45k|                                                          edge HIGHBD_CALL_SUFFIX);
 1275|  3.45k|                    dsp->ipred.intra_pred[m](dst, f->cur.stride[0], edge,
 1276|  3.45k|                                             t_dim->w * 4, t_dim->h * 4,
 1277|  3.45k|                                             angle | intra_flags,
 1278|  3.45k|                                             4 * f->bw - 4 * t->bx,
 1279|  3.45k|                                             4 * f->bh - 4 * t->by
 1280|  3.45k|                                             HIGHBD_CALL_SUFFIX);
 1281|       |
 1282|  3.45k|                    if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   34|  3.45k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 3.45k]
  |  |  ------------------
  |  |   35|  3.45k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  3.45k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1283|      0|                        hex_dump(edge - t_dim->h * 4, t_dim->h * 4,
 1284|      0|                                 t_dim->h * 4, 2, "l");
 1285|      0|                        hex_dump(edge, 0, 1, 1, "tl");
 1286|      0|                        hex_dump(edge + 1, t_dim->w * 4,
 1287|      0|                                 t_dim->w * 4, 2, "t");
 1288|      0|                        hex_dump(dst, f->cur.stride[0],
 1289|      0|                                 t_dim->w * 4, t_dim->h * 4, "y-intra-pred");
 1290|      0|                    }
 1291|       |
 1292|  3.48k|                skip_y_pred: {}
 1293|  3.48k|                    if (!b->skip) {
  ------------------
  |  Branch (1293:25): [True: 3.10k, False: 380]
  ------------------
 1294|  3.10k|                        coef *cf;
 1295|  3.10k|                        int eob;
 1296|  3.10k|                        enum TxfmType txtp;
 1297|  3.10k|                        if (t->frame_thread.pass) {
  ------------------
  |  Branch (1297:29): [True: 3.10k, False: 0]
  ------------------
 1298|  3.10k|                            const int p = t->frame_thread.pass & 1;
 1299|  3.10k|                            const int cbi = *ts->frame_thread[p].cbi++;
 1300|  3.10k|                            cf = ts->frame_thread[p].cf;
 1301|  3.10k|                            ts->frame_thread[p].cf += imin(t_dim->w, 8) * imin(t_dim->h, 8) * 16;
 1302|  3.10k|                            eob  = cbi >> 5;
 1303|  3.10k|                            txtp = cbi & 0x1f;
 1304|  3.10k|                        } else {
 1305|      0|                            uint8_t cf_ctx;
 1306|      0|                            cf = bitfn(t->cf);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1307|      0|                            eob = decode_coefs(t, &t->a->lcoef[bx4 + x],
 1308|      0|                                               &t->l.lcoef[by4 + y], b->tx, bs,
 1309|      0|                                               b, 1, 0, cf, &txtp, &cf_ctx);
 1310|      0|                            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1311|      0|                                printf("Post-y-cf-blk[tx=%d,txtp=%d,eob=%d]: r=%d\n",
 1312|      0|                                       b->tx, txtp, eob, ts->msac.rng);
 1313|      0|                            dav1d_memset_likely_pow2(&t->a->lcoef[bx4 + x], cf_ctx, imin(t_dim->w, f->bw - t->bx));
 1314|      0|                            dav1d_memset_likely_pow2(&t->l.lcoef[by4 + y], cf_ctx, imin(t_dim->h, f->bh - t->by));
 1315|      0|                        }
 1316|  3.10k|                        if (eob >= 0) {
  ------------------
  |  Branch (1316:29): [True: 1.63k, False: 1.47k]
  ------------------
 1317|  1.63k|                            if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|  1.63k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 1.63k]
  |  |  ------------------
  |  |   35|  1.63k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  1.63k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1318|      0|                                coef_dump(cf, imin(t_dim->h, 8) * 4,
 1319|      0|                                          imin(t_dim->w, 8) * 4, 3, "dq");
 1320|  1.63k|                            dsp->itx.itxfm_add[b->tx]
 1321|  1.63k|                                              [txtp](dst,
 1322|  1.63k|                                                     f->cur.stride[0],
 1323|  1.63k|                                                     cf, eob HIGHBD_CALL_SUFFIX);
 1324|  1.63k|                            if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|  1.63k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 1.63k]
  |  |  ------------------
  |  |   35|  1.63k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  1.63k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1325|      0|                                hex_dump(dst, f->cur.stride[0],
 1326|      0|                                         t_dim->w * 4, t_dim->h * 4, "recon");
 1327|  1.63k|                        }
 1328|  3.10k|                    } else if (!t->frame_thread.pass) {
  ------------------
  |  Branch (1328:32): [True: 0, False: 380]
  ------------------
 1329|      0|                        dav1d_memset_pow2[t_dim->lw](&t->a->lcoef[bx4 + x], 0x40);
 1330|      0|                        dav1d_memset_pow2[t_dim->lh](&t->l.lcoef[by4 + y], 0x40);
 1331|      0|                    }
 1332|  3.48k|                    dst += 4 * t_dim->w;
 1333|  3.48k|                }
 1334|  2.01k|                t->bx -= x;
 1335|  2.01k|            }
 1336|  1.42k|            t->by -= y;
 1337|       |
 1338|  1.42k|            if (!has_chroma) continue;
  ------------------
  |  Branch (1338:17): [True: 290, False: 1.13k]
  ------------------
 1339|       |
 1340|  1.13k|            const ptrdiff_t stride = f->cur.stride[1];
 1341|       |
 1342|  1.13k|            if (b->uv_mode == CFL_PRED) {
  ------------------
  |  Branch (1342:17): [True: 222, False: 910]
  ------------------
 1343|    222|                assert(!init_x && !init_y);
  ------------------
  |  |  140|    444|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:30): [True: 222, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 222]
  |  |  ------------------
  ------------------
 1344|       |
 1345|    222|                int16_t *const ac = t->scratch.ac;
 1346|    222|                pixel *y_src = ((pixel *) f->cur.data[0]) + 4 * (t->bx & ~ss_hor) +
 1347|    222|                                 4 * (t->by & ~ss_ver) * PXSTRIDE(f->cur.stride[0]);
  ------------------
  |  |   53|    222|#define PXSTRIDE(x) (x)
  ------------------
 1348|    222|                const ptrdiff_t uv_off = 4 * ((t->bx >> ss_hor) +
 1349|    222|                                              (t->by >> ss_ver) * PXSTRIDE(stride));
  ------------------
  |  |   53|    222|#define PXSTRIDE(x) (x)
  ------------------
 1350|    222|                pixel *const uv_dst[2] = { ((pixel *) f->cur.data[1]) + uv_off,
 1351|    222|                                           ((pixel *) f->cur.data[2]) + uv_off };
 1352|       |
 1353|    222|                const int furthest_r =
 1354|    222|                    ((cw4 << ss_hor) + t_dim->w - 1) & ~(t_dim->w - 1);
 1355|    222|                const int furthest_b =
 1356|    222|                    ((ch4 << ss_ver) + t_dim->h - 1) & ~(t_dim->h - 1);
 1357|    222|                dsp->ipred.cfl_ac[f->cur.p.layout - 1](ac, y_src, f->cur.stride[0],
 1358|    222|                                                         cbw4 - (furthest_r >> ss_hor),
 1359|    222|                                                         cbh4 - (furthest_b >> ss_ver),
 1360|    222|                                                         cbw4 * 4, cbh4 * 4);
 1361|    666|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1361:34): [True: 444, False: 222]
  ------------------
 1362|    444|                    if (!b->cfl_alpha[pl]) continue;
  ------------------
  |  Branch (1362:25): [True: 78, False: 366]
  ------------------
 1363|    366|                    int angle = 0;
 1364|    366|                    const pixel *top_sb_edge = NULL;
 1365|    366|                    if (!((t->by & ~ss_ver) & (f->sb_step - 1))) {
  ------------------
  |  Branch (1365:25): [True: 72, False: 294]
  ------------------
 1366|     72|                        top_sb_edge = f->ipred_edge[pl + 1];
 1367|     72|                        const int sby = t->by >> f->sb_shift;
 1368|     72|                        top_sb_edge += f->sb128w * 128 * (sby - 1);
 1369|     72|                    }
 1370|    366|                    const int xpos = t->bx >> ss_hor, ypos = t->by >> ss_ver;
 1371|    366|                    const int xstart = ts->tiling.col_start >> ss_hor;
 1372|    366|                    const int ystart = ts->tiling.row_start >> ss_ver;
 1373|    366|                    const enum IntraPredMode m =
 1374|    366|                        bytefn(dav1d_prepare_intra_edges)(xpos, xpos > xstart,
  ------------------
  |  |   87|    366|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|    366|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1375|    366|                                                          ypos, ypos > ystart,
 1376|    366|                                                          ts->tiling.col_end >> ss_hor,
 1377|    366|                                                          ts->tiling.row_end >> ss_ver,
 1378|    366|                                                          0, uv_dst[pl], stride,
 1379|    366|                                                          top_sb_edge, DC_PRED, &angle,
 1380|    366|                                                          uv_t_dim->w, uv_t_dim->h, 0,
 1381|    366|                                                          edge HIGHBD_CALL_SUFFIX);
 1382|    366|                    dsp->ipred.cfl_pred[m](uv_dst[pl], stride, edge,
 1383|    366|                                           uv_t_dim->w * 4,
 1384|    366|                                           uv_t_dim->h * 4,
 1385|    366|                                           ac, b->cfl_alpha[pl]
 1386|    366|                                           HIGHBD_CALL_SUFFIX);
 1387|    366|                }
 1388|    222|                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   34|    222|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 222]
  |  |  ------------------
  |  |   35|    222|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    222|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1389|      0|                    ac_dump(ac, 4*cbw4, 4*cbh4, "ac");
 1390|      0|                    hex_dump(uv_dst[0], stride, cbw4 * 4, cbh4 * 4, "u-cfl-pred");
 1391|      0|                    hex_dump(uv_dst[1], stride, cbw4 * 4, cbh4 * 4, "v-cfl-pred");
 1392|      0|                }
 1393|    910|            } else if (b->pal_sz[1]) {
  ------------------
  |  Branch (1393:24): [True: 2, False: 908]
  ------------------
 1394|      2|                const ptrdiff_t uv_dstoff = 4 * ((t->bx >> ss_hor) +
 1395|      2|                                              (t->by >> ss_ver) * PXSTRIDE(f->cur.stride[1]));
  ------------------
  |  |   53|      2|#define PXSTRIDE(x) (x)
  ------------------
 1396|      2|                const pixel (*pal)[8];
 1397|      2|                const uint8_t *pal_idx;
 1398|      2|                if (t->frame_thread.pass) {
  ------------------
  |  Branch (1398:21): [True: 2, False: 0]
  ------------------
 1399|      2|                    const int p = t->frame_thread.pass & 1;
 1400|      2|                    assert(ts->frame_thread[p].pal_idx);
  ------------------
  |  |  140|      2|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2]
  |  |  |  Branch (140:68): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1401|      2|                    pal = f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 1402|      2|                                              ((t->bx >> 1) + (t->by & 1))];
 1403|      2|                    pal_idx = ts->frame_thread[p].pal_idx;
 1404|      2|                    ts->frame_thread[p].pal_idx += cbw4 * cbh4 * 8;
 1405|      2|                } else {
 1406|      0|                    pal = bytefn(t->scratch.pal);
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1407|      0|                    pal_idx = t->scratch.pal_idx_uv;
 1408|      0|                }
 1409|       |
 1410|      2|                f->dsp->ipred.pal_pred(((pixel *) f->cur.data[1]) + uv_dstoff,
 1411|      2|                                       f->cur.stride[1], pal[1],
 1412|      2|                                       pal_idx, cbw4 * 4, cbh4 * 4);
 1413|      2|                f->dsp->ipred.pal_pred(((pixel *) f->cur.data[2]) + uv_dstoff,
 1414|      2|                                       f->cur.stride[1], pal[2],
 1415|      2|                                       pal_idx, cbw4 * 4, cbh4 * 4);
 1416|      2|                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   34|      2|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2]
  |  |  ------------------
  |  |   35|      2|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      2|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1417|      0|                    hex_dump(((pixel *) f->cur.data[1]) + uv_dstoff,
 1418|      0|                             PXSTRIDE(f->cur.stride[1]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1419|      0|                             cbw4 * 4, cbh4 * 4, "u-pal-pred");
 1420|      0|                    hex_dump(((pixel *) f->cur.data[2]) + uv_dstoff,
 1421|      0|                             PXSTRIDE(f->cur.stride[1]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1422|      0|                             cbw4 * 4, cbh4 * 4, "v-pal-pred");
 1423|      0|                }
 1424|      2|            }
 1425|       |
 1426|  1.13k|            const int sm_uv_fl = sm_uv_flag(t->a, cbx4) |
 1427|  1.13k|                                 sm_uv_flag(&t->l, cby4);
 1428|  1.13k|            const int uv_sb_has_tr =
 1429|  1.13k|                ((init_x + 16) >> ss_hor) < cw4 ? 1 : init_y ? 0 :
  ------------------
  |  Branch (1429:17): [True: 48, False: 1.08k]
  |  Branch (1429:55): [True: 24, False: 1.06k]
  ------------------
 1430|  1.08k|                intra_edge_flags & (EDGE_I420_TOP_HAS_RIGHT >> (f->cur.p.layout - 1));
 1431|  1.13k|            const int uv_sb_has_bl =
 1432|  1.13k|                init_x ? 0 : ((init_y + 16) >> ss_ver) < ch4 ? 1 :
  ------------------
  |  Branch (1432:17): [True: 48, False: 1.08k]
  |  Branch (1432:30): [True: 24, False: 1.06k]
  ------------------
 1433|  1.08k|                intra_edge_flags & (EDGE_I420_LEFT_HAS_BOTTOM >> (f->cur.p.layout - 1));
 1434|  1.13k|            const int sub_cw4 = imin(cw4, (init_x + 16) >> ss_hor);
 1435|  3.39k|            for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1435:30): [True: 2.26k, False: 1.13k]
  ------------------
 1436|  4.52k|                for (y = init_y >> ss_ver, t->by += init_y; y < sub_ch4;
  ------------------
  |  Branch (1436:61): [True: 2.26k, False: 2.26k]
  ------------------
 1437|  2.26k|                     y += uv_t_dim->h, t->by += uv_t_dim->h << ss_ver)
 1438|  2.26k|                {
 1439|  2.26k|                    pixel *dst = ((pixel *) f->cur.data[1 + pl]) +
 1440|  2.26k|                                   4 * ((t->by >> ss_ver) * PXSTRIDE(stride) +
  ------------------
  |  |   53|  2.26k|#define PXSTRIDE(x) (x)
  ------------------
 1441|  2.26k|                                        ((t->bx + init_x) >> ss_hor));
 1442|  4.52k|                    for (x = init_x >> ss_hor, t->bx += init_x; x < sub_cw4;
  ------------------
  |  Branch (1442:65): [True: 2.26k, False: 2.26k]
  ------------------
 1443|  2.26k|                         x += uv_t_dim->w, t->bx += uv_t_dim->w << ss_hor)
 1444|  2.26k|                    {
 1445|  2.26k|                        if ((b->uv_mode == CFL_PRED && b->cfl_alpha[pl]) ||
  ------------------
  |  Branch (1445:30): [True: 444, False: 1.82k]
  |  Branch (1445:56): [True: 366, False: 78]
  ------------------
 1446|  1.89k|                            b->pal_sz[1])
  ------------------
  |  Branch (1446:29): [True: 4, False: 1.89k]
  ------------------
 1447|    370|                        {
 1448|    370|                            goto skip_uv_pred;
 1449|    370|                        }
 1450|       |
 1451|  1.89k|                        int angle = b->uv_angle;
 1452|       |                        // this probably looks weird because we're using
 1453|       |                        // luma flags in a chroma loop, but that's because
 1454|       |                        // prepare_intra_edges() expects luma flags as input
 1455|  1.89k|                        const enum EdgeFlags edge_flags =
 1456|  1.89k|                            (((y > (init_y >> ss_ver) || !uv_sb_has_tr) &&
  ------------------
  |  Branch (1456:32): [True: 0, False: 1.89k]
  |  Branch (1456:58): [True: 710, False: 1.18k]
  ------------------
 1457|    710|                              (x + uv_t_dim->w >= sub_cw4)) ?
  ------------------
  |  Branch (1457:31): [True: 710, False: 0]
  ------------------
 1458|  1.18k|                                 0 : EDGE_I444_TOP_HAS_RIGHT) |
 1459|  1.89k|                            ((x > (init_x >> ss_hor) ||
  ------------------
  |  Branch (1459:31): [True: 0, False: 1.89k]
  ------------------
 1460|  1.89k|                              (!uv_sb_has_bl && y + uv_t_dim->h >= sub_ch4)) ?
  ------------------
  |  Branch (1460:32): [True: 1.18k, False: 712]
  |  Branch (1460:49): [True: 1.18k, False: 0]
  ------------------
 1461|  1.18k|                                 0 : EDGE_I444_LEFT_HAS_BOTTOM);
 1462|  1.89k|                        const pixel *top_sb_edge = NULL;
 1463|  1.89k|                        if (!((t->by & ~ss_ver) & (f->sb_step - 1))) {
  ------------------
  |  Branch (1463:29): [True: 484, False: 1.41k]
  ------------------
 1464|    484|                            top_sb_edge = f->ipred_edge[1 + pl];
 1465|    484|                            const int sby = t->by >> f->sb_shift;
 1466|    484|                            top_sb_edge += f->sb128w * 128 * (sby - 1);
 1467|    484|                        }
 1468|  1.89k|                        const enum IntraPredMode uv_mode =
 1469|  1.89k|                             b->uv_mode == CFL_PRED ? DC_PRED : b->uv_mode;
  ------------------
  |  Branch (1469:30): [True: 78, False: 1.81k]
  ------------------
 1470|  1.89k|                        const int xpos = t->bx >> ss_hor, ypos = t->by >> ss_ver;
 1471|  1.89k|                        const int xstart = ts->tiling.col_start >> ss_hor;
 1472|  1.89k|                        const int ystart = ts->tiling.row_start >> ss_ver;
 1473|  1.89k|                        const enum IntraPredMode m =
 1474|  1.89k|                            bytefn(dav1d_prepare_intra_edges)(xpos, xpos > xstart,
  ------------------
  |  |   87|  1.89k|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|  1.89k|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1475|  1.89k|                                                              ypos, ypos > ystart,
 1476|  1.89k|                                                              ts->tiling.col_end >> ss_hor,
 1477|  1.89k|                                                              ts->tiling.row_end >> ss_ver,
 1478|  1.89k|                                                              edge_flags, dst, stride,
 1479|  1.89k|                                                              top_sb_edge, uv_mode,
 1480|  1.89k|                                                              &angle, uv_t_dim->w,
 1481|  1.89k|                                                              uv_t_dim->h,
 1482|  1.89k|                                                              f->seq_hdr->intra_edge_filter,
 1483|  1.89k|                                                              edge HIGHBD_CALL_SUFFIX);
 1484|  1.89k|                        angle |= intra_edge_filter_flag;
 1485|  1.89k|                        dsp->ipred.intra_pred[m](dst, stride, edge,
 1486|  1.89k|                                                 uv_t_dim->w * 4,
 1487|  1.89k|                                                 uv_t_dim->h * 4,
 1488|  1.89k|                                                 angle | sm_uv_fl,
 1489|  1.89k|                                                 (4 * f->bw + ss_hor -
 1490|  1.89k|                                                  4 * (t->bx & ~ss_hor)) >> ss_hor,
 1491|  1.89k|                                                 (4 * f->bh + ss_ver -
 1492|  1.89k|                                                  4 * (t->by & ~ss_ver)) >> ss_ver
 1493|  1.89k|                                                 HIGHBD_CALL_SUFFIX);
 1494|  1.89k|                        if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   34|  1.89k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 1.89k]
  |  |  ------------------
  |  |   35|  1.89k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  1.89k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                      if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1495|      0|                            hex_dump(edge - uv_t_dim->h * 4, uv_t_dim->h * 4,
 1496|      0|                                     uv_t_dim->h * 4, 2, "l");
 1497|      0|                            hex_dump(edge, 0, 1, 1, "tl");
 1498|      0|                            hex_dump(edge + 1, uv_t_dim->w * 4,
 1499|      0|                                     uv_t_dim->w * 4, 2, "t");
 1500|      0|                            hex_dump(dst, stride, uv_t_dim->w * 4,
 1501|      0|                                     uv_t_dim->h * 4, pl ? "v-intra-pred" : "u-intra-pred");
  ------------------
  |  Branch (1501:55): [True: 0, False: 0]
  ------------------
 1502|      0|                        }
 1503|       |
 1504|  2.26k|                    skip_uv_pred: {}
 1505|  2.26k|                        if (!b->skip) {
  ------------------
  |  Branch (1505:29): [True: 1.96k, False: 300]
  ------------------
 1506|  1.96k|                            enum TxfmType txtp;
 1507|  1.96k|                            int eob;
 1508|  1.96k|                            coef *cf;
 1509|  1.96k|                            if (t->frame_thread.pass) {
  ------------------
  |  Branch (1509:33): [True: 1.96k, False: 0]
  ------------------
 1510|  1.96k|                                const int p = t->frame_thread.pass & 1;
 1511|  1.96k|                                const int cbi = *ts->frame_thread[p].cbi++;
 1512|  1.96k|                                cf = ts->frame_thread[p].cf;
 1513|  1.96k|                                ts->frame_thread[p].cf += uv_t_dim->w * uv_t_dim->h * 16;
 1514|  1.96k|                                eob  = cbi >> 5;
 1515|  1.96k|                                txtp = cbi & 0x1f;
 1516|  1.96k|                            } else {
 1517|      0|                                uint8_t cf_ctx;
 1518|      0|                                cf = bitfn(t->cf);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1519|      0|                                eob = decode_coefs(t, &t->a->ccoef[pl][cbx4 + x],
 1520|      0|                                                   &t->l.ccoef[pl][cby4 + y],
 1521|      0|                                                   b->uvtx, bs, b, 1, 1 + pl, cf,
 1522|      0|                                                   &txtp, &cf_ctx);
 1523|      0|                                if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1524|      0|                                    printf("Post-uv-cf-blk[pl=%d,tx=%d,"
 1525|      0|                                           "txtp=%d,eob=%d]: r=%d [x=%d,cbx4=%d]\n",
 1526|      0|                                           pl, b->uvtx, txtp, eob, ts->msac.rng, x, cbx4);
 1527|      0|                                int ctw = imin(uv_t_dim->w, (f->bw - t->bx + ss_hor) >> ss_hor);
 1528|      0|                                int cth = imin(uv_t_dim->h, (f->bh - t->by + ss_ver) >> ss_ver);
 1529|      0|                                dav1d_memset_likely_pow2(&t->a->ccoef[pl][cbx4 + x], cf_ctx, ctw);
 1530|      0|                                dav1d_memset_likely_pow2(&t->l.ccoef[pl][cby4 + y], cf_ctx, cth);
 1531|      0|                            }
 1532|  1.96k|                            if (eob >= 0) {
  ------------------
  |  Branch (1532:33): [True: 338, False: 1.62k]
  ------------------
 1533|    338|                                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|    338|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 338]
  |  |  ------------------
  |  |   35|    338|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    338|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1534|      0|                                    coef_dump(cf, uv_t_dim->h * 4,
 1535|      0|                                              uv_t_dim->w * 4, 3, "dq");
 1536|    338|                                dsp->itx.itxfm_add[b->uvtx]
 1537|    338|                                                  [txtp](dst, stride,
 1538|    338|                                                         cf, eob HIGHBD_CALL_SUFFIX);
 1539|    338|                                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|    338|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 338]
  |  |  ------------------
  |  |   35|    338|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    338|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1540|      0|                                    hex_dump(dst, stride, uv_t_dim->w * 4,
 1541|      0|                                             uv_t_dim->h * 4, "recon");
 1542|    338|                            }
 1543|  1.96k|                        } else if (!t->frame_thread.pass) {
  ------------------
  |  Branch (1543:36): [True: 0, False: 300]
  ------------------
 1544|      0|                            dav1d_memset_pow2[uv_t_dim->lw](&t->a->ccoef[pl][cbx4 + x], 0x40);
 1545|      0|                            dav1d_memset_pow2[uv_t_dim->lh](&t->l.ccoef[pl][cby4 + y], 0x40);
 1546|      0|                        }
 1547|  2.26k|                        dst += uv_t_dim->w * 4;
 1548|  2.26k|                    }
 1549|  2.26k|                    t->bx -= x << ss_hor;
 1550|  2.26k|                }
 1551|  2.26k|                t->by -= y << ss_ver;
 1552|  2.26k|            }
 1553|  1.13k|        }
 1554|  1.37k|    }
 1555|  1.35k|}
dav1d_recon_b_inter_8bpc:
 1559|    116|{
 1560|    116|    Dav1dTileState *const ts = t->ts;
 1561|    116|    const Dav1dFrameContext *const f = t->f;
 1562|    116|    const Dav1dDSPContext *const dsp = f->dsp;
 1563|    116|    const int bx4 = t->bx & 31, by4 = t->by & 31;
 1564|    116|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 1565|    116|    const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
 1566|    116|    const int cbx4 = bx4 >> ss_hor, cby4 = by4 >> ss_ver;
 1567|    116|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
 1568|    116|    const int bw4 = b_dim[0], bh4 = b_dim[1];
 1569|    116|    const int w4 = imin(bw4, f->bw - t->bx), h4 = imin(bh4, f->bh - t->by);
 1570|    116|    const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400 &&
  ------------------
  |  Branch (1570:28): [True: 116, False: 0]
  ------------------
 1571|    116|                           (bw4 > ss_hor || t->bx & 1) &&
  ------------------
  |  Branch (1571:29): [True: 96, False: 20]
  |  Branch (1571:45): [True: 14, False: 6]
  ------------------
 1572|    110|                           (bh4 > ss_ver || t->by & 1);
  ------------------
  |  Branch (1572:29): [True: 88, False: 22]
  |  Branch (1572:45): [True: 14, False: 8]
  ------------------
 1573|    116|    const int chr_layout_idx = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I400 ? 0 :
  ------------------
  |  Branch (1573:32): [True: 0, False: 116]
  ------------------
 1574|    116|                               DAV1D_PIXEL_LAYOUT_I444 - f->cur.p.layout;
 1575|    116|    int res;
 1576|       |
 1577|       |    // prediction
 1578|    116|    const int cbh4 = (bh4 + ss_ver) >> ss_ver, cbw4 = (bw4 + ss_hor) >> ss_hor;
 1579|    116|    pixel *dst = ((pixel *) f->cur.data[0]) +
 1580|    116|        4 * (t->by * PXSTRIDE(f->cur.stride[0]) + t->bx);
  ------------------
  |  |   53|    116|#define PXSTRIDE(x) (x)
  ------------------
 1581|    116|    const ptrdiff_t uvdstoff =
 1582|    116|        4 * ((t->bx >> ss_hor) + (t->by >> ss_ver) * PXSTRIDE(f->cur.stride[1]));
  ------------------
  |  |   53|    116|#define PXSTRIDE(x) (x)
  ------------------
 1583|    116|    if (IS_KEY_OR_INTRA(f->frame_hdr)) {
  ------------------
  |  |   43|    116|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|    116|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  |  |  |  Branch (43:5): [True: 116, False: 0]
  |  |  ------------------
  ------------------
 1584|       |        // intrabc
 1585|    116|        assert(!f->frame_hdr->super_res.enabled);
  ------------------
  |  |  140|    116|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 116]
  |  |  |  Branch (140:68): [Folded, False: 116]
  |  |  ------------------
  ------------------
 1586|    116|        res = mc(t, dst, NULL, f->cur.stride[0], bw4, bh4, t->bx, t->by, 0,
 1587|    116|                 b->mv[0], &f->sr_cur, 0 /* unused */, FILTER_2D_BILINEAR);
 1588|    116|        if (res) return res;
  ------------------
  |  Branch (1588:13): [True: 0, False: 116]
  ------------------
 1589|    306|        if (has_chroma) for (int pl = 1; pl < 3; pl++) {
  ------------------
  |  Branch (1589:13): [True: 102, False: 14]
  |  Branch (1589:42): [True: 204, False: 102]
  ------------------
 1590|    204|            res = mc(t, ((pixel *)f->cur.data[pl]) + uvdstoff, NULL, f->cur.stride[1],
 1591|    204|                     bw4 << (bw4 == ss_hor), bh4 << (bh4 == ss_ver),
 1592|    204|                     t->bx & ~ss_hor, t->by & ~ss_ver, pl, b->mv[0],
 1593|    204|                     &f->sr_cur, 0 /* unused */, FILTER_2D_BILINEAR);
 1594|    204|            if (res) return res;
  ------------------
  |  Branch (1594:17): [True: 0, False: 204]
  ------------------
 1595|    204|        }
 1596|    116|    } else if (b->comp_type == COMP_INTER_NONE) {
  ------------------
  |  Branch (1596:16): [True: 0, False: 0]
  ------------------
 1597|      0|        const Dav1dThreadPicture *const refp = &f->refp[b->ref[0]];
 1598|      0|        const enum Filter2d filter_2d = b->filter2d;
 1599|       |
 1600|      0|        if (imin(bw4, bh4) > 1 &&
  ------------------
  |  Branch (1600:13): [True: 0, False: 0]
  ------------------
 1601|      0|            ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) ||
  ------------------
  |  Branch (1601:15): [True: 0, False: 0]
  |  Branch (1601:44): [True: 0, False: 0]
  ------------------
 1602|      0|             (b->motion_mode == MM_WARP && t->warpmv.type > DAV1D_WM_TYPE_TRANSLATION)))
  ------------------
  |  Branch (1602:15): [True: 0, False: 0]
  |  Branch (1602:44): [True: 0, False: 0]
  ------------------
 1603|      0|        {
 1604|      0|            res = warp_affine(t, dst, NULL, f->cur.stride[0], b_dim, 0, refp,
 1605|      0|                              b->motion_mode == MM_WARP ? &t->warpmv :
  ------------------
  |  Branch (1605:31): [True: 0, False: 0]
  ------------------
 1606|      0|                                  &f->frame_hdr->gmv[b->ref[0]]);
 1607|      0|            if (res) return res;
  ------------------
  |  Branch (1607:17): [True: 0, False: 0]
  ------------------
 1608|      0|        } else {
 1609|      0|            res = mc(t, dst, NULL, f->cur.stride[0],
 1610|      0|                     bw4, bh4, t->bx, t->by, 0, b->mv[0], refp, b->ref[0], filter_2d);
 1611|      0|            if (res) return res;
  ------------------
  |  Branch (1611:17): [True: 0, False: 0]
  ------------------
 1612|      0|            if (b->motion_mode == MM_OBMC) {
  ------------------
  |  Branch (1612:17): [True: 0, False: 0]
  ------------------
 1613|      0|                res = obmc(t, dst, f->cur.stride[0], b_dim, 0, bx4, by4, w4, h4);
 1614|      0|                if (res) return res;
  ------------------
  |  Branch (1614:21): [True: 0, False: 0]
  ------------------
 1615|      0|            }
 1616|      0|        }
 1617|      0|        if (b->interintra_type) {
  ------------------
  |  Branch (1617:13): [True: 0, False: 0]
  ------------------
 1618|      0|            pixel *const tl_edge = bitfn(t->scratch.edge) + 32;
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1619|      0|            enum IntraPredMode m = b->interintra_mode == II_SMOOTH_PRED ?
  ------------------
  |  Branch (1619:36): [True: 0, False: 0]
  ------------------
 1620|      0|                                   SMOOTH_PRED : b->interintra_mode;
 1621|      0|            pixel *const tmp = bitfn(t->scratch.interintra);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1622|      0|            int angle = 0;
 1623|      0|            const pixel *top_sb_edge = NULL;
 1624|      0|            if (!(t->by & (f->sb_step - 1))) {
  ------------------
  |  Branch (1624:17): [True: 0, False: 0]
  ------------------
 1625|      0|                top_sb_edge = f->ipred_edge[0];
 1626|      0|                const int sby = t->by >> f->sb_shift;
 1627|      0|                top_sb_edge += f->sb128w * 128 * (sby - 1);
 1628|      0|            }
 1629|      0|            m = bytefn(dav1d_prepare_intra_edges)(t->bx, t->bx > ts->tiling.col_start,
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1630|      0|                                                  t->by, t->by > ts->tiling.row_start,
 1631|      0|                                                  ts->tiling.col_end, ts->tiling.row_end,
 1632|      0|                                                  0, dst, f->cur.stride[0], top_sb_edge,
 1633|      0|                                                  m, &angle, bw4, bh4, 0, tl_edge
 1634|      0|                                                  HIGHBD_CALL_SUFFIX);
 1635|      0|            dsp->ipred.intra_pred[m](tmp, 4 * bw4 * sizeof(pixel),
 1636|      0|                                     tl_edge, bw4 * 4, bh4 * 4, 0, 0, 0
 1637|      0|                                     HIGHBD_CALL_SUFFIX);
 1638|      0|            dsp->mc.blend(dst, f->cur.stride[0], tmp,
 1639|      0|                          bw4 * 4, bh4 * 4, II_MASK(0, bs, b));
  ------------------
  |  |   83|      0|    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
  |  |   84|      0|    (size_t)((b)->interintra_type == INTER_INTRA_BLEND ? \
  |  |  ------------------
  |  |  |  Branch (84:14): [True: 0, False: 0]
  |  |  ------------------
  |  |   85|      0|    dav1d_masks.offsets[c][(bs)-BS_32x32].ii[(b)->interintra_mode] : \
  |  |   86|      0|    dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[0][(b)->wedge_idx]) * 8))
  ------------------
 1640|      0|        }
 1641|       |
 1642|      0|        if (!has_chroma) goto skip_inter_chroma_pred;
  ------------------
  |  Branch (1642:13): [True: 0, False: 0]
  ------------------
 1643|       |
 1644|       |        // sub8x8 derivation
 1645|      0|        int is_sub8x8 = bw4 == ss_hor || bh4 == ss_ver;
  ------------------
  |  Branch (1645:25): [True: 0, False: 0]
  |  Branch (1645:42): [True: 0, False: 0]
  ------------------
 1646|      0|        refmvs_block *const *r;
 1647|      0|        if (is_sub8x8) {
  ------------------
  |  Branch (1647:13): [True: 0, False: 0]
  ------------------
 1648|      0|            assert(ss_hor == 1);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1649|      0|            r = &t->rt.r[(t->by & 31) + 5];
 1650|      0|            if (bw4 == 1) is_sub8x8 &= r[0][t->bx - 1].ref.ref[0] > 0;
  ------------------
  |  Branch (1650:17): [True: 0, False: 0]
  ------------------
 1651|      0|            if (bh4 == ss_ver) is_sub8x8 &= r[-1][t->bx].ref.ref[0] > 0;
  ------------------
  |  Branch (1651:17): [True: 0, False: 0]
  ------------------
 1652|      0|            if (bw4 == 1 && bh4 == ss_ver)
  ------------------
  |  Branch (1652:17): [True: 0, False: 0]
  |  Branch (1652:29): [True: 0, False: 0]
  ------------------
 1653|      0|                is_sub8x8 &= r[-1][t->bx - 1].ref.ref[0] > 0;
 1654|      0|        }
 1655|       |
 1656|       |        // chroma prediction
 1657|      0|        if (is_sub8x8) {
  ------------------
  |  Branch (1657:13): [True: 0, False: 0]
  ------------------
 1658|      0|            assert(ss_hor == 1);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1659|      0|            ptrdiff_t h_off = 0, v_off = 0;
 1660|      0|            if (bw4 == 1 && bh4 == ss_ver) {
  ------------------
  |  Branch (1660:17): [True: 0, False: 0]
  |  Branch (1660:29): [True: 0, False: 0]
  ------------------
 1661|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1661:34): [True: 0, False: 0]
  ------------------
 1662|      0|                    res = mc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff,
 1663|      0|                             NULL, f->cur.stride[1],
 1664|      0|                             bw4, bh4, t->bx - 1, t->by - 1, 1 + pl,
 1665|      0|                             r[-1][t->bx - 1].mv.mv[0],
 1666|      0|                             &f->refp[r[-1][t->bx - 1].ref.ref[0] - 1],
 1667|      0|                             r[-1][t->bx - 1].ref.ref[0] - 1,
 1668|      0|                             t->frame_thread.pass != 2 ? t->tl_4x4_filter :
  ------------------
  |  Branch (1668:30): [True: 0, False: 0]
  ------------------
 1669|      0|                                 f->frame_thread.b[((t->by - 1) * f->b4_stride) + t->bx - 1].filter2d);
 1670|      0|                    if (res) return res;
  ------------------
  |  Branch (1670:25): [True: 0, False: 0]
  ------------------
 1671|      0|                }
 1672|      0|                v_off = 2 * PXSTRIDE(f->cur.stride[1]);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1673|      0|                h_off = 2;
 1674|      0|            }
 1675|      0|            if (bw4 == 1) {
  ------------------
  |  Branch (1675:17): [True: 0, False: 0]
  ------------------
 1676|      0|                const enum Filter2d left_filter_2d =
 1677|      0|                    dav1d_filter_2d[t->l.filter[1][by4]][t->l.filter[0][by4]];
 1678|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1678:34): [True: 0, False: 0]
  ------------------
 1679|      0|                    res = mc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff + v_off, NULL,
 1680|      0|                             f->cur.stride[1], bw4, bh4, t->bx - 1,
 1681|      0|                             t->by, 1 + pl, r[0][t->bx - 1].mv.mv[0],
 1682|      0|                             &f->refp[r[0][t->bx - 1].ref.ref[0] - 1],
 1683|      0|                             r[0][t->bx - 1].ref.ref[0] - 1,
 1684|      0|                             t->frame_thread.pass != 2 ? left_filter_2d :
  ------------------
  |  Branch (1684:30): [True: 0, False: 0]
  ------------------
 1685|      0|                                 f->frame_thread.b[(t->by * f->b4_stride) + t->bx - 1].filter2d);
 1686|      0|                    if (res) return res;
  ------------------
  |  Branch (1686:25): [True: 0, False: 0]
  ------------------
 1687|      0|                }
 1688|      0|                h_off = 2;
 1689|      0|            }
 1690|      0|            if (bh4 == ss_ver) {
  ------------------
  |  Branch (1690:17): [True: 0, False: 0]
  ------------------
 1691|      0|                const enum Filter2d top_filter_2d =
 1692|      0|                    dav1d_filter_2d[t->a->filter[1][bx4]][t->a->filter[0][bx4]];
 1693|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1693:34): [True: 0, False: 0]
  ------------------
 1694|      0|                    res = mc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff + h_off, NULL,
 1695|      0|                             f->cur.stride[1], bw4, bh4, t->bx, t->by - 1,
 1696|      0|                             1 + pl, r[-1][t->bx].mv.mv[0],
 1697|      0|                             &f->refp[r[-1][t->bx].ref.ref[0] - 1],
 1698|      0|                             r[-1][t->bx].ref.ref[0] - 1,
 1699|      0|                             t->frame_thread.pass != 2 ? top_filter_2d :
  ------------------
  |  Branch (1699:30): [True: 0, False: 0]
  ------------------
 1700|      0|                                 f->frame_thread.b[((t->by - 1) * f->b4_stride) + t->bx].filter2d);
 1701|      0|                    if (res) return res;
  ------------------
  |  Branch (1701:25): [True: 0, False: 0]
  ------------------
 1702|      0|                }
 1703|      0|                v_off = 2 * PXSTRIDE(f->cur.stride[1]);
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1704|      0|            }
 1705|      0|            for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1705:30): [True: 0, False: 0]
  ------------------
 1706|      0|                res = mc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff + h_off + v_off, NULL, f->cur.stride[1],
 1707|      0|                         bw4, bh4, t->bx, t->by, 1 + pl, b->mv[0],
 1708|      0|                         refp, b->ref[0], filter_2d);
 1709|      0|                if (res) return res;
  ------------------
  |  Branch (1709:21): [True: 0, False: 0]
  ------------------
 1710|      0|            }
 1711|      0|        } else {
 1712|      0|            if (imin(cbw4, cbh4) > 1 &&
  ------------------
  |  Branch (1712:17): [True: 0, False: 0]
  ------------------
 1713|      0|                ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) ||
  ------------------
  |  Branch (1713:19): [True: 0, False: 0]
  |  Branch (1713:48): [True: 0, False: 0]
  ------------------
 1714|      0|                 (b->motion_mode == MM_WARP && t->warpmv.type > DAV1D_WM_TYPE_TRANSLATION)))
  ------------------
  |  Branch (1714:19): [True: 0, False: 0]
  |  Branch (1714:48): [True: 0, False: 0]
  ------------------
 1715|      0|            {
 1716|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1716:34): [True: 0, False: 0]
  ------------------
 1717|      0|                    res = warp_affine(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff, NULL,
 1718|      0|                                      f->cur.stride[1], b_dim, 1 + pl, refp,
 1719|      0|                                      b->motion_mode == MM_WARP ? &t->warpmv :
  ------------------
  |  Branch (1719:39): [True: 0, False: 0]
  ------------------
 1720|      0|                                          &f->frame_hdr->gmv[b->ref[0]]);
 1721|      0|                    if (res) return res;
  ------------------
  |  Branch (1721:25): [True: 0, False: 0]
  ------------------
 1722|      0|                }
 1723|      0|            } else {
 1724|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1724:34): [True: 0, False: 0]
  ------------------
 1725|      0|                    res = mc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff,
 1726|      0|                             NULL, f->cur.stride[1],
 1727|      0|                             bw4 << (bw4 == ss_hor), bh4 << (bh4 == ss_ver),
 1728|      0|                             t->bx & ~ss_hor, t->by & ~ss_ver,
 1729|      0|                             1 + pl, b->mv[0], refp, b->ref[0], filter_2d);
 1730|      0|                    if (res) return res;
  ------------------
  |  Branch (1730:25): [True: 0, False: 0]
  ------------------
 1731|      0|                    if (b->motion_mode == MM_OBMC) {
  ------------------
  |  Branch (1731:25): [True: 0, False: 0]
  ------------------
 1732|      0|                        res = obmc(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff,
 1733|      0|                                   f->cur.stride[1], b_dim, 1 + pl, bx4, by4, w4, h4);
 1734|      0|                        if (res) return res;
  ------------------
  |  Branch (1734:29): [True: 0, False: 0]
  ------------------
 1735|      0|                    }
 1736|      0|                }
 1737|      0|            }
 1738|      0|            if (b->interintra_type) {
  ------------------
  |  Branch (1738:17): [True: 0, False: 0]
  ------------------
 1739|       |                // FIXME for 8x32 with 4:2:2 subsampling, this probably does
 1740|       |                // the wrong thing since it will select 4x16, not 4x32, as a
 1741|       |                // transform size...
 1742|      0|                const uint8_t *const ii_mask = II_MASK(chr_layout_idx, bs, b);
  ------------------
  |  |   83|      0|    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
  |  |   84|      0|    (size_t)((b)->interintra_type == INTER_INTRA_BLEND ? \
  |  |  ------------------
  |  |  |  Branch (84:14): [True: 0, False: 0]
  |  |  ------------------
  |  |   85|      0|    dav1d_masks.offsets[c][(bs)-BS_32x32].ii[(b)->interintra_mode] : \
  |  |   86|      0|    dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[0][(b)->wedge_idx]) * 8))
  ------------------
 1743|       |
 1744|      0|                for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1744:34): [True: 0, False: 0]
  ------------------
 1745|      0|                    pixel *const tmp = bitfn(t->scratch.interintra);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1746|      0|                    pixel *const tl_edge = bitfn(t->scratch.edge) + 32;
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1747|      0|                    enum IntraPredMode m =
 1748|      0|                        b->interintra_mode == II_SMOOTH_PRED ?
  ------------------
  |  Branch (1748:25): [True: 0, False: 0]
  ------------------
 1749|      0|                        SMOOTH_PRED : b->interintra_mode;
 1750|      0|                    int angle = 0;
 1751|      0|                    pixel *const uvdst = ((pixel *) f->cur.data[1 + pl]) + uvdstoff;
 1752|      0|                    const pixel *top_sb_edge = NULL;
 1753|      0|                    if (!(t->by & (f->sb_step - 1))) {
  ------------------
  |  Branch (1753:25): [True: 0, False: 0]
  ------------------
 1754|      0|                        top_sb_edge = f->ipred_edge[pl + 1];
 1755|      0|                        const int sby = t->by >> f->sb_shift;
 1756|      0|                        top_sb_edge += f->sb128w * 128 * (sby - 1);
 1757|      0|                    }
 1758|      0|                    m = bytefn(dav1d_prepare_intra_edges)(t->bx >> ss_hor,
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 1759|      0|                                                          (t->bx >> ss_hor) >
 1760|      0|                                                              (ts->tiling.col_start >> ss_hor),
 1761|      0|                                                          t->by >> ss_ver,
 1762|      0|                                                          (t->by >> ss_ver) >
 1763|      0|                                                              (ts->tiling.row_start >> ss_ver),
 1764|      0|                                                          ts->tiling.col_end >> ss_hor,
 1765|      0|                                                          ts->tiling.row_end >> ss_ver,
 1766|      0|                                                          0, uvdst, f->cur.stride[1],
 1767|      0|                                                          top_sb_edge, m,
 1768|      0|                                                          &angle, cbw4, cbh4, 0, tl_edge
 1769|      0|                                                          HIGHBD_CALL_SUFFIX);
 1770|      0|                    dsp->ipred.intra_pred[m](tmp, cbw4 * 4 * sizeof(pixel),
 1771|      0|                                             tl_edge, cbw4 * 4, cbh4 * 4, 0, 0, 0
 1772|      0|                                             HIGHBD_CALL_SUFFIX);
 1773|      0|                    dsp->mc.blend(uvdst, f->cur.stride[1], tmp,
 1774|      0|                                  cbw4 * 4, cbh4 * 4, ii_mask);
 1775|      0|                }
 1776|      0|            }
 1777|      0|        }
 1778|       |
 1779|      0|    skip_inter_chroma_pred: {}
 1780|      0|        t->tl_4x4_filter = filter_2d;
 1781|      0|    } else {
 1782|      0|        const enum Filter2d filter_2d = b->filter2d;
 1783|       |        // Maximum super block size is 128x128
 1784|      0|        int16_t (*tmp)[128 * 128] = t->scratch.compinter;
 1785|      0|        int jnt_weight;
 1786|      0|        uint8_t *const seg_mask = t->scratch.seg_mask;
 1787|      0|        const uint8_t *mask;
 1788|       |
 1789|      0|        for (int i = 0; i < 2; i++) {
  ------------------
  |  Branch (1789:25): [True: 0, False: 0]
  ------------------
 1790|      0|            const Dav1dThreadPicture *const refp = &f->refp[b->ref[i]];
 1791|       |
 1792|      0|            if (b->inter_mode == GLOBALMV_GLOBALMV && f->gmv_warp_allowed[b->ref[i]]) {
  ------------------
  |  Branch (1792:17): [True: 0, False: 0]
  |  Branch (1792:55): [True: 0, False: 0]
  ------------------
 1793|      0|                res = warp_affine(t, NULL, tmp[i], bw4 * 4, b_dim, 0, refp,
 1794|      0|                                  &f->frame_hdr->gmv[b->ref[i]]);
 1795|      0|                if (res) return res;
  ------------------
  |  Branch (1795:21): [True: 0, False: 0]
  ------------------
 1796|      0|            } else {
 1797|      0|                res = mc(t, NULL, tmp[i], 0, bw4, bh4, t->bx, t->by, 0,
 1798|      0|                         b->mv[i], refp, b->ref[i], filter_2d);
 1799|      0|                if (res) return res;
  ------------------
  |  Branch (1799:21): [True: 0, False: 0]
  ------------------
 1800|      0|            }
 1801|      0|        }
 1802|      0|        switch (b->comp_type) {
  ------------------
  |  Branch (1802:17): [True: 0, False: 0]
  ------------------
 1803|      0|        case COMP_INTER_AVG:
  ------------------
  |  Branch (1803:9): [True: 0, False: 0]
  ------------------
 1804|      0|            dsp->mc.avg(dst, f->cur.stride[0], tmp[0], tmp[1],
 1805|      0|                        bw4 * 4, bh4 * 4 HIGHBD_CALL_SUFFIX);
 1806|      0|            break;
 1807|      0|        case COMP_INTER_WEIGHTED_AVG:
  ------------------
  |  Branch (1807:9): [True: 0, False: 0]
  ------------------
 1808|      0|            jnt_weight = f->jnt_weights[b->ref[0]][b->ref[1]];
 1809|      0|            dsp->mc.w_avg(dst, f->cur.stride[0], tmp[0], tmp[1],
 1810|      0|                          bw4 * 4, bh4 * 4, jnt_weight HIGHBD_CALL_SUFFIX);
 1811|      0|            break;
 1812|      0|        case COMP_INTER_SEG:
  ------------------
  |  Branch (1812:9): [True: 0, False: 0]
  ------------------
 1813|      0|            dsp->mc.w_mask[chr_layout_idx](dst, f->cur.stride[0],
 1814|      0|                                           tmp[b->mask_sign], tmp[!b->mask_sign],
 1815|      0|                                           bw4 * 4, bh4 * 4, seg_mask,
 1816|      0|                                           b->mask_sign HIGHBD_CALL_SUFFIX);
 1817|      0|            mask = seg_mask;
 1818|      0|            break;
 1819|      0|        case COMP_INTER_WEDGE:
  ------------------
  |  Branch (1819:9): [True: 0, False: 0]
  ------------------
 1820|      0|            mask = WEDGE_MASK(0, bs, 0, b->wedge_idx);
  ------------------
  |  |   89|      0|    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
  |  |   90|      0|    (size_t)dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[sign][idx] * 8))
  ------------------
 1821|      0|            dsp->mc.mask(dst, f->cur.stride[0],
 1822|      0|                         tmp[b->mask_sign], tmp[!b->mask_sign],
 1823|      0|                         bw4 * 4, bh4 * 4, mask HIGHBD_CALL_SUFFIX);
 1824|      0|            if (has_chroma)
  ------------------
  |  Branch (1824:17): [True: 0, False: 0]
  ------------------
 1825|      0|                mask = WEDGE_MASK(chr_layout_idx, bs, b->mask_sign, b->wedge_idx);
  ------------------
  |  |   89|      0|    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
  |  |   90|      0|    (size_t)dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[sign][idx] * 8))
  ------------------
 1826|      0|            break;
 1827|      0|        }
 1828|       |
 1829|       |        // chroma
 1830|      0|        if (has_chroma) for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1830:13): [True: 0, False: 0]
  |  Branch (1830:42): [True: 0, False: 0]
  ------------------
 1831|      0|            for (int i = 0; i < 2; i++) {
  ------------------
  |  Branch (1831:29): [True: 0, False: 0]
  ------------------
 1832|      0|                const Dav1dThreadPicture *const refp = &f->refp[b->ref[i]];
 1833|      0|                if (b->inter_mode == GLOBALMV_GLOBALMV &&
  ------------------
  |  Branch (1833:21): [True: 0, False: 0]
  ------------------
 1834|      0|                    imin(cbw4, cbh4) > 1 && f->gmv_warp_allowed[b->ref[i]])
  ------------------
  |  Branch (1834:21): [True: 0, False: 0]
  |  Branch (1834:45): [True: 0, False: 0]
  ------------------
 1835|      0|                {
 1836|      0|                    res = warp_affine(t, NULL, tmp[i], bw4 * 4 >> ss_hor,
 1837|      0|                                      b_dim, 1 + pl,
 1838|      0|                                      refp, &f->frame_hdr->gmv[b->ref[i]]);
 1839|      0|                    if (res) return res;
  ------------------
  |  Branch (1839:25): [True: 0, False: 0]
  ------------------
 1840|      0|                } else {
 1841|      0|                    res = mc(t, NULL, tmp[i], 0, bw4, bh4, t->bx, t->by,
 1842|      0|                             1 + pl, b->mv[i], refp, b->ref[i], filter_2d);
 1843|      0|                    if (res) return res;
  ------------------
  |  Branch (1843:25): [True: 0, False: 0]
  ------------------
 1844|      0|                }
 1845|      0|            }
 1846|      0|            pixel *const uvdst = ((pixel *) f->cur.data[1 + pl]) + uvdstoff;
 1847|      0|            switch (b->comp_type) {
  ------------------
  |  Branch (1847:21): [True: 0, False: 0]
  ------------------
 1848|      0|            case COMP_INTER_AVG:
  ------------------
  |  Branch (1848:13): [True: 0, False: 0]
  ------------------
 1849|      0|                dsp->mc.avg(uvdst, f->cur.stride[1], tmp[0], tmp[1],
 1850|      0|                            bw4 * 4 >> ss_hor, bh4 * 4 >> ss_ver
 1851|      0|                            HIGHBD_CALL_SUFFIX);
 1852|      0|                break;
 1853|      0|            case COMP_INTER_WEIGHTED_AVG:
  ------------------
  |  Branch (1853:13): [True: 0, False: 0]
  ------------------
 1854|      0|                dsp->mc.w_avg(uvdst, f->cur.stride[1], tmp[0], tmp[1],
 1855|      0|                              bw4 * 4 >> ss_hor, bh4 * 4 >> ss_ver, jnt_weight
 1856|      0|                              HIGHBD_CALL_SUFFIX);
 1857|      0|                break;
 1858|      0|            case COMP_INTER_WEDGE:
  ------------------
  |  Branch (1858:13): [True: 0, False: 0]
  ------------------
 1859|      0|            case COMP_INTER_SEG:
  ------------------
  |  Branch (1859:13): [True: 0, False: 0]
  ------------------
 1860|      0|                dsp->mc.mask(uvdst, f->cur.stride[1],
 1861|      0|                             tmp[b->mask_sign], tmp[!b->mask_sign],
 1862|      0|                             bw4 * 4 >> ss_hor, bh4 * 4 >> ss_ver, mask
 1863|      0|                             HIGHBD_CALL_SUFFIX);
 1864|      0|                break;
 1865|      0|            }
 1866|      0|        }
 1867|      0|    }
 1868|       |
 1869|    116|    if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   34|    116|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 116]
  |  |  ------------------
  |  |   35|    116|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    116|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                  if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1870|      0|        hex_dump(dst, f->cur.stride[0], b_dim[0] * 4, b_dim[1] * 4, "y-pred");
 1871|      0|        if (has_chroma) {
  ------------------
  |  Branch (1871:13): [True: 0, False: 0]
  ------------------
 1872|      0|            hex_dump(&((pixel *) f->cur.data[1])[uvdstoff], f->cur.stride[1],
 1873|      0|                     cbw4 * 4, cbh4 * 4, "u-pred");
 1874|      0|            hex_dump(&((pixel *) f->cur.data[2])[uvdstoff], f->cur.stride[1],
 1875|      0|                     cbw4 * 4, cbh4 * 4, "v-pred");
 1876|      0|        }
 1877|      0|    }
 1878|       |
 1879|    116|    const int cw4 = (w4 + ss_hor) >> ss_hor, ch4 = (h4 + ss_ver) >> ss_ver;
 1880|       |
 1881|    116|    if (b->skip) {
  ------------------
  |  Branch (1881:9): [True: 6, False: 110]
  ------------------
 1882|       |        // reset coef contexts
 1883|      6|        BlockContext *const a = t->a;
 1884|      6|        dav1d_memset_pow2[b_dim[2]](&a->lcoef[bx4], 0x40);
 1885|      6|        dav1d_memset_pow2[b_dim[3]](&t->l.lcoef[by4], 0x40);
 1886|      6|        if (has_chroma) {
  ------------------
  |  Branch (1886:13): [True: 6, False: 0]
  ------------------
 1887|      6|            dav1d_memset_pow2_fn memset_cw = dav1d_memset_pow2[ulog2(cbw4)];
 1888|      6|            dav1d_memset_pow2_fn memset_ch = dav1d_memset_pow2[ulog2(cbh4)];
 1889|      6|            memset_cw(&a->ccoef[0][cbx4], 0x40);
 1890|      6|            memset_cw(&a->ccoef[1][cbx4], 0x40);
 1891|      6|            memset_ch(&t->l.ccoef[0][cby4], 0x40);
 1892|      6|            memset_ch(&t->l.ccoef[1][cby4], 0x40);
 1893|      6|        }
 1894|      6|        return 0;
 1895|      6|    }
 1896|       |
 1897|    110|    const TxfmInfo *const uvtx = &dav1d_txfm_dimensions[b->uvtx];
 1898|    110|    const TxfmInfo *const ytx = &dav1d_txfm_dimensions[b->max_ytx];
 1899|    110|    const uint16_t tx_split[2] = { b->tx_split0, b->tx_split1 };
 1900|       |
 1901|    236|    for (int init_y = 0; init_y < bh4; init_y += 16) {
  ------------------
  |  Branch (1901:26): [True: 126, False: 110]
  ------------------
 1902|    284|        for (int init_x = 0; init_x < bw4; init_x += 16) {
  ------------------
  |  Branch (1902:30): [True: 158, False: 126]
  ------------------
 1903|       |            // coefficient coding & inverse transforms
 1904|    158|            int y_off = !!init_y, y;
 1905|    158|            dst += PXSTRIDE(f->cur.stride[0]) * 4 * init_y;
  ------------------
  |  |   53|    158|#define PXSTRIDE(x) (x)
  ------------------
 1906|    316|            for (y = init_y, t->by += init_y; y < imin(h4, init_y + 16);
  ------------------
  |  Branch (1906:47): [True: 158, False: 158]
  ------------------
 1907|    158|                 y += ytx->h, y_off++)
 1908|    158|            {
 1909|    158|                int x, x_off = !!init_x;
 1910|    316|                for (x = init_x, t->bx += init_x; x < imin(w4, init_x + 16);
  ------------------
  |  Branch (1910:51): [True: 158, False: 158]
  ------------------
 1911|    158|                     x += ytx->w, x_off++)
 1912|    158|                {
 1913|    158|                    read_coef_tree(t, bs, b, b->max_ytx, 0, tx_split,
 1914|    158|                                   x_off, y_off, &dst[x * 4]);
 1915|    158|                    t->bx += ytx->w;
 1916|    158|                }
 1917|    158|                dst += PXSTRIDE(f->cur.stride[0]) * 4 * ytx->h;
  ------------------
  |  |   53|    158|#define PXSTRIDE(x) (x)
  ------------------
 1918|    158|                t->bx -= x;
 1919|    158|                t->by += ytx->h;
 1920|    158|            }
 1921|    158|            dst -= PXSTRIDE(f->cur.stride[0]) * 4 * y;
  ------------------
  |  |   53|    158|#define PXSTRIDE(x) (x)
  ------------------
 1922|    158|            t->by -= y;
 1923|       |
 1924|       |            // chroma coefs and inverse transform
 1925|    432|            if (has_chroma) for (int pl = 0; pl < 2; pl++) {
  ------------------
  |  Branch (1925:17): [True: 144, False: 14]
  |  Branch (1925:46): [True: 288, False: 144]
  ------------------
 1926|    288|                pixel *uvdst = ((pixel *) f->cur.data[1 + pl]) + uvdstoff +
 1927|    288|                    (PXSTRIDE(f->cur.stride[1]) * init_y * 4 >> ss_ver);
  ------------------
  |  |   53|    288|#define PXSTRIDE(x) (x)
  ------------------
 1928|    288|                for (y = init_y >> ss_ver, t->by += init_y;
 1929|    576|                     y < imin(ch4, (init_y + 16) >> ss_ver); y += uvtx->h)
  ------------------
  |  Branch (1929:22): [True: 288, False: 288]
  ------------------
 1930|    288|                {
 1931|    288|                    int x;
 1932|    288|                    for (x = init_x >> ss_hor, t->bx += init_x;
 1933|    576|                         x < imin(cw4, (init_x + 16) >> ss_hor); x += uvtx->w)
  ------------------
  |  Branch (1933:26): [True: 288, False: 288]
  ------------------
 1934|    288|                    {
 1935|    288|                        coef *cf;
 1936|    288|                        int eob;
 1937|    288|                        enum TxfmType txtp;
 1938|    288|                        if (t->frame_thread.pass) {
  ------------------
  |  Branch (1938:29): [True: 288, False: 0]
  ------------------
 1939|    288|                            const int p = t->frame_thread.pass & 1;
 1940|    288|                            const int cbi = *ts->frame_thread[p].cbi++;
 1941|    288|                            cf = ts->frame_thread[p].cf;
 1942|    288|                            ts->frame_thread[p].cf += uvtx->w * uvtx->h * 16;
 1943|    288|                            eob  = cbi >> 5;
 1944|    288|                            txtp = cbi & 0x1f;
 1945|    288|                        } else {
 1946|      0|                            uint8_t cf_ctx;
 1947|      0|                            cf = bitfn(t->cf);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1948|      0|                            txtp = t->scratch.txtp_map[(by4 + (y << ss_ver)) * 32 +
 1949|      0|                                                        bx4 + (x << ss_hor)];
 1950|      0|                            eob = decode_coefs(t, &t->a->ccoef[pl][cbx4 + x],
 1951|      0|                                               &t->l.ccoef[pl][cby4 + y],
 1952|      0|                                               b->uvtx, bs, b, 0, 1 + pl,
 1953|      0|                                               cf, &txtp, &cf_ctx);
 1954|      0|                            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1955|      0|                                printf("Post-uv-cf-blk[pl=%d,tx=%d,"
 1956|      0|                                       "txtp=%d,eob=%d]: r=%d\n",
 1957|      0|                                       pl, b->uvtx, txtp, eob, ts->msac.rng);
 1958|      0|                            int ctw = imin(uvtx->w, (f->bw - t->bx + ss_hor) >> ss_hor);
 1959|      0|                            int cth = imin(uvtx->h, (f->bh - t->by + ss_ver) >> ss_ver);
 1960|      0|                            dav1d_memset_likely_pow2(&t->a->ccoef[pl][cbx4 + x], cf_ctx, ctw);
 1961|      0|                            dav1d_memset_likely_pow2(&t->l.ccoef[pl][cby4 + y], cf_ctx, cth);
 1962|      0|                        }
 1963|    288|                        if (eob >= 0) {
  ------------------
  |  Branch (1963:29): [True: 28, False: 260]
  ------------------
 1964|     28|                            if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|     28|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 28]
  |  |  ------------------
  |  |   35|     28|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|     28|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1965|      0|                                coef_dump(cf, uvtx->h * 4, uvtx->w * 4, 3, "dq");
 1966|     28|                            dsp->itx.itxfm_add[b->uvtx]
 1967|     28|                                              [txtp](&uvdst[4 * x],
 1968|     28|                                                     f->cur.stride[1],
 1969|     28|                                                     cf, eob HIGHBD_CALL_SUFFIX);
 1970|     28|                            if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|     28|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 28]
  |  |  ------------------
  |  |   35|     28|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|     28|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1971|      0|                                hex_dump(&uvdst[4 * x], f->cur.stride[1],
 1972|      0|                                         uvtx->w * 4, uvtx->h * 4, "recon");
 1973|     28|                        }
 1974|    288|                        t->bx += uvtx->w << ss_hor;
 1975|    288|                    }
 1976|    288|                    uvdst += PXSTRIDE(f->cur.stride[1]) * 4 * uvtx->h;
  ------------------
  |  |   53|    288|#define PXSTRIDE(x) (x)
  ------------------
 1977|    288|                    t->bx -= x << ss_hor;
 1978|    288|                    t->by += uvtx->h << ss_ver;
 1979|    288|                }
 1980|    288|                t->by -= y << ss_ver;
 1981|    288|            }
 1982|    158|        }
 1983|    126|    }
 1984|    110|    return 0;
 1985|    116|}
dav1d_filter_sbrow_deblock_rows_8bpc:
 2005|      4|void bytefn(dav1d_filter_sbrow_deblock_rows)(Dav1dFrameContext *const f, const int sby) {
 2006|      4|    const int y = sby * f->sb_step * 4;
 2007|      4|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 2008|      4|    pixel *const p[3] = {
 2009|      4|        f->lf.p[0] + y * PXSTRIDE(f->cur.stride[0]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2010|      4|        f->lf.p[1] + (y * PXSTRIDE(f->cur.stride[1]) >> ss_ver),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2011|      4|        f->lf.p[2] + (y * PXSTRIDE(f->cur.stride[1]) >> ss_ver)
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2012|      4|    };
 2013|      4|    Av1Filter *mask = f->lf.mask + (sby >> !f->seq_hdr->sb128) * f->sb128w;
 2014|      4|    if (f->c->inloop_filters & DAV1D_INLOOPFILTER_DEBLOCK &&
  ------------------
  |  Branch (2014:9): [True: 4, False: 0]
  ------------------
 2015|      4|        (f->frame_hdr->loopfilter.level_y[0] || f->frame_hdr->loopfilter.level_y[1]))
  ------------------
  |  Branch (2015:10): [True: 0, False: 4]
  |  Branch (2015:49): [True: 0, False: 4]
  ------------------
 2016|      0|    {
 2017|      0|        bytefn(dav1d_loopfilter_sbrow_rows)(f, p, mask, sby);
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2018|      0|    }
 2019|      4|    if (f->seq_hdr->cdef || f->lf.restore_planes) {
  ------------------
  |  Branch (2019:9): [True: 4, False: 0]
  |  Branch (2019:29): [True: 0, False: 0]
  ------------------
 2020|       |        // Store loop filtered pixels required by CDEF / LR
 2021|      4|        bytefn(dav1d_copy_lpf)(f, p, sby);
  ------------------
  |  |   87|      4|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      4|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2022|      4|    }
 2023|      4|}
dav1d_filter_sbrow_cdef_8bpc:
 2025|      4|void bytefn(dav1d_filter_sbrow_cdef)(Dav1dTaskContext *const tc, const int sby) {
 2026|      4|    const Dav1dFrameContext *const f = tc->f;
 2027|      4|    if (!(f->c->inloop_filters & DAV1D_INLOOPFILTER_CDEF)) return;
  ------------------
  |  Branch (2027:9): [True: 0, False: 4]
  ------------------
 2028|      4|    const int sbsz = f->sb_step;
 2029|      4|    const int y = sby * sbsz * 4;
 2030|      4|    const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 2031|      4|    pixel *const p[3] = {
 2032|      4|        f->lf.p[0] + y * PXSTRIDE(f->cur.stride[0]),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2033|      4|        f->lf.p[1] + (y * PXSTRIDE(f->cur.stride[1]) >> ss_ver),
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2034|      4|        f->lf.p[2] + (y * PXSTRIDE(f->cur.stride[1]) >> ss_ver)
  ------------------
  |  |   53|      4|#define PXSTRIDE(x) (x)
  ------------------
 2035|      4|    };
 2036|      4|    Av1Filter *prev_mask = f->lf.mask + ((sby - 1) >> !f->seq_hdr->sb128) * f->sb128w;
 2037|      4|    Av1Filter *mask = f->lf.mask + (sby >> !f->seq_hdr->sb128) * f->sb128w;
 2038|      4|    const int start = sby * sbsz;
 2039|      4|    if (sby) {
  ------------------
  |  Branch (2039:9): [True: 0, False: 4]
  ------------------
 2040|      0|        const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 2041|      0|        pixel *p_up[3] = {
 2042|      0|            p[0] - 8 * PXSTRIDE(f->cur.stride[0]),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 2043|      0|            p[1] - (8 * PXSTRIDE(f->cur.stride[1]) >> ss_ver),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 2044|      0|            p[2] - (8 * PXSTRIDE(f->cur.stride[1]) >> ss_ver),
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 2045|      0|        };
 2046|      0|        bytefn(dav1d_cdef_brow)(tc, p_up, prev_mask, start - 2, start, 1, sby);
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2047|      0|    }
 2048|      4|    const int n_blks = sbsz - 2 * (sby + 1 < f->sbh);
 2049|      4|    const int end = imin(start + n_blks, f->bh);
 2050|      4|    bytefn(dav1d_cdef_brow)(tc, p, mask, start, end, 0, sby);
  ------------------
  |  |   87|      4|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      4|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2051|      4|}
dav1d_backup_ipred_edge_8bpc:
 2111|      8|void bytefn(dav1d_backup_ipred_edge)(Dav1dTaskContext *const t) {
 2112|      8|    const Dav1dFrameContext *const f = t->f;
 2113|      8|    Dav1dTileState *const ts = t->ts;
 2114|      8|    const int sby = t->by >> f->sb_shift;
 2115|      8|    const int sby_off = f->sb128w * 128 * sby;
 2116|      8|    const int x_off = ts->tiling.col_start;
 2117|       |
 2118|      8|    const pixel *const y =
 2119|      8|        ((const pixel *) f->cur.data[0]) + x_off * 4 +
 2120|      8|                    ((t->by + f->sb_step) * 4 - 1) * PXSTRIDE(f->cur.stride[0]);
  ------------------
  |  |   53|      8|#define PXSTRIDE(x) (x)
  ------------------
 2121|      8|    pixel_copy(&f->ipred_edge[0][sby_off + x_off * 4], y,
  ------------------
  |  |   47|      8|#define pixel_copy memcpy
  ------------------
 2122|      8|               4 * (ts->tiling.col_end - x_off));
 2123|       |
 2124|      8|    if (f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400) {
  ------------------
  |  Branch (2124:9): [True: 8, False: 0]
  ------------------
 2125|      8|        const int ss_ver = f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
 2126|      8|        const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
 2127|       |
 2128|      8|        const ptrdiff_t uv_off = (x_off * 4 >> ss_hor) +
 2129|      8|            (((t->by + f->sb_step) * 4 >> ss_ver) - 1) * PXSTRIDE(f->cur.stride[1]);
  ------------------
  |  |   53|      8|#define PXSTRIDE(x) (x)
  ------------------
 2130|     24|        for (int pl = 1; pl <= 2; pl++)
  ------------------
  |  Branch (2130:26): [True: 16, False: 8]
  ------------------
 2131|     16|            pixel_copy(&f->ipred_edge[pl][sby_off + (x_off * 4 >> ss_hor)],
  ------------------
  |  |   47|     16|#define pixel_copy memcpy
  ------------------
 2132|     16|                       &((const pixel *) f->cur.data[pl])[uv_off],
 2133|     16|                       4 * (ts->tiling.col_end - x_off) >> ss_hor);
 2134|      8|    }
 2135|      8|}
dav1d_copy_pal_block_y_8bpc:
 2141|      8|{
 2142|      8|    const Dav1dFrameContext *const f = t->f;
 2143|      8|    pixel *const pal = t->frame_thread.pass ?
  ------------------
  |  Branch (2143:24): [True: 8, False: 0]
  ------------------
 2144|      8|        f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 2145|      8|                            ((t->bx >> 1) + (t->by & 1))][0] :
 2146|      8|        bytefn(t->scratch.pal)[0];
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      8|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2147|     56|    for (int x = 0; x < bw4; x++)
  ------------------
  |  Branch (2147:21): [True: 48, False: 8]
  ------------------
 2148|     48|        memcpy(bytefn(t->al_pal)[0][bx4 + x][0], pal, 8 * sizeof(pixel));
  ------------------
  |  |   87|     48|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     48|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2149|     36|    for (int y = 0; y < bh4; y++)
  ------------------
  |  Branch (2149:21): [True: 28, False: 8]
  ------------------
 2150|     28|        memcpy(bytefn(t->al_pal)[1][by4 + y][0], pal, 8 * sizeof(pixel));
  ------------------
  |  |   87|     28|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     28|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2151|      8|}
dav1d_copy_pal_block_uv_8bpc:
 2157|      2|{
 2158|      2|    const Dav1dFrameContext *const f = t->f;
 2159|      2|    const pixel (*const pal)[8] = t->frame_thread.pass ?
  ------------------
  |  Branch (2159:35): [True: 2, False: 0]
  ------------------
 2160|      2|        f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 2161|      2|                            ((t->bx >> 1) + (t->by & 1))] :
 2162|      2|        bytefn(t->scratch.pal);
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      0|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2163|       |    // see aomedia bug 2183 for why we use luma coordinates here
 2164|      6|    for (int pl = 1; pl <= 2; pl++) {
  ------------------
  |  Branch (2164:22): [True: 4, False: 2]
  ------------------
 2165|     36|        for (int x = 0; x < bw4; x++)
  ------------------
  |  Branch (2165:25): [True: 32, False: 4]
  ------------------
 2166|     32|            memcpy(bytefn(t->al_pal)[0][bx4 + x][pl], pal[pl], 8 * sizeof(pixel));
  ------------------
  |  |   87|     32|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     32|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2167|     12|        for (int y = 0; y < bh4; y++)
  ------------------
  |  Branch (2167:25): [True: 8, False: 4]
  ------------------
 2168|      8|            memcpy(bytefn(t->al_pal)[1][by4 + y][pl], pal[pl], 8 * sizeof(pixel));
  ------------------
  |  |   87|      8|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      8|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2169|      4|    }
 2170|      2|}
dav1d_read_pal_plane_8bpc:
 2175|     10|{
 2176|     10|    Dav1dTileState *const ts = t->ts;
 2177|     10|    const Dav1dFrameContext *const f = t->f;
 2178|     10|    const int pal_sz = b->pal_sz[pl] = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|     10|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
 2179|     10|                                           ts->cdf.m.pal_sz[pl][sz_ctx], 6) + 2;
 2180|     10|    pixel cache[16], used_cache[8];
 2181|     10|    int l_cache = pl ? t->pal_sz_uv[1][by4] : t->l.pal_sz[by4];
  ------------------
  |  Branch (2181:19): [True: 2, False: 8]
  ------------------
 2182|     10|    int n_cache = 0;
 2183|       |    // don't reuse above palette outside SB64 boundaries
 2184|     10|    int a_cache = by4 & 15 ? pl ? t->pal_sz_uv[0][bx4] : t->a->pal_sz[bx4] : 0;
  ------------------
  |  Branch (2184:19): [True: 4, False: 6]
  |  Branch (2184:30): [True: 2, False: 2]
  ------------------
 2185|     10|    const pixel *l = bytefn(t->al_pal)[1][by4][pl];
  ------------------
  |  |   87|     10|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     10|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2186|     10|    const pixel *a = bytefn(t->al_pal)[0][bx4][pl];
  ------------------
  |  |   87|     10|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     10|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2187|       |
 2188|       |    // fill/sort cache
 2189|     10|    while (l_cache && a_cache) {
  ------------------
  |  Branch (2189:12): [True: 0, False: 10]
  |  Branch (2189:23): [True: 0, False: 0]
  ------------------
 2190|      0|        if (*l < *a) {
  ------------------
  |  Branch (2190:13): [True: 0, False: 0]
  ------------------
 2191|      0|            if (!n_cache || cache[n_cache - 1] != *l)
  ------------------
  |  Branch (2191:17): [True: 0, False: 0]
  |  Branch (2191:29): [True: 0, False: 0]
  ------------------
 2192|      0|                cache[n_cache++] = *l;
 2193|      0|            l++;
 2194|      0|            l_cache--;
 2195|      0|        } else {
 2196|      0|            if (*a == *l) {
  ------------------
  |  Branch (2196:17): [True: 0, False: 0]
  ------------------
 2197|      0|                l++;
 2198|      0|                l_cache--;
 2199|      0|            }
 2200|      0|            if (!n_cache || cache[n_cache - 1] != *a)
  ------------------
  |  Branch (2200:17): [True: 0, False: 0]
  |  Branch (2200:29): [True: 0, False: 0]
  ------------------
 2201|      0|                cache[n_cache++] = *a;
 2202|      0|            a++;
 2203|      0|            a_cache--;
 2204|      0|        }
 2205|      0|    }
 2206|     10|    if (l_cache) {
  ------------------
  |  Branch (2206:9): [True: 0, False: 10]
  ------------------
 2207|      0|        do {
 2208|      0|            if (!n_cache || cache[n_cache - 1] != *l)
  ------------------
  |  Branch (2208:17): [True: 0, False: 0]
  |  Branch (2208:29): [True: 0, False: 0]
  ------------------
 2209|      0|                cache[n_cache++] = *l;
 2210|      0|            l++;
 2211|      0|        } while (--l_cache > 0);
  ------------------
  |  Branch (2211:18): [True: 0, False: 0]
  ------------------
 2212|     10|    } else if (a_cache) {
  ------------------
  |  Branch (2212:16): [True: 0, False: 10]
  ------------------
 2213|      0|        do {
 2214|      0|            if (!n_cache || cache[n_cache - 1] != *a)
  ------------------
  |  Branch (2214:17): [True: 0, False: 0]
  |  Branch (2214:29): [True: 0, False: 0]
  ------------------
 2215|      0|                cache[n_cache++] = *a;
 2216|      0|            a++;
 2217|      0|        } while (--a_cache > 0);
  ------------------
  |  Branch (2217:18): [True: 0, False: 0]
  ------------------
 2218|      0|    }
 2219|       |
 2220|       |    // find reused cache entries
 2221|     10|    int i = 0;
 2222|     10|    for (int n = 0; n < n_cache && i < pal_sz; n++)
  ------------------
  |  Branch (2222:21): [True: 0, False: 10]
  |  Branch (2222:36): [True: 0, False: 0]
  ------------------
 2223|      0|        if (dav1d_msac_decode_bool_equi(&ts->msac))
  ------------------
  |  |   85|      0|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (2223:13): [True: 0, False: 0]
  ------------------
 2224|      0|            used_cache[i++] = cache[n];
 2225|     10|    const int n_used_cache = i;
 2226|       |
 2227|       |    // parse new entries
 2228|     10|    pixel *const pal = t->frame_thread.pass ?
  ------------------
  |  Branch (2228:24): [True: 10, False: 0]
  ------------------
 2229|     10|        f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 2230|     10|                            ((t->bx >> 1) + (t->by & 1))][pl] :
 2231|     10|        bytefn(t->scratch.pal)[pl];
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|     10|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2232|     10|    if (i < pal_sz) {
  ------------------
  |  Branch (2232:9): [True: 10, False: 0]
  ------------------
 2233|     10|        const int bpc = BITDEPTH == 8 ? 8 : f->cur.p.bpc;
  ------------------
  |  Branch (2233:25): [True: 10, Folded]
  ------------------
 2234|     10|        int prev = pal[i++] = dav1d_msac_decode_bools(&ts->msac, bpc);
 2235|       |
 2236|     10|        if (i < pal_sz) {
  ------------------
  |  Branch (2236:13): [True: 10, False: 0]
  ------------------
 2237|     10|            int bits = bpc - 3 + dav1d_msac_decode_bools(&ts->msac, 2);
 2238|     10|            const int max = (1 << bpc) - 1;
 2239|       |
 2240|     34|            do {
 2241|     34|                const int delta = dav1d_msac_decode_bools(&ts->msac, bits);
 2242|     34|                prev = pal[i++] = imin(prev + delta + !pl, max);
 2243|     34|                if (prev + !pl >= max) {
  ------------------
  |  Branch (2243:21): [True: 4, False: 30]
  ------------------
 2244|      6|                    for (; i < pal_sz; i++)
  ------------------
  |  Branch (2244:28): [True: 2, False: 4]
  ------------------
 2245|      2|                        pal[i] = max;
 2246|      4|                    break;
 2247|      4|                }
 2248|     30|                bits = imin(bits, 1 + ulog2(max - prev - !pl));
 2249|     30|            } while (i < pal_sz);
  ------------------
  |  Branch (2249:22): [True: 24, False: 6]
  ------------------
 2250|     10|        }
 2251|       |
 2252|       |        // merge cache+new entries
 2253|     10|        int n = 0, m = n_used_cache;
 2254|     56|        for (i = 0; i < pal_sz; i++) {
  ------------------
  |  Branch (2254:21): [True: 46, False: 10]
  ------------------
 2255|     46|            if (n < n_used_cache && (m >= pal_sz || used_cache[n] <= pal[m])) {
  ------------------
  |  Branch (2255:17): [True: 0, False: 46]
  |  Branch (2255:38): [True: 0, False: 0]
  |  Branch (2255:53): [True: 0, False: 0]
  ------------------
 2256|      0|                pal[i] = used_cache[n++];
 2257|     46|            } else {
 2258|     46|                assert(m < pal_sz);
  ------------------
  |  |  140|     46|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 46]
  |  |  |  Branch (140:68): [Folded, False: 46]
  |  |  ------------------
  ------------------
 2259|     46|                pal[i] = pal[m++];
 2260|     46|            }
 2261|     46|        }
 2262|     10|    } else {
 2263|      0|        memcpy(pal, used_cache, n_used_cache * sizeof(*used_cache));
 2264|      0|    }
 2265|       |
 2266|     10|    if (DEBUG_BLOCK_INFO) {
  ------------------
  |  |   34|     10|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 10]
  |  |  ------------------
  |  |   35|     10|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|     10|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2267|      0|        printf("Post-pal[pl=%d,sz=%d,cache_size=%d,used_cache=%d]: r=%d, cache=",
 2268|      0|               pl, pal_sz, n_cache, n_used_cache, ts->msac.rng);
 2269|      0|        for (int n = 0; n < n_cache; n++)
  ------------------
  |  Branch (2269:25): [True: 0, False: 0]
  ------------------
 2270|      0|            printf("%c%02x", n ? ' ' : '[', cache[n]);
  ------------------
  |  Branch (2270:30): [True: 0, False: 0]
  ------------------
 2271|      0|        printf("%s, pal=", n_cache ? "]" : "[]");
  ------------------
  |  Branch (2271:28): [True: 0, False: 0]
  ------------------
 2272|      0|        for (int n = 0; n < pal_sz; n++)
  ------------------
  |  Branch (2272:25): [True: 0, False: 0]
  ------------------
 2273|      0|            printf("%c%02x", n ? ' ' : '[', pal[n]);
  ------------------
  |  Branch (2273:30): [True: 0, False: 0]
  ------------------
 2274|      0|        printf("]\n");
 2275|      0|    }
 2276|     10|}
dav1d_read_pal_uv_8bpc:
 2280|      2|{
 2281|      2|    bytefn(dav1d_read_pal_plane)(t, b, 1, sz_ctx, bx4, by4);
  ------------------
  |  |   87|      2|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      2|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2282|       |
 2283|       |    // V pal coding
 2284|      2|    Dav1dTileState *const ts = t->ts;
 2285|      2|    const Dav1dFrameContext *const f = t->f;
 2286|      2|    pixel *const pal = t->frame_thread.pass ?
  ------------------
  |  Branch (2286:24): [True: 2, False: 0]
  ------------------
 2287|      2|        f->frame_thread.pal[((t->by >> 1) + (t->bx & 1)) * (f->b4_stride >> 1) +
 2288|      2|                            ((t->bx >> 1) + (t->by & 1))][2] :
 2289|      2|        bytefn(t->scratch.pal)[2];
  ------------------
  |  |   87|      0|#define bytefn(x) bitfn(x)
  |  |  ------------------
  |  |  |  |   51|      2|#define bitfn(x) x##_8bpc
  |  |  ------------------
  ------------------
 2290|      2|    const int bpc = BITDEPTH == 8 ? 8 : f->cur.p.bpc;
  ------------------
  |  Branch (2290:21): [True: 2, Folded]
  ------------------
 2291|      2|    if (dav1d_msac_decode_bool_equi(&ts->msac)) {
  ------------------
  |  |   85|      2|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (2291:9): [True: 0, False: 2]
  ------------------
 2292|      0|        const int bits = bpc - 4 + dav1d_msac_decode_bools(&ts->msac, 2);
 2293|      0|        int prev = pal[0] = dav1d_msac_decode_bools(&ts->msac, bpc);
 2294|      0|        const int max = (1 << bpc) - 1;
 2295|      0|        for (int i = 1; i < b->pal_sz[1]; i++) {
  ------------------
  |  Branch (2295:25): [True: 0, False: 0]
  ------------------
 2296|      0|            int delta = dav1d_msac_decode_bools(&ts->msac, bits);
 2297|      0|            if (delta && dav1d_msac_decode_bool_equi(&ts->msac)) delta = -delta;
  ------------------
  |  |   85|      0|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (2297:17): [True: 0, False: 0]
  |  Branch (2297:26): [True: 0, False: 0]
  ------------------
 2298|      0|            prev = pal[i] = (prev + delta) & max;
 2299|      0|        }
 2300|      2|    } else {
 2301|     18|        for (int i = 0; i < b->pal_sz[1]; i++)
  ------------------
  |  Branch (2301:25): [True: 16, False: 2]
  ------------------
 2302|     16|            pal[i] = dav1d_msac_decode_bools(&ts->msac, bpc);
 2303|      2|    }
 2304|      2|    if (DEBUG_BLOCK_INFO) {
  ------------------
  |  |   34|      2|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 2]
  |  |  ------------------
  |  |   35|      2|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      2|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2305|      0|        printf("Post-pal[pl=2]: r=%d ", ts->msac.rng);
 2306|      0|        for (int n = 0; n < b->pal_sz[1]; n++)
  ------------------
  |  Branch (2306:25): [True: 0, False: 0]
  ------------------
 2307|      0|            printf("%c%02x", n ? ' ' : '[', pal[n]);
  ------------------
  |  Branch (2307:30): [True: 0, False: 0]
  ------------------
 2308|      0|        printf("]\n");
 2309|      0|    }
 2310|      2|}
recon_tmpl.c:read_coef_tree:
  736|    990|{
  737|    990|    const Dav1dFrameContext *const f = t->f;
  738|    990|    Dav1dTileState *const ts = t->ts;
  739|    990|    const Dav1dDSPContext *const dsp = f->dsp;
  740|    990|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[ytx];
  741|    990|    const int txw = t_dim->w, txh = t_dim->h;
  742|       |
  743|       |    /* y_off can be larger than 3 since lossless blocks use TX_4X4 but can't
  744|       |     * be splitted. Aviods an undefined left shift. */
  745|    990|    if (depth < 2 && tx_split[depth] &&
  ------------------
  |  Branch (745:9): [True: 910, False: 80]
  |  Branch (745:22): [True: 146, False: 764]
  ------------------
  746|    146|        tx_split[depth] & (1 << (y_off * 4 + x_off)))
  ------------------
  |  Branch (746:9): [True: 106, False: 40]
  ------------------
  747|    106|    {
  748|    106|        const enum RectTxfmSize sub = t_dim->sub;
  749|    106|        const TxfmInfo *const sub_t_dim = &dav1d_txfm_dimensions[sub];
  750|    106|        const int txsw = sub_t_dim->w, txsh = sub_t_dim->h;
  751|       |
  752|    106|        read_coef_tree(t, bs, b, sub, depth + 1, tx_split,
  753|    106|                       x_off * 2 + 0, y_off * 2 + 0, dst);
  754|    106|        t->bx += txsw;
  755|    106|        if (txw >= txh && t->bx < f->bw)
  ------------------
  |  Branch (755:13): [True: 90, False: 16]
  |  Branch (755:27): [True: 90, False: 0]
  ------------------
  756|     90|            read_coef_tree(t, bs, b, sub, depth + 1, tx_split, x_off * 2 + 1,
  757|     90|                           y_off * 2 + 0, dst ? &dst[4 * txsw] : NULL);
  ------------------
  |  Branch (757:43): [True: 42, False: 48]
  ------------------
  758|    106|        t->bx -= txsw;
  759|    106|        t->by += txsh;
  760|    106|        if (txh >= txw && t->by < f->bh) {
  ------------------
  |  Branch (760:13): [True: 54, False: 52]
  |  Branch (760:27): [True: 54, False: 0]
  ------------------
  761|     54|            if (dst)
  ------------------
  |  Branch (761:17): [True: 24, False: 30]
  ------------------
  762|     24|                dst += 4 * txsh * PXSTRIDE(f->cur.stride[0]);
  ------------------
  |  |   53|     24|#define PXSTRIDE(x) (x)
  ------------------
  763|     54|            read_coef_tree(t, bs, b, sub, depth + 1, tx_split,
  764|     54|                           x_off * 2 + 0, y_off * 2 + 1, dst);
  765|     54|            t->bx += txsw;
  766|     54|            if (txw >= txh && t->bx < f->bw)
  ------------------
  |  Branch (766:17): [True: 38, False: 16]
  |  Branch (766:31): [True: 38, False: 0]
  ------------------
  767|     38|                read_coef_tree(t, bs, b, sub, depth + 1, tx_split, x_off * 2 + 1,
  768|     38|                               y_off * 2 + 1, dst ? &dst[4 * txsw] : NULL);
  ------------------
  |  Branch (768:47): [True: 18, False: 20]
  ------------------
  769|     54|            t->bx -= txsw;
  770|     54|        }
  771|    106|        t->by -= txsh;
  772|    884|    } else {
  773|    884|        const int bx4 = t->bx & 31, by4 = t->by & 31;
  774|    884|        enum TxfmType txtp;
  775|    884|        uint8_t cf_ctx;
  776|    884|        int eob;
  777|    884|        coef *cf;
  778|       |
  779|    884|        if (t->frame_thread.pass) {
  ------------------
  |  Branch (779:13): [True: 884, False: 0]
  ------------------
  780|    884|            const int p = t->frame_thread.pass & 1;
  781|    884|            assert(ts->frame_thread[p].cf);
  ------------------
  |  |  140|    884|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 884]
  |  |  |  Branch (140:68): [Folded, False: 884]
  |  |  ------------------
  ------------------
  782|    884|            cf = ts->frame_thread[p].cf;
  783|    884|            ts->frame_thread[p].cf += imin(t_dim->w, 8) * imin(t_dim->h, 8) * 16;
  784|    884|        } else {
  785|      0|            cf = bitfn(t->cf);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
  786|      0|        }
  787|    884|        if (t->frame_thread.pass != 2) {
  ------------------
  |  Branch (787:13): [True: 642, False: 242]
  ------------------
  788|    642|            eob = decode_coefs(t, &t->a->lcoef[bx4], &t->l.lcoef[by4],
  789|    642|                               ytx, bs, b, 0, 0, cf, &txtp, &cf_ctx);
  790|    642|            if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|    642|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 642]
  |  |  ------------------
  |  |   35|    642|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    642|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  791|      0|                printf("Post-y-cf-blk[tx=%d,txtp=%d,eob=%d]: r=%d\n",
  792|      0|                       ytx, txtp, eob, ts->msac.rng);
  793|    642|            dav1d_memset_likely_pow2(&t->a->lcoef[bx4], cf_ctx, imin(txw, f->bw - t->bx));
  794|    642|            dav1d_memset_likely_pow2(&t->l.lcoef[by4], cf_ctx, imin(txh, f->bh - t->by));
  795|    642|#define set_ctx(rep_macro) \
  796|    642|            for (int y = 0; y < txh; y++) { \
  797|    642|                rep_macro(txtp_map, 0, txtp); \
  798|    642|                txtp_map += 32; \
  799|    642|            }
  800|    642|            uint8_t *txtp_map = &t->scratch.txtp_map[by4 * 32 + bx4];
  801|    642|            case_set_upto16(t_dim->lw);
  ------------------
  |  |   80|    642|    switch (var) { \
  |  |   81|     88|    case 0: set_ctx(set_ctx1); break; \
  |  |  ------------------
  |  |  |  |  796|    238|            for (int y = 0; y < txh; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (796:29): [True: 150, False: 88]
  |  |  |  |  ------------------
  |  |  |  |  797|    150|                rep_macro(txtp_map, 0, txtp); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|    150|    case 0: set_ctx(set_ctx1); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|    150|    ((union alias8 *) &(var)[off])->u8 = (val) * 0x01
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  798|    150|                txtp_map += 32; \
  |  |  |  |  799|    150|            }
  |  |  ------------------
  |  |  |  Branch (81:5): [True: 88, False: 554]
  |  |  ------------------
  |  |   82|    184|    case 1: set_ctx(set_ctx2); break; \
  |  |  ------------------
  |  |  |  |  796|    736|            for (int y = 0; y < txh; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (796:29): [True: 552, False: 184]
  |  |  |  |  ------------------
  |  |  |  |  797|    552|                rep_macro(txtp_map, 0, txtp); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|    552|    case 1: set_ctx(set_ctx2); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    552|    ((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  798|    552|                txtp_map += 32; \
  |  |  |  |  799|    552|            }
  |  |  ------------------
  |  |  |  Branch (82:5): [True: 184, False: 458]
  |  |  ------------------
  |  |   83|    144|    case 2: set_ctx(set_ctx4); break; \
  |  |  ------------------
  |  |  |  |  796|    626|            for (int y = 0; y < txh; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (796:29): [True: 482, False: 144]
  |  |  |  |  ------------------
  |  |  |  |  797|    482|                rep_macro(txtp_map, 0, txtp); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   83|    482|    case 2: set_ctx(set_ctx4); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|    482|    ((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  798|    482|                txtp_map += 32; \
  |  |  |  |  799|    482|            }
  |  |  ------------------
  |  |  |  Branch (83:5): [True: 144, False: 498]
  |  |  ------------------
  |  |   84|     42|    case 3: set_ctx(set_ctx8); break; \
  |  |  ------------------
  |  |  |  |  796|    270|            for (int y = 0; y < txh; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (796:29): [True: 228, False: 42]
  |  |  |  |  ------------------
  |  |  |  |  797|    228|                rep_macro(txtp_map, 0, txtp); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|    228|    case 3: set_ctx(set_ctx8); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|    228|    ((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  798|    228|                txtp_map += 32; \
  |  |  |  |  799|    228|            }
  |  |  ------------------
  |  |  |  Branch (84:5): [True: 42, False: 600]
  |  |  ------------------
  |  |   85|    184|    case 4: set_ctx(set_ctx16); break; \
  |  |  ------------------
  |  |  |  |  796|  3.06k|            for (int y = 0; y < txh; y++) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (796:29): [True: 2.88k, False: 184]
  |  |  |  |  ------------------
  |  |  |  |  797|  2.88k|                rep_macro(txtp_map, 0, txtp); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|  2.88k|    case 4: set_ctx(set_ctx16); break; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|  2.88k|#define set_ctx16(var, off, val) do { \
  |  |  |  |  |  |  |  |   64|  2.88k|        memset(&(var)[off], val, 16); \
  |  |  |  |  |  |  |  |   65|  2.88k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (65:14): [Folded, False: 2.88k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  798|  2.88k|                txtp_map += 32; \
  |  |  |  |  799|  2.88k|            }
  |  |  ------------------
  |  |  |  Branch (85:5): [True: 184, False: 458]
  |  |  ------------------
  |  |   86|      0|    default: assert(0); \
  |  |  ------------------
  |  |  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (86:5): [True: 0, False: 642]
  |  |  ------------------
  |  |   87|    642|    }
  ------------------
  802|    642|#undef set_ctx
  803|    642|            if (t->frame_thread.pass == 1)
  ------------------
  |  Branch (803:17): [True: 642, False: 0]
  ------------------
  804|    642|                *ts->frame_thread[1].cbi++ = eob * (1 << 5) + txtp;
  805|    642|        } else {
  806|    242|            const int cbi = *ts->frame_thread[0].cbi++;
  807|    242|            eob  = cbi >> 5;
  808|    242|            txtp = cbi & 0x1f;
  809|    242|        }
  810|    884|        if (!(t->frame_thread.pass & 1)) {
  ------------------
  |  Branch (810:13): [True: 242, False: 642]
  ------------------
  811|    242|            assert(dst);
  ------------------
  |  |  140|    242|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 242]
  |  |  |  Branch (140:68): [Folded, False: 242]
  |  |  ------------------
  ------------------
  812|    242|            if (eob >= 0) {
  ------------------
  |  Branch (812:17): [True: 122, False: 120]
  ------------------
  813|    122|                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|    122|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 122]
  |  |  ------------------
  |  |   35|    122|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    122|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
  814|      0|                    coef_dump(cf, imin(t_dim->h, 8) * 4, imin(t_dim->w, 8) * 4, 3, "dq");
  815|    122|                dsp->itx.itxfm_add[ytx][txtp](dst, f->cur.stride[0], cf, eob
  816|    122|                                              HIGHBD_CALL_SUFFIX);
  817|    122|                if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   34|    122|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 122]
  |  |  ------------------
  |  |   35|    122|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|    122|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS)
  ------------------
  |  |   37|      0|#define DEBUG_B_PIXELS 0
  |  |  ------------------
  |  |  |  Branch (37:24): [Folded, False: 0]
  |  |  ------------------
  ------------------
  818|      0|                    hex_dump(dst, f->cur.stride[0], t_dim->w * 4, t_dim->h * 4, "recon");
  819|    122|            }
  820|    242|        }
  821|    884|    }
  822|    990|}
recon_tmpl.c:decode_coefs:
  327|  9.35k|{
  328|  9.35k|    Dav1dTileState *const ts = t->ts;
  329|  9.35k|    const int chroma = !!plane;
  330|  9.35k|    const Dav1dFrameContext *const f = t->f;
  331|  9.35k|    const int lossless = f->frame_hdr->segmentation.lossless[b->seg_id];
  332|  9.35k|    const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[tx];
  333|  9.35k|    const int dbg = DEBUG_BLOCK_INFO && plane && 0;
  ------------------
  |  |   34|  9.35k|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 9.35k]
  |  |  ------------------
  |  |   35|  9.35k|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|  9.35k|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (333:41): [True: 0, False: 0]
  |  Branch (333:50): [Folded, False: 0]
  ------------------
  334|       |
  335|  9.35k|    if (dbg)
  ------------------
  |  Branch (335:9): [Folded, False: 9.35k]
  ------------------
  336|      0|        printf("Start: r=%d\n", ts->msac.rng);
  337|       |
  338|       |    // does this block have any non-zero coefficients
  339|  9.35k|    const int sctx = get_skip_ctx(t_dim, bs, a, l, chroma, f->cur.p.layout);
  340|  9.35k|    const int all_skip = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|  9.35k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  341|  9.35k|                             ts->cdf.coef.skip[t_dim->ctx][sctx]);
  342|  9.35k|    if (dbg)
  ------------------
  |  Branch (342:9): [Folded, False: 9.35k]
  ------------------
  343|      0|        printf("Post-non-zero[%d][%d][%d]: r=%d\n",
  344|      0|               t_dim->ctx, sctx, all_skip, ts->msac.rng);
  345|  9.35k|    if (all_skip) {
  ------------------
  |  Branch (345:9): [True: 5.28k, False: 4.06k]
  ------------------
  346|  5.28k|        *res_ctx = 0x40;
  347|  5.28k|        *txtp = lossless * WHT_WHT; /* lossless ? WHT_WHT : DCT_DCT */
  348|  5.28k|        return -1;
  349|  5.28k|    }
  350|       |
  351|       |    // transform type (chroma: derived, luma: explicitly coded)
  352|  4.06k|    if (lossless) {
  ------------------
  |  Branch (352:9): [True: 0, False: 4.06k]
  ------------------
  353|      0|        assert(t_dim->max == TX_4X4);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  354|      0|        *txtp = WHT_WHT;
  355|  4.06k|    } else if (t_dim->max + intra >= TX_64X64) {
  ------------------
  |  Branch (355:16): [True: 374, False: 3.68k]
  ------------------
  356|    374|        *txtp = DCT_DCT;
  357|  3.68k|    } else if (chroma) {
  ------------------
  |  Branch (357:16): [True: 1.05k, False: 2.63k]
  ------------------
  358|       |        // inferred from either the luma txtp (inter) or a LUT (intra)
  359|  1.05k|        *txtp = intra ? dav1d_txtp_from_uvmode[b->uv_mode] :
  ------------------
  |  Branch (359:17): [True: 716, False: 336]
  ------------------
  360|  1.05k|                        get_uv_inter_txtp(t_dim, *txtp);
  361|  2.63k|    } else if (!f->frame_hdr->segmentation.qidx[b->seg_id]) {
  ------------------
  |  Branch (361:16): [True: 0, False: 2.63k]
  ------------------
  362|       |        // In libaom, lossless is checked by a literal qidx == 0, but not all
  363|       |        // such blocks are actually lossless. The remainder gets an implicit
  364|       |        // transform type (for luma)
  365|      0|        *txtp = DCT_DCT;
  366|  2.63k|    } else {
  367|  2.63k|        unsigned idx;
  368|  2.63k|        if (intra) {
  ------------------
  |  Branch (368:13): [True: 2.27k, False: 360]
  ------------------
  369|  2.27k|            const enum IntraPredMode y_mode_nofilt = b->y_mode == FILTER_PRED ?
  ------------------
  |  Branch (369:54): [True: 534, False: 1.74k]
  ------------------
  370|  1.74k|                dav1d_filter_mode_to_y_mode[b->y_angle] : b->y_mode;
  371|  2.27k|            if (f->frame_hdr->reduced_txtp_set || t_dim->min == TX_16X16) {
  ------------------
  |  Branch (371:17): [True: 0, False: 2.27k]
  |  Branch (371:51): [True: 270, False: 2.00k]
  ------------------
  372|    270|                idx = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|    270|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
  373|    270|                          ts->cdf.m.txtp_intra2[t_dim->min][y_mode_nofilt], 4);
  374|    270|                *txtp = dav1d_tx_types_per_set[idx + 0];
  375|  2.00k|            } else {
  376|  2.00k|                idx = dav1d_msac_decode_symbol_adapt8(&ts->msac,
  ------------------
  |  |   76|  2.00k|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  ------------------
  377|  2.00k|                          ts->cdf.m.txtp_intra1[t_dim->min][y_mode_nofilt], 6);
  378|  2.00k|                *txtp = dav1d_tx_types_per_set[idx + 5];
  379|  2.00k|            }
  380|  2.27k|            if (dbg)
  ------------------
  |  Branch (380:17): [Folded, False: 2.27k]
  ------------------
  381|      0|                printf("Post-txtp-intra[%d->%d][%d][%d->%d]: r=%d\n",
  382|      0|                       tx, t_dim->min, y_mode_nofilt, idx, *txtp, ts->msac.rng);
  383|  2.27k|        } else {
  384|    360|            if (f->frame_hdr->reduced_txtp_set || t_dim->max == TX_32X32) {
  ------------------
  |  Branch (384:17): [True: 0, False: 360]
  |  Branch (384:51): [True: 84, False: 276]
  ------------------
  385|     84|                idx = dav1d_msac_decode_bool_adapt(&ts->msac,
  ------------------
  |  |   82|     84|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  386|     84|                          ts->cdf.m.txtp_inter3[t_dim->min]);
  387|     84|                *txtp = (idx - 1) & IDTX; /* idx ? DCT_DCT : IDTX */
  388|    276|            } else if (t_dim->min == TX_16X16) {
  ------------------
  |  Branch (388:24): [True: 40, False: 236]
  ------------------
  389|     40|                idx = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|     40|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
  390|     40|                          ts->cdf.m.txtp_inter2, 11);
  391|     40|                *txtp = dav1d_tx_types_per_set[idx + 12];
  392|    236|            } else {
  393|    236|                idx = dav1d_msac_decode_symbol_adapt16(&ts->msac,
  ------------------
  |  |   79|    236|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  ------------------
  394|    236|                          ts->cdf.m.txtp_inter1[t_dim->min], 15);
  395|    236|                *txtp = dav1d_tx_types_per_set[idx + 24];
  396|    236|            }
  397|    360|            if (dbg)
  ------------------
  |  Branch (397:17): [Folded, False: 360]
  ------------------
  398|      0|                printf("Post-txtp-inter[%d->%d][%d->%d]: r=%d\n",
  399|      0|                       tx, t_dim->min, idx, *txtp, ts->msac.rng);
  400|    360|        }
  401|  2.63k|    }
  402|       |
  403|       |    // find end-of-block (eob)
  404|  4.06k|    int eob;
  405|  4.06k|    const int slw = imin(t_dim->lw, TX_32X32), slh = imin(t_dim->lh, TX_32X32);
  406|  4.06k|    const int tx2dszctx = slw + slh;
  407|  4.06k|    const enum TxClass tx_class = dav1d_tx_type_class[*txtp];
  408|  4.06k|    const int is_1d = tx_class != TX_CLASS_2D;
  409|  4.06k|    switch (tx2dszctx) {
  ------------------
  |  Branch (409:13): [True: 4.06k, False: 0]
  ------------------
  410|      0|#define case_sz(sz, bin, ns, is_1d) \
  411|      0|    case sz: { \
  412|      0|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  413|      0|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  414|      0|        break; \
  415|      0|    }
  416|    738|    case_sz(0,   16,  8, [is_1d]);
  ------------------
  |  |  411|    738|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 738, False: 3.32k]
  |  |  ------------------
  |  |  412|    738|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|    738|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   76|    738|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|    738|        break; \
  |  |  415|    738|    }
  ------------------
  417|    630|    case_sz(1,   32,  8, [is_1d]);
  ------------------
  |  |  411|    630|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 630, False: 3.43k]
  |  |  ------------------
  |  |  412|    630|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|    630|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   76|    630|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|    630|        break; \
  |  |  415|    630|    }
  ------------------
  418|  1.46k|    case_sz(2,   64,  8, [is_1d]);
  ------------------
  |  |  411|  1.46k|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 1.46k, False: 2.59k]
  |  |  ------------------
  |  |  412|  1.46k|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|  1.46k|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   76|  1.46k|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|  1.46k|        break; \
  |  |  415|  1.46k|    }
  ------------------
  419|    334|    case_sz(3,  128,  8, [is_1d]);
  ------------------
  |  |  411|    334|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 334, False: 3.72k]
  |  |  ------------------
  |  |  412|    334|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|    334|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   76|    334|#define dav1d_msac_decode_symbol_adapt8  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|    334|        break; \
  |  |  415|    334|    }
  ------------------
  420|    566|    case_sz(4,  256, 16, [is_1d]);
  ------------------
  |  |  411|    566|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 566, False: 3.49k]
  |  |  ------------------
  |  |  412|    566|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|    566|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   79|    566|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|    566|        break; \
  |  |  415|    566|    }
  ------------------
  421|     98|    case_sz(5,  512, 16,        );
  ------------------
  |  |  411|     98|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 98, False: 3.96k]
  |  |  ------------------
  |  |  412|     98|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|     98|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   79|     98|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|     98|        break; \
  |  |  415|     98|    }
  ------------------
  422|    232|    case_sz(6, 1024, 16,        );
  ------------------
  |  |  411|    232|    case sz: { \
  |  |  ------------------
  |  |  |  Branch (411:5): [True: 232, False: 3.83k]
  |  |  ------------------
  |  |  412|    232|        uint16_t *const eob_bin_cdf = ts->cdf.coef.eob_bin_##bin[chroma]is_1d; \
  |  |  413|    232|        eob = dav1d_msac_decode_symbol_adapt##ns(&ts->msac, eob_bin_cdf, 4 + sz); \
  |  |  ------------------
  |  |  |  |   79|    232|#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  414|    232|        break; \
  |  |  415|    232|    }
  ------------------
  423|  4.06k|#undef case_sz
  424|  4.06k|    }
  425|  4.06k|    if (dbg)
  ------------------
  |  Branch (425:9): [Folded, False: 4.06k]
  ------------------
  426|      0|        printf("Post-eob_bin_%d[%d][%d][%d]: r=%d\n",
  427|      0|               16 << tx2dszctx, chroma, is_1d, eob, ts->msac.rng);
  428|  4.06k|    if (eob > 1) {
  ------------------
  |  Branch (428:9): [True: 2.89k, False: 1.16k]
  ------------------
  429|  2.89k|        const int eob_bin = eob - 2;
  430|  2.89k|        uint16_t *const eob_hi_bit_cdf =
  431|  2.89k|            ts->cdf.coef.eob_hi_bit[t_dim->ctx][chroma][eob_bin];
  432|  2.89k|        const int eob_hi_bit = dav1d_msac_decode_bool_adapt(&ts->msac, eob_hi_bit_cdf);
  ------------------
  |  |   82|  2.89k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  433|  2.89k|        if (dbg)
  ------------------
  |  Branch (433:13): [Folded, False: 2.89k]
  ------------------
  434|      0|            printf("Post-eob_hi_bit[%d][%d][%d][%d]: r=%d\n",
  435|      0|                   t_dim->ctx, chroma, eob_bin, eob_hi_bit, ts->msac.rng);
  436|  2.89k|        eob = ((eob_hi_bit | 2) << eob_bin) | dav1d_msac_decode_bools(&ts->msac, eob_bin);
  437|  2.89k|        if (dbg)
  ------------------
  |  Branch (437:13): [Folded, False: 2.89k]
  ------------------
  438|      0|            printf("Post-eob[%d]: r=%d\n", eob, ts->msac.rng);
  439|  2.89k|    }
  440|  4.06k|    assert(eob >= 0);
  ------------------
  |  |  140|  4.06k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4.06k]
  |  |  |  Branch (140:68): [Folded, False: 4.06k]
  |  |  ------------------
  ------------------
  441|       |
  442|       |    // base tokens
  443|  4.06k|    uint16_t (*const eob_cdf)[4] = ts->cdf.coef.eob_base_tok[t_dim->ctx][chroma];
  444|  4.06k|    uint16_t (*const hi_cdf)[4] = ts->cdf.coef.br_tok[imin(t_dim->ctx, 3)][chroma];
  445|  4.06k|    unsigned rc, dc_tok;
  446|       |
  447|  4.06k|    if (eob) {
  ------------------
  |  Branch (447:9): [True: 3.06k, False: 1.00k]
  ------------------
  448|  3.06k|        uint16_t (*const lo_cdf)[4] = ts->cdf.coef.base_tok[t_dim->ctx][chroma];
  449|  3.06k|        uint8_t *const levels = t->scratch.levels; // bits 0-5: tok, 6-7: lo_tok
  450|       |
  451|       |        /* eob */
  452|  3.06k|        unsigned ctx = 1 + (eob > 2 << tx2dszctx) + (eob > 4 << tx2dszctx);
  453|  3.06k|        int eob_tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, eob_cdf[ctx], 2);
  ------------------
  |  |   73|  3.06k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  454|  3.06k|        int tok = eob_tok + 1;
  455|  3.06k|        int level_tok = tok * 0x41;
  456|  3.06k|        unsigned mag;
  457|       |
  458|  3.06k|#define DECODE_COEFS_CLASS(tx_class) \
  459|  3.06k|        unsigned x, y; \
  460|  3.06k|        uint8_t *level; \
  461|  3.06k|        if (tx_class == TX_CLASS_2D) \
  462|  3.06k|            rc = scan[eob], x = rc >> shift, y = rc & mask; \
  463|  3.06k|        else if (tx_class == TX_CLASS_H) \
  464|       |            /* Transposing reduces the stride and padding requirements */ \
  465|  3.06k|            x = eob & mask, y = eob >> shift, rc = eob; \
  466|  3.06k|        else /* tx_class == TX_CLASS_V */ \
  467|  3.06k|            x = eob & mask, y = eob >> shift, rc = (x << shift2) | y; \
  468|  3.06k|        if (dbg) \
  469|  3.06k|            printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  470|  3.06k|                   t_dim->ctx, chroma, ctx, eob, rc, tok, ts->msac.rng); \
  471|  3.06k|        if (eob_tok == 2) { \
  472|  3.06k|            ctx = (tx_class == TX_CLASS_2D ? (x | y) > 1 : y != 0) ? 14 : 7; \
  473|  3.06k|            tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  474|  3.06k|            level_tok = tok + (3 << 6); \
  475|  3.06k|            if (dbg) \
  476|  3.06k|                printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  477|  3.06k|                       imin(t_dim->ctx, 3), chroma, ctx, eob, rc, tok, \
  478|  3.06k|                       ts->msac.rng); \
  479|  3.06k|        } \
  480|  3.06k|        cf[rc] = tok << 11; \
  481|  3.06k|        if (tx_class == TX_CLASS_2D) \
  482|  3.06k|            level = levels + rc; \
  483|  3.06k|        else \
  484|  3.06k|            level = levels + x * stride + y; \
  485|  3.06k|        *level = (uint8_t) level_tok; \
  486|  3.06k|        for (int i = eob - 1; i > 0; i--) { /* ac */ \
  487|  3.06k|            unsigned rc_i; \
  488|  3.06k|            if (tx_class == TX_CLASS_2D) \
  489|  3.06k|                rc_i = scan[i], x = rc_i >> shift, y = rc_i & mask; \
  490|  3.06k|            else if (tx_class == TX_CLASS_H) \
  491|  3.06k|                x = i & mask, y = i >> shift, rc_i = i; \
  492|  3.06k|            else /* tx_class == TX_CLASS_V */ \
  493|  3.06k|                x = i & mask, y = i >> shift, rc_i = (x << shift2) | y; \
  494|  3.06k|            assert(x < 32 && y < 32); \
  495|  3.06k|            if (tx_class == TX_CLASS_2D) \
  496|  3.06k|                level = levels + rc_i; \
  497|  3.06k|            else \
  498|  3.06k|                level = levels + x * stride + y; \
  499|  3.06k|            ctx = get_lo_ctx(level, tx_class, &mag, lo_ctx_offsets, x, y, stride); \
  500|  3.06k|            if (tx_class == TX_CLASS_2D) \
  501|  3.06k|                y |= x; \
  502|  3.06k|            tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  503|  3.06k|            if (dbg) \
  504|  3.06k|                printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  505|  3.06k|                       t_dim->ctx, chroma, ctx, i, rc_i, tok, ts->msac.rng); \
  506|  3.06k|            if (tok == 3) { \
  507|  3.06k|                mag &= 63; \
  508|  3.06k|                ctx = (y > (tx_class == TX_CLASS_2D) ? 14 : 7) + \
  509|  3.06k|                      (mag > 12 ? 6 : (mag + 1) >> 1); \
  510|  3.06k|                tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  511|  3.06k|                if (dbg) \
  512|  3.06k|                    printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  513|  3.06k|                           imin(t_dim->ctx, 3), chroma, ctx, i, rc_i, tok, \
  514|  3.06k|                           ts->msac.rng); \
  515|  3.06k|                *level = (uint8_t) (tok + (3 << 6)); \
  516|  3.06k|                cf[rc_i] = (tok << 11) | rc; \
  517|  3.06k|                rc = rc_i; \
  518|  3.06k|            } else { \
  519|       |                /* 0x1 for tok, 0x7ff as bitmask for rc, 0x41 for level_tok */ \
  520|  3.06k|                tok *= 0x17ff41; \
  521|  3.06k|                *level = (uint8_t) tok; \
  522|       |                /* tok ? (tok << 11) | rc : 0 */ \
  523|  3.06k|                tok = (tok >> 9) & (rc + ~0x7ffu); \
  524|  3.06k|                if (tok) rc = rc_i; \
  525|  3.06k|                cf[rc_i] = tok; \
  526|  3.06k|            } \
  527|  3.06k|        } \
  528|       |        /* dc */ \
  529|  3.06k|        ctx = (tx_class == TX_CLASS_2D) ? 0 : \
  530|  3.06k|            get_lo_ctx(levels, tx_class, &mag, lo_ctx_offsets, 0, 0, stride); \
  531|  3.06k|        dc_tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  532|  3.06k|        if (dbg) \
  533|  3.06k|            printf("Post-dc_lo_tok[%d][%d][%d][%d]: r=%d\n", \
  534|  3.06k|                   t_dim->ctx, chroma, ctx, dc_tok, ts->msac.rng); \
  535|  3.06k|        if (dc_tok == 3) { \
  536|  3.06k|            if (tx_class == TX_CLASS_2D) \
  537|  3.06k|                mag = levels[0 * stride + 1] + levels[1 * stride + 0] + \
  538|  3.06k|                      levels[1 * stride + 1]; \
  539|  3.06k|            mag &= 63; \
  540|  3.06k|            ctx = mag > 12 ? 6 : (mag + 1) >> 1; \
  541|  3.06k|            dc_tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  542|  3.06k|            if (dbg) \
  543|  3.06k|                printf("Post-dc_hi_tok[%d][%d][0][%d]: r=%d\n", \
  544|  3.06k|                       imin(t_dim->ctx, 3), chroma, dc_tok, ts->msac.rng); \
  545|  3.06k|        } \
  546|  3.06k|        break
  547|       |
  548|  3.06k|        const uint16_t *scan;
  549|  3.06k|        switch (tx_class) {
  550|  2.68k|        case TX_CLASS_2D: {
  ------------------
  |  Branch (550:9): [True: 2.68k, False: 378]
  ------------------
  551|  2.68k|            const unsigned nonsquare_tx = tx >= RTX_4X8;
  552|  2.68k|            const uint8_t (*const lo_ctx_offsets)[5] =
  553|  2.68k|                dav1d_lo_ctx_offsets[nonsquare_tx + (tx & nonsquare_tx)];
  554|  2.68k|            scan = dav1d_scans[tx];
  555|  2.68k|            const ptrdiff_t stride = 4 << slh;
  556|  2.68k|            const unsigned shift = slh + 2, shift2 = 0;
  557|  2.68k|            const unsigned mask = (4 << slh) - 1;
  558|  2.68k|            memset(levels, 0, stride * ((4 << slw) + 2));
  559|  2.68k|            DECODE_COEFS_CLASS(TX_CLASS_2D);
  ------------------
  |  |  459|  2.68k|        unsigned x, y; \
  |  |  460|  2.68k|        uint8_t *level; \
  |  |  461|  2.68k|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (461:13): [True: 2.68k, Folded]
  |  |  ------------------
  |  |  462|  2.68k|            rc = scan[eob], x = rc >> shift, y = rc & mask; \
  |  |  463|  2.68k|        else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (463:18): [Folded, False: 0]
  |  |  ------------------
  |  |  464|      0|            /* Transposing reduces the stride and padding requirements */ \
  |  |  465|      0|            x = eob & mask, y = eob >> shift, rc = eob; \
  |  |  466|      0|        else /* tx_class == TX_CLASS_V */ \
  |  |  467|      0|            x = eob & mask, y = eob >> shift, rc = (x << shift2) | y; \
  |  |  468|  2.68k|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (468:13): [Folded, False: 2.68k]
  |  |  ------------------
  |  |  469|  2.68k|            printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  470|      0|                   t_dim->ctx, chroma, ctx, eob, rc, tok, ts->msac.rng); \
  |  |  471|  2.68k|        if (eob_tok == 2) { \
  |  |  ------------------
  |  |  |  Branch (471:13): [True: 34, False: 2.65k]
  |  |  ------------------
  |  |  472|     34|            ctx = (tx_class == TX_CLASS_2D ? (x | y) > 1 : y != 0) ? 14 : 7; \
  |  |  ------------------
  |  |  |  Branch (472:19): [True: 30, False: 4]
  |  |  |  Branch (472:20): [True: 34, Folded]
  |  |  ------------------
  |  |  473|     34|            tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|     34|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  474|     34|            level_tok = tok + (3 << 6); \
  |  |  475|     34|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (475:17): [Folded, False: 34]
  |  |  ------------------
  |  |  476|     34|                printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  477|      0|                       imin(t_dim->ctx, 3), chroma, ctx, eob, rc, tok, \
  |  |  478|      0|                       ts->msac.rng); \
  |  |  479|     34|        } \
  |  |  480|  2.68k|        cf[rc] = tok << 11; \
  |  |  481|  2.68k|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (481:13): [True: 2.68k, Folded]
  |  |  ------------------
  |  |  482|  2.68k|            level = levels + rc; \
  |  |  483|  2.68k|        else \
  |  |  484|  2.68k|            level = levels + x * stride + y; \
  |  |  485|  2.68k|        *level = (uint8_t) level_tok; \
  |  |  486|  89.4k|        for (int i = eob - 1; i > 0; i--) { /* ac */ \
  |  |  ------------------
  |  |  |  Branch (486:31): [True: 86.7k, False: 2.68k]
  |  |  ------------------
  |  |  487|  86.7k|            unsigned rc_i; \
  |  |  488|  86.7k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (488:17): [True: 86.7k, Folded]
  |  |  ------------------
  |  |  489|  86.7k|                rc_i = scan[i], x = rc_i >> shift, y = rc_i & mask; \
  |  |  490|  86.7k|            else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (490:22): [Folded, False: 0]
  |  |  ------------------
  |  |  491|      0|                x = i & mask, y = i >> shift, rc_i = i; \
  |  |  492|      0|            else /* tx_class == TX_CLASS_V */ \
  |  |  493|      0|                x = i & mask, y = i >> shift, rc_i = (x << shift2) | y; \
  |  |  494|  86.7k|            assert(x < 32 && y < 32); \
  |  |  ------------------
  |  |  |  |  140|   173k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:30): [True: 86.7k, False: 0]
  |  |  |  |  |  Branch (140:30): [True: 86.7k, False: 0]
  |  |  |  |  |  Branch (140:68): [Folded, False: 86.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  495|  86.7k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (495:17): [True: 86.7k, Folded]
  |  |  ------------------
  |  |  496|  86.7k|                level = levels + rc_i; \
  |  |  497|  86.7k|            else \
  |  |  498|  86.7k|                level = levels + x * stride + y; \
  |  |  499|  86.7k|            ctx = get_lo_ctx(level, tx_class, &mag, lo_ctx_offsets, x, y, stride); \
  |  |  500|  86.7k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (500:17): [True: 86.7k, Folded]
  |  |  ------------------
  |  |  501|  86.7k|                y |= x; \
  |  |  502|  86.7k|            tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|  86.7k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  503|  86.7k|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (503:17): [Folded, False: 86.7k]
  |  |  ------------------
  |  |  504|  86.7k|                printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  505|      0|                       t_dim->ctx, chroma, ctx, i, rc_i, tok, ts->msac.rng); \
  |  |  506|  86.7k|            if (tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (506:17): [True: 7.90k, False: 78.8k]
  |  |  ------------------
  |  |  507|  7.90k|                mag &= 63; \
  |  |  508|  7.90k|                ctx = (y > (tx_class == TX_CLASS_2D) ? 14 : 7) + \
  |  |  ------------------
  |  |  |  Branch (508:24): [True: 6.78k, False: 1.12k]
  |  |  ------------------
  |  |  509|  7.90k|                      (mag > 12 ? 6 : (mag + 1) >> 1); \
  |  |  ------------------
  |  |  |  Branch (509:24): [True: 876, False: 7.02k]
  |  |  ------------------
  |  |  510|  7.90k|                tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|  7.90k|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  511|  7.90k|                if (dbg) \
  |  |  ------------------
  |  |  |  Branch (511:21): [Folded, False: 7.90k]
  |  |  ------------------
  |  |  512|  7.90k|                    printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  513|      0|                           imin(t_dim->ctx, 3), chroma, ctx, i, rc_i, tok, \
  |  |  514|      0|                           ts->msac.rng); \
  |  |  515|  7.90k|                *level = (uint8_t) (tok + (3 << 6)); \
  |  |  516|  7.90k|                cf[rc_i] = (tok << 11) | rc; \
  |  |  517|  7.90k|                rc = rc_i; \
  |  |  518|  78.8k|            } else { \
  |  |  519|  78.8k|                /* 0x1 for tok, 0x7ff as bitmask for rc, 0x41 for level_tok */ \
  |  |  520|  78.8k|                tok *= 0x17ff41; \
  |  |  521|  78.8k|                *level = (uint8_t) tok; \
  |  |  522|  78.8k|                /* tok ? (tok << 11) | rc : 0 */ \
  |  |  523|  78.8k|                tok = (tok >> 9) & (rc + ~0x7ffu); \
  |  |  524|  78.8k|                if (tok) rc = rc_i; \
  |  |  ------------------
  |  |  |  Branch (524:21): [True: 27.2k, False: 51.6k]
  |  |  ------------------
  |  |  525|  78.8k|                cf[rc_i] = tok; \
  |  |  526|  78.8k|            } \
  |  |  527|  86.7k|        } \
  |  |  528|  2.68k|        /* dc */ \
  |  |  529|  2.68k|        ctx = (tx_class == TX_CLASS_2D) ? 0 : \
  |  |  ------------------
  |  |  |  Branch (529:15): [True: 2.68k, Folded]
  |  |  ------------------
  |  |  530|  2.68k|            get_lo_ctx(levels, tx_class, &mag, lo_ctx_offsets, 0, 0, stride); \
  |  |  531|  2.68k|        dc_tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|  2.68k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  532|  2.68k|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (532:13): [Folded, False: 2.68k]
  |  |  ------------------
  |  |  533|  2.68k|            printf("Post-dc_lo_tok[%d][%d][%d][%d]: r=%d\n", \
  |  |  534|      0|                   t_dim->ctx, chroma, ctx, dc_tok, ts->msac.rng); \
  |  |  535|  2.68k|        if (dc_tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 922, False: 1.76k]
  |  |  ------------------
  |  |  536|    922|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (536:17): [True: 922, Folded]
  |  |  ------------------
  |  |  537|    922|                mag = levels[0 * stride + 1] + levels[1 * stride + 0] + \
  |  |  538|    922|                      levels[1 * stride + 1]; \
  |  |  539|    922|            mag &= 63; \
  |  |  540|    922|            ctx = mag > 12 ? 6 : (mag + 1) >> 1; \
  |  |  ------------------
  |  |  |  Branch (540:19): [True: 142, False: 780]
  |  |  ------------------
  |  |  541|    922|            dc_tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|    922|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  542|    922|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (542:17): [Folded, False: 922]
  |  |  ------------------
  |  |  543|    922|                printf("Post-dc_hi_tok[%d][%d][0][%d]: r=%d\n", \
  |  |  544|      0|                       imin(t_dim->ctx, 3), chroma, dc_tok, ts->msac.rng); \
  |  |  545|    922|        } \
  |  |  546|  2.68k|        break
  ------------------
  560|  2.68k|        }
  561|    268|        case TX_CLASS_H: {
  ------------------
  |  Branch (561:9): [True: 268, False: 2.79k]
  ------------------
  562|    268|            const uint8_t (*const lo_ctx_offsets)[5] = NULL;
  563|    268|            const ptrdiff_t stride = 16;
  564|    268|            const unsigned shift = slh + 2, shift2 = 0;
  565|    268|            const unsigned mask = (4 << slh) - 1;
  566|    268|            memset(levels, 0, stride * ((4 << slh) + 2));
  567|    268|            DECODE_COEFS_CLASS(TX_CLASS_H);
  ------------------
  |  |  459|    268|        unsigned x, y; \
  |  |  460|    268|        uint8_t *level; \
  |  |  461|    268|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (461:13): [Folded, False: 268]
  |  |  ------------------
  |  |  462|    268|            rc = scan[eob], x = rc >> shift, y = rc & mask; \
  |  |  463|    268|        else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (463:18): [True: 268, Folded]
  |  |  ------------------
  |  |  464|    268|            /* Transposing reduces the stride and padding requirements */ \
  |  |  465|    268|            x = eob & mask, y = eob >> shift, rc = eob; \
  |  |  466|    268|        else /* tx_class == TX_CLASS_V */ \
  |  |  467|    268|            x = eob & mask, y = eob >> shift, rc = (x << shift2) | y; \
  |  |  468|    268|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (468:13): [Folded, False: 268]
  |  |  ------------------
  |  |  469|    268|            printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  470|      0|                   t_dim->ctx, chroma, ctx, eob, rc, tok, ts->msac.rng); \
  |  |  471|    268|        if (eob_tok == 2) { \
  |  |  ------------------
  |  |  |  Branch (471:13): [True: 2, False: 266]
  |  |  ------------------
  |  |  472|      2|            ctx = (tx_class == TX_CLASS_2D ? (x | y) > 1 : y != 0) ? 14 : 7; \
  |  |  ------------------
  |  |  |  Branch (472:19): [True: 2, False: 0]
  |  |  |  Branch (472:20): [Folded, False: 2]
  |  |  ------------------
  |  |  473|      2|            tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|      2|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  474|      2|            level_tok = tok + (3 << 6); \
  |  |  475|      2|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (475:17): [Folded, False: 2]
  |  |  ------------------
  |  |  476|      2|                printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  477|      0|                       imin(t_dim->ctx, 3), chroma, ctx, eob, rc, tok, \
  |  |  478|      0|                       ts->msac.rng); \
  |  |  479|      2|        } \
  |  |  480|    268|        cf[rc] = tok << 11; \
  |  |  481|    268|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (481:13): [Folded, False: 268]
  |  |  ------------------
  |  |  482|    268|            level = levels + rc; \
  |  |  483|    268|        else \
  |  |  484|    268|            level = levels + x * stride + y; \
  |  |  485|    268|        *level = (uint8_t) level_tok; \
  |  |  486|  5.59k|        for (int i = eob - 1; i > 0; i--) { /* ac */ \
  |  |  ------------------
  |  |  |  Branch (486:31): [True: 5.33k, False: 268]
  |  |  ------------------
  |  |  487|  5.33k|            unsigned rc_i; \
  |  |  488|  5.33k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (488:17): [Folded, False: 5.33k]
  |  |  ------------------
  |  |  489|  5.33k|                rc_i = scan[i], x = rc_i >> shift, y = rc_i & mask; \
  |  |  490|  5.33k|            else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (490:22): [True: 5.33k, Folded]
  |  |  ------------------
  |  |  491|  5.33k|                x = i & mask, y = i >> shift, rc_i = i; \
  |  |  492|  5.33k|            else /* tx_class == TX_CLASS_V */ \
  |  |  493|  5.33k|                x = i & mask, y = i >> shift, rc_i = (x << shift2) | y; \
  |  |  494|  5.33k|            assert(x < 32 && y < 32); \
  |  |  ------------------
  |  |  |  |  140|  10.6k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:30): [True: 5.33k, False: 0]
  |  |  |  |  |  Branch (140:30): [True: 5.33k, False: 0]
  |  |  |  |  |  Branch (140:68): [Folded, False: 5.33k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  495|  5.33k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (495:17): [Folded, False: 5.33k]
  |  |  ------------------
  |  |  496|  5.33k|                level = levels + rc_i; \
  |  |  497|  5.33k|            else \
  |  |  498|  5.33k|                level = levels + x * stride + y; \
  |  |  499|  5.33k|            ctx = get_lo_ctx(level, tx_class, &mag, lo_ctx_offsets, x, y, stride); \
  |  |  500|  5.33k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (500:17): [Folded, False: 5.33k]
  |  |  ------------------
  |  |  501|  5.33k|                y |= x; \
  |  |  502|  5.33k|            tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|  5.33k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  503|  5.33k|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (503:17): [Folded, False: 5.33k]
  |  |  ------------------
  |  |  504|  5.33k|                printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  505|      0|                       t_dim->ctx, chroma, ctx, i, rc_i, tok, ts->msac.rng); \
  |  |  506|  5.33k|            if (tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (506:17): [True: 172, False: 5.15k]
  |  |  ------------------
  |  |  507|    172|                mag &= 63; \
  |  |  508|    172|                ctx = (y > (tx_class == TX_CLASS_2D) ? 14 : 7) + \
  |  |  ------------------
  |  |  |  Branch (508:24): [True: 124, False: 48]
  |  |  ------------------
  |  |  509|    172|                      (mag > 12 ? 6 : (mag + 1) >> 1); \
  |  |  ------------------
  |  |  |  Branch (509:24): [True: 10, False: 162]
  |  |  ------------------
  |  |  510|    172|                tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|    172|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  511|    172|                if (dbg) \
  |  |  ------------------
  |  |  |  Branch (511:21): [Folded, False: 172]
  |  |  ------------------
  |  |  512|    172|                    printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  513|      0|                           imin(t_dim->ctx, 3), chroma, ctx, i, rc_i, tok, \
  |  |  514|      0|                           ts->msac.rng); \
  |  |  515|    172|                *level = (uint8_t) (tok + (3 << 6)); \
  |  |  516|    172|                cf[rc_i] = (tok << 11) | rc; \
  |  |  517|    172|                rc = rc_i; \
  |  |  518|  5.15k|            } else { \
  |  |  519|  5.15k|                /* 0x1 for tok, 0x7ff as bitmask for rc, 0x41 for level_tok */ \
  |  |  520|  5.15k|                tok *= 0x17ff41; \
  |  |  521|  5.15k|                *level = (uint8_t) tok; \
  |  |  522|  5.15k|                /* tok ? (tok << 11) | rc : 0 */ \
  |  |  523|  5.15k|                tok = (tok >> 9) & (rc + ~0x7ffu); \
  |  |  524|  5.15k|                if (tok) rc = rc_i; \
  |  |  ------------------
  |  |  |  Branch (524:21): [True: 1.29k, False: 3.86k]
  |  |  ------------------
  |  |  525|  5.15k|                cf[rc_i] = tok; \
  |  |  526|  5.15k|            } \
  |  |  527|  5.33k|        } \
  |  |  528|    268|        /* dc */ \
  |  |  529|    268|        ctx = (tx_class == TX_CLASS_2D) ? 0 : \
  |  |  ------------------
  |  |  |  Branch (529:15): [Folded, False: 268]
  |  |  ------------------
  |  |  530|    268|            get_lo_ctx(levels, tx_class, &mag, lo_ctx_offsets, 0, 0, stride); \
  |  |  531|    268|        dc_tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|    268|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  532|    268|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (532:13): [Folded, False: 268]
  |  |  ------------------
  |  |  533|    268|            printf("Post-dc_lo_tok[%d][%d][%d][%d]: r=%d\n", \
  |  |  534|      0|                   t_dim->ctx, chroma, ctx, dc_tok, ts->msac.rng); \
  |  |  535|    268|        if (dc_tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 20, False: 248]
  |  |  ------------------
  |  |  536|     20|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (536:17): [Folded, False: 20]
  |  |  ------------------
  |  |  537|     20|                mag = levels[0 * stride + 1] + levels[1 * stride + 0] + \
  |  |  538|      0|                      levels[1 * stride + 1]; \
  |  |  539|     20|            mag &= 63; \
  |  |  540|     20|            ctx = mag > 12 ? 6 : (mag + 1) >> 1; \
  |  |  ------------------
  |  |  |  Branch (540:19): [True: 0, False: 20]
  |  |  ------------------
  |  |  541|     20|            dc_tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|     20|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  542|     20|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (542:17): [Folded, False: 20]
  |  |  ------------------
  |  |  543|     20|                printf("Post-dc_hi_tok[%d][%d][0][%d]: r=%d\n", \
  |  |  544|      0|                       imin(t_dim->ctx, 3), chroma, dc_tok, ts->msac.rng); \
  |  |  545|     20|        } \
  |  |  546|    268|        break
  ------------------
  568|    268|        }
  569|    110|        case TX_CLASS_V: {
  ------------------
  |  Branch (569:9): [True: 110, False: 2.95k]
  ------------------
  570|    110|            const uint8_t (*const lo_ctx_offsets)[5] = NULL;
  571|    110|            const ptrdiff_t stride = 16;
  572|    110|            const unsigned shift = slw + 2, shift2 = slh + 2;
  573|    110|            const unsigned mask = (4 << slw) - 1;
  574|    110|            memset(levels, 0, stride * ((4 << slw) + 2));
  575|    110|            DECODE_COEFS_CLASS(TX_CLASS_V);
  ------------------
  |  |  459|    110|        unsigned x, y; \
  |  |  460|    110|        uint8_t *level; \
  |  |  461|    110|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (461:13): [Folded, False: 110]
  |  |  ------------------
  |  |  462|    110|            rc = scan[eob], x = rc >> shift, y = rc & mask; \
  |  |  463|    110|        else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (463:18): [Folded, False: 110]
  |  |  ------------------
  |  |  464|    110|            /* Transposing reduces the stride and padding requirements */ \
  |  |  465|    110|            x = eob & mask, y = eob >> shift, rc = eob; \
  |  |  466|    110|        else /* tx_class == TX_CLASS_V */ \
  |  |  467|    110|            x = eob & mask, y = eob >> shift, rc = (x << shift2) | y; \
  |  |  468|    110|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (468:13): [Folded, False: 110]
  |  |  ------------------
  |  |  469|    110|            printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  470|      0|                   t_dim->ctx, chroma, ctx, eob, rc, tok, ts->msac.rng); \
  |  |  471|    110|        if (eob_tok == 2) { \
  |  |  ------------------
  |  |  |  Branch (471:13): [True: 0, False: 110]
  |  |  ------------------
  |  |  472|      0|            ctx = (tx_class == TX_CLASS_2D ? (x | y) > 1 : y != 0) ? 14 : 7; \
  |  |  ------------------
  |  |  |  Branch (472:19): [True: 0, False: 0]
  |  |  |  Branch (472:20): [Folded, False: 0]
  |  |  ------------------
  |  |  473|      0|            tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|      0|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  474|      0|            level_tok = tok + (3 << 6); \
  |  |  475|      0|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (475:17): [Folded, False: 0]
  |  |  ------------------
  |  |  476|      0|                printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  477|      0|                       imin(t_dim->ctx, 3), chroma, ctx, eob, rc, tok, \
  |  |  478|      0|                       ts->msac.rng); \
  |  |  479|      0|        } \
  |  |  480|    110|        cf[rc] = tok << 11; \
  |  |  481|    110|        if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (481:13): [Folded, False: 110]
  |  |  ------------------
  |  |  482|    110|            level = levels + rc; \
  |  |  483|    110|        else \
  |  |  484|    110|            level = levels + x * stride + y; \
  |  |  485|    110|        *level = (uint8_t) level_tok; \
  |  |  486|  2.03k|        for (int i = eob - 1; i > 0; i--) { /* ac */ \
  |  |  ------------------
  |  |  |  Branch (486:31): [True: 1.92k, False: 110]
  |  |  ------------------
  |  |  487|  1.92k|            unsigned rc_i; \
  |  |  488|  1.92k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (488:17): [Folded, False: 1.92k]
  |  |  ------------------
  |  |  489|  1.92k|                rc_i = scan[i], x = rc_i >> shift, y = rc_i & mask; \
  |  |  490|  1.92k|            else if (tx_class == TX_CLASS_H) \
  |  |  ------------------
  |  |  |  Branch (490:22): [Folded, False: 1.92k]
  |  |  ------------------
  |  |  491|  1.92k|                x = i & mask, y = i >> shift, rc_i = i; \
  |  |  492|  1.92k|            else /* tx_class == TX_CLASS_V */ \
  |  |  493|  1.92k|                x = i & mask, y = i >> shift, rc_i = (x << shift2) | y; \
  |  |  494|  1.92k|            assert(x < 32 && y < 32); \
  |  |  ------------------
  |  |  |  |  140|  3.84k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:30): [True: 1.92k, False: 0]
  |  |  |  |  |  Branch (140:30): [True: 1.92k, False: 0]
  |  |  |  |  |  Branch (140:68): [Folded, False: 1.92k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  495|  1.92k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (495:17): [Folded, False: 1.92k]
  |  |  ------------------
  |  |  496|  1.92k|                level = levels + rc_i; \
  |  |  497|  1.92k|            else \
  |  |  498|  1.92k|                level = levels + x * stride + y; \
  |  |  499|  1.92k|            ctx = get_lo_ctx(level, tx_class, &mag, lo_ctx_offsets, x, y, stride); \
  |  |  500|  1.92k|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (500:17): [Folded, False: 1.92k]
  |  |  ------------------
  |  |  501|  1.92k|                y |= x; \
  |  |  502|  1.92k|            tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|  1.92k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  503|  1.92k|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (503:17): [Folded, False: 1.92k]
  |  |  ------------------
  |  |  504|  1.92k|                printf("Post-lo_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  505|      0|                       t_dim->ctx, chroma, ctx, i, rc_i, tok, ts->msac.rng); \
  |  |  506|  1.92k|            if (tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (506:17): [True: 58, False: 1.86k]
  |  |  ------------------
  |  |  507|     58|                mag &= 63; \
  |  |  508|     58|                ctx = (y > (tx_class == TX_CLASS_2D) ? 14 : 7) + \
  |  |  ------------------
  |  |  |  Branch (508:24): [True: 28, False: 30]
  |  |  ------------------
  |  |  509|     58|                      (mag > 12 ? 6 : (mag + 1) >> 1); \
  |  |  ------------------
  |  |  |  Branch (509:24): [True: 4, False: 54]
  |  |  ------------------
  |  |  510|     58|                tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|     58|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  511|     58|                if (dbg) \
  |  |  ------------------
  |  |  |  Branch (511:21): [Folded, False: 58]
  |  |  ------------------
  |  |  512|     58|                    printf("Post-hi_tok[%d][%d][%d][%d=%d=%d]: r=%d\n", \
  |  |  513|      0|                           imin(t_dim->ctx, 3), chroma, ctx, i, rc_i, tok, \
  |  |  514|      0|                           ts->msac.rng); \
  |  |  515|     58|                *level = (uint8_t) (tok + (3 << 6)); \
  |  |  516|     58|                cf[rc_i] = (tok << 11) | rc; \
  |  |  517|     58|                rc = rc_i; \
  |  |  518|  1.86k|            } else { \
  |  |  519|  1.86k|                /* 0x1 for tok, 0x7ff as bitmask for rc, 0x41 for level_tok */ \
  |  |  520|  1.86k|                tok *= 0x17ff41; \
  |  |  521|  1.86k|                *level = (uint8_t) tok; \
  |  |  522|  1.86k|                /* tok ? (tok << 11) | rc : 0 */ \
  |  |  523|  1.86k|                tok = (tok >> 9) & (rc + ~0x7ffu); \
  |  |  524|  1.86k|                if (tok) rc = rc_i; \
  |  |  ------------------
  |  |  |  Branch (524:21): [True: 508, False: 1.35k]
  |  |  ------------------
  |  |  525|  1.86k|                cf[rc_i] = tok; \
  |  |  526|  1.86k|            } \
  |  |  527|  1.92k|        } \
  |  |  528|    110|        /* dc */ \
  |  |  529|    110|        ctx = (tx_class == TX_CLASS_2D) ? 0 : \
  |  |  ------------------
  |  |  |  Branch (529:15): [Folded, False: 110]
  |  |  ------------------
  |  |  530|    110|            get_lo_ctx(levels, tx_class, &mag, lo_ctx_offsets, 0, 0, stride); \
  |  |  531|    110|        dc_tok = dav1d_msac_decode_symbol_adapt4(&ts->msac, lo_cdf[ctx], 3); \
  |  |  ------------------
  |  |  |  |   73|    110|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  |  |  ------------------
  |  |  532|    110|        if (dbg) \
  |  |  ------------------
  |  |  |  Branch (532:13): [Folded, False: 110]
  |  |  ------------------
  |  |  533|    110|            printf("Post-dc_lo_tok[%d][%d][%d][%d]: r=%d\n", \
  |  |  534|      0|                   t_dim->ctx, chroma, ctx, dc_tok, ts->msac.rng); \
  |  |  535|    110|        if (dc_tok == 3) { \
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 6, False: 104]
  |  |  ------------------
  |  |  536|      6|            if (tx_class == TX_CLASS_2D) \
  |  |  ------------------
  |  |  |  Branch (536:17): [Folded, False: 6]
  |  |  ------------------
  |  |  537|      6|                mag = levels[0 * stride + 1] + levels[1 * stride + 0] + \
  |  |  538|      0|                      levels[1 * stride + 1]; \
  |  |  539|      6|            mag &= 63; \
  |  |  540|      6|            ctx = mag > 12 ? 6 : (mag + 1) >> 1; \
  |  |  ------------------
  |  |  |  Branch (540:19): [True: 0, False: 6]
  |  |  ------------------
  |  |  541|      6|            dc_tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[ctx]); \
  |  |  ------------------
  |  |  |  |   91|      6|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  |  |  ------------------
  |  |  542|      6|            if (dbg) \
  |  |  ------------------
  |  |  |  Branch (542:17): [Folded, False: 6]
  |  |  ------------------
  |  |  543|      6|                printf("Post-dc_hi_tok[%d][%d][0][%d]: r=%d\n", \
  |  |  544|      0|                       imin(t_dim->ctx, 3), chroma, dc_tok, ts->msac.rng); \
  |  |  545|      6|        } \
  |  |  546|    110|        break
  ------------------
  576|    110|        }
  577|      0|#undef DECODE_COEFS_CLASS
  578|      0|        default: assert(0);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (578:9): [True: 0, False: 3.06k]
  ------------------
  579|  3.06k|        }
  580|  3.06k|    } else { // dc-only
  581|  1.00k|        int tok_br = dav1d_msac_decode_symbol_adapt4(&ts->msac, eob_cdf[0], 2);
  ------------------
  |  |   73|  1.00k|#define dav1d_msac_decode_symbol_adapt4  dav1d_msac_decode_symbol_adapt_c
  ------------------
  582|  1.00k|        dc_tok = 1 + tok_br;
  583|  1.00k|        if (dbg)
  ------------------
  |  Branch (583:13): [Folded, False: 1.00k]
  ------------------
  584|      0|            printf("Post-dc_lo_tok[%d][%d][%d][%d]: r=%d\n",
  585|      0|                   t_dim->ctx, chroma, 0, dc_tok, ts->msac.rng);
  586|  1.00k|        if (tok_br == 2) {
  ------------------
  |  Branch (586:13): [True: 50, False: 950]
  ------------------
  587|     50|            dc_tok = dav1d_msac_decode_hi_tok(&ts->msac, hi_cdf[0]);
  ------------------
  |  |   91|     50|#define dav1d_msac_decode_hi_tok         dav1d_msac_decode_hi_tok_c
  ------------------
  588|     50|            if (dbg)
  ------------------
  |  Branch (588:17): [Folded, False: 50]
  ------------------
  589|      0|                printf("Post-dc_hi_tok[%d][%d][0][%d]: r=%d\n",
  590|      0|                       imin(t_dim->ctx, 3), chroma, dc_tok, ts->msac.rng);
  591|     50|        }
  592|  1.00k|        rc = 0;
  593|  1.00k|    }
  594|       |
  595|       |    // residual and sign
  596|  4.06k|    const uint16_t *const dq_tbl = ts->dq[b->seg_id][plane];
  597|  4.06k|    const uint8_t *const qm_tbl = *txtp < IDTX ? f->qm[tx][plane] : NULL;
  ------------------
  |  Branch (597:35): [True: 3.56k, False: 496]
  ------------------
  598|  4.06k|    const int dq_shift = imax(0, t_dim->ctx - 2);
  599|  4.06k|    const int cf_max = ~(~127U << (BITDEPTH == 8 ? 8 : f->cur.p.bpc));
  ------------------
  |  Branch (599:36): [True: 4.06k, Folded]
  ------------------
  600|  4.06k|    unsigned cul_level, dc_sign_level;
  601|       |
  602|  4.06k|    if (!dc_tok) {
  ------------------
  |  Branch (602:9): [True: 870, False: 3.19k]
  ------------------
  603|    870|        cul_level = 0;
  604|    870|        dc_sign_level = 1 << 6;
  605|    870|        if (qm_tbl) goto ac_qm;
  ------------------
  |  Branch (605:13): [True: 422, False: 448]
  ------------------
  606|    448|        goto ac_noqm;
  607|    870|    }
  608|       |
  609|  3.19k|    const int dc_sign_ctx = get_dc_sign_ctx(tx, a, l);
  610|  3.19k|    uint16_t *const dc_sign_cdf = ts->cdf.coef.dc_sign[chroma][dc_sign_ctx];
  611|  3.19k|    const int dc_sign = dav1d_msac_decode_bool_adapt(&ts->msac, dc_sign_cdf);
  ------------------
  |  |   82|  3.19k|#define dav1d_msac_decode_bool_adapt     dav1d_msac_decode_bool_adapt_c
  ------------------
  612|  3.19k|    if (dbg)
  ------------------
  |  Branch (612:9): [Folded, False: 3.19k]
  ------------------
  613|      0|        printf("Post-dc_sign[%d][%d][%d]: r=%d\n",
  614|      0|               chroma, dc_sign_ctx, dc_sign, ts->msac.rng);
  615|       |
  616|  3.19k|    int dc_dq = dq_tbl[0];
  617|  3.19k|    dc_sign_level = (dc_sign - 1) & (2 << 6);
  618|       |
  619|  3.19k|    if (qm_tbl) {
  ------------------
  |  Branch (619:9): [True: 2.16k, False: 1.03k]
  ------------------
  620|  2.16k|        dc_dq = (dc_dq * qm_tbl[0] + 16) >> 5;
  621|       |
  622|  2.16k|        if (dc_tok == 15) {
  ------------------
  |  Branch (622:13): [True: 12, False: 2.15k]
  ------------------
  623|     12|            dc_tok = read_golomb(&ts->msac) + 15;
  624|     12|            if (dbg)
  ------------------
  |  Branch (624:17): [Folded, False: 12]
  ------------------
  625|      0|                printf("Post-dc_residual[%d->%d]: r=%d\n",
  626|      0|                       dc_tok - 15, dc_tok, ts->msac.rng);
  627|       |
  628|     12|            dc_tok &= 0xfffff;
  629|     12|            dc_dq = (dc_dq * dc_tok) & 0xffffff;
  630|  2.15k|        } else {
  631|  2.15k|            dc_dq *= dc_tok;
  632|  2.15k|            assert(dc_dq <= 0xffffff);
  ------------------
  |  |  140|  2.15k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.15k]
  |  |  |  Branch (140:68): [Folded, False: 2.15k]
  |  |  ------------------
  ------------------
  633|  2.15k|        }
  634|  2.16k|        cul_level = dc_tok;
  635|  2.16k|        dc_dq >>= dq_shift;
  636|  2.16k|        dc_dq = umin(dc_dq, cf_max + dc_sign);
  637|  2.16k|        cf[0] = (coef) (dc_sign ? -dc_dq : dc_dq);
  ------------------
  |  Branch (637:25): [True: 1.12k, False: 1.04k]
  ------------------
  638|       |
  639|  3.14k|        if (rc) ac_qm: {
  ------------------
  |  Branch (639:13): [True: 1.36k, False: 800]
  ------------------
  640|  3.14k|            const unsigned ac_dq = dq_tbl[1];
  641|  13.6k|            do {
  642|  13.6k|                const int sign = dav1d_msac_decode_bool_equi(&ts->msac);
  ------------------
  |  |   85|  13.6k|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  643|  13.6k|                if (dbg)
  ------------------
  |  Branch (643:21): [Folded, False: 13.6k]
  ------------------
  644|      0|                    printf("Post-sign[%d=%d]: r=%d\n", rc, sign, ts->msac.rng);
  645|  13.6k|                const unsigned rc_tok = cf[rc];
  646|  13.6k|                unsigned tok, dq = (ac_dq * qm_tbl[rc] + 16) >> 5;
  647|  13.6k|                int dq_sat;
  648|       |
  649|  13.6k|                if (rc_tok >= (15 << 11)) {
  ------------------
  |  Branch (649:21): [True: 14, False: 13.6k]
  ------------------
  650|     14|                    tok = read_golomb(&ts->msac) + 15;
  651|     14|                    if (dbg)
  ------------------
  |  Branch (651:25): [Folded, False: 14]
  ------------------
  652|      0|                        printf("Post-residual[%d=%d->%d]: r=%d\n",
  653|      0|                               rc, tok - 15, tok, ts->msac.rng);
  654|       |
  655|     14|                    tok &= 0xfffff;
  656|     14|                    dq = (dq * tok) & 0xffffff;
  657|  13.6k|                } else {
  658|  13.6k|                    tok = rc_tok >> 11;
  659|  13.6k|                    dq *= tok;
  660|  13.6k|                    assert(dq <= 0xffffff);
  ------------------
  |  |  140|  13.6k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 13.6k]
  |  |  |  Branch (140:68): [Folded, False: 13.6k]
  |  |  ------------------
  ------------------
  661|  13.6k|                }
  662|  13.6k|                cul_level += tok;
  663|  13.6k|                dq >>= dq_shift;
  664|  13.6k|                dq_sat = umin(dq, cf_max + sign);
  665|  13.6k|                cf[rc] = (coef) (sign ? -dq_sat : dq_sat);
  ------------------
  |  Branch (665:34): [True: 6.74k, False: 6.90k]
  ------------------
  666|       |
  667|  13.6k|                rc = rc_tok & 0x3ff;
  668|  13.6k|            } while (rc);
  ------------------
  |  Branch (668:22): [True: 11.8k, False: 1.78k]
  ------------------
  669|  3.14k|        }
  670|  2.16k|    } else {
  671|       |        // non-qmatrix is the common case and allows for additional optimizations
  672|  1.03k|        if (dc_tok == 15) {
  ------------------
  |  Branch (672:13): [True: 124, False: 906]
  ------------------
  673|    124|            dc_tok = read_golomb(&ts->msac) + 15;
  674|    124|            if (dbg)
  ------------------
  |  Branch (674:17): [Folded, False: 124]
  ------------------
  675|      0|                printf("Post-dc_residual[%d->%d]: r=%d\n",
  676|      0|                       dc_tok - 15, dc_tok, ts->msac.rng);
  677|       |
  678|    124|            dc_tok &= 0xfffff;
  679|    124|            dc_dq = ((dc_dq * dc_tok) & 0xffffff) >> dq_shift;
  680|    124|            dc_dq = umin(dc_dq, cf_max + dc_sign);
  681|    906|        } else {
  682|    906|            dc_dq = ((dc_dq * dc_tok) >> dq_shift);
  683|    906|            assert(dc_dq <= cf_max);
  ------------------
  |  |  140|    906|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 906]
  |  |  |  Branch (140:68): [Folded, False: 906]
  |  |  ------------------
  ------------------
  684|    906|        }
  685|  1.03k|        cul_level = dc_tok;
  686|  1.03k|        cf[0] = (coef) (dc_sign ? -dc_dq : dc_dq);
  ------------------
  |  Branch (686:25): [True: 580, False: 450]
  ------------------
  687|       |
  688|  2.10k|        if (rc) ac_noqm: {
  ------------------
  |  Branch (688:13): [True: 830, False: 200]
  ------------------
  689|  2.10k|            const unsigned ac_dq = dq_tbl[1];
  690|  26.5k|            do {
  691|  26.5k|                const int sign = dav1d_msac_decode_bool_equi(&ts->msac);
  ------------------
  |  |   85|  26.5k|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  692|  26.5k|                if (dbg)
  ------------------
  |  Branch (692:21): [Folded, False: 26.5k]
  ------------------
  693|      0|                    printf("Post-sign[%d=%d]: r=%d\n", rc, sign, ts->msac.rng);
  694|  26.5k|                const unsigned rc_tok = cf[rc];
  695|  26.5k|                unsigned tok;
  696|  26.5k|                int dq;
  697|       |
  698|       |                // residual
  699|  26.5k|                if (rc_tok >= (15 << 11)) {
  ------------------
  |  Branch (699:21): [True: 268, False: 26.3k]
  ------------------
  700|    268|                    tok = read_golomb(&ts->msac) + 15;
  701|    268|                    if (dbg)
  ------------------
  |  Branch (701:25): [Folded, False: 268]
  ------------------
  702|      0|                        printf("Post-residual[%d=%d->%d]: r=%d\n",
  703|      0|                               rc, tok - 15, tok, ts->msac.rng);
  704|       |
  705|       |                    // coefficient parsing, see 5.11.39
  706|    268|                    tok &= 0xfffff;
  707|       |
  708|       |                    // dequant, see 7.12.3
  709|    268|                    dq = ((ac_dq * tok) & 0xffffff) >> dq_shift;
  710|    268|                    dq = umin(dq, cf_max + sign);
  711|  26.3k|                } else {
  712|       |                    // cannot exceed cf_max, so we can avoid the clipping
  713|  26.3k|                    tok = rc_tok >> 11;
  714|  26.3k|                    dq = ((ac_dq * tok) >> dq_shift);
  715|  26.3k|                    assert(dq <= cf_max);
  ------------------
  |  |  140|  26.3k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 26.3k]
  |  |  |  Branch (140:68): [Folded, False: 26.3k]
  |  |  ------------------
  ------------------
  716|  26.3k|                }
  717|  26.5k|                cul_level += tok;
  718|  26.5k|                cf[rc] = (coef) (sign ? -dq : dq);
  ------------------
  |  Branch (718:34): [True: 13.3k, False: 13.2k]
  ------------------
  719|       |
  720|  26.5k|                rc = rc_tok & 0x3ff; // next non-zero rc, zero if eob
  721|  26.5k|            } while (rc);
  ------------------
  |  Branch (721:22): [True: 25.3k, False: 1.27k]
  ------------------
  722|  2.10k|        }
  723|  1.03k|    }
  724|       |
  725|       |    // context
  726|  4.06k|    *res_ctx = umin(cul_level, 63) | dc_sign_level;
  727|       |
  728|  4.06k|    return eob;
  729|  3.19k|}
recon_tmpl.c:get_skip_ctx:
   65|  9.35k|{
   66|  9.35k|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
   67|       |
   68|  9.35k|    if (chroma) {
  ------------------
  |  Branch (68:9): [True: 4.24k, False: 5.10k]
  ------------------
   69|  4.24k|        const int ss_ver = layout == DAV1D_PIXEL_LAYOUT_I420;
   70|  4.24k|        const int ss_hor = layout != DAV1D_PIXEL_LAYOUT_I444;
   71|  4.24k|        const int not_one_blk = b_dim[2] - (!!b_dim[2] && ss_hor) > t_dim->lw ||
  ------------------
  |  Branch (71:33): [True: 808, False: 3.43k]
  |  Branch (71:45): [True: 3.94k, False: 296]
  |  Branch (71:59): [True: 3.94k, False: 0]
  ------------------
   72|  3.43k|                                b_dim[3] - (!!b_dim[3] && ss_ver) > t_dim->lh;
  ------------------
  |  Branch (72:33): [True: 0, False: 3.43k]
  |  Branch (72:45): [True: 2.99k, False: 440]
  |  Branch (72:59): [True: 2.99k, False: 0]
  ------------------
   73|  4.24k|        unsigned ca, cl;
   74|       |
   75|  4.24k|#define MERGE_CTX(dir, type, no_val) \
   76|  4.24k|        c##dir = *(const type *) dir != no_val; \
   77|  4.24k|        break
   78|       |
   79|  4.24k|        switch (t_dim->lw) {
   80|       |        /* For some reason the MSVC CRT _wassert() function is not flagged as
   81|       |         * __declspec(noreturn), so when using those headers the compiler will
   82|       |         * expect execution to continue after an assertion has been triggered
   83|       |         * and will therefore complain about the use of uninitialized variables
   84|       |         * when compiled in debug mode if we put the default case at the end. */
   85|      0|        default: assert(0); /* fall-through */
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (85:9): [True: 0, False: 4.24k]
  ------------------
   86|  1.58k|        case TX_4X4:   MERGE_CTX(a, uint8_t,  0x40);
  ------------------
  |  |   76|  1.58k|        c##dir = *(const type *) dir != no_val; \
  |  |   77|  1.58k|        break
  ------------------
  |  Branch (86:9): [True: 1.58k, False: 2.66k]
  ------------------
   87|  1.27k|        case TX_8X8:   MERGE_CTX(a, uint16_t, 0x4040);
  ------------------
  |  |   76|  1.27k|        c##dir = *(const type *) dir != no_val; \
  |  |   77|  1.27k|        break
  ------------------
  |  Branch (87:9): [True: 1.27k, False: 2.96k]
  ------------------
   88|    504|        case TX_16X16: MERGE_CTX(a, uint32_t, 0x40404040U);
  ------------------
  |  |   76|    504|        c##dir = *(const type *) dir != no_val; \
  |  |   77|    504|        break
  ------------------
  |  Branch (88:9): [True: 504, False: 3.74k]
  ------------------
   89|    884|        case TX_32X32: MERGE_CTX(a, uint64_t, 0x4040404040404040ULL);
  ------------------
  |  |   76|    884|        c##dir = *(const type *) dir != no_val; \
  |  |   77|    884|        break
  ------------------
  |  Branch (89:9): [True: 884, False: 3.36k]
  ------------------
   90|  4.24k|        }
   91|  4.24k|        switch (t_dim->lh) {
   92|      0|        default: assert(0); /* fall-through */
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (92:9): [True: 0, False: 4.24k]
  ------------------
   93|  1.88k|        case TX_4X4:   MERGE_CTX(l, uint8_t,  0x40);
  ------------------
  |  |   76|  1.88k|        c##dir = *(const type *) dir != no_val; \
  |  |   77|  1.88k|        break
  ------------------
  |  Branch (93:9): [True: 1.88k, False: 2.36k]
  ------------------
   94|    832|        case TX_8X8:   MERGE_CTX(l, uint16_t, 0x4040);
  ------------------
  |  |   76|    832|        c##dir = *(const type *) dir != no_val; \
  |  |   77|    832|        break
  ------------------
  |  Branch (94:9): [True: 832, False: 3.41k]
  ------------------
   95|    624|        case TX_16X16: MERGE_CTX(l, uint32_t, 0x40404040U);
  ------------------
  |  |   76|    624|        c##dir = *(const type *) dir != no_val; \
  |  |   77|    624|        break
  ------------------
  |  Branch (95:9): [True: 624, False: 3.62k]
  ------------------
   96|    904|        case TX_32X32: MERGE_CTX(l, uint64_t, 0x4040404040404040ULL);
  ------------------
  |  |   76|    904|        c##dir = *(const type *) dir != no_val; \
  |  |   77|    904|        break
  ------------------
  |  Branch (96:9): [True: 904, False: 3.34k]
  ------------------
   97|  4.24k|        }
   98|  4.24k|#undef MERGE_CTX
   99|       |
  100|  4.24k|        return 7 + not_one_blk * 3 + ca + cl;
  101|  5.10k|    } else if (b_dim[2] == t_dim->lw && b_dim[3] == t_dim->lh) {
  ------------------
  |  Branch (101:16): [True: 1.85k, False: 3.25k]
  |  Branch (101:41): [True: 1.38k, False: 468]
  ------------------
  102|  1.38k|        return 0;
  103|  3.72k|    } else {
  104|  3.72k|        unsigned la, ll;
  105|       |
  106|  3.72k|#define MERGE_CTX(dir, type, tx) \
  107|  3.72k|        if (tx == TX_64X64) { \
  108|  3.72k|            uint64_t tmp = *(const uint64_t *) dir; \
  109|  3.72k|            tmp |= *(const uint64_t *) &dir[8]; \
  110|  3.72k|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  111|  3.72k|        } else \
  112|  3.72k|            l##dir = *(const type *) dir; \
  113|  3.72k|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  114|  3.72k|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  115|  3.72k|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  116|  3.72k|        break
  117|       |
  118|  3.72k|        switch (t_dim->lw) {
  119|      0|        default: assert(0); /* fall-through */
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (119:9): [True: 0, False: 3.72k]
  ------------------
  120|    796|        case TX_4X4:   MERGE_CTX(a, uint8_t,  TX_4X4);
  ------------------
  |  |  107|    796|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 796]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|    796|            l##dir = *(const type *) dir; \
  |  |  113|    796|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 796]
  |  |  ------------------
  |  |  114|    796|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [Folded, False: 796]
  |  |  ------------------
  |  |  115|    796|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 796]
  |  |  ------------------
  |  |  116|    796|        break
  ------------------
  |  Branch (120:9): [True: 796, False: 2.92k]
  ------------------
  121|  2.16k|        case TX_8X8:   MERGE_CTX(a, uint16_t, TX_8X8);
  ------------------
  |  |  107|  2.16k|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 2.16k]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|  2.16k|            l##dir = *(const type *) dir; \
  |  |  113|  2.16k|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 2.16k]
  |  |  ------------------
  |  |  114|  2.16k|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [Folded, False: 2.16k]
  |  |  ------------------
  |  |  115|  2.16k|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.16k, Folded]
  |  |  ------------------
  |  |  116|  2.16k|        break
  ------------------
  |  Branch (121:9): [True: 2.16k, False: 1.55k]
  ------------------
  122|    340|        case TX_16X16: MERGE_CTX(a, uint32_t, TX_16X16);
  ------------------
  |  |  107|    340|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 340]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|    340|            l##dir = *(const type *) dir; \
  |  |  113|    340|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 340]
  |  |  ------------------
  |  |  114|    340|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 340, Folded]
  |  |  ------------------
  |  |  115|    340|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 340, Folded]
  |  |  ------------------
  |  |  116|    340|        break
  ------------------
  |  Branch (122:9): [True: 340, False: 3.38k]
  ------------------
  123|     12|        case TX_32X32: MERGE_CTX(a, uint32_t, TX_32X32);
  ------------------
  |  |  107|     12|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 12]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|     12|            l##dir = *(const type *) dir; \
  |  |  113|     12|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 12, Folded]
  |  |  ------------------
  |  |  114|     12|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 12, Folded]
  |  |  ------------------
  |  |  115|     12|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, Folded]
  |  |  ------------------
  |  |  116|     12|        break
  ------------------
  |  Branch (123:9): [True: 12, False: 3.70k]
  ------------------
  124|    404|        case TX_64X64: MERGE_CTX(a, uint32_t, TX_64X64);
  ------------------
  |  |  107|    404|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [True: 404, Folded]
  |  |  ------------------
  |  |  108|    404|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|    404|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|    404|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|    404|        } else \
  |  |  112|    404|            l##dir = *(const type *) dir; \
  |  |  113|    404|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 404]
  |  |  ------------------
  |  |  114|    404|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 404, Folded]
  |  |  ------------------
  |  |  115|    404|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 404, Folded]
  |  |  ------------------
  |  |  116|    404|        break
  ------------------
  |  Branch (124:9): [True: 404, False: 3.31k]
  ------------------
  125|  3.72k|        }
  126|  3.72k|        switch (t_dim->lh) {
  127|      0|        default: assert(0); /* fall-through */
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (127:9): [True: 0, False: 3.72k]
  ------------------
  128|    856|        case TX_4X4:   MERGE_CTX(l, uint8_t,  TX_4X4);
  ------------------
  |  |  107|    856|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 856]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|    856|            l##dir = *(const type *) dir; \
  |  |  113|    856|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 856]
  |  |  ------------------
  |  |  114|    856|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [Folded, False: 856]
  |  |  ------------------
  |  |  115|    856|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 856]
  |  |  ------------------
  |  |  116|    856|        break
  ------------------
  |  Branch (128:9): [True: 856, False: 2.86k]
  ------------------
  129|  2.11k|        case TX_8X8:   MERGE_CTX(l, uint16_t, TX_8X8);
  ------------------
  |  |  107|  2.11k|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 2.11k]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|  2.11k|            l##dir = *(const type *) dir; \
  |  |  113|  2.11k|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 2.11k]
  |  |  ------------------
  |  |  114|  2.11k|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [Folded, False: 2.11k]
  |  |  ------------------
  |  |  115|  2.11k|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.11k, Folded]
  |  |  ------------------
  |  |  116|  2.11k|        break
  ------------------
  |  Branch (129:9): [True: 2.11k, False: 1.60k]
  ------------------
  130|    328|        case TX_16X16: MERGE_CTX(l, uint32_t, TX_16X16);
  ------------------
  |  |  107|    328|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 328]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|    328|            l##dir = *(const type *) dir; \
  |  |  113|    328|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 328]
  |  |  ------------------
  |  |  114|    328|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 328, Folded]
  |  |  ------------------
  |  |  115|    328|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 328, Folded]
  |  |  ------------------
  |  |  116|    328|        break
  ------------------
  |  Branch (130:9): [True: 328, False: 3.39k]
  ------------------
  131|     20|        case TX_32X32: MERGE_CTX(l, uint32_t, TX_32X32);
  ------------------
  |  |  107|     20|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [Folded, False: 20]
  |  |  ------------------
  |  |  108|      0|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|      0|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|      0|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|      0|        } else \
  |  |  112|     20|            l##dir = *(const type *) dir; \
  |  |  113|     20|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 20, Folded]
  |  |  ------------------
  |  |  114|     20|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 20, Folded]
  |  |  ------------------
  |  |  115|     20|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 20, Folded]
  |  |  ------------------
  |  |  116|     20|        break
  ------------------
  |  Branch (131:9): [True: 20, False: 3.70k]
  ------------------
  132|    404|        case TX_64X64: MERGE_CTX(l, uint32_t, TX_64X64);
  ------------------
  |  |  107|    404|        if (tx == TX_64X64) { \
  |  |  ------------------
  |  |  |  Branch (107:13): [True: 404, Folded]
  |  |  ------------------
  |  |  108|    404|            uint64_t tmp = *(const uint64_t *) dir; \
  |  |  109|    404|            tmp |= *(const uint64_t *) &dir[8]; \
  |  |  110|    404|            l##dir = (unsigned) (tmp >> 32) | (unsigned) tmp; \
  |  |  111|    404|        } else \
  |  |  112|    404|            l##dir = *(const type *) dir; \
  |  |  113|    404|        if (tx == TX_32X32) l##dir |= *(const type *) &dir[sizeof(type)]; \
  |  |  ------------------
  |  |  |  Branch (113:13): [Folded, False: 404]
  |  |  ------------------
  |  |  114|    404|        if (tx >= TX_16X16) l##dir |= l##dir >> 16; \
  |  |  ------------------
  |  |  |  Branch (114:13): [True: 404, Folded]
  |  |  ------------------
  |  |  115|    404|        if (tx >= TX_8X8)   l##dir |= l##dir >> 8; \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 404, Folded]
  |  |  ------------------
  |  |  116|    404|        break
  ------------------
  |  Branch (132:9): [True: 404, False: 3.31k]
  ------------------
  133|  3.72k|        }
  134|  3.72k|#undef MERGE_CTX
  135|       |
  136|  3.72k|        return dav1d_skip_ctx[umin(la & 0x3F, 4)][umin(ll & 0x3F, 4)];
  137|  3.72k|    }
  138|  9.35k|}
recon_tmpl.c:get_lo_ctx:
  304|  94.3k|{
  305|  94.3k|    unsigned mag = levels[0 * stride + 1] + levels[1 * stride + 0];
  306|  94.3k|    unsigned offset;
  307|  94.3k|    if (tx_class == TX_CLASS_2D) {
  ------------------
  |  Branch (307:9): [True: 86.7k, False: 7.62k]
  ------------------
  308|  86.7k|        mag += levels[1 * stride + 1];
  309|  86.7k|        *hi_mag = mag;
  310|  86.7k|        mag += levels[0 * stride + 2] + levels[2 * stride + 0];
  311|  86.7k|        offset = ctx_offsets[umin(y, 4)][umin(x, 4)];
  312|  86.7k|    } else {
  313|  7.62k|        mag += levels[0 * stride + 2];
  314|  7.62k|        *hi_mag = mag;
  315|  7.62k|        mag += levels[0 * stride + 3] + levels[0 * stride + 4];
  316|  7.62k|        offset = 26 + (y > 1 ? 10 : y * 5);
  ------------------
  |  Branch (316:24): [True: 3.69k, False: 3.93k]
  ------------------
  317|  7.62k|    }
  318|  94.3k|    return offset + (mag > 512 ? 4 : (mag + 64) >> 7);
  ------------------
  |  Branch (318:22): [True: 8.14k, False: 86.2k]
  ------------------
  319|  94.3k|}
recon_tmpl.c:get_dc_sign_ctx:
  143|  3.19k|{
  144|  3.19k|    uint64_t mask = 0xC0C0C0C0C0C0C0C0ULL, mul = 0x0101010101010101ULL;
  145|  3.19k|    int s;
  146|       |
  147|  3.19k|#if ARCH_X86_64 && defined(__GNUC__)
  148|       |    /* Coerce compilers into producing better code. For some reason
  149|       |     * every x86-64 compiler is awful at handling 64-bit constants. */
  150|  3.19k|    __asm__("" : "+r"(mask), "+r"(mul));
  151|  3.19k|#endif
  152|       |
  153|  3.19k|    switch(tx) {
  154|      0|    default: assert(0); /* fall-through */
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, Folded]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (154:5): [True: 0, False: 3.19k]
  ------------------
  155|    586|    case TX_4X4: {
  ------------------
  |  Branch (155:5): [True: 586, False: 2.60k]
  ------------------
  156|    586|        int t = *(const uint8_t *) a >> 6;
  157|    586|        t    += *(const uint8_t *) l >> 6;
  158|    586|        s = t - 1 - 1;
  159|    586|        break;
  160|      0|    }
  161|    872|    case TX_8X8: {
  ------------------
  |  Branch (161:5): [True: 872, False: 2.32k]
  ------------------
  162|    872|        uint32_t t = *(const uint16_t *) a & (uint32_t) mask;
  163|    872|        t         += *(const uint16_t *) l & (uint32_t) mask;
  164|    872|        t *= 0x04040404U;
  165|    872|        s = (int) (t >> 24) - 2 - 2;
  166|    872|        break;
  167|      0|    }
  168|    330|    case TX_16X16: {
  ------------------
  |  Branch (168:5): [True: 330, False: 2.86k]
  ------------------
  169|    330|        uint32_t t = (*(const uint32_t *) a & (uint32_t) mask) >> 6;
  170|    330|        t         += (*(const uint32_t *) l & (uint32_t) mask) >> 6;
  171|    330|        t *= (uint32_t) mul;
  172|    330|        s = (int) (t >> 24) - 4 - 4;
  173|    330|        break;
  174|      0|    }
  175|     92|    case TX_32X32: {
  ------------------
  |  Branch (175:5): [True: 92, False: 3.10k]
  ------------------
  176|     92|        uint64_t t = (*(const uint64_t *) a & mask) >> 6;
  177|     92|        t         += (*(const uint64_t *) l & mask) >> 6;
  178|     92|        t *= mul;
  179|     92|        s = (int) (t >> 56) - 8 - 8;
  180|     92|        break;
  181|      0|    }
  182|    118|    case TX_64X64: {
  ------------------
  |  Branch (182:5): [True: 118, False: 3.07k]
  ------------------
  183|    118|        uint64_t t = (*(const uint64_t *) &a[0] & mask) >> 6;
  184|    118|        t         += (*(const uint64_t *) &a[8] & mask) >> 6;
  185|    118|        t         += (*(const uint64_t *) &l[0] & mask) >> 6;
  186|    118|        t         += (*(const uint64_t *) &l[8] & mask) >> 6;
  187|    118|        t *= mul;
  188|    118|        s = (int) (t >> 56) - 16 - 16;
  189|    118|        break;
  190|      0|    }
  191|    164|    case RTX_4X8: {
  ------------------
  |  Branch (191:5): [True: 164, False: 3.02k]
  ------------------
  192|    164|        uint32_t t = *(const uint8_t  *) a & (uint32_t) mask;
  193|    164|        t         += *(const uint16_t *) l & (uint32_t) mask;
  194|    164|        t *= 0x04040404U;
  195|    164|        s = (int) (t >> 24) - 1 - 2;
  196|    164|        break;
  197|      0|    }
  198|    310|    case RTX_8X4: {
  ------------------
  |  Branch (198:5): [True: 310, False: 2.88k]
  ------------------
  199|    310|        uint32_t t = *(const uint16_t *) a & (uint32_t) mask;
  200|    310|        t         += *(const uint8_t  *) l & (uint32_t) mask;
  201|    310|        t *= 0x04040404U;
  202|    310|        s = (int) (t >> 24) - 2 - 1;
  203|    310|        break;
  204|      0|    }
  205|    128|    case RTX_8X16: {
  ------------------
  |  Branch (205:5): [True: 128, False: 3.06k]
  ------------------
  206|    128|        uint32_t t = *(const uint16_t *) a & (uint32_t) mask;
  207|    128|        t         += *(const uint32_t *) l & (uint32_t) mask;
  208|    128|        t = (t >> 6) * (uint32_t) mul;
  209|    128|        s = (int) (t >> 24) - 2 - 4;
  210|    128|        break;
  211|      0|    }
  212|    132|    case RTX_16X8: {
  ------------------
  |  Branch (212:5): [True: 132, False: 3.06k]
  ------------------
  213|    132|        uint32_t t = *(const uint32_t *) a & (uint32_t) mask;
  214|    132|        t         += *(const uint16_t *) l & (uint32_t) mask;
  215|    132|        t = (t >> 6) * (uint32_t) mul;
  216|    132|        s = (int) (t >> 24) - 4 - 2;
  217|    132|        break;
  218|      0|    }
  219|     52|    case RTX_16X32: {
  ------------------
  |  Branch (219:5): [True: 52, False: 3.14k]
  ------------------
  220|     52|        uint64_t t = *(const uint32_t *) a & (uint32_t) mask;
  221|     52|        t         += *(const uint64_t *) l & mask;
  222|     52|        t = (t >> 6) * mul;
  223|     52|        s = (int) (t >> 56) - 4 - 8;
  224|     52|        break;
  225|      0|    }
  226|     26|    case RTX_32X16: {
  ------------------
  |  Branch (226:5): [True: 26, False: 3.16k]
  ------------------
  227|     26|        uint64_t t = *(const uint64_t *) a & mask;
  228|     26|        t         += *(const uint32_t *) l & (uint32_t) mask;
  229|     26|        t = (t >> 6) * mul;
  230|     26|        s = (int) (t >> 56) - 8 - 4;
  231|     26|        break;
  232|      0|    }
  233|      4|    case RTX_32X64: {
  ------------------
  |  Branch (233:5): [True: 4, False: 3.18k]
  ------------------
  234|      4|        uint64_t t = (*(const uint64_t *) &a[0] & mask) >> 6;
  235|      4|        t         += (*(const uint64_t *) &l[0] & mask) >> 6;
  236|      4|        t         += (*(const uint64_t *) &l[8] & mask) >> 6;
  237|      4|        t *= mul;
  238|      4|        s = (int) (t >> 56) - 8 - 16;
  239|      4|        break;
  240|      0|    }
  241|      4|    case RTX_64X32: {
  ------------------
  |  Branch (241:5): [True: 4, False: 3.18k]
  ------------------
  242|      4|        uint64_t t = (*(const uint64_t *) &a[0] & mask) >> 6;
  243|      4|        t         += (*(const uint64_t *) &a[8] & mask) >> 6;
  244|      4|        t         += (*(const uint64_t *) &l[0] & mask) >> 6;
  245|      4|        t *= mul;
  246|      4|        s = (int) (t >> 56) - 16 - 8;
  247|      4|        break;
  248|      0|    }
  249|    104|    case RTX_4X16: {
  ------------------
  |  Branch (249:5): [True: 104, False: 3.08k]
  ------------------
  250|    104|        uint32_t t = *(const uint8_t  *) a & (uint32_t) mask;
  251|    104|        t         += *(const uint32_t *) l & (uint32_t) mask;
  252|    104|        t = (t >> 6) * (uint32_t) mul;
  253|    104|        s = (int) (t >> 24) - 1 - 4;
  254|    104|        break;
  255|      0|    }
  256|    134|    case RTX_16X4: {
  ------------------
  |  Branch (256:5): [True: 134, False: 3.05k]
  ------------------
  257|    134|        uint32_t t = *(const uint32_t *) a & (uint32_t) mask;
  258|    134|        t         += *(const uint8_t  *) l & (uint32_t) mask;
  259|    134|        t = (t >> 6) * (uint32_t) mul;
  260|    134|        s = (int) (t >> 24) - 4 - 1;
  261|    134|        break;
  262|      0|    }
  263|     62|    case RTX_8X32: {
  ------------------
  |  Branch (263:5): [True: 62, False: 3.13k]
  ------------------
  264|     62|        uint64_t t = *(const uint16_t *) a & (uint32_t) mask;
  265|     62|        t         += *(const uint64_t *) l & mask;
  266|     62|        t = (t >> 6) * mul;
  267|     62|        s = (int) (t >> 56) - 2 - 8;
  268|     62|        break;
  269|      0|    }
  270|     64|    case RTX_32X8: {
  ------------------
  |  Branch (270:5): [True: 64, False: 3.12k]
  ------------------
  271|     64|        uint64_t t = *(const uint64_t *) a & mask;
  272|     64|        t         += *(const uint16_t *) l & (uint32_t) mask;
  273|     64|        t = (t >> 6) * mul;
  274|     64|        s = (int) (t >> 56) - 8 - 2;
  275|     64|        break;
  276|      0|    }
  277|      2|    case RTX_16X64: {
  ------------------
  |  Branch (277:5): [True: 2, False: 3.19k]
  ------------------
  278|      2|        uint64_t t = *(const uint32_t *) a & (uint32_t) mask;
  279|      2|        t         += *(const uint64_t *) &l[0] & mask;
  280|      2|        t = (t >> 6) + ((*(const uint64_t *) &l[8] & mask) >> 6);
  281|      2|        t *= mul;
  282|      2|        s = (int) (t >> 56) - 4 - 16;
  283|      2|        break;
  284|      0|    }
  285|      8|    case RTX_64X16: {
  ------------------
  |  Branch (285:5): [True: 8, False: 3.18k]
  ------------------
  286|      8|        uint64_t t = *(const uint64_t *) &a[0] & mask;
  287|      8|        t         += *(const uint32_t *) l & (uint32_t) mask;
  288|      8|        t = (t >> 6) + ((*(const uint64_t *) &a[8] & mask) >> 6);
  289|      8|        t *= mul;
  290|      8|        s = (int) (t >> 56) - 16 - 4;
  291|      8|        break;
  292|      0|    }
  293|  3.19k|    }
  294|       |
  295|  3.19k|    return (s != 0) + (s > 0);
  296|  3.19k|}
recon_tmpl.c:read_golomb:
   49|    418|static inline unsigned read_golomb(MsacContext *const msac) {
   50|    418|    int len = 0;
   51|    418|    unsigned val = 1;
   52|       |
   53|    864|    while (!dav1d_msac_decode_bool_equi(msac) && len < 32) len++;
  ------------------
  |  |   85|    864|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (53:12): [True: 446, False: 418]
  |  Branch (53:50): [True: 446, False: 0]
  ------------------
   54|    864|    while (len--) val = (val << 1) + dav1d_msac_decode_bool_equi(msac);
  ------------------
  |  |   85|    446|#define dav1d_msac_decode_bool_equi      dav1d_msac_decode_bool_equi_c
  ------------------
  |  Branch (54:12): [True: 446, False: 418]
  ------------------
   55|       |
   56|    418|    return val - 1;
   57|    418|}
recon_tmpl.c:mc:
  944|    320|{
  945|    320|    assert((dst8 != NULL) ^ (dst16 != NULL));
  ------------------
  |  |  140|    320|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 320]
  |  |  |  Branch (140:68): [Folded, False: 320]
  |  |  ------------------
  ------------------
  946|    320|    const Dav1dFrameContext *const f = t->f;
  947|    320|    const int ss_ver = !!pl && f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  ------------------
  |  Branch (947:24): [True: 204, False: 116]
  |  Branch (947:32): [True: 204, False: 0]
  ------------------
  948|    320|    const int ss_hor = !!pl && f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
  ------------------
  |  Branch (948:24): [True: 204, False: 116]
  |  Branch (948:32): [True: 204, False: 0]
  ------------------
  949|    320|    const int h_mul = 4 >> ss_hor, v_mul = 4 >> ss_ver;
  950|    320|    const int mvx = mv.x, mvy = mv.y;
  951|    320|    const int mx = mvx & (15 >> !ss_hor), my = mvy & (15 >> !ss_ver);
  952|    320|    ptrdiff_t ref_stride = refp->p.stride[!!pl];
  953|    320|    const pixel *ref;
  954|       |
  955|    320|    if (refp->p.p.w == f->cur.p.w && refp->p.p.h == f->cur.p.h) {
  ------------------
  |  Branch (955:9): [True: 320, False: 0]
  |  Branch (955:38): [True: 320, False: 0]
  ------------------
  956|    320|        const int dx = bx * h_mul + (mvx >> (3 + ss_hor));
  957|    320|        const int dy = by * v_mul + (mvy >> (3 + ss_ver));
  958|    320|        int w, h;
  959|       |
  960|    320|        if (refp->p.data[0] != f->cur.data[0]) { // i.e. not for intrabc
  ------------------
  |  Branch (960:13): [True: 0, False: 320]
  ------------------
  961|      0|            w = (f->cur.p.w + ss_hor) >> ss_hor;
  962|      0|            h = (f->cur.p.h + ss_ver) >> ss_ver;
  963|    320|        } else {
  964|    320|            w = f->bw * 4 >> ss_hor;
  965|    320|            h = f->bh * 4 >> ss_ver;
  966|    320|        }
  967|    320|        if (dx < !!mx * 3 || dy < !!my * 3 ||
  ------------------
  |  Branch (967:13): [True: 8, False: 312]
  |  Branch (967:30): [True: 12, False: 300]
  ------------------
  968|    300|            dx + bw4 * h_mul + !!mx * 4 > w ||
  ------------------
  |  Branch (968:13): [True: 0, False: 300]
  ------------------
  969|    300|            dy + bh4 * v_mul + !!my * 4 > h)
  ------------------
  |  Branch (969:13): [True: 0, False: 300]
  ------------------
  970|     20|        {
  971|     20|            pixel *const emu_edge_buf = bitfn(t->scratch.emu_edge);
  ------------------
  |  |   51|     20|#define bitfn(x) x##_8bpc
  ------------------
  972|     20|            f->dsp->mc.emu_edge(bw4 * h_mul + !!mx * 7, bh4 * v_mul + !!my * 7,
  973|     20|                                w, h, dx - !!mx * 3, dy - !!my * 3,
  974|     20|                                emu_edge_buf, 192 * sizeof(pixel),
  975|     20|                                refp->p.data[pl], ref_stride);
  976|     20|            ref = &emu_edge_buf[192 * !!my * 3 + !!mx * 3];
  977|     20|            ref_stride = 192 * sizeof(pixel);
  978|    300|        } else {
  979|    300|            ref = ((pixel *) refp->p.data[pl]) + PXSTRIDE(ref_stride) * dy + dx;
  ------------------
  |  |   53|    300|#define PXSTRIDE(x) (x)
  ------------------
  980|    300|        }
  981|       |
  982|    320|        if (dst8 != NULL) {
  ------------------
  |  Branch (982:13): [True: 320, False: 0]
  ------------------
  983|    320|            f->dsp->mc.mc[filter_2d](dst8, dst_stride, ref, ref_stride, bw4 * h_mul,
  984|    320|                                     bh4 * v_mul, mx << !ss_hor, my << !ss_ver
  985|    320|                                     HIGHBD_CALL_SUFFIX);
  986|    320|        } else {
  987|      0|            f->dsp->mc.mct[filter_2d](dst16, ref, ref_stride, bw4 * h_mul,
  988|      0|                                      bh4 * v_mul, mx << !ss_hor, my << !ss_ver
  989|      0|                                      HIGHBD_CALL_SUFFIX);
  990|      0|        }
  991|    320|    } else {
  992|      0|        assert(refp != &f->sr_cur);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  993|       |
  994|      0|        const int orig_pos_y = (by * v_mul << 4) + mvy * (1 << !ss_ver);
  995|      0|        const int orig_pos_x = (bx * h_mul << 4) + mvx * (1 << !ss_hor);
  996|      0|#define scale_mv(res, val, scale) do { \
  997|      0|            const int64_t tmp = (int64_t)(val) * scale + (scale - 0x4000) * 8; \
  998|      0|            res = apply_sign64((int) ((llabs(tmp) + 128) >> 8), tmp) + 32;     \
  999|      0|        } while (0)
 1000|      0|        int pos_y, pos_x;
 1001|      0|        scale_mv(pos_x, orig_pos_x, f->svc[refidx][0].scale);
  ------------------
  |  |  996|      0|#define scale_mv(res, val, scale) do { \
  |  |  997|      0|            const int64_t tmp = (int64_t)(val) * scale + (scale - 0x4000) * 8; \
  |  |  998|      0|            res = apply_sign64((int) ((llabs(tmp) + 128) >> 8), tmp) + 32;     \
  |  |  999|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (999:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1002|      0|        scale_mv(pos_y, orig_pos_y, f->svc[refidx][1].scale);
  ------------------
  |  |  996|      0|#define scale_mv(res, val, scale) do { \
  |  |  997|      0|            const int64_t tmp = (int64_t)(val) * scale + (scale - 0x4000) * 8; \
  |  |  998|      0|            res = apply_sign64((int) ((llabs(tmp) + 128) >> 8), tmp) + 32;     \
  |  |  999|      0|        } while (0)
  |  |  ------------------
  |  |  |  Branch (999:18): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1003|      0|#undef scale_mv
 1004|      0|        const int left = pos_x >> 10;
 1005|      0|        const int top = pos_y >> 10;
 1006|      0|        const int right =
 1007|      0|            ((pos_x + (bw4 * h_mul - 1) * f->svc[refidx][0].step) >> 10) + 1;
 1008|      0|        const int bottom =
 1009|      0|            ((pos_y + (bh4 * v_mul - 1) * f->svc[refidx][1].step) >> 10) + 1;
 1010|       |
 1011|      0|        if (DEBUG_BLOCK_INFO)
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1012|      0|            printf("Off %dx%d [%d,%d,%d], size %dx%d [%d,%d]\n",
 1013|      0|                   left, top, orig_pos_x, f->svc[refidx][0].scale, refidx,
 1014|      0|                   right-left, bottom-top,
 1015|      0|                   f->svc[refidx][0].step, f->svc[refidx][1].step);
 1016|       |
 1017|      0|        const int w = (refp->p.p.w + ss_hor) >> ss_hor;
 1018|      0|        const int h = (refp->p.p.h + ss_ver) >> ss_ver;
 1019|      0|        if (left < 3 || top < 3 || right + 4 > w || bottom + 4 > h) {
  ------------------
  |  Branch (1019:13): [True: 0, False: 0]
  |  Branch (1019:25): [True: 0, False: 0]
  |  Branch (1019:36): [True: 0, False: 0]
  |  Branch (1019:53): [True: 0, False: 0]
  ------------------
 1020|      0|            pixel *const emu_edge_buf = bitfn(t->scratch.emu_edge);
  ------------------
  |  |   51|      0|#define bitfn(x) x##_8bpc
  ------------------
 1021|      0|            f->dsp->mc.emu_edge(right - left + 7, bottom - top + 7,
 1022|      0|                                w, h, left - 3, top - 3,
 1023|      0|                                emu_edge_buf, 320 * sizeof(pixel),
 1024|      0|                                refp->p.data[pl], ref_stride);
 1025|      0|            ref = &emu_edge_buf[320 * 3 + 3];
 1026|      0|            ref_stride = 320 * sizeof(pixel);
 1027|      0|            if (DEBUG_BLOCK_INFO) printf("Emu\n");
  ------------------
  |  |   34|      0|#define DEBUG_BLOCK_INFO 0 && \
  |  |  ------------------
  |  |  |  Branch (34:26): [Folded, False: 0]
  |  |  ------------------
  |  |   35|      0|        f->frame_hdr->frame_offset == 2 && t->by >= 0 && t->by < 4 && \
  |  |  ------------------
  |  |  |  Branch (35:9): [True: 0, False: 0]
  |  |  |  Branch (35:44): [True: 0, False: 0]
  |  |  |  Branch (35:58): [True: 0, False: 0]
  |  |  ------------------
  |  |   36|      0|        t->bx >= 8 && t->bx < 12
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 0, False: 0]
  |  |  |  Branch (36:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1028|      0|        } else {
 1029|      0|            ref = ((pixel *) refp->p.data[pl]) + PXSTRIDE(ref_stride) * top + left;
  ------------------
  |  |   53|      0|#define PXSTRIDE(x) (x)
  ------------------
 1030|      0|        }
 1031|       |
 1032|      0|        if (dst8 != NULL) {
  ------------------
  |  Branch (1032:13): [True: 0, False: 0]
  ------------------
 1033|      0|            f->dsp->mc.mc_scaled[filter_2d](dst8, dst_stride, ref, ref_stride,
 1034|      0|                                            bw4 * h_mul, bh4 * v_mul,
 1035|      0|                                            pos_x & 0x3ff, pos_y & 0x3ff,
 1036|      0|                                            f->svc[refidx][0].step,
 1037|      0|                                            f->svc[refidx][1].step
 1038|      0|                                            HIGHBD_CALL_SUFFIX);
 1039|      0|        } else {
 1040|      0|            f->dsp->mc.mct_scaled[filter_2d](dst16, ref, ref_stride,
 1041|      0|                                             bw4 * h_mul, bh4 * v_mul,
 1042|      0|                                             pos_x & 0x3ff, pos_y & 0x3ff,
 1043|      0|                                             f->svc[refidx][0].step,
 1044|      0|                                             f->svc[refidx][1].step
 1045|      0|                                             HIGHBD_CALL_SUFFIX);
 1046|      0|        }
 1047|      0|    }
 1048|       |
 1049|    320|    return 0;
 1050|    320|}

dav1d_ref_create:
   37|      9|Dav1dRef *dav1d_ref_create(const enum AllocationType type, size_t size) {
   38|      9|    size = (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
   39|       |
   40|      9|    uint8_t *const data = dav1d_alloc_aligned(type, size + sizeof(Dav1dRef), 64);
  ------------------
  |  |  134|      9|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
   41|      9|    if (!data) return NULL;
  ------------------
  |  Branch (41:9): [True: 0, False: 9]
  ------------------
   42|       |
   43|      9|    Dav1dRef *const res = (Dav1dRef*)(data + size);
   44|      9|    res->const_data = res->user_data = res->data = data;
   45|      9|    atomic_init(&res->ref_cnt, 1);
   46|      9|    res->free_ref = 0;
   47|      9|    res->free_callback = default_free_callback;
   48|       |
   49|      9|    return res;
   50|      9|}
dav1d_ref_create_using_pool:
   56|     19|Dav1dRef *dav1d_ref_create_using_pool(Dav1dMemPool *const pool, size_t size) {
   57|     19|    void *const buf = dav1d_mem_pool_pop(pool, size);
   58|     19|    if (!buf) return NULL;
  ------------------
  |  Branch (58:9): [True: 0, False: 19]
  ------------------
   59|       |
   60|       |    /* Store Dav1dRef inside the Dav1dMemPoolBuffer alignment padding */
   61|     19|    assert(sizeof(Dav1dMemPoolBuffer) + sizeof(Dav1dRef) <= 64);
  ------------------
  |  |  140|     19|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [Folded, False: 19]
  |  |  |  Branch (140:68): [Folded, False: 19]
  |  |  ------------------
  ------------------
   62|     19|    Dav1dRef *const res = &((Dav1dRef*)buf)[-1];
   63|     19|    res->data = buf;
   64|     19|    res->const_data = pool;
   65|     19|    atomic_init(&res->ref_cnt, 1);
   66|     19|    res->free_ref = 0;
   67|     19|    res->free_callback = pool_free_callback;
   68|     19|    res->user_data = buf;
   69|       |
   70|     19|    return res;
   71|     19|}
dav1d_ref_dec:
   73|  2.41k|void dav1d_ref_dec(Dav1dRef **const pref) {
   74|  2.41k|    assert(pref != NULL);
  ------------------
  |  |  140|  2.41k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 2.41k]
  |  |  |  Branch (140:68): [Folded, False: 2.41k]
  |  |  ------------------
  ------------------
   75|       |
   76|  2.41k|    Dav1dRef *const ref = *pref;
   77|  2.41k|    if (!ref) return;
  ------------------
  |  Branch (77:9): [True: 2.22k, False: 193]
  ------------------
   78|       |
   79|    193|    *pref = NULL;
   80|    193|    if (atomic_fetch_sub(&ref->ref_cnt, 1) == 1) {
  ------------------
  |  Branch (80:9): [True: 32, False: 161]
  ------------------
   81|     32|        const int free_ref = ref->free_ref;
   82|     32|        ref->free_callback(ref->const_data, ref->user_data);
   83|     32|        if (free_ref) dav1d_free(ref);
  ------------------
  |  |  135|      0|#define dav1d_free(ptr) free(ptr)
  ------------------
  |  Branch (83:13): [True: 0, False: 32]
  ------------------
   84|     32|    }
   85|    193|}
ref.c:default_free_callback:
   32|      9|static void default_free_callback(const uint8_t *const data, void *const user_data) {
   33|      9|    assert(data == user_data);
  ------------------
  |  |  140|      9|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 9]
  |  |  |  Branch (140:68): [Folded, False: 9]
  |  |  ------------------
  ------------------
   34|      9|    dav1d_free_aligned(user_data);
  ------------------
  |  |  136|      9|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
   35|      9|}
ref.c:pool_free_callback:
   52|     19|static void pool_free_callback(const uint8_t *const data, void *const user_data) {
   53|     19|    dav1d_mem_pool_push((Dav1dMemPool*)data, user_data);
   54|     19|}

picture.c:dav1d_ref_inc:
   69|    128|static inline void dav1d_ref_inc(Dav1dRef *const ref) {
   70|       |    atomic_fetch_add_explicit(&ref->ref_cnt, 1, memory_order_relaxed);
   71|    128|}
picture.c:dav1d_ref_init:
   59|      4|{
   60|      4|    ref->data = NULL;
   61|      4|    ref->const_data = ptr;
   62|       |    atomic_init(&ref->ref_cnt, 1);
   63|      4|    ref->free_ref = free_ref;
   64|      4|    ref->free_callback = free_callback;
   65|      4|    ref->user_data = user_data;
   66|      4|    return ref;
   67|      4|}
data.c:dav1d_ref_inc:
   69|     13|static inline void dav1d_ref_inc(Dav1dRef *const ref) {
   70|       |    atomic_fetch_add_explicit(&ref->ref_cnt, 1, memory_order_relaxed);
   71|     13|}
decode.c:dav1d_ref_inc:
   69|     20|static inline void dav1d_ref_inc(Dav1dRef *const ref) {
   70|       |    atomic_fetch_add_explicit(&ref->ref_cnt, 1, memory_order_relaxed);
   71|     20|}

dav1d_refmvs_find:
  354|    502|{
  355|    502|    const refmvs_frame *const rf = rt->rf;
  356|    502|    const uint8_t *const b_dim = dav1d_block_dimensions[bs];
  357|    502|    const int bw4 = b_dim[0], w4 = imin(imin(bw4, 16), rt->tile_col.end - bx4);
  358|    502|    const int bh4 = b_dim[1], h4 = imin(imin(bh4, 16), rt->tile_row.end - by4);
  359|    502|    mv gmv[2], tgmv[2];
  360|       |
  361|    502|    *cnt = 0;
  362|    502|    assert(ref.ref[0] >=  0 && ref.ref[0] <= 8 &&
  ------------------
  |  |  140|  3.01k|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 502, False: 0]
  |  |  |  Branch (140:30): [True: 502, False: 0]
  |  |  |  Branch (140:30): [True: 502, False: 0]
  |  |  |  Branch (140:30): [True: 502, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 502]
  |  |  ------------------
  ------------------
  363|    502|           ref.ref[1] >= -1 && ref.ref[1] <= 8);
  364|    502|    if (ref.ref[0] > 0) {
  ------------------
  |  Branch (364:9): [True: 0, False: 502]
  ------------------
  365|      0|        tgmv[0] = get_gmv_2d(&rf->frm_hdr->gmv[ref.ref[0] - 1],
  366|      0|                             bx4, by4, bw4, bh4, rf->frm_hdr);
  367|      0|        gmv[0] = rf->frm_hdr->gmv[ref.ref[0] - 1].type > DAV1D_WM_TYPE_TRANSLATION ?
  ------------------
  |  Branch (367:18): [True: 0, False: 0]
  ------------------
  368|      0|                 tgmv[0] : (mv) { .n = INVALID_MV };
  ------------------
  |  |   40|      0|#define INVALID_MV 0x80008000
  ------------------
  369|    502|    } else {
  370|    502|        tgmv[0] = (mv) { .n = 0 };
  371|    502|        gmv[0] = (mv) { .n = INVALID_MV };
  ------------------
  |  |   40|    502|#define INVALID_MV 0x80008000
  ------------------
  372|    502|    }
  373|    502|    if (ref.ref[1] > 0) {
  ------------------
  |  Branch (373:9): [True: 0, False: 502]
  ------------------
  374|      0|        tgmv[1] = get_gmv_2d(&rf->frm_hdr->gmv[ref.ref[1] - 1],
  375|      0|                             bx4, by4, bw4, bh4, rf->frm_hdr);
  376|      0|        gmv[1] = rf->frm_hdr->gmv[ref.ref[1] - 1].type > DAV1D_WM_TYPE_TRANSLATION ?
  ------------------
  |  Branch (376:18): [True: 0, False: 0]
  ------------------
  377|      0|                 tgmv[1] : (mv) { .n = INVALID_MV };
  ------------------
  |  |   40|      0|#define INVALID_MV 0x80008000
  ------------------
  378|      0|    }
  379|       |
  380|       |    // top
  381|    502|    int have_newmv = 0, have_col_mvs = 0, have_row_mvs = 0;
  382|    502|    unsigned max_rows = 0, n_rows = ~0;
  383|    502|    const refmvs_block *b_top;
  384|    502|    if (by4 > rt->tile_row.start) {
  ------------------
  |  Branch (384:9): [True: 490, False: 12]
  ------------------
  385|    490|        max_rows = imin((by4 - rt->tile_row.start + 1) >> 1, 2 + (bh4 > 1));
  386|    490|        b_top = &rt->r[(by4 & 31) - 1 + 5][bx4];
  387|    490|        n_rows = scan_row(mvstack, cnt, ref, gmv, b_top,
  388|    490|                          bw4, w4, max_rows, bw4 >= 16 ? 4 : 1,
  ------------------
  |  Branch (388:46): [True: 48, False: 442]
  ------------------
  389|    490|                          &have_newmv, &have_row_mvs);
  390|    490|    }
  391|       |
  392|       |    // left
  393|    502|    unsigned max_cols = 0, n_cols = ~0U;
  394|    502|    refmvs_block *const *b_left;
  395|    502|    if (bx4 > rt->tile_col.start) {
  ------------------
  |  Branch (395:9): [True: 490, False: 12]
  ------------------
  396|    490|        max_cols = imin((bx4 - rt->tile_col.start + 1) >> 1, 2 + (bw4 > 1));
  397|    490|        b_left = &rt->r[(by4 & 31) + 5];
  398|    490|        n_cols = scan_col(mvstack, cnt, ref, gmv, b_left,
  399|    490|                          bh4, h4, bx4 - 1, max_cols, bh4 >= 16 ? 4 : 1,
  ------------------
  |  Branch (399:55): [True: 66, False: 424]
  ------------------
  400|    490|                          &have_newmv, &have_col_mvs);
  401|    490|    }
  402|       |
  403|       |    // top/right
  404|    502|    if (n_rows != ~0U && edge_flags & EDGE_I444_TOP_HAS_RIGHT &&
  ------------------
  |  Branch (404:9): [True: 490, False: 12]
  |  Branch (404:26): [True: 320, False: 170]
  ------------------
  405|    320|        imax(bw4, bh4) <= 16 && bw4 + bx4 < rt->tile_col.end)
  ------------------
  |  Branch (405:9): [True: 280, False: 40]
  |  Branch (405:33): [True: 278, False: 2]
  ------------------
  406|    278|    {
  407|    278|        add_spatial_candidate(mvstack, cnt, 4, &b_top[bw4], ref, gmv,
  408|    278|                              &have_newmv, &have_row_mvs);
  409|    278|    }
  410|       |
  411|    502|    const int nearest_match = have_col_mvs + have_row_mvs;
  412|    502|    const int nearest_cnt = *cnt;
  413|  1.01k|    for (int n = 0; n < nearest_cnt; n++)
  ------------------
  |  Branch (413:21): [True: 510, False: 502]
  ------------------
  414|    510|        mvstack[n].weight += 640;
  415|       |
  416|       |    // temporal
  417|    502|    int globalmv_ctx = rf->frm_hdr->use_ref_frame_mvs;
  418|    502|    if (rf->use_ref_frame_mvs) {
  ------------------
  |  Branch (418:9): [True: 0, False: 502]
  ------------------
  419|      0|        const ptrdiff_t stride = rf->rp_stride;
  420|      0|        const int by8 = by4 >> 1, bx8 = bx4 >> 1;
  421|      0|        const refmvs_temporal_block *const rbi = &rt->rp_proj[(by8 & 15) * stride + bx8];
  422|      0|        const refmvs_temporal_block *rb = rbi;
  423|      0|        const int step_h = bw4 >= 16 ? 2 : 1, step_v = bh4 >= 16 ? 2 : 1;
  ------------------
  |  Branch (423:28): [True: 0, False: 0]
  |  Branch (423:56): [True: 0, False: 0]
  ------------------
  424|      0|        const int w8 = imin((w4 + 1) >> 1, 8), h8 = imin((h4 + 1) >> 1, 8);
  425|      0|        for (int y = 0; y < h8; y += step_v) {
  ------------------
  |  Branch (425:25): [True: 0, False: 0]
  ------------------
  426|      0|            for (int x = 0; x < w8; x+= step_h) {
  ------------------
  |  Branch (426:29): [True: 0, False: 0]
  ------------------
  427|      0|                add_temporal_candidate(rf, mvstack, cnt, &rb[x], ref,
  428|      0|                                       !(x | y) ? &globalmv_ctx : NULL, tgmv);
  ------------------
  |  Branch (428:40): [True: 0, False: 0]
  ------------------
  429|      0|            }
  430|      0|            rb += stride * step_v;
  431|      0|        }
  432|      0|        if (imin(bw4, bh4) >= 2 && imax(bw4, bh4) < 16) {
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  |  Branch (432:36): [True: 0, False: 0]
  ------------------
  433|      0|            const int bh8 = bh4 >> 1, bw8 = bw4 >> 1;
  434|      0|            rb = &rbi[bh8 * stride];
  435|      0|            const int has_bottom = by8 + bh8 < imin(rt->tile_row.end >> 1,
  436|      0|                                                    (by8 & ~7) + 8);
  437|      0|            if (has_bottom && bx8 - 1 >= imax(rt->tile_col.start >> 1, bx8 & ~7)) {
  ------------------
  |  Branch (437:17): [True: 0, False: 0]
  |  Branch (437:31): [True: 0, False: 0]
  ------------------
  438|      0|                add_temporal_candidate(rf, mvstack, cnt, &rb[-1], ref,
  439|      0|                                       NULL, NULL);
  440|      0|            }
  441|      0|            if (bx8 + bw8 < imin(rt->tile_col.end >> 1, (bx8 & ~7) + 8)) {
  ------------------
  |  Branch (441:17): [True: 0, False: 0]
  ------------------
  442|      0|                if (has_bottom) {
  ------------------
  |  Branch (442:21): [True: 0, False: 0]
  ------------------
  443|      0|                    add_temporal_candidate(rf, mvstack, cnt, &rb[bw8], ref,
  444|      0|                                           NULL, NULL);
  445|      0|                }
  446|      0|                if (by8 + bh8 - 1 < imin(rt->tile_row.end >> 1, (by8 & ~7) + 8)) {
  ------------------
  |  Branch (446:21): [True: 0, False: 0]
  ------------------
  447|      0|                    add_temporal_candidate(rf, mvstack, cnt, &rb[bw8 - stride],
  448|      0|                                           ref, NULL, NULL);
  449|      0|                }
  450|      0|            }
  451|      0|        }
  452|      0|    }
  453|    502|    assert(*cnt <= 8);
  ------------------
  |  |  140|    502|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 502]
  |  |  |  Branch (140:68): [Folded, False: 502]
  |  |  ------------------
  ------------------
  454|       |
  455|       |    // top/left (which, confusingly, is part of "secondary" references)
  456|    502|    int have_dummy_newmv_match;
  457|    502|    if ((n_rows | n_cols) != ~0U) {
  ------------------
  |  Branch (457:9): [True: 478, False: 24]
  ------------------
  458|    478|        add_spatial_candidate(mvstack, cnt, 4, &b_top[-1], ref, gmv,
  459|    478|                              &have_dummy_newmv_match, &have_row_mvs);
  460|    478|    }
  461|       |
  462|       |    // "secondary" (non-direct neighbour) top & left edges
  463|       |    // what is different about secondary is that everything is now in 8x8 resolution
  464|  1.50k|    for (int n = 2; n <= 3; n++) {
  ------------------
  |  Branch (464:21): [True: 1.00k, False: 502]
  ------------------
  465|  1.00k|        if ((unsigned) n > n_rows && (unsigned) n <= max_rows) {
  ------------------
  |  Branch (465:13): [True: 626, False: 378]
  |  Branch (465:38): [True: 518, False: 108]
  ------------------
  466|    518|            n_rows += scan_row(mvstack, cnt, ref, gmv,
  467|    518|                               &rt->r[(((by4 & 31) - 2 * n + 1) | 1) + 5][bx4 | 1],
  468|    518|                               bw4, w4, 1 + max_rows - n, bw4 >= 16 ? 4 : 2,
  ------------------
  |  Branch (468:59): [True: 6, False: 512]
  ------------------
  469|    518|                               &have_dummy_newmv_match, &have_row_mvs);
  470|    518|        }
  471|       |
  472|  1.00k|        if ((unsigned) n > n_cols && (unsigned) n <= max_cols) {
  ------------------
  |  Branch (472:13): [True: 654, False: 350]
  |  Branch (472:38): [True: 572, False: 82]
  ------------------
  473|    572|            n_cols += scan_col(mvstack, cnt, ref, gmv, &rt->r[((by4 & 31) | 1) + 5],
  474|    572|                               bh4, h4, (bx4 - n * 2 + 1) | 1,
  475|    572|                               1 + max_cols - n, bh4 >= 16 ? 4 : 2,
  ------------------
  |  Branch (475:50): [True: 38, False: 534]
  ------------------
  476|    572|                               &have_dummy_newmv_match, &have_col_mvs);
  477|    572|        }
  478|  1.00k|    }
  479|    502|    assert(*cnt <= 8);
  ------------------
  |  |  140|    502|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 502]
  |  |  |  Branch (140:68): [Folded, False: 502]
  |  |  ------------------
  ------------------
  480|       |
  481|    502|    const int ref_match_count = have_col_mvs + have_row_mvs;
  482|       |
  483|       |    // context build-up
  484|    502|    int refmv_ctx, newmv_ctx;
  485|    502|    switch (nearest_match) {
  ------------------
  |  Branch (485:13): [True: 502, False: 0]
  ------------------
  486|    190|    case 0:
  ------------------
  |  Branch (486:5): [True: 190, False: 312]
  ------------------
  487|    190|        refmv_ctx = imin(2, ref_match_count);
  488|    190|        newmv_ctx = ref_match_count > 0;
  489|    190|        break;
  490|    184|    case 1:
  ------------------
  |  Branch (490:5): [True: 184, False: 318]
  ------------------
  491|    184|        refmv_ctx = imin(ref_match_count * 3, 4);
  492|    184|        newmv_ctx = 3 - have_newmv;
  493|    184|        break;
  494|    128|    case 2:
  ------------------
  |  Branch (494:5): [True: 128, False: 374]
  ------------------
  495|    128|        refmv_ctx = 5;
  496|    128|        newmv_ctx = 5 - have_newmv;
  497|    128|        break;
  498|    502|    }
  499|       |
  500|       |    // sorting (nearest, then "secondary")
  501|    502|    int len = nearest_cnt;
  502|    898|    while (len) {
  ------------------
  |  Branch (502:12): [True: 396, False: 502]
  ------------------
  503|    396|        int last = 0;
  504|    622|        for (int n = 1; n < len; n++) {
  ------------------
  |  Branch (504:25): [True: 226, False: 396]
  ------------------
  505|    226|            if (mvstack[n - 1].weight < mvstack[n].weight) {
  ------------------
  |  Branch (505:17): [True: 92, False: 134]
  ------------------
  506|     92|#define EXCHANGE(a, b) do { refmvs_candidate tmp = a; a = b; b = tmp; } while (0)
  507|     92|                EXCHANGE(mvstack[n - 1], mvstack[n]);
  ------------------
  |  |  506|     92|#define EXCHANGE(a, b) do { refmvs_candidate tmp = a; a = b; b = tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (506:80): [Folded, False: 92]
  |  |  ------------------
  ------------------
  508|     92|                last = n;
  509|     92|            }
  510|    226|        }
  511|    396|        len = last;
  512|    396|    }
  513|    502|    len = *cnt;
  514|    860|    while (len > nearest_cnt) {
  ------------------
  |  Branch (514:12): [True: 358, False: 502]
  ------------------
  515|    358|        int last = nearest_cnt;
  516|    558|        for (int n = nearest_cnt + 1; n < len; n++) {
  ------------------
  |  Branch (516:39): [True: 200, False: 358]
  ------------------
  517|    200|            if (mvstack[n - 1].weight < mvstack[n].weight) {
  ------------------
  |  Branch (517:17): [True: 78, False: 122]
  ------------------
  518|     78|                EXCHANGE(mvstack[n - 1], mvstack[n]);
  ------------------
  |  |  506|     78|#define EXCHANGE(a, b) do { refmvs_candidate tmp = a; a = b; b = tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (506:80): [Folded, False: 78]
  |  |  ------------------
  ------------------
  519|     78|#undef EXCHANGE
  520|     78|                last = n;
  521|     78|            }
  522|    200|        }
  523|    358|        len = last;
  524|    358|    }
  525|       |
  526|    502|    if (ref.ref[1] > 0) {
  ------------------
  |  Branch (526:9): [True: 0, False: 502]
  ------------------
  527|      0|        if (*cnt < 2) {
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            const int sign0 = rf->sign_bias[ref.ref[0] - 1];
  529|      0|            const int sign1 = rf->sign_bias[ref.ref[1] - 1];
  530|      0|            const int sz4 = imin(w4, h4);
  531|      0|            refmvs_candidate *const same = &mvstack[*cnt];
  532|      0|            int same_count[4] = { 0 };
  533|       |
  534|       |            // non-self references in top
  535|      0|            if (n_rows != ~0U) for (int x = 0; x < sz4;) {
  ------------------
  |  Branch (535:17): [True: 0, False: 0]
  |  Branch (535:48): [True: 0, False: 0]
  ------------------
  536|      0|                const refmvs_block *const cand_b = &b_top[x];
  537|      0|                add_compound_extended_candidate(same, same_count, cand_b,
  538|      0|                                                sign0, sign1, ref, rf->sign_bias);
  539|      0|                x += dav1d_block_dimensions[cand_b->bs][0];
  540|      0|            }
  541|       |
  542|       |            // non-self references in left
  543|      0|            if (n_cols != ~0U) for (int y = 0; y < sz4;) {
  ------------------
  |  Branch (543:17): [True: 0, False: 0]
  |  Branch (543:48): [True: 0, False: 0]
  ------------------
  544|      0|                const refmvs_block *const cand_b = &b_left[y][bx4 - 1];
  545|      0|                add_compound_extended_candidate(same, same_count, cand_b,
  546|      0|                                                sign0, sign1, ref, rf->sign_bias);
  547|      0|                y += dav1d_block_dimensions[cand_b->bs][1];
  548|      0|            }
  549|       |
  550|      0|            refmvs_candidate *const diff = &same[2];
  551|      0|            const int *const diff_count = &same_count[2];
  552|       |
  553|       |            // merge together
  554|      0|            for (int n = 0; n < 2; n++) {
  ------------------
  |  Branch (554:29): [True: 0, False: 0]
  ------------------
  555|      0|                int m = same_count[n];
  556|       |
  557|      0|                if (m >= 2) continue;
  ------------------
  |  Branch (557:21): [True: 0, False: 0]
  ------------------
  558|       |
  559|      0|                const int l = diff_count[n];
  560|      0|                if (l) {
  ------------------
  |  Branch (560:21): [True: 0, False: 0]
  ------------------
  561|      0|                    same[m].mv.mv[n] = diff[0].mv.mv[n];
  562|      0|                    if (++m == 2) continue;
  ------------------
  |  Branch (562:25): [True: 0, False: 0]
  ------------------
  563|      0|                    if (l == 2) {
  ------------------
  |  Branch (563:25): [True: 0, False: 0]
  ------------------
  564|      0|                        same[1].mv.mv[n] = diff[1].mv.mv[n];
  565|      0|                        continue;
  566|      0|                    }
  567|      0|                }
  568|      0|                do {
  569|      0|                    same[m].mv.mv[n] = tgmv[n];
  570|      0|                } while (++m < 2);
  ------------------
  |  Branch (570:26): [True: 0, False: 0]
  ------------------
  571|      0|            }
  572|       |
  573|       |            // if the first extended was the same as the non-extended one,
  574|       |            // then replace it with the second extended one
  575|      0|            int n = *cnt;
  576|      0|            if (n == 1 && mvstack[0].mv.n == same[0].mv.n)
  ------------------
  |  Branch (576:17): [True: 0, False: 0]
  |  Branch (576:27): [True: 0, False: 0]
  ------------------
  577|      0|                mvstack[1].mv = mvstack[2].mv;
  578|      0|            do {
  579|      0|                mvstack[n].weight = 2;
  580|      0|            } while (++n < 2);
  ------------------
  |  Branch (580:22): [True: 0, False: 0]
  ------------------
  581|      0|            *cnt = 2;
  582|      0|        }
  583|       |
  584|       |        // clamping
  585|      0|        const int left = -(bx4 + bw4 + 4) * 4 * 8;
  586|      0|        const int right = (rf->iw4 - bx4 + 4) * 4 * 8;
  587|      0|        const int top = -(by4 + bh4 + 4) * 4 * 8;
  588|      0|        const int bottom = (rf->ih4 - by4 + 4) * 4 * 8;
  589|       |
  590|      0|        const int n_refmvs = *cnt;
  591|      0|        int n = 0;
  592|      0|        do {
  593|      0|            mvstack[n].mv.mv[0].x = iclip(mvstack[n].mv.mv[0].x, left, right);
  594|      0|            mvstack[n].mv.mv[0].y = iclip(mvstack[n].mv.mv[0].y, top, bottom);
  595|      0|            mvstack[n].mv.mv[1].x = iclip(mvstack[n].mv.mv[1].x, left, right);
  596|      0|            mvstack[n].mv.mv[1].y = iclip(mvstack[n].mv.mv[1].y, top, bottom);
  597|      0|        } while (++n < n_refmvs);
  ------------------
  |  Branch (597:18): [True: 0, False: 0]
  ------------------
  598|       |
  599|      0|        switch (refmv_ctx >> 1) {
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|        case 0:
  ------------------
  |  Branch (600:9): [True: 0, False: 0]
  ------------------
  601|      0|            *ctx = imin(newmv_ctx, 1);
  602|      0|            break;
  603|      0|        case 1:
  ------------------
  |  Branch (603:9): [True: 0, False: 0]
  ------------------
  604|      0|            *ctx = 1 + imin(newmv_ctx, 3);
  605|      0|            break;
  606|      0|        case 2:
  ------------------
  |  Branch (606:9): [True: 0, False: 0]
  ------------------
  607|      0|            *ctx = iclip(3 + newmv_ctx, 4, 7);
  608|      0|            break;
  609|      0|        }
  610|       |
  611|      0|        return;
  612|    502|    } else if (*cnt < 2 && ref.ref[0] > 0) {
  ------------------
  |  Branch (612:16): [True: 226, False: 276]
  |  Branch (612:28): [True: 0, False: 226]
  ------------------
  613|      0|        const int sign = rf->sign_bias[ref.ref[0] - 1];
  614|      0|        const int sz4 = imin(w4, h4);
  615|       |
  616|       |        // non-self references in top
  617|      0|        if (n_rows != ~0U) for (int x = 0; x < sz4 && *cnt < 2;) {
  ------------------
  |  Branch (617:13): [True: 0, False: 0]
  |  Branch (617:44): [True: 0, False: 0]
  |  Branch (617:55): [True: 0, False: 0]
  ------------------
  618|      0|            const refmvs_block *const cand_b = &b_top[x];
  619|      0|            add_single_extended_candidate(mvstack, cnt, cand_b, sign, rf->sign_bias);
  620|      0|            x += dav1d_block_dimensions[cand_b->bs][0];
  621|      0|        }
  622|       |
  623|       |        // non-self references in left
  624|      0|        if (n_cols != ~0U) for (int y = 0; y < sz4 && *cnt < 2;) {
  ------------------
  |  Branch (624:13): [True: 0, False: 0]
  |  Branch (624:44): [True: 0, False: 0]
  |  Branch (624:55): [True: 0, False: 0]
  ------------------
  625|      0|            const refmvs_block *const cand_b = &b_left[y][bx4 - 1];
  626|      0|            add_single_extended_candidate(mvstack, cnt, cand_b, sign, rf->sign_bias);
  627|      0|            y += dav1d_block_dimensions[cand_b->bs][1];
  628|      0|        }
  629|      0|    }
  630|    502|    assert(*cnt <= 8);
  ------------------
  |  |  140|    502|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 502]
  |  |  |  Branch (140:68): [Folded, False: 502]
  |  |  ------------------
  ------------------
  631|       |
  632|       |    // clamping
  633|    502|    int n_refmvs = *cnt;
  634|    502|    if (n_refmvs) {
  ------------------
  |  Branch (634:9): [True: 376, False: 126]
  ------------------
  635|    376|        const int left = -(bx4 + bw4 + 4) * 4 * 8;
  636|    376|        const int right = (rf->iw4 - bx4 + 4) * 4 * 8;
  637|    376|        const int top = -(by4 + bh4 + 4) * 4 * 8;
  638|    376|        const int bottom = (rf->ih4 - by4 + 4) * 4 * 8;
  639|       |
  640|    376|        int n = 0;
  641|    974|        do {
  642|    974|            mvstack[n].mv.mv[0].x = iclip(mvstack[n].mv.mv[0].x, left, right);
  643|    974|            mvstack[n].mv.mv[0].y = iclip(mvstack[n].mv.mv[0].y, top, bottom);
  644|    974|        } while (++n < n_refmvs);
  ------------------
  |  Branch (644:18): [True: 598, False: 376]
  ------------------
  645|    376|    }
  646|       |
  647|    854|    for (int n = *cnt; n < 2; n++)
  ------------------
  |  Branch (647:24): [True: 352, False: 502]
  ------------------
  648|    352|        mvstack[n].mv.mv[0] = tgmv[0];
  649|       |
  650|    502|    *ctx = (refmv_ctx << 4) | (globalmv_ctx << 3) | newmv_ctx;
  651|    502|}
dav1d_refmvs_tile_sbrow_init:
  657|     26|{
  658|     26|    if (rf->n_tile_threads == 1) tile_row_idx = 0;
  ------------------
  |  Branch (658:9): [True: 0, False: 26]
  ------------------
  659|     26|    rt->rp_proj = &rf->rp_proj[16 * rf->rp_stride * tile_row_idx];
  660|     26|    const ptrdiff_t r_stride = rf->rp_stride * 2;
  661|     26|    const ptrdiff_t pass_off = (rf->n_frame_threads > 1 && pass == 2) ?
  ------------------
  |  Branch (661:33): [True: 26, False: 0]
  |  Branch (661:60): [True: 8, False: 18]
  ------------------
  662|     18|        35 * 2 * rf->n_blocks : 0;
  663|     26|    refmvs_block *r = &rf->r[35 * r_stride * tile_row_idx + pass_off];
  664|     26|    const int sbsz = rf->sbsz;
  665|     26|    const int off = (sbsz * sby) & 16;
  666|    698|    for (int i = 0; i < sbsz; i++, r += r_stride)
  ------------------
  |  Branch (666:21): [True: 672, False: 26]
  ------------------
  667|    672|        rt->r[off + 5 + i] = r;
  668|     26|    rt->r[off + 0] = r;
  669|     26|    r += r_stride;
  670|     26|    rt->r[off + 1] = NULL;
  671|     26|    rt->r[off + 2] = r;
  672|     26|    r += r_stride;
  673|     26|    rt->r[off + 3] = NULL;
  674|     26|    rt->r[off + 4] = r;
  675|     26|    if (sby & 1) {
  ------------------
  |  Branch (675:9): [True: 12, False: 14]
  ------------------
  676|     12|#define EXCHANGE(a, b) do { void *const tmp = a; a = b; b = tmp; } while (0)
  677|     12|        EXCHANGE(rt->r[off + 0], rt->r[off + sbsz + 0]);
  ------------------
  |  |  676|     12|#define EXCHANGE(a, b) do { void *const tmp = a; a = b; b = tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (676:75): [Folded, False: 12]
  |  |  ------------------
  ------------------
  678|     12|        EXCHANGE(rt->r[off + 2], rt->r[off + sbsz + 2]);
  ------------------
  |  |  676|     12|#define EXCHANGE(a, b) do { void *const tmp = a; a = b; b = tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (676:75): [Folded, False: 12]
  |  |  ------------------
  ------------------
  679|     12|        EXCHANGE(rt->r[off + 4], rt->r[off + sbsz + 4]);
  ------------------
  |  |  676|     12|#define EXCHANGE(a, b) do { void *const tmp = a; a = b; b = tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (676:75): [Folded, False: 12]
  |  |  ------------------
  ------------------
  680|     12|#undef EXCHANGE
  681|     12|    }
  682|       |
  683|     26|    rt->rf = rf;
  684|     26|    rt->tile_row.start = tile_row_start4;
  685|     26|    rt->tile_row.end = imin(tile_row_end4, rf->ih4);
  686|     26|    rt->tile_col.start = tile_col_start4;
  687|     26|    rt->tile_col.end = imin(tile_col_end4, rf->iw4);
  688|     26|}
dav1d_refmvs_init_frame:
  807|      4|{
  808|      4|    const int rp_stride = ((frm_hdr->width[0] + 127) & ~127) >> 3;
  809|      4|    const int n_tile_rows = n_tile_threads > 1 ? frm_hdr->tiling.rows : 1;
  ------------------
  |  Branch (809:29): [True: 4, False: 0]
  ------------------
  810|      4|    const int n_blocks = rp_stride * n_tile_rows;
  811|       |
  812|      4|    rf->sbsz = 16 << seq_hdr->sb128;
  813|      4|    rf->frm_hdr = frm_hdr;
  814|      4|    rf->iw8 = (frm_hdr->width[0] + 7) >> 3;
  815|      4|    rf->ih8 = (frm_hdr->height + 7) >> 3;
  816|      4|    rf->iw4 = rf->iw8 << 1;
  817|      4|    rf->ih4 = rf->ih8 << 1;
  818|      4|    rf->rp = rp;
  819|      4|    rf->rp_stride = rp_stride;
  820|      4|    rf->n_tile_threads = n_tile_threads;
  821|      4|    rf->n_frame_threads = n_frame_threads;
  822|       |
  823|      4|    if (n_blocks != rf->n_blocks) {
  ------------------
  |  Branch (823:9): [True: 4, False: 0]
  ------------------
  824|      4|        const size_t r_sz = sizeof(*rf->r) * 35 * 2 * n_blocks * (1 + (n_frame_threads > 1));
  825|      4|        const size_t rp_proj_sz = sizeof(*rf->rp_proj) * 16 * n_blocks;
  826|       |        /* Note that sizeof(*rf->r) == 12, but it's accessed using 16-byte unaligned
  827|       |         * loads in save_tmvs() asm which can overread 4 bytes into rp_proj. */
  828|      4|        dav1d_free_aligned(rf->r);
  ------------------
  |  |  136|      4|#define dav1d_free_aligned(ptr) dav1d_free_aligned_internal(ptr)
  ------------------
  829|      4|        rf->r = dav1d_alloc_aligned(ALLOC_REFMVS, r_sz + rp_proj_sz, 64);
  ------------------
  |  |  134|      4|#define dav1d_alloc_aligned(type, sz, align) dav1d_alloc_aligned_internal(sz, align)
  ------------------
  830|      4|        if (!rf->r) {
  ------------------
  |  Branch (830:13): [True: 0, False: 4]
  ------------------
  831|      0|            rf->n_blocks = 0;
  832|      0|            return DAV1D_ERR(ENOMEM);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  833|      0|        }
  834|       |
  835|      4|        rf->rp_proj = (refmvs_temporal_block*)((uintptr_t)rf->r + r_sz);
  836|      4|        rf->n_blocks = n_blocks;
  837|      4|    }
  838|       |
  839|      4|    const int poc = frm_hdr->frame_offset;
  840|     32|    for (int i = 0; i < 7; i++) {
  ------------------
  |  Branch (840:21): [True: 28, False: 4]
  ------------------
  841|     28|        const int poc_diff = get_poc_diff(seq_hdr->order_hint_n_bits,
  842|     28|                                          ref_poc[i], poc);
  843|     28|        rf->sign_bias[i] = poc_diff > 0;
  844|     28|        rf->mfmv_sign[i] = poc_diff < 0;
  845|     28|        rf->pocdiff[i] = iclip(get_poc_diff(seq_hdr->order_hint_n_bits,
  846|     28|                                            poc, ref_poc[i]), -31, 31);
  847|     28|    }
  848|       |
  849|       |    // temporal MV setup
  850|      4|    rf->n_mfmvs = 0;
  851|      4|    rf->rp_ref = rp_ref;
  852|      4|    if (frm_hdr->use_ref_frame_mvs && seq_hdr->order_hint_n_bits) {
  ------------------
  |  Branch (852:9): [True: 0, False: 4]
  |  Branch (852:39): [True: 0, False: 0]
  ------------------
  853|      0|        int total = 2;
  854|      0|        if (rp_ref[0] && ref_ref_poc[0][6] != ref_poc[3] /* alt-of-last != gold */) {
  ------------------
  |  Branch (854:13): [True: 0, False: 0]
  |  Branch (854:26): [True: 0, False: 0]
  ------------------
  855|      0|            rf->mfmv_ref[rf->n_mfmvs++] = 0; // last
  856|      0|            total = 3;
  857|      0|        }
  858|      0|        if (rp_ref[4] && get_poc_diff(seq_hdr->order_hint_n_bits, ref_poc[4],
  ------------------
  |  Branch (858:13): [True: 0, False: 0]
  |  Branch (858:26): [True: 0, False: 0]
  ------------------
  859|      0|                                      frm_hdr->frame_offset) > 0)
  860|      0|        {
  861|      0|            rf->mfmv_ref[rf->n_mfmvs++] = 4; // bwd
  862|      0|        }
  863|      0|        if (rp_ref[5] && get_poc_diff(seq_hdr->order_hint_n_bits, ref_poc[5],
  ------------------
  |  Branch (863:13): [True: 0, False: 0]
  |  Branch (863:26): [True: 0, False: 0]
  ------------------
  864|      0|                                      frm_hdr->frame_offset) > 0)
  865|      0|        {
  866|      0|            rf->mfmv_ref[rf->n_mfmvs++] = 5; // altref2
  867|      0|        }
  868|      0|        if (rf->n_mfmvs < total && rp_ref[6] &&
  ------------------
  |  Branch (868:13): [True: 0, False: 0]
  |  Branch (868:36): [True: 0, False: 0]
  ------------------
  869|      0|            get_poc_diff(seq_hdr->order_hint_n_bits, ref_poc[6],
  ------------------
  |  Branch (869:13): [True: 0, False: 0]
  ------------------
  870|      0|                         frm_hdr->frame_offset) > 0)
  871|      0|        {
  872|      0|            rf->mfmv_ref[rf->n_mfmvs++] = 6; // altref
  873|      0|        }
  874|      0|        if (rf->n_mfmvs < total && rp_ref[1])
  ------------------
  |  Branch (874:13): [True: 0, False: 0]
  |  Branch (874:36): [True: 0, False: 0]
  ------------------
  875|      0|            rf->mfmv_ref[rf->n_mfmvs++] = 1; // last2
  876|       |
  877|      0|        for (int n = 0; n < rf->n_mfmvs; n++) {
  ------------------
  |  Branch (877:25): [True: 0, False: 0]
  ------------------
  878|      0|            const int rpoc = ref_poc[rf->mfmv_ref[n]];
  879|      0|            const int diff1 = get_poc_diff(seq_hdr->order_hint_n_bits,
  880|      0|                                           rpoc, frm_hdr->frame_offset);
  881|      0|            if (abs(diff1) > 31) {
  ------------------
  |  Branch (881:17): [True: 0, False: 0]
  ------------------
  882|      0|                rf->mfmv_ref2cur[n] = INVALID_REF2CUR;
  ------------------
  |  |   41|      0|#define INVALID_REF2CUR (-32)
  ------------------
  883|      0|            } else {
  884|      0|                rf->mfmv_ref2cur[n] = rf->mfmv_ref[n] < 4 ? -diff1 : diff1;
  ------------------
  |  Branch (884:39): [True: 0, False: 0]
  ------------------
  885|      0|                for (int m = 0; m < 7; m++) {
  ------------------
  |  Branch (885:33): [True: 0, False: 0]
  ------------------
  886|      0|                    const int rrpoc = ref_ref_poc[rf->mfmv_ref[n]][m];
  887|      0|                    const int diff2 = get_poc_diff(seq_hdr->order_hint_n_bits,
  888|      0|                                                   rpoc, rrpoc);
  889|       |                    // unsigned comparison also catches the < 0 case
  890|      0|                    rf->mfmv_ref2ref[n][m] = (unsigned) diff2 > 31U ? 0 : diff2;
  ------------------
  |  Branch (890:46): [True: 0, False: 0]
  ------------------
  891|      0|                }
  892|      0|            }
  893|      0|        }
  894|      0|    }
  895|      4|    rf->use_ref_frame_mvs = rf->n_mfmvs > 0;
  896|       |
  897|      4|    return 0;
  898|      4|}
dav1d_refmvs_dsp_init:
  921|      9|{
  922|      9|    c->load_tmvs = load_tmvs_c;
  923|      9|    c->save_tmvs = save_tmvs_c;
  924|      9|    c->splat_mv = splat_mv_c;
  925|       |
  926|       |#if HAVE_ASM
  927|       |#if ARCH_AARCH64 || ARCH_ARM
  928|       |    refmvs_dsp_init_arm(c);
  929|       |#elif ARCH_LOONGARCH64
  930|       |    refmvs_dsp_init_loongarch(c);
  931|       |#elif ARCH_X86
  932|       |    refmvs_dsp_init_x86(c);
  933|       |#endif
  934|       |#endif
  935|      9|}
refmvs.c:scan_row:
  102|  1.00k|{
  103|  1.00k|    const refmvs_block *cand_b = b;
  104|  1.00k|    const enum BlockSize first_cand_bs = cand_b->bs;
  105|  1.00k|    const uint8_t *const first_cand_b_dim = dav1d_block_dimensions[first_cand_bs];
  106|  1.00k|    int cand_bw4 = first_cand_b_dim[0];
  107|  1.00k|    int len = imax(step, imin(bw4, cand_bw4));
  108|       |
  109|  1.00k|    if (bw4 <= cand_bw4) {
  ------------------
  |  Branch (109:9): [True: 880, False: 128]
  ------------------
  110|       |        // FIXME weight can be higher for odd blocks (bx4 & 1), but then the
  111|       |        // position of the first block has to be odd already, i.e. not just
  112|       |        // for row_offset=-3/-5
  113|       |        // FIXME why can this not be cand_bw4?
  114|    880|        const int weight = bw4 == 1 ? 2 :
  ------------------
  |  Branch (114:28): [True: 212, False: 668]
  ------------------
  115|    880|                           imax(2, imin(2 * max_rows, first_cand_b_dim[1]));
  116|    880|        add_spatial_candidate(mvstack, cnt, len * weight, cand_b, ref, gmv,
  117|    880|                              have_newmv_match, have_refmv_match);
  118|    880|        return weight >> 1;
  119|    880|    }
  120|       |
  121|    250|    for (int x = 0;;) {
  122|       |        // FIXME if we overhang above, we could fill a bitmask so we don't have
  123|       |        // to repeat the add_spatial_candidate() for the next row, but just increase
  124|       |        // the weight here
  125|    250|        add_spatial_candidate(mvstack, cnt, len * 2, cand_b, ref, gmv,
  126|    250|                              have_newmv_match, have_refmv_match);
  127|    250|        x += len;
  128|    250|        if (x >= w4) return 1;
  ------------------
  |  Branch (128:13): [True: 128, False: 122]
  ------------------
  129|    122|        cand_b = &b[x];
  130|    122|        cand_bw4 = dav1d_block_dimensions[cand_b->bs][0];
  131|    122|        assert(cand_bw4 < bw4);
  ------------------
  |  |  140|    122|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 122]
  |  |  |  Branch (140:68): [Folded, False: 122]
  |  |  ------------------
  ------------------
  132|    122|        len = imax(step, cand_bw4);
  133|    122|    }
  134|    128|}
refmvs.c:scan_col:
  141|  1.06k|{
  142|  1.06k|    const refmvs_block *cand_b = &b[0][bx4];
  143|  1.06k|    const enum BlockSize first_cand_bs = cand_b->bs;
  144|  1.06k|    const uint8_t *const first_cand_b_dim = dav1d_block_dimensions[first_cand_bs];
  145|  1.06k|    int cand_bh4 = first_cand_b_dim[1];
  146|  1.06k|    int len = imax(step, imin(bh4, cand_bh4));
  147|       |
  148|  1.06k|    if (bh4 <= cand_bh4) {
  ------------------
  |  Branch (148:9): [True: 894, False: 168]
  ------------------
  149|       |        // FIXME weight can be higher for odd blocks (by4 & 1), but then the
  150|       |        // position of the first block has to be odd already, i.e. not just
  151|       |        // for col_offset=-3/-5
  152|       |        // FIXME why can this not be cand_bh4?
  153|    894|        const int weight = bh4 == 1 ? 2 :
  ------------------
  |  Branch (153:28): [True: 272, False: 622]
  ------------------
  154|    894|                           imax(2, imin(2 * max_cols, first_cand_b_dim[0]));
  155|    894|        add_spatial_candidate(mvstack, cnt, len * weight, cand_b, ref, gmv,
  156|    894|                            have_newmv_match, have_refmv_match);
  157|    894|        return weight >> 1;
  158|    894|    }
  159|       |
  160|    368|    for (int y = 0;;) {
  161|       |        // FIXME if we overhang above, we could fill a bitmask so we don't have
  162|       |        // to repeat the add_spatial_candidate() for the next row, but just increase
  163|       |        // the weight here
  164|    368|        add_spatial_candidate(mvstack, cnt, len * 2, cand_b, ref, gmv,
  165|    368|                              have_newmv_match, have_refmv_match);
  166|    368|        y += len;
  167|    368|        if (y >= h4) return 1;
  ------------------
  |  Branch (167:13): [True: 168, False: 200]
  ------------------
  168|    200|        cand_b = &b[y][bx4];
  169|    200|        cand_bh4 = dav1d_block_dimensions[cand_b->bs][1];
  170|    200|        assert(cand_bh4 < bh4);
  ------------------
  |  |  140|    200|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 200]
  |  |  |  Branch (140:68): [Folded, False: 200]
  |  |  ------------------
  ------------------
  171|    200|        len = imax(step, cand_bh4);
  172|    200|    }
  173|    168|}
refmvs.c:add_spatial_candidate:
   46|  3.14k|{
   47|  3.14k|    if (b->mv.mv[0].n == INVALID_MV) return; // intra block, no intrabc
  ------------------
  |  |   40|  3.14k|#define INVALID_MV 0x80008000
  ------------------
  |  Branch (47:9): [True: 1.95k, False: 1.19k]
  ------------------
   48|       |
   49|  1.19k|    if (ref.ref[1] == -1) {
  ------------------
  |  Branch (49:9): [True: 1.19k, False: 0]
  ------------------
   50|  1.19k|        for (int n = 0; n < 2; n++) {
  ------------------
  |  Branch (50:25): [True: 1.19k, False: 0]
  ------------------
   51|  1.19k|            if (b->ref.ref[n] == ref.ref[0]) {
  ------------------
  |  Branch (51:17): [True: 1.19k, False: 0]
  ------------------
   52|  1.19k|                const mv cand_mv = ((b->mf & 1) && gmv[0].n != INVALID_MV) ?
  ------------------
  |  |   40|      0|#define INVALID_MV 0x80008000
  ------------------
  |  Branch (52:37): [True: 0, False: 1.19k]
  |  Branch (52:52): [True: 0, False: 0]
  ------------------
   53|  1.19k|                                   gmv[0] : b->mv.mv[n];
   54|       |
   55|  1.19k|                *have_refmv_match = 1;
   56|  1.19k|                *have_newmv_match |= b->mf >> 1;
   57|       |
   58|  1.19k|                const int last = *cnt;
   59|  2.51k|                for (int m = 0; m < last; m++)
  ------------------
  |  Branch (59:33): [True: 1.54k, False: 976]
  ------------------
   60|  1.54k|                    if (mvstack[m].mv.mv[0].n == cand_mv.n) {
  ------------------
  |  Branch (60:25): [True: 220, False: 1.32k]
  ------------------
   61|    220|                        mvstack[m].weight += weight;
   62|    220|                        return;
   63|    220|                    }
   64|       |
   65|    976|                if (last < 8) {
  ------------------
  |  Branch (65:21): [True: 974, False: 2]
  ------------------
   66|    974|                    mvstack[last].mv.mv[0] = cand_mv;
   67|    974|                    mvstack[last].weight = weight;
   68|    974|                    *cnt = last + 1;
   69|    974|                }
   70|    976|                return;
   71|  1.19k|            }
   72|  1.19k|        }
   73|  1.19k|    } else if (b->ref.pair == ref.pair) {
  ------------------
  |  Branch (73:16): [True: 0, False: 0]
  ------------------
   74|      0|        const refmvs_mvpair cand_mv = { .mv = {
   75|      0|            [0] = ((b->mf & 1) && gmv[0].n != INVALID_MV) ? gmv[0] : b->mv.mv[0],
  ------------------
  |  |   40|      0|#define INVALID_MV 0x80008000
  ------------------
  |  Branch (75:20): [True: 0, False: 0]
  |  Branch (75:35): [True: 0, False: 0]
  ------------------
   76|      0|            [1] = ((b->mf & 1) && gmv[1].n != INVALID_MV) ? gmv[1] : b->mv.mv[1],
  ------------------
  |  |   40|      0|#define INVALID_MV 0x80008000
  ------------------
  |  Branch (76:20): [True: 0, False: 0]
  |  Branch (76:35): [True: 0, False: 0]
  ------------------
   77|      0|        }};
   78|       |
   79|      0|        *have_refmv_match = 1;
   80|      0|        *have_newmv_match |= b->mf >> 1;
   81|       |
   82|      0|        const int last = *cnt;
   83|      0|        for (int n = 0; n < last; n++)
  ------------------
  |  Branch (83:25): [True: 0, False: 0]
  ------------------
   84|      0|            if (mvstack[n].mv.n == cand_mv.n) {
  ------------------
  |  Branch (84:17): [True: 0, False: 0]
  ------------------
   85|      0|                mvstack[n].weight += weight;
   86|      0|                return;
   87|      0|            }
   88|       |
   89|      0|        if (last < 8) {
  ------------------
  |  Branch (89:13): [True: 0, False: 0]
  ------------------
   90|      0|            mvstack[last].mv = cand_mv;
   91|      0|            mvstack[last].weight = weight;
   92|      0|            *cnt = last + 1;
   93|      0|        }
   94|      0|    }
   95|  1.19k|}
refmvs.c:splat_mv_c:
  902|  2.65k|{
  903|  11.8k|    do {
  904|  11.8k|        refmvs_block *const r = *rr++ + bx4;
  905|   152k|        for (int x = 0; x < bw4; x++)
  ------------------
  |  Branch (905:25): [True: 140k, False: 11.8k]
  ------------------
  906|   140k|            r[x] = *rmv;
  907|  11.8k|    } while (--bh4);
  ------------------
  |  Branch (907:14): [True: 9.19k, False: 2.65k]
  ------------------
  908|  2.65k|}

dav1d_init_last_nonzero_col_from_eob_tables:
  350|      4|COLD void dav1d_init_last_nonzero_col_from_eob_tables(void) {
  351|       |    static pthread_once_t initted = PTHREAD_ONCE_INIT;
  352|      4|    pthread_once(&initted, init_internal);
  353|      4|}
scan.c:init_internal:
  333|      1|static COLD void init_internal(void) {
  334|      1|    init_tbl(last_nonzero_col_from_eob_4x4,   scan_4x4,    4,  4);
  335|      1|    init_tbl(last_nonzero_col_from_eob_8x8,   scan_8x8,    8,  8);
  336|      1|    init_tbl(last_nonzero_col_from_eob_16x16, scan_16x16, 16, 16);
  337|      1|    init_tbl(last_nonzero_col_from_eob_32x32, scan_32x32, 32, 32);
  338|      1|    init_tbl(last_nonzero_col_from_eob_4x8,   scan_4x8,    4,  8);
  339|      1|    init_tbl(last_nonzero_col_from_eob_8x4,   scan_8x4,    8,  4);
  340|      1|    init_tbl(last_nonzero_col_from_eob_8x16,  scan_8x16,   8, 16);
  341|      1|    init_tbl(last_nonzero_col_from_eob_16x8,  scan_16x8,  16,  8);
  342|      1|    init_tbl(last_nonzero_col_from_eob_16x32, scan_16x32, 16, 32);
  343|      1|    init_tbl(last_nonzero_col_from_eob_32x16, scan_32x16, 32, 16);
  344|      1|    init_tbl(last_nonzero_col_from_eob_4x16,  scan_4x16,   4, 16);
  345|      1|    init_tbl(last_nonzero_col_from_eob_16x4,  scan_16x4,  16,  4);
  346|      1|    init_tbl(last_nonzero_col_from_eob_8x32,  scan_8x32,   8, 32);
  347|      1|    init_tbl(last_nonzero_col_from_eob_32x8,  scan_32x8,  32,  8);
  348|      1|}
scan.c:init_tbl:
  321|     14|{
  322|     14|    int max_col = 0;
  323|    218|    for (int y = 0, n = 0; y < h; y++) {
  ------------------
  |  Branch (323:28): [True: 204, False: 14]
  ------------------
  324|  3.54k|        for (int x = 0; x < w; x++, n++) {
  ------------------
  |  Branch (324:25): [True: 3.34k, False: 204]
  ------------------
  325|  3.34k|            const int rc = scan[n];
  326|  3.34k|            const int rcx = rc & (h - 1);
  327|  3.34k|            max_col = imax(max_col, rcx);
  328|  3.34k|            last_nonzero_col_from_eob[n] = max_col;
  329|  3.34k|        }
  330|    204|    }
  331|     14|}

thread_task.c:dav1d_set_thread_name:
  152|    288|static inline void dav1d_set_thread_name(const char *const name) {
  153|       |    prctl(PR_SET_NAME, name);
  154|    288|}

dav1d_task_create_tile_sbrow:
  270|      8|{
  271|      8|    Dav1dTask *tasks = f->task_thread.tile_tasks[0];
  272|      8|    const int uses_2pass = f->c->n_fc > 1;
  273|      8|    const int n_tasks_per_pass = f->frame_hdr->tiling.cols * f->frame_hdr->tiling.rows;
  274|      8|    const int n_tasks = n_tasks_per_pass * (1 + uses_2pass);
  275|      8|    if (pass < 2) {
  ------------------
  |  Branch (275:9): [True: 4, False: 4]
  ------------------
  276|      4|        if (n_tasks > f->task_thread.num_tile_tasks) {
  ------------------
  |  Branch (276:13): [True: 4, False: 0]
  ------------------
  277|      4|            const size_t size = sizeof(Dav1dTask) * n_tasks;
  278|      4|            tasks = dav1d_realloc(ALLOC_COMMON_CTX, f->task_thread.tile_tasks[0], size);
  ------------------
  |  |  133|      4|#define dav1d_realloc(type, ptr, sz) realloc(ptr, sz)
  ------------------
  279|      4|            if (!tasks) return -1;
  ------------------
  |  Branch (279:17): [True: 0, False: 4]
  ------------------
  280|      4|            memset(tasks, 0, size);
  281|      4|            f->task_thread.tile_tasks[0] = tasks;
  282|      4|            f->task_thread.num_tile_tasks = n_tasks;
  283|      4|        }
  284|      4|        f->task_thread.tile_tasks[1] = tasks + n_tasks_per_pass;
  285|      4|    }
  286|      8|    assert(n_tasks <= f->task_thread.num_tile_tasks);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 8]
  |  |  |  Branch (140:68): [Folded, False: 8]
  |  |  ------------------
  ------------------
  287|       |
  288|      8|    Dav1dTask *pf_t;
  289|      8|    if (create_filter_sbrow(f, pass, &pf_t))
  ------------------
  |  Branch (289:9): [True: 0, False: 8]
  ------------------
  290|      0|        return -1;
  291|       |
  292|      8|    Dav1dTask *const p1_tasks = f->task_thread.tile_tasks[1];
  293|      8|    Dav1dTask *prev_t = NULL;
  294|      8|    if (pass == 2) {
  ------------------
  |  Branch (294:9): [True: 4, False: 4]
  ------------------
  295|      4|        prev_t = &p1_tasks[n_tasks_per_pass - 1];
  296|       |        // PF task is scheduled after the last sby=0 TILE task
  297|      4|        if (f->frame_hdr->tiling.rows == 1)
  ------------------
  |  Branch (297:13): [True: 4, False: 0]
  ------------------
  298|      4|            prev_t = prev_t->next;
  299|      4|    }
  300|      8|    tasks += (pass & 1) * n_tasks_per_pass;
  301|     16|    for (int tile_idx = 0; tile_idx < n_tasks_per_pass; tile_idx++) {
  ------------------
  |  Branch (301:28): [True: 8, False: 8]
  ------------------
  302|      8|        Dav1dTileState *const ts = &f->ts[tile_idx];
  303|      8|        Dav1dTask *t = &tasks[tile_idx];
  304|      8|        t->sby = ts->tiling.row_start >> f->sb_shift;
  305|      8|        if (pf_t && t->sby) {
  ------------------
  |  Branch (305:13): [True: 8, False: 0]
  |  Branch (305:21): [True: 0, False: 8]
  ------------------
  306|      0|            prev_t->next = pf_t;
  307|      0|            prev_t = pf_t;
  308|      0|            pf_t = NULL;
  309|      0|        }
  310|      8|        t->recon_progress = 0;
  311|      8|        t->deblock_progress = 0;
  312|      8|        t->deps_skip = 0;
  313|      8|        t->type = pass != 1 ? DAV1D_TASK_TYPE_TILE_RECONSTRUCTION :
  ------------------
  |  Branch (313:19): [True: 4, False: 4]
  ------------------
  314|      8|                              DAV1D_TASK_TYPE_TILE_ENTROPY;
  315|      8|        t->frame_idx = (int)(f - f->c->fc);
  316|      8|        if (prev_t) prev_t->next = t;
  ------------------
  |  Branch (316:13): [True: 4, False: 4]
  ------------------
  317|      8|        prev_t = t;
  318|      8|    }
  319|      8|    if (pf_t) {
  ------------------
  |  Branch (319:9): [True: 8, False: 0]
  ------------------
  320|      8|        prev_t->next = pf_t;
  321|      8|        prev_t = pf_t;
  322|      8|    }
  323|      8|    prev_t->next = NULL;
  324|       |
  325|      8|    atomic_store(&f->task_thread.done[pass & 1], 0);
  326|       |
  327|       |    // XXX in theory this could be done locklessly, at this point they are no
  328|       |    // tasks in the frameQ, so no other runner should be using this lock, but
  329|       |    // we must add both passes at once
  330|      8|    if (!(pass & 1)) {
  ------------------
  |  Branch (330:9): [True: 4, False: 4]
  ------------------
  331|      4|        pthread_mutex_lock(&f->task_thread.pending_tasks.lock);
  332|      4|        assert(f->task_thread.pending_tasks.head == NULL);
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
  333|      4|        f->task_thread.pending_tasks.head = f->task_thread.tile_tasks[pass == 2];
  334|      4|        f->task_thread.pending_tasks.tail = prev_t;
  335|      4|        atomic_store(&f->task_thread.pending_tasks.merge, 1);
  336|      4|        atomic_store(&f->task_thread.init_done, 1);
  337|      4|        pthread_mutex_unlock(&f->task_thread.pending_tasks.lock);
  338|      4|    }
  339|      8|    return 0;
  340|      8|}
dav1d_task_frame_init:
  342|      4|void dav1d_task_frame_init(Dav1dFrameContext *const f) {
  343|      4|    const Dav1dContext *const c = f->c;
  344|       |
  345|      4|    atomic_store(&f->task_thread.init_done, 0);
  346|       |    // schedule init task, which will schedule the remaining tasks
  347|      4|    Dav1dTask *const t = &f->task_thread.init_task;
  348|      4|    t->type = DAV1D_TASK_TYPE_INIT;
  349|      4|    t->frame_idx = (int)(f - c->fc);
  350|      4|    t->sby = 0;
  351|      4|    t->recon_progress = t->deblock_progress = 0;
  352|      4|    insert_task(f, t, 1);
  353|      4|}
dav1d_worker_task:
  556|    288|void *dav1d_worker_task(void *data) {
  557|    288|    Dav1dTaskContext *const tc = data;
  558|    288|    const Dav1dContext *const c = tc->c;
  559|    288|    struct TaskThreadData *const ttd = tc->task_thread.ttd;
  560|       |
  561|    288|    dav1d_set_thread_name("dav1d-worker");
  562|       |
  563|    288|    pthread_mutex_lock(&ttd->lock);
  564|    801|    for (;;) {
  565|    801|        if (tc->task_thread.die) break;
  ------------------
  |  Branch (565:13): [True: 288, False: 513]
  ------------------
  566|    513|        if (atomic_load(c->flush)) goto park;
  ------------------
  |  Branch (566:13): [True: 8, False: 505]
  ------------------
  567|       |
  568|    505|        merge_pending(c);
  569|    505|        if (ttd->delayed_fg.exec) { // run delayed film grain first
  ------------------
  |  Branch (569:13): [True: 0, False: 505]
  ------------------
  570|      0|            delayed_fg_task(c, ttd);
  571|      0|            continue;
  572|      0|        }
  573|    505|        Dav1dFrameContext *f;
  574|    505|        Dav1dTask *t, *prev_t = NULL;
  575|    505|        if (c->n_fc > 1) { // run init tasks second
  ------------------
  |  Branch (575:13): [True: 505, False: 0]
  ------------------
  576|  3.51k|            for (unsigned i = 0; i < c->n_fc; i++) {
  ------------------
  |  Branch (576:34): [True: 3.01k, False: 501]
  ------------------
  577|  3.01k|                const unsigned first = atomic_load(&ttd->first);
  578|  3.01k|                f = &c->fc[(first + i) % c->n_fc];
  579|  3.01k|                if (atomic_load(&f->task_thread.init_done)) continue;
  ------------------
  |  Branch (579:21): [True: 209, False: 2.80k]
  ------------------
  580|  2.80k|                t = f->task_thread.task_head;
  581|  2.80k|                if (!t) continue;
  ------------------
  |  Branch (581:21): [True: 2.79k, False: 4]
  ------------------
  582|      4|                if (t->type == DAV1D_TASK_TYPE_INIT) goto found;
  ------------------
  |  Branch (582:21): [True: 4, False: 0]
  ------------------
  583|      0|                if (t->type == DAV1D_TASK_TYPE_INIT_CDF) {
  ------------------
  |  Branch (583:21): [True: 0, False: 0]
  ------------------
  584|       |                    // XXX This can be a simple else, if adding tasks of both
  585|       |                    // passes at once (in dav1d_task_create_tile_sbrow).
  586|       |                    // Adding the tasks to the pending Q can result in a
  587|       |                    // thread merging them before setting init_done.
  588|       |                    // We will need to set init_done before adding to the
  589|       |                    // pending Q, so maybe return the tasks, set init_done,
  590|       |                    // and add to pending Q only then.
  591|      0|                    const int p1 = f->in_cdf.progress ?
  ------------------
  |  Branch (591:36): [True: 0, False: 0]
  ------------------
  592|      0|                        atomic_load(f->in_cdf.progress) : 1;
  593|      0|                    if (p1) {
  ------------------
  |  Branch (593:25): [True: 0, False: 0]
  ------------------
  594|      0|                        atomic_fetch_or(&f->task_thread.error, p1 == TILE_ERROR);
  595|      0|                        goto found;
  596|      0|                    }
  597|      0|                }
  598|      0|            }
  599|    505|        }
  600|    763|        while (ttd->cur < c->n_fc) { // run decoding tasks last
  ------------------
  |  Branch (600:16): [True: 366, False: 397]
  ------------------
  601|    366|            const unsigned first = atomic_load(&ttd->first);
  602|    366|            f = &c->fc[(first + ttd->cur) % c->n_fc];
  603|    366|            merge_pending_frame(f);
  604|    366|            prev_t = f->task_thread.task_cur_prev;
  605|    366|            t = prev_t ? prev_t->next : f->task_thread.task_head;
  ------------------
  |  Branch (605:17): [True: 2, False: 364]
  ------------------
  606|    455|            while (t) {
  ------------------
  |  Branch (606:20): [True: 193, False: 262]
  ------------------
  607|    193|                if (t->type == DAV1D_TASK_TYPE_INIT_CDF) goto next;
  ------------------
  |  Branch (607:21): [True: 0, False: 193]
  ------------------
  608|    193|                else if (t->type == DAV1D_TASK_TYPE_TILE_ENTROPY ||
  ------------------
  |  Branch (608:26): [True: 20, False: 173]
  ------------------
  609|    173|                         t->type == DAV1D_TASK_TYPE_TILE_RECONSTRUCTION)
  ------------------
  |  Branch (609:26): [True: 20, False: 153]
  ------------------
  610|     40|                {
  611|       |                    // if not bottom sbrow of tile, this task will be re-added
  612|       |                    // after it's finished
  613|     40|                    if (!check_tile(t, f, c->n_fc > 1))
  ------------------
  |  Branch (613:25): [True: 36, False: 4]
  ------------------
  614|     36|                        goto found;
  615|    153|                } else if (t->recon_progress) {
  ------------------
  |  Branch (615:28): [True: 153, False: 0]
  ------------------
  616|    153|                    const int p = t->type == DAV1D_TASK_TYPE_ENTROPY_PROGRESS;
  617|    153|                    int error = atomic_load(&f->task_thread.error);
  618|    153|                    assert(!atomic_load(&f->task_thread.done[p]) || error);
  ------------------
  |  |  140|    175|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 131, False: 22]
  |  |  |  Branch (140:30): [True: 22, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 153]
  |  |  ------------------
  ------------------
  619|    153|                    const int tile_row_base = f->frame_hdr->tiling.cols *
  620|    153|                                              f->frame_thread.next_tile_row[p];
  621|    153|                    if (p) {
  ------------------
  |  Branch (621:25): [True: 56, False: 97]
  ------------------
  622|     56|                        atomic_int *const prog = &f->frame_thread.entropy_progress;
  623|     56|                        const int p1 = atomic_load(prog);
  624|     56|                        if (p1 < t->sby) goto next;
  ------------------
  |  Branch (624:29): [True: 0, False: 56]
  ------------------
  625|     56|                        atomic_fetch_or(&f->task_thread.error, p1 == TILE_ERROR);
  626|     56|                    }
  627|    221|                    for (int tc = 0; tc < f->frame_hdr->tiling.cols; tc++) {
  ------------------
  |  Branch (627:38): [True: 153, False: 68]
  ------------------
  628|    153|                        Dav1dTileState *const ts = &f->ts[tile_row_base + tc];
  629|    153|                        const int p2 = atomic_load(&ts->progress[p]);
  630|    153|                        if (p2 < t->recon_progress) goto next;
  ------------------
  |  Branch (630:29): [True: 85, False: 68]
  ------------------
  631|    153|                        atomic_fetch_or(&f->task_thread.error, p2 == TILE_ERROR);
  632|     68|                    }
  633|     68|                    if (t->sby + 1 < f->sbh) {
  ------------------
  |  Branch (633:25): [True: 60, False: 8]
  ------------------
  634|       |                        // add sby+1 to list to replace this one
  635|     60|                        Dav1dTask *next_t = &t[1];
  636|     60|                        *next_t = *t;
  637|     60|                        next_t->sby++;
  638|     60|                        const int ntr = f->frame_thread.next_tile_row[p] + 1;
  639|     60|                        const int start = f->frame_hdr->tiling.row_start_sb[ntr];
  640|     60|                        if (next_t->sby == start)
  ------------------
  |  Branch (640:29): [True: 0, False: 60]
  ------------------
  641|      0|                            f->frame_thread.next_tile_row[p] = ntr;
  642|     60|                        next_t->recon_progress = next_t->sby + 1;
  643|     60|                        insert_task(f, next_t, 0);
  644|     60|                    }
  645|     68|                    goto found;
  646|    153|                } else if (t->type == DAV1D_TASK_TYPE_CDEF) {
  ------------------
  |  Branch (646:28): [True: 0, False: 0]
  ------------------
  647|      0|                    atomic_uint *prog = f->frame_thread.copy_lpf_progress;
  648|      0|                    const int p1 = atomic_load(&prog[(t->sby - 1) >> 5]);
  649|      0|                    if (p1 & (1U << ((t->sby - 1) & 31)))
  ------------------
  |  Branch (649:25): [True: 0, False: 0]
  ------------------
  650|      0|                        goto found;
  651|      0|                } else {
  652|      0|                    assert(t->deblock_progress);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  653|      0|                    const int p1 = atomic_load(&f->frame_thread.deblock_progress);
  654|      0|                    if (p1 >= t->deblock_progress) {
  ------------------
  |  Branch (654:25): [True: 0, False: 0]
  ------------------
  655|      0|                        atomic_fetch_or(&f->task_thread.error, p1 == TILE_ERROR);
  656|      0|                        goto found;
  657|      0|                    }
  658|      0|                }
  659|     89|            next:
  660|     89|                prev_t = t;
  661|     89|                t = t->next;
  662|     89|                f->task_thread.task_cur_prev = prev_t;
  663|     89|            }
  664|    262|            ttd->cur++;
  665|    262|        }
  666|    397|        if (reset_task_cur(c, ttd, UINT_MAX)) continue;
  ------------------
  |  Branch (666:13): [True: 1, False: 396]
  ------------------
  667|    396|        if (merge_pending(c)) continue;
  ------------------
  |  Branch (667:13): [True: 0, False: 396]
  ------------------
  668|    404|    park:
  669|    404|        tc->task_thread.flushed = 1;
  670|    404|        pthread_cond_signal(&tc->task_thread.td.cond);
  671|       |        // we want to be woken up next time progress is signaled
  672|    404|        atomic_store(&ttd->cond_signaled, 0);
  673|    404|        pthread_cond_wait(&ttd->cond, &ttd->lock);
  674|    404|        tc->task_thread.flushed = 0;
  675|    404|        reset_task_cur(c, ttd, UINT_MAX);
  676|    404|        continue;
  677|       |
  678|    108|    found:
  679|       |        // remove t from list
  680|    108|        if (prev_t) prev_t->next = t->next;
  ------------------
  |  Branch (680:13): [True: 30, False: 78]
  ------------------
  681|     78|        else f->task_thread.task_head = t->next;
  682|    108|        if (!t->next) f->task_thread.task_tail = prev_t;
  ------------------
  |  Branch (682:13): [True: 12, False: 96]
  ------------------
  683|    108|        if (t->type > DAV1D_TASK_TYPE_INIT_CDF && !f->task_thread.task_head)
  ------------------
  |  Branch (683:13): [True: 104, False: 4]
  |  Branch (683:51): [True: 4, False: 100]
  ------------------
  684|      4|            ttd->cur++;
  685|    108|        t->next = NULL;
  686|       |        // we don't need to check cond_signaled here, since we found a task
  687|       |        // after the last signal so we want to re-signal the next waiting thread
  688|       |        // and again won't need to signal after that
  689|    108|        atomic_store(&ttd->cond_signaled, 1);
  690|    108|        pthread_cond_signal(&ttd->cond);
  691|    108|        pthread_mutex_unlock(&ttd->lock);
  692|    144|    found_unlocked:;
  693|    144|        const int flush = atomic_load(c->flush);
  694|    144|        int error = atomic_fetch_or(&f->task_thread.error, flush) | flush;
  695|       |
  696|       |        // run it
  697|    144|        tc->f = f;
  698|    144|        int sby = t->sby;
  699|    144|        switch (t->type) {
  700|      4|        case DAV1D_TASK_TYPE_INIT: {
  ------------------
  |  Branch (700:9): [True: 4, False: 140]
  ------------------
  701|      4|            assert(c->n_fc > 1);
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
  702|      4|            int res = dav1d_decode_frame_init(f);
  703|      4|            int p1 = f->in_cdf.progress ? atomic_load(f->in_cdf.progress) : 1;
  ------------------
  |  Branch (703:22): [True: 0, False: 4]
  ------------------
  704|      4|            if (res || p1 == TILE_ERROR) {
  ------------------
  |  |   36|      4|#define TILE_ERROR (INT_MAX - 1)
  ------------------
  |  Branch (704:17): [True: 0, False: 4]
  |  Branch (704:24): [True: 0, False: 4]
  ------------------
  705|      0|                pthread_mutex_lock(&ttd->lock);
  706|      0|                abort_frame(f, res ? res : DAV1D_ERR(EINVAL));
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (706:32): [True: 0, False: 0]
  ------------------
  707|      0|                reset_task_cur(c, ttd, t->frame_idx);
  708|      4|            } else {
  709|      4|                t->type = DAV1D_TASK_TYPE_INIT_CDF;
  710|      4|                if (p1) goto found_unlocked;
  ------------------
  |  Branch (710:21): [True: 4, False: 0]
  ------------------
  711|      0|                add_pending(f, t);
  712|      0|                pthread_mutex_lock(&ttd->lock);
  713|      0|            }
  714|      0|            continue;
  715|      4|        }
  716|      4|        case DAV1D_TASK_TYPE_INIT_CDF: {
  ------------------
  |  Branch (716:9): [True: 4, False: 140]
  ------------------
  717|      4|            assert(c->n_fc > 1);
  ------------------
  |  |  140|      4|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 4]
  |  |  |  Branch (140:68): [Folded, False: 4]
  |  |  ------------------
  ------------------
  718|      4|            int res = DAV1D_ERR(EINVAL);
  ------------------
  |  |   58|      4|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  719|      4|            if (!atomic_load(&f->task_thread.error))
  ------------------
  |  Branch (719:17): [True: 4, False: 0]
  ------------------
  720|      4|                res = dav1d_decode_frame_init_cdf(f);
  721|      4|            if (f->frame_hdr->refresh_context && !f->task_thread.update_set)
  ------------------
  |  Branch (721:17): [True: 0, False: 4]
  |  Branch (721:50): [True: 0, False: 0]
  ------------------
  722|      4|                atomic_store(f->out_cdf.progress, res < 0 ? TILE_ERROR : 1);
  ------------------
  |  Branch (722:17): [True: 0, False: 0]
  ------------------
  723|     12|            for (int p = 1; p <= 2 && !res; p++)
  ------------------
  |  Branch (723:29): [True: 8, False: 4]
  |  Branch (723:39): [True: 8, False: 0]
  ------------------
  724|      8|                res = dav1d_task_create_tile_sbrow(f, p, 0);
  725|      4|            pthread_mutex_lock(&ttd->lock);
  726|      4|            if (res) {
  ------------------
  |  Branch (726:17): [True: 0, False: 4]
  ------------------
  727|      0|                abort_frame(f, DAV1D_ERR(ENOMEM));
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  728|      0|                reset_task_cur(c, ttd, t->frame_idx);
  729|      0|                atomic_store(&f->task_thread.init_done, 1);
  730|      0|            }
  731|      4|            continue;
  732|      4|        }
  733|     34|        case DAV1D_TASK_TYPE_TILE_ENTROPY:
  ------------------
  |  Branch (733:9): [True: 34, False: 110]
  ------------------
  734|     68|        case DAV1D_TASK_TYPE_TILE_RECONSTRUCTION: {
  ------------------
  |  Branch (734:9): [True: 34, False: 110]
  ------------------
  735|     68|            const int p = t->type == DAV1D_TASK_TYPE_TILE_ENTROPY;
  736|     68|            const int tile_idx = (int)(t - f->task_thread.tile_tasks[p]);
  737|     68|            Dav1dTileState *const ts = &f->ts[tile_idx];
  738|       |
  739|     68|            tc->ts = ts;
  740|     68|            tc->by = sby << f->sb_shift;
  741|     68|            const int uses_2pass = c->n_fc > 1;
  742|     68|            tc->frame_thread.pass = !uses_2pass ? 0 :
  ------------------
  |  Branch (742:37): [True: 0, False: 68]
  ------------------
  743|     68|                1 + (t->type == DAV1D_TASK_TYPE_TILE_RECONSTRUCTION);
  744|     68|            if (!error) error = dav1d_decode_tile_sbrow(tc);
  ------------------
  |  Branch (744:17): [True: 26, False: 42]
  ------------------
  745|     68|            const int progress = error ? TILE_ERROR : 1 + sby;
  ------------------
  |  |   36|     46|#define TILE_ERROR (INT_MAX - 1)
  ------------------
  |  Branch (745:34): [True: 46, False: 22]
  ------------------
  746|       |
  747|       |            // signal progress
  748|     68|            atomic_fetch_or(&f->task_thread.error, error);
  749|     68|            if (((sby + 1) << f->sb_shift) < ts->tiling.row_end) {
  ------------------
  |  Branch (749:17): [True: 60, False: 8]
  ------------------
  750|     60|                t->sby++;
  751|     60|                t->deps_skip = 0;
  752|     60|                if (!check_tile(t, f, uses_2pass)) {
  ------------------
  |  Branch (752:21): [True: 32, False: 28]
  ------------------
  753|     32|                    atomic_store(&ts->progress[p], progress);
  754|     32|                    reset_task_cur_async(ttd, t->frame_idx, c->n_fc);
  755|     32|                    if (!atomic_fetch_or(&ttd->cond_signaled, 1))
  ------------------
  |  Branch (755:25): [True: 0, False: 32]
  ------------------
  756|      0|                        pthread_cond_signal(&ttd->cond);
  757|     32|                    goto found_unlocked;
  758|     32|                }
  759|     60|                atomic_store(&ts->progress[p], progress);
  760|     28|                add_pending(f, t);
  761|     28|                pthread_mutex_lock(&ttd->lock);
  762|     28|            } else {
  763|      8|                pthread_mutex_lock(&ttd->lock);
  764|      8|                atomic_store(&ts->progress[p], progress);
  765|      8|                reset_task_cur(c, ttd, t->frame_idx);
  766|      8|                error = atomic_load(&f->task_thread.error);
  767|      8|                if (f->frame_hdr->refresh_context &&
  ------------------
  |  Branch (767:21): [True: 0, False: 8]
  ------------------
  768|      0|                    tc->frame_thread.pass <= 1 && f->task_thread.update_set &&
  ------------------
  |  Branch (768:21): [True: 0, False: 0]
  |  Branch (768:51): [True: 0, False: 0]
  ------------------
  769|      0|                    f->frame_hdr->tiling.update == tile_idx)
  ------------------
  |  Branch (769:21): [True: 0, False: 0]
  ------------------
  770|      0|                {
  771|      0|                    if (!error)
  ------------------
  |  Branch (771:25): [True: 0, False: 0]
  ------------------
  772|      0|                        dav1d_cdf_thread_update(f->frame_hdr, f->out_cdf.data.cdf,
  773|      0|                                                &f->ts[f->frame_hdr->tiling.update].cdf);
  774|      0|                    if (c->n_fc > 1)
  ------------------
  |  Branch (774:25): [True: 0, False: 0]
  ------------------
  775|      0|                        atomic_store(f->out_cdf.progress, error ? TILE_ERROR : 1);
  ------------------
  |  Branch (775:25): [True: 0, False: 0]
  ------------------
  776|      0|                }
  777|      8|                if (atomic_fetch_sub(&f->task_thread.task_counter, 1) - 1 == 0 &&
  ------------------
  |  Branch (777:21): [True: 0, False: 8]
  ------------------
  778|      8|                    atomic_load(&f->task_thread.done[0]) &&
  ------------------
  |  Branch (778:21): [True: 0, False: 0]
  ------------------
  779|      0|                    (!uses_2pass || atomic_load(&f->task_thread.done[1])))
  ------------------
  |  Branch (779:22): [True: 0, False: 0]
  |  Branch (779:37): [True: 0, False: 0]
  ------------------
  780|      0|                {
  781|      0|                    error = atomic_load(&f->task_thread.error);
  782|      0|                    dav1d_decode_frame_exit(f, error == 1 ? DAV1D_ERR(EINVAL) :
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (782:48): [True: 0, False: 0]
  ------------------
  783|      0|                                            error ? DAV1D_ERR(ENOMEM) : 0);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (783:45): [True: 0, False: 0]
  ------------------
  784|      0|                    f->n_tile_data = 0;
  785|      0|                    pthread_cond_signal(&f->task_thread.cond);
  786|      0|                }
  787|      8|                assert(atomic_load(&f->task_thread.task_counter) >= 0);
  ------------------
  |  |  140|      8|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 8]
  |  |  |  Branch (140:68): [Folded, False: 8]
  |  |  ------------------
  ------------------
  788|      8|                if (!atomic_fetch_or(&ttd->cond_signaled, 1))
  ------------------
  |  Branch (788:21): [True: 2, False: 6]
  ------------------
  789|      2|                    pthread_cond_signal(&ttd->cond);
  790|      8|            }
  791|     36|            continue;
  792|     68|        }
  793|     36|        case DAV1D_TASK_TYPE_DEBLOCK_COLS:
  ------------------
  |  Branch (793:9): [True: 0, False: 144]
  ------------------
  794|      0|            if (!atomic_load(&f->task_thread.error))
  ------------------
  |  Branch (794:17): [True: 0, False: 0]
  ------------------
  795|      0|                f->bd_fn.filter_sbrow_deblock_cols(f, sby);
  796|      0|            if (ensure_progress(ttd, f, t, DAV1D_TASK_TYPE_DEBLOCK_ROWS,
  ------------------
  |  Branch (796:17): [True: 0, False: 0]
  ------------------
  797|      0|                                &f->frame_thread.deblock_progress,
  798|      0|                                &t->deblock_progress)) continue;
  799|       |            // fall-through
  800|     34|        case DAV1D_TASK_TYPE_DEBLOCK_ROWS:
  ------------------
  |  Branch (800:9): [True: 34, False: 110]
  ------------------
  801|     34|            if (!atomic_load(&f->task_thread.error))
  ------------------
  |  Branch (801:17): [True: 4, False: 30]
  ------------------
  802|      4|                f->bd_fn.filter_sbrow_deblock_rows(f, sby);
  803|       |            // signal deblock progress
  804|     34|            if (f->frame_hdr->loopfilter.level_y[0] ||
  ------------------
  |  Branch (804:17): [True: 0, False: 34]
  ------------------
  805|     34|                f->frame_hdr->loopfilter.level_y[1])
  ------------------
  |  Branch (805:17): [True: 0, False: 34]
  ------------------
  806|      0|            {
  807|      0|                error = atomic_load(&f->task_thread.error);
  808|      0|                atomic_store(&f->frame_thread.deblock_progress,
  ------------------
  |  Branch (808:17): [True: 0, False: 0]
  ------------------
  809|      0|                             error ? TILE_ERROR : sby + 1);
  810|      0|                reset_task_cur_async(ttd, t->frame_idx, c->n_fc);
  811|      0|                if (!atomic_fetch_or(&ttd->cond_signaled, 1))
  ------------------
  |  Branch (811:21): [True: 0, False: 0]
  ------------------
  812|      0|                    pthread_cond_signal(&ttd->cond);
  813|     34|            } else if (f->seq_hdr->cdef || f->lf.restore_planes) {
  ------------------
  |  Branch (813:24): [True: 34, False: 0]
  |  Branch (813:44): [True: 0, False: 0]
  ------------------
  814|     34|                atomic_fetch_or(&f->frame_thread.copy_lpf_progress[sby >> 5],
  815|     34|                                1U << (sby & 31));
  816|       |                // CDEF needs the top buffer to be saved by lr_copy_lpf of the
  817|       |                // previous sbrow
  818|     34|                if (sby) {
  ------------------
  |  Branch (818:21): [True: 30, False: 4]
  ------------------
  819|     30|                    int prog = atomic_load(&f->frame_thread.copy_lpf_progress[(sby - 1) >> 5]);
  820|     30|                    if (~prog & (1U << ((sby - 1) & 31))) {
  ------------------
  |  Branch (820:25): [True: 0, False: 30]
  ------------------
  821|      0|                        t->type = DAV1D_TASK_TYPE_CDEF;
  822|      0|                        t->recon_progress = t->deblock_progress = 0;
  823|      0|                        add_pending(f, t);
  824|      0|                        pthread_mutex_lock(&ttd->lock);
  825|      0|                        continue;
  826|      0|                    }
  827|     30|                }
  828|     34|            }
  829|       |            // fall-through
  830|     34|        case DAV1D_TASK_TYPE_CDEF:
  ------------------
  |  Branch (830:9): [True: 0, False: 144]
  ------------------
  831|     34|            if (f->seq_hdr->cdef) {
  ------------------
  |  Branch (831:17): [True: 34, False: 0]
  ------------------
  832|     34|                if (!atomic_load(&f->task_thread.error))
  ------------------
  |  Branch (832:21): [True: 4, False: 30]
  ------------------
  833|      4|                    f->bd_fn.filter_sbrow_cdef(tc, sby);
  834|     34|                reset_task_cur_async(ttd, t->frame_idx, c->n_fc);
  835|     34|                if (!atomic_fetch_or(&ttd->cond_signaled, 1))
  ------------------
  |  Branch (835:21): [True: 2, False: 32]
  ------------------
  836|      2|                    pthread_cond_signal(&ttd->cond);
  837|     34|            }
  838|       |            // fall-through
  839|     34|        case DAV1D_TASK_TYPE_SUPER_RESOLUTION:
  ------------------
  |  Branch (839:9): [True: 0, False: 144]
  ------------------
  840|     34|            if (f->frame_hdr->width[0] != f->frame_hdr->width[1])
  ------------------
  |  Branch (840:17): [True: 0, False: 34]
  ------------------
  841|      0|                if (!atomic_load(&f->task_thread.error))
  ------------------
  |  Branch (841:21): [True: 0, False: 0]
  ------------------
  842|      0|                    f->bd_fn.filter_sbrow_resize(f, sby);
  843|       |            // fall-through
  844|     34|        case DAV1D_TASK_TYPE_LOOP_RESTORATION:
  ------------------
  |  Branch (844:9): [True: 0, False: 144]
  ------------------
  845|     34|            if (!atomic_load(&f->task_thread.error) && f->lf.restore_planes)
  ------------------
  |  Branch (845:17): [True: 4, False: 30]
  |  Branch (845:56): [True: 0, False: 4]
  ------------------
  846|      0|                f->bd_fn.filter_sbrow_lr(f, sby);
  847|       |            // fall-through
  848|     34|        case DAV1D_TASK_TYPE_RECONSTRUCTION_PROGRESS:
  ------------------
  |  Branch (848:9): [True: 0, False: 144]
  ------------------
  849|       |            // dummy to cover for no post-filters
  850|     68|        case DAV1D_TASK_TYPE_ENTROPY_PROGRESS:
  ------------------
  |  Branch (850:9): [True: 34, False: 110]
  ------------------
  851|       |            // dummy to convert tile progress to frame
  852|     68|            break;
  853|      0|        default: abort();
  ------------------
  |  Branch (853:9): [True: 0, False: 144]
  ------------------
  854|    144|        }
  855|       |        // if task completed [typically LR], signal picture progress as per below
  856|     68|        const int uses_2pass = c->n_fc > 1;
  857|     68|        const int sbh = f->sbh;
  858|     68|        const int sbsz = f->sb_step * 4;
  859|     68|        if (t->type == DAV1D_TASK_TYPE_ENTROPY_PROGRESS) {
  ------------------
  |  Branch (859:13): [True: 34, False: 34]
  ------------------
  860|     34|            error = atomic_load(&f->task_thread.error);
  861|     34|            const unsigned y = sby + 1 == sbh ? UINT_MAX : (unsigned)(sby + 1) * sbsz;
  ------------------
  |  Branch (861:32): [True: 4, False: 30]
  ------------------
  862|     34|            assert(c->n_fc > 1);
  ------------------
  |  |  140|     34|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 34]
  |  |  |  Branch (140:68): [Folded, False: 34]
  |  |  ------------------
  ------------------
  863|     34|            if (f->sr_cur.p.data[0] /* upon flush, this can be free'ed already */)
  ------------------
  |  Branch (863:17): [True: 34, False: 0]
  ------------------
  864|     34|                atomic_store(&f->sr_cur.progress[0], error ? FRAME_ERROR : y);
  ------------------
  |  Branch (864:17): [True: 20, False: 14]
  ------------------
  865|     34|            atomic_store(&f->frame_thread.entropy_progress,
  ------------------
  |  Branch (865:13): [True: 20, False: 14]
  ------------------
  866|     34|                         error ? TILE_ERROR : sby + 1);
  867|     34|            if (sby + 1 == sbh)
  ------------------
  |  Branch (867:17): [True: 4, False: 30]
  ------------------
  868|     34|                atomic_store(&f->task_thread.done[1], 1);
  869|     34|            pthread_mutex_lock(&ttd->lock);
  870|     34|            const int num_tasks = atomic_fetch_sub(&f->task_thread.task_counter, 1) - 1;
  871|     34|            if (sby + 1 < sbh && num_tasks) {
  ------------------
  |  Branch (871:17): [True: 30, False: 4]
  |  Branch (871:34): [True: 30, False: 0]
  ------------------
  872|     30|                reset_task_cur(c, ttd, t->frame_idx);
  873|     30|                continue;
  874|     30|            }
  875|      4|            if (!num_tasks && atomic_load(&f->task_thread.done[0]) &&
  ------------------
  |  Branch (875:17): [True: 0, False: 4]
  |  Branch (875:31): [True: 0, False: 0]
  ------------------
  876|      4|                atomic_load(&f->task_thread.done[1]))
  ------------------
  |  Branch (876:17): [True: 0, False: 0]
  ------------------
  877|      0|            {
  878|      0|                error = atomic_load(&f->task_thread.error);
  879|      0|                dav1d_decode_frame_exit(f, error == 1 ? DAV1D_ERR(EINVAL) :
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (879:44): [True: 0, False: 0]
  ------------------
  880|      0|                                        error ? DAV1D_ERR(ENOMEM) : 0);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (880:41): [True: 0, False: 0]
  ------------------
  881|      0|                f->n_tile_data = 0;
  882|      0|                pthread_cond_signal(&f->task_thread.cond);
  883|      0|            }
  884|      4|            reset_task_cur(c, ttd, t->frame_idx);
  885|      4|            continue;
  886|     34|        }
  887|       |    // t->type != DAV1D_TASK_TYPE_ENTROPY_PROGRESS
  888|     68|        atomic_fetch_or(&f->frame_thread.frame_progress[sby >> 5],
  889|     34|                        1U << (sby & 31));
  890|     34|        pthread_mutex_lock(&f->task_thread.lock);
  891|     34|        sby = get_frame_progress(c, f);
  892|     34|        error = atomic_load(&f->task_thread.error);
  893|     34|        const unsigned y = sby + 1 == sbh ? UINT_MAX : (unsigned)(sby + 1) * sbsz;
  ------------------
  |  Branch (893:28): [True: 26, False: 8]
  ------------------
  894|     34|        if (c->n_fc > 1 && f->sr_cur.p.data[0] /* upon flush, this can be free'ed already */)
  ------------------
  |  Branch (894:13): [True: 34, False: 0]
  |  Branch (894:28): [True: 34, False: 0]
  ------------------
  895|     34|            atomic_store(&f->sr_cur.progress[1], error ? FRAME_ERROR : y);
  ------------------
  |  Branch (895:13): [True: 30, False: 4]
  ------------------
  896|     34|        pthread_mutex_unlock(&f->task_thread.lock);
  897|     34|        if (sby + 1 == sbh)
  ------------------
  |  Branch (897:13): [True: 26, False: 8]
  ------------------
  898|     34|            atomic_store(&f->task_thread.done[0], 1);
  899|     34|        pthread_mutex_lock(&ttd->lock);
  900|     34|        const int num_tasks = atomic_fetch_sub(&f->task_thread.task_counter, 1) - 1;
  901|     34|        if (sby + 1 < sbh && num_tasks) {
  ------------------
  |  Branch (901:13): [True: 8, False: 26]
  |  Branch (901:30): [True: 8, False: 0]
  ------------------
  902|      8|            reset_task_cur(c, ttd, t->frame_idx);
  903|      8|            continue;
  904|      8|        }
  905|     26|        if (!num_tasks && atomic_load(&f->task_thread.done[0]) &&
  ------------------
  |  Branch (905:13): [True: 4, False: 22]
  |  Branch (905:27): [True: 4, False: 0]
  ------------------
  906|      4|            (!uses_2pass || atomic_load(&f->task_thread.done[1])))
  ------------------
  |  Branch (906:14): [True: 0, False: 4]
  |  Branch (906:29): [True: 4, False: 0]
  ------------------
  907|      4|        {
  908|      4|            error = atomic_load(&f->task_thread.error);
  909|      4|            dav1d_decode_frame_exit(f, error == 1 ? DAV1D_ERR(EINVAL) :
  ------------------
  |  |   58|      4|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (909:40): [True: 4, False: 0]
  ------------------
  910|      4|                                    error ? DAV1D_ERR(ENOMEM) : 0);
  ------------------
  |  |   58|      0|#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
  ------------------
  |  Branch (910:37): [True: 0, False: 0]
  ------------------
  911|      4|            f->n_tile_data = 0;
  912|      4|            pthread_cond_signal(&f->task_thread.cond);
  913|      4|        }
  914|     26|        reset_task_cur(c, ttd, t->frame_idx);
  915|     26|    }
  916|    288|    pthread_mutex_unlock(&ttd->lock);
  917|       |
  918|       |    return NULL;
  919|    288|}
thread_task.c:create_filter_sbrow:
  215|      8|{
  216|      8|    const int has_deblock = f->frame_hdr->loopfilter.level_y[0] ||
  ------------------
  |  Branch (216:29): [True: 0, False: 8]
  ------------------
  217|      8|                            f->frame_hdr->loopfilter.level_y[1];
  ------------------
  |  Branch (217:29): [True: 0, False: 8]
  ------------------
  218|      8|    const int has_cdef = f->seq_hdr->cdef;
  219|      8|    const int has_resize = f->frame_hdr->width[0] != f->frame_hdr->width[1];
  220|      8|    const int has_lr = f->lf.restore_planes;
  221|       |
  222|      8|    Dav1dTask *tasks = f->task_thread.tasks;
  223|      8|    const int uses_2pass = f->c->n_fc > 1;
  224|      8|    int num_tasks = f->sbh * (1 + uses_2pass);
  225|      8|    if (num_tasks > f->task_thread.num_tasks) {
  ------------------
  |  Branch (225:9): [True: 4, False: 4]
  ------------------
  226|      4|        const size_t size = sizeof(Dav1dTask) * num_tasks;
  227|      4|        tasks = dav1d_realloc(ALLOC_COMMON_CTX, f->task_thread.tasks, size);
  ------------------
  |  |  133|      4|#define dav1d_realloc(type, ptr, sz) realloc(ptr, sz)
  ------------------
  228|      4|        if (!tasks) return -1;
  ------------------
  |  Branch (228:13): [True: 0, False: 4]
  ------------------
  229|      4|        memset(tasks, 0, size);
  230|      4|        f->task_thread.tasks = tasks;
  231|      4|        f->task_thread.num_tasks = num_tasks;
  232|      4|    }
  233|      8|    tasks += f->sbh * (pass & 1);
  234|       |
  235|      8|    if (pass & 1) {
  ------------------
  |  Branch (235:9): [True: 4, False: 4]
  ------------------
  236|      4|        f->frame_thread.entropy_progress = 0;
  237|      4|    } else {
  238|      4|        const int prog_sz = ((f->sbh + 31) & ~31) >> 5;
  239|      4|        if (prog_sz > f->frame_thread.prog_sz) {
  ------------------
  |  Branch (239:13): [True: 4, False: 0]
  ------------------
  240|      4|            atomic_uint *const prog = dav1d_realloc(ALLOC_COMMON_CTX, f->frame_thread.frame_progress,
  ------------------
  |  |  133|      4|#define dav1d_realloc(type, ptr, sz) realloc(ptr, sz)
  ------------------
  241|      4|                                                    2 * prog_sz * sizeof(*prog));
  242|      4|            if (!prog) return -1;
  ------------------
  |  Branch (242:17): [True: 0, False: 4]
  ------------------
  243|      4|            f->frame_thread.frame_progress = prog;
  244|      4|            f->frame_thread.copy_lpf_progress = prog + prog_sz;
  245|      4|        }
  246|      4|        f->frame_thread.prog_sz = prog_sz;
  247|      4|        memset(f->frame_thread.frame_progress, 0, prog_sz * sizeof(atomic_uint));
  248|      4|        memset(f->frame_thread.copy_lpf_progress, 0, prog_sz * sizeof(atomic_uint));
  249|      4|        atomic_store(&f->frame_thread.deblock_progress, 0);
  250|      4|    }
  251|      8|    f->frame_thread.next_tile_row[pass & 1] = 0;
  252|       |
  253|      8|    Dav1dTask *t = &tasks[0];
  254|      8|    t->sby = 0;
  255|      8|    t->recon_progress = 1;
  256|      8|    t->deblock_progress = 0;
  257|      8|    t->type = pass == 1 ? DAV1D_TASK_TYPE_ENTROPY_PROGRESS :
  ------------------
  |  Branch (257:15): [True: 4, False: 4]
  ------------------
  258|      8|              has_deblock ? DAV1D_TASK_TYPE_DEBLOCK_COLS :
  ------------------
  |  Branch (258:15): [True: 0, False: 4]
  ------------------
  259|      4|              has_cdef || has_lr /* i.e. LR backup */ ? DAV1D_TASK_TYPE_DEBLOCK_ROWS :
  ------------------
  |  Branch (259:15): [True: 4, False: 0]
  |  Branch (259:27): [True: 0, False: 0]
  ------------------
  260|      4|              has_resize ? DAV1D_TASK_TYPE_SUPER_RESOLUTION :
  ------------------
  |  Branch (260:15): [True: 0, False: 0]
  ------------------
  261|      0|              DAV1D_TASK_TYPE_RECONSTRUCTION_PROGRESS;
  262|      8|    t->frame_idx = (int)(f - f->c->fc);
  263|       |
  264|      8|    *res_t = t;
  265|      8|    return 0;
  266|      8|}
thread_task.c:insert_task:
  172|    108|{
  173|    108|    insert_tasks(f, t, t, cond_signal);
  174|    108|}
thread_task.c:insert_tasks:
  118|    108|{
  119|       |    // insert task back into task queue
  120|    108|    Dav1dTask *t_ptr, *prev_t = NULL;
  121|    108|    for (t_ptr = f->task_thread.task_head;
  122|    250|         t_ptr; prev_t = t_ptr, t_ptr = t_ptr->next)
  ------------------
  |  Branch (122:10): [True: 166, False: 84]
  ------------------
  123|    166|    {
  124|       |        // entropy coding precedes other steps
  125|    166|        if (t_ptr->type == DAV1D_TASK_TYPE_TILE_ENTROPY) {
  ------------------
  |  Branch (125:13): [True: 12, False: 154]
  ------------------
  126|     12|            if (first->type > DAV1D_TASK_TYPE_TILE_ENTROPY) continue;
  ------------------
  |  Branch (126:17): [True: 12, False: 0]
  ------------------
  127|       |            // both are entropy
  128|      0|            if (first->sby > t_ptr->sby) continue;
  ------------------
  |  Branch (128:17): [True: 0, False: 0]
  ------------------
  129|      0|            if (first->sby < t_ptr->sby) {
  ------------------
  |  Branch (129:17): [True: 0, False: 0]
  ------------------
  130|      0|                insert_tasks_between(f, first, last, prev_t, t_ptr, cond_signal);
  131|      0|                return;
  132|      0|            }
  133|       |            // same sby
  134|    154|        } else {
  135|    154|            if (first->type == DAV1D_TASK_TYPE_TILE_ENTROPY) {
  ------------------
  |  Branch (135:17): [True: 16, False: 138]
  ------------------
  136|     16|                insert_tasks_between(f, first, last, prev_t, t_ptr, cond_signal);
  137|     16|                return;
  138|     16|            }
  139|    138|            if (first->sby > t_ptr->sby) continue;
  ------------------
  |  Branch (139:17): [True: 106, False: 32]
  ------------------
  140|     32|            if (first->sby < t_ptr->sby) {
  ------------------
  |  Branch (140:17): [True: 8, False: 24]
  ------------------
  141|      8|                insert_tasks_between(f, first, last, prev_t, t_ptr, cond_signal);
  142|      8|                return;
  143|      8|            }
  144|       |            // same sby
  145|     24|            if (first->type > t_ptr->type) continue;
  ------------------
  |  Branch (145:17): [True: 24, False: 0]
  ------------------
  146|      0|            if (first->type < t_ptr->type) {
  ------------------
  |  Branch (146:17): [True: 0, False: 0]
  ------------------
  147|      0|                insert_tasks_between(f, first, last, prev_t, t_ptr, cond_signal);
  148|      0|                return;
  149|      0|            }
  150|       |            // same task type
  151|      0|        }
  152|       |
  153|       |        // sort by tile-id
  154|      0|        assert(first->type == DAV1D_TASK_TYPE_TILE_RECONSTRUCTION ||
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:30): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  155|      0|               first->type == DAV1D_TASK_TYPE_TILE_ENTROPY);
  156|      0|        assert(first->type == t_ptr->type);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  157|      0|        assert(t_ptr->sby == first->sby);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  158|      0|        const int p = first->type == DAV1D_TASK_TYPE_TILE_ENTROPY;
  159|      0|        const int t_tile_idx = (int) (first - f->task_thread.tile_tasks[p]);
  160|      0|        const int p_tile_idx = (int) (t_ptr - f->task_thread.tile_tasks[p]);
  161|      0|        assert(t_tile_idx != p_tile_idx);
  ------------------
  |  |  140|      0|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:28): [True: 0, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 0]
  |  |  ------------------
  ------------------
  162|      0|        if (t_tile_idx > p_tile_idx) continue;
  ------------------
  |  Branch (162:13): [True: 0, False: 0]
  ------------------
  163|      0|        insert_tasks_between(f, first, last, prev_t, t_ptr, cond_signal);
  164|      0|        return;
  165|      0|    }
  166|       |    // append at the end
  167|     84|    insert_tasks_between(f, first, last, prev_t, NULL, cond_signal);
  168|     84|}
thread_task.c:insert_tasks_between:
  102|    108|{
  103|    108|    struct TaskThreadData *const ttd = f->task_thread.ttd;
  104|    108|    if (atomic_load(f->c->flush)) return;
  ------------------
  |  Branch (104:9): [True: 0, False: 108]
  ------------------
  105|    108|    assert(!a || a->next == b);
  ------------------
  |  |  140|    192|#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  Branch (140:30): [True: 24, False: 84]
  |  |  |  Branch (140:30): [True: 84, False: 0]
  |  |  |  Branch (140:68): [Folded, False: 108]
  |  |  ------------------
  ------------------
  106|    108|    if (!a) f->task_thread.task_head = first;
  ------------------
  |  Branch (106:9): [True: 24, False: 84]
  ------------------
  107|     84|    else a->next = first;
  108|    108|    if (!b) f->task_thread.task_tail = last;
  ------------------
  |  Branch (108:9): [True: 84, False: 24]
  ------------------
  109|    108|    last->next = b;
  110|    108|    reset_task_cur(f->c, ttd, first->frame_idx);
  111|    108|    if (cond_signal && !atomic_fetch_or(&ttd->cond_signaled, 1))
  ------------------
  |  Branch (111:9): [True: 4, False: 104]
  |  Branch (111:24): [True: 4, False: 0]
  ------------------
  112|      4|        pthread_cond_signal(&ttd->cond);
  113|    108|}
thread_task.c:merge_pending:
  206|    901|static inline int merge_pending(const Dav1dContext *const c) {
  207|    901|    int res = 0;
  208|  6.30k|    for (unsigned i = 0; i < c->n_fc; i++)
  ------------------
  |  Branch (208:26): [True: 5.40k, False: 901]
  ------------------
  209|  5.40k|        res |= merge_pending_frame(&c->fc[i]);
  210|    901|    return res;
  211|    901|}
thread_task.c:merge_pending_frame:
  188|  5.77k|static inline int merge_pending_frame(Dav1dFrameContext *const f) {
  189|  5.77k|    int const merge = atomic_load(&f->task_thread.pending_tasks.merge);
  190|  5.77k|    if (merge) {
  ------------------
  |  Branch (190:9): [True: 32, False: 5.74k]
  ------------------
  191|     32|        pthread_mutex_lock(&f->task_thread.pending_tasks.lock);
  192|     32|        Dav1dTask *t = f->task_thread.pending_tasks.head;
  193|     32|        f->task_thread.pending_tasks.head = NULL;
  194|     32|        f->task_thread.pending_tasks.tail = NULL;
  195|     32|        atomic_store(&f->task_thread.pending_tasks.merge, 0);
  196|     32|        pthread_mutex_unlock(&f->task_thread.pending_tasks.lock);
  197|     76|        while (t) {
  ------------------
  |  Branch (197:16): [True: 44, False: 32]
  ------------------
  198|     44|            Dav1dTask *const tmp = t->next;
  199|     44|            insert_task(f, t, 0);
  200|     44|            t = tmp;
  201|     44|        }
  202|     32|    }
  203|  5.77k|    return merge;
  204|  5.77k|}
thread_task.c:check_tile:
  395|    100|{
  396|    100|    const int tp = t->type == DAV1D_TASK_TYPE_TILE_ENTROPY;
  397|    100|    const int tile_idx = (int)(t - f->task_thread.tile_tasks[tp]);
  398|    100|    Dav1dTileState *const ts = &f->ts[tile_idx];
  399|    100|    const int p1 = atomic_load(&ts->progress[tp]);
  400|    100|    if (p1 < t->sby) return 1;
  ------------------
  |  Branch (400:9): [True: 28, False: 72]
  ------------------
  401|     72|    int error = p1 == TILE_ERROR;
  ------------------
  |  |   36|     72|#define TILE_ERROR (INT_MAX - 1)
  ------------------
  402|     72|    error |= atomic_fetch_or(&f->task_thread.error, error);
  403|     72|    if (!error && frame_mt && !tp) {
  ------------------
  |  Branch (403:9): [True: 30, False: 42]
  |  Branch (403:19): [True: 30, False: 0]
  |  Branch (403:31): [True: 12, False: 18]
  ------------------
  404|     12|        const int p2 = atomic_load(&ts->progress[1]);
  405|     12|        if (p2 <= t->sby) return 1;
  ------------------
  |  Branch (405:13): [True: 4, False: 8]
  ------------------
  406|      8|        error = p2 == TILE_ERROR;
  ------------------
  |  |   36|      8|#define TILE_ERROR (INT_MAX - 1)
  ------------------
  407|      8|        error |= atomic_fetch_or(&f->task_thread.error, error);
  408|      8|    }
  409|     68|    if (!error && frame_mt && !IS_KEY_OR_INTRA(f->frame_hdr)) {
  ------------------
  |  |   43|     26|    (!IS_INTER_OR_SWITCH(frame_header))
  |  |  ------------------
  |  |  |  |   36|     26|    ((frame_header)->frame_type & 1)
  |  |  ------------------
  ------------------
  |  Branch (409:9): [True: 26, False: 42]
  |  Branch (409:19): [True: 26, False: 0]
  |  Branch (409:31): [True: 0, False: 26]
  ------------------
  410|       |        // check reference state
  411|      0|        const Dav1dThreadPicture *p = &f->sr_cur;
  412|      0|        const int ss_ver = p->p.p.layout == DAV1D_PIXEL_LAYOUT_I420;
  413|      0|        const unsigned p_b = (t->sby + 1) << (f->sb_shift + 2);
  414|      0|        const int tile_sby = t->sby - (ts->tiling.row_start >> f->sb_shift);
  415|      0|        const int (*const lowest_px)[2] = ts->lowest_pixel[tile_sby];
  416|      0|        for (int n = t->deps_skip; n < 7; n++, t->deps_skip++) {
  ------------------
  |  Branch (416:36): [True: 0, False: 0]
  ------------------
  417|      0|            unsigned lowest;
  418|      0|            if (tp) {
  ------------------
  |  Branch (418:17): [True: 0, False: 0]
  ------------------
  419|       |                // if temporal mv refs are disabled, we only need this
  420|       |                // for the primary ref; if segmentation is disabled, we
  421|       |                // don't even need that
  422|      0|                lowest = p_b;
  423|      0|            } else {
  424|       |                // +8 is postfilter-induced delay
  425|      0|                const int y = lowest_px[n][0] == INT_MIN ? INT_MIN :
  ------------------
  |  Branch (425:31): [True: 0, False: 0]
  ------------------
  426|      0|                              lowest_px[n][0] + 8;
  427|      0|                const int uv = lowest_px[n][1] == INT_MIN ? INT_MIN :
  ------------------
  |  Branch (427:32): [True: 0, False: 0]
  ------------------
  428|      0|                               lowest_px[n][1] * (1 << ss_ver) + 8;
  429|      0|                const int max = imax(y, uv);
  430|      0|                if (max == INT_MIN) continue;
  ------------------
  |  Branch (430:21): [True: 0, False: 0]
  ------------------
  431|      0|                lowest = iclip(max, 1, f->refp[n].p.p.h);
  432|      0|            }
  433|      0|            const unsigned p3 = atomic_load(&f->refp[n].progress[!tp]);
  434|      0|            if (p3 < lowest) return 1;
  ------------------
  |  Branch (434:17): [True: 0, False: 0]
  ------------------
  435|      0|            atomic_fetch_or(&f->task_thread.error, p3 == FRAME_ERROR);
  436|      0|        }
  437|      0|    }
  438|     68|    return 0;
  439|     68|}
thread_task.c:reset_task_cur:
   50|    985|{
   51|    985|    const unsigned first = atomic_load(&ttd->first);
   52|    985|    unsigned reset_frame_idx = atomic_exchange(&ttd->reset_task_cur, UINT_MAX);
   53|    985|    if (reset_frame_idx < first) {
  ------------------
  |  Branch (53:9): [True: 0, False: 985]
  ------------------
   54|      0|        if (frame_idx == UINT_MAX) return 0;
  ------------------
  |  Branch (54:13): [True: 0, False: 0]
  ------------------
   55|      0|        reset_frame_idx = UINT_MAX;
   56|      0|    }
   57|    985|    if (!ttd->cur && c->fc[first].task_thread.task_cur_prev == NULL)
  ------------------
  |  Branch (57:9): [True: 180, False: 805]
  |  Branch (57:22): [True: 150, False: 30]
  ------------------
   58|    150|        return 0;
   59|    835|    if (reset_frame_idx != UINT_MAX) {
  ------------------
  |  Branch (59:9): [True: 5, False: 830]
  ------------------
   60|      5|        if (frame_idx == UINT_MAX) {
  ------------------
  |  Branch (60:13): [True: 3, False: 2]
  ------------------
   61|      3|            if (reset_frame_idx > first + ttd->cur)
  ------------------
  |  Branch (61:17): [True: 0, False: 3]
  ------------------
   62|      0|                return 0;
   63|      3|            ttd->cur = reset_frame_idx - first;
   64|      3|            goto cur_found;
   65|      3|        }
   66|    830|    } else if (frame_idx == UINT_MAX)
  ------------------
  |  Branch (66:16): [True: 750, False: 80]
  ------------------
   67|    750|        return 0;
   68|     82|    if (frame_idx < first) frame_idx += c->n_fc;
  ------------------
  |  Branch (68:9): [True: 0, False: 82]
  ------------------
   69|     82|    const unsigned min_frame_idx = umin(reset_frame_idx, frame_idx);
   70|     82|    const unsigned cur_frame_idx = first + ttd->cur;
   71|     82|    if (ttd->cur < c->n_fc && cur_frame_idx < min_frame_idx)
  ------------------
  |  Branch (71:9): [True: 29, False: 53]
  |  Branch (71:31): [True: 0, False: 29]
  ------------------
   72|      0|        return 0;
   73|    148|    for (ttd->cur = min_frame_idx - first; ttd->cur < c->n_fc; ttd->cur++)
  ------------------
  |  Branch (73:44): [True: 137, False: 11]
  ------------------
   74|    137|        if (c->fc[(first + ttd->cur) % c->n_fc].task_thread.task_head)
  ------------------
  |  Branch (74:13): [True: 71, False: 66]
  ------------------
   75|     71|            break;
   76|     85|cur_found:
   77|    529|    for (unsigned i = ttd->cur; i < c->n_fc; i++)
  ------------------
  |  Branch (77:33): [True: 444, False: 85]
  ------------------
   78|    444|        c->fc[(first + i) % c->n_fc].task_thread.task_cur_prev = NULL;
   79|     85|    return 1;
   80|     82|}
thread_task.c:add_pending:
  176|     28|static inline void add_pending(Dav1dFrameContext *const f, Dav1dTask *const t) {
  177|     28|    pthread_mutex_lock(&f->task_thread.pending_tasks.lock);
  178|     28|    t->next = NULL;
  179|     28|    if (!f->task_thread.pending_tasks.head)
  ------------------
  |  Branch (179:9): [True: 28, False: 0]
  ------------------
  180|     28|        f->task_thread.pending_tasks.head = t;
  181|      0|    else
  182|      0|        f->task_thread.pending_tasks.tail->next = t;
  183|     28|    f->task_thread.pending_tasks.tail = t;
  184|       |    atomic_store(&f->task_thread.pending_tasks.merge, 1);
  185|     28|    pthread_mutex_unlock(&f->task_thread.pending_tasks.lock);
  186|     28|}
thread_task.c:reset_task_cur_async:
   84|     66|{
   85|     66|    const unsigned first = atomic_load(&ttd->first);
   86|     66|    if (frame_idx < first) frame_idx += n_frames;
  ------------------
  |  Branch (86:9): [True: 0, False: 66]
  ------------------
   87|     66|    unsigned last_idx = frame_idx;
   88|     66|    do {
   89|     66|        frame_idx = last_idx;
   90|     66|        last_idx = atomic_exchange(&ttd->reset_task_cur, frame_idx);
   91|     66|    } while (last_idx < frame_idx);
  ------------------
  |  Branch (91:14): [True: 0, False: 66]
  ------------------
   92|     66|    if (frame_idx == first && atomic_load(&ttd->first) != first) {
  ------------------
  |  Branch (92:9): [True: 66, False: 0]
  |  Branch (92:31): [True: 0, False: 66]
  ------------------
   93|      0|        unsigned expected = frame_idx;
   94|       |        atomic_compare_exchange_strong(&ttd->reset_task_cur, &expected, UINT_MAX);
   95|      0|    }
   96|     66|}
thread_task.c:get_frame_progress:
  443|     34|{
  444|     34|    unsigned frame_prog = c->n_fc > 1 ? atomic_load(&f->sr_cur.progress[1]) : 0;
  ------------------
  |  Branch (444:27): [True: 34, False: 0]
  ------------------
  445|     34|    if (frame_prog >= FRAME_ERROR)
  ------------------
  |  |   35|     34|#define FRAME_ERROR (UINT_MAX - 1)
  ------------------
  |  Branch (445:9): [True: 26, False: 8]
  ------------------
  446|     26|        return f->sbh - 1;
  447|      8|    int idx = frame_prog >> (f->sb_shift + 7);
  448|      8|    int prog;
  449|      8|    do {
  450|      8|        atomic_uint *state = &f->frame_thread.frame_progress[idx];
  451|      8|        const unsigned val = ~atomic_load(state);
  452|      8|        prog = val ? ctz(val) : 32;
  ------------------
  |  Branch (452:16): [True: 8, False: 0]
  ------------------
  453|      8|        if (prog != 32) break;
  ------------------
  |  Branch (453:13): [True: 8, False: 0]
  ------------------
  454|      0|        prog = 0;
  455|      0|    } while (++idx < f->frame_thread.prog_sz);
  ------------------
  |  Branch (455:14): [True: 0, False: 0]
  ------------------
  456|      8|    return ((idx << 5) | prog) - 1;
  457|     34|}

dav1d_init_ii_wedge_masks:
  207|      1|COLD void dav1d_init_ii_wedge_masks(void) {
  208|       |    // This function is guaranteed to be called only once
  209|       |
  210|      1|    enum WedgeMasterLineType {
  211|      1|        WEDGE_MASTER_LINE_ODD,
  212|      1|        WEDGE_MASTER_LINE_EVEN,
  213|      1|        WEDGE_MASTER_LINE_VERT,
  214|      1|        N_WEDGE_MASTER_LINES,
  215|      1|    };
  216|      1|    static const uint8_t wedge_master_border[N_WEDGE_MASTER_LINES][8] = {
  217|      1|        [WEDGE_MASTER_LINE_ODD]  = {  1,  2,  6, 18, 37, 53, 60, 63 },
  218|      1|        [WEDGE_MASTER_LINE_EVEN] = {  1,  4, 11, 27, 46, 58, 62, 63 },
  219|      1|        [WEDGE_MASTER_LINE_VERT] = {  0,  2,  7, 21, 43, 57, 62, 64 },
  220|      1|    };
  221|      1|    uint8_t master[6][64 * 64];
  222|       |
  223|       |    // create master templates
  224|     65|    for (int y = 0, off = 0; y < 64; y++, off += 64)
  ------------------
  |  Branch (224:30): [True: 64, False: 1]
  ------------------
  225|     64|        insert_border(&master[WEDGE_VERTICAL][off],
  226|     64|                      wedge_master_border[WEDGE_MASTER_LINE_VERT], 32);
  227|     33|    for (int y = 0, off = 0, ctr = 48; y < 64; y += 2, off += 128, ctr--)
  ------------------
  |  Branch (227:40): [True: 32, False: 1]
  ------------------
  228|     32|    {
  229|     32|        insert_border(&master[WEDGE_OBLIQUE63][off],
  230|     32|                      wedge_master_border[WEDGE_MASTER_LINE_EVEN], ctr);
  231|     32|        insert_border(&master[WEDGE_OBLIQUE63][off + 64],
  232|     32|                      wedge_master_border[WEDGE_MASTER_LINE_ODD], ctr - 1);
  233|     32|    }
  234|       |
  235|      1|    transpose(master[WEDGE_OBLIQUE27], master[WEDGE_OBLIQUE63]);
  236|      1|    transpose(master[WEDGE_HORIZONTAL], master[WEDGE_VERTICAL]);
  237|      1|    hflip(master[WEDGE_OBLIQUE117], master[WEDGE_OBLIQUE63]);
  238|      1|    hflip(master[WEDGE_OBLIQUE153], master[WEDGE_OBLIQUE27]);
  239|       |
  240|      1|#define fill(w, h, sz_422, sz_420, hvsw, signs) \
  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  242|      1|                master, wedge_codebook_16_##hvsw, \
  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  246|       |
  247|      1|    fill(32, 32, 16x32, 16x16, heqw, 0x7bfb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  248|      1|    fill(32, 16, 16x16, 16x8,  hltw, 0x7beb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  249|      1|    fill(32,  8, 16x8,  16x4,  hltw, 0x6beb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  250|      1|    fill(16, 32,  8x32,  8x16, hgtw, 0x7beb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  251|      1|    fill(16, 16,  8x16,  8x8,  heqw, 0x7bfb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  252|      1|    fill(16,  8,  8x8,   8x4,  hltw, 0x7beb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  253|      1|    fill( 8, 32,  4x32,  4x16, hgtw, 0x7aeb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  254|      1|    fill( 8, 16,  4x16,  4x8,  hgtw, 0x7beb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  255|      1|    fill( 8,  8,  4x8,   4x4,  heqw, 0x7bfb);
  ------------------
  |  |  241|      1|    fill2d_16x2(w, h, BS_##w##x##h - BS_32x32, \
  |  |  242|      1|                master, wedge_codebook_16_##hvsw, \
  |  |  243|      1|                dav1d_masks.wedge_444_##w##x##h, \
  |  |  244|      1|                dav1d_masks.wedge_422_##sz_422, \
  |  |  245|      1|                dav1d_masks.wedge_420_##sz_420, signs)
  ------------------
  256|      1|#undef fill
  257|       |
  258|      1|    memset(dav1d_masks.ii_dc, 32, 32 * 32);
  259|      4|    for (int c = 0; c < 3; c++) {
  ------------------
  |  Branch (259:21): [True: 3, False: 1]
  ------------------
  260|      3|        dav1d_masks.offsets[c][BS_32x32-BS_32x32].ii[II_DC_PRED] =
  261|      3|        dav1d_masks.offsets[c][BS_32x16-BS_32x32].ii[II_DC_PRED] =
  262|      3|        dav1d_masks.offsets[c][BS_16x32-BS_32x32].ii[II_DC_PRED] =
  263|      3|        dav1d_masks.offsets[c][BS_16x16-BS_32x32].ii[II_DC_PRED] =
  264|      3|        dav1d_masks.offsets[c][BS_16x8 -BS_32x32].ii[II_DC_PRED] =
  265|      3|        dav1d_masks.offsets[c][BS_8x16 -BS_32x32].ii[II_DC_PRED] =
  266|      3|        dav1d_masks.offsets[c][BS_8x8  -BS_32x32].ii[II_DC_PRED] =
  267|      3|            MASK_OFFSET(dav1d_masks.ii_dc);
  ------------------
  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  ------------------
  268|      3|    }
  269|       |
  270|      1|#define BUILD_NONDC_II_MASKS(w, h, step) \
  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  272|       |
  273|      1|#define ASSIGN_NONDC_II_OFFSET(bs, w444, h444, w422, h422, w420, h420) \
  274|      1|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  275|      1|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  276|      1|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  277|      1|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  278|      1|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  279|      1|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  280|       |
  281|      1|    BUILD_NONDC_II_MASKS(32, 32, 1);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  282|      1|    BUILD_NONDC_II_MASKS(16, 32, 1);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  283|      1|    BUILD_NONDC_II_MASKS(16, 16, 2);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  284|      1|    BUILD_NONDC_II_MASKS( 8, 32, 1);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  285|      1|    BUILD_NONDC_II_MASKS( 8, 16, 2);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  286|      1|    BUILD_NONDC_II_MASKS( 8,  8, 4);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  287|      1|    BUILD_NONDC_II_MASKS( 4, 16, 2);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  288|      1|    BUILD_NONDC_II_MASKS( 4,  8, 4);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  289|      1|    BUILD_NONDC_II_MASKS( 4,  4, 8);
  ------------------
  |  |  271|      1|    build_nondc_ii_masks(dav1d_masks.ii_nondc_##w##x##h, w, h, step)
  ------------------
  290|      4|    for (int p = 0; p < 3; p++) {
  ------------------
  |  Branch (290:21): [True: 3, False: 1]
  ------------------
  291|      3|        ASSIGN_NONDC_II_OFFSET(BS_32x32, 32, 32, 16, 32, 16, 16);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  292|      3|        ASSIGN_NONDC_II_OFFSET(BS_32x16, 32, 32, 16, 16, 16, 16);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  293|      3|        ASSIGN_NONDC_II_OFFSET(BS_16x32, 16, 32,  8, 32,  8, 16);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  294|      3|        ASSIGN_NONDC_II_OFFSET(BS_16x16, 16, 16,  8, 16,  8,  8);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  295|      3|        ASSIGN_NONDC_II_OFFSET(BS_16x8,  16, 16,  8,  8,  8,  8);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  296|      3|        ASSIGN_NONDC_II_OFFSET(BS_8x16,   8, 16,  4, 16,  4,  8);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  297|      3|        ASSIGN_NONDC_II_OFFSET(BS_8x8,    8,  8,  4,  8,  4,  4);
  ------------------
  |  |  274|      3|    dav1d_masks.offsets[0][bs-BS_32x32].ii[p + 1] = \
  |  |  275|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w444##x##h444[p*w444*h444]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  276|      3|    dav1d_masks.offsets[1][bs-BS_32x32].ii[p + 1] = \
  |  |  277|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w422##x##h422[p*w422*h422]); \
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  |  |  278|      3|    dav1d_masks.offsets[2][bs-BS_32x32].ii[p + 1] = \
  |  |  279|      3|        MASK_OFFSET(&dav1d_masks.ii_nondc_##w420##x##h420[p*w420*h420])
  |  |  ------------------
  |  |  |  |  129|      3|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  |  |  ------------------
  ------------------
  298|      3|    }
  299|      1|}
wedge.c:insert_border:
   90|    128|{
   91|    128|    if (ctr > 4) memset(dst, 0, ctr - 4);
  ------------------
  |  Branch (91:9): [True: 128, False: 0]
  ------------------
   92|    128|    memcpy(dst + imax(ctr, 4) - 4, src + imax(4 - ctr, 0), imin(64 - ctr, 8));
   93|    128|    if (ctr < 64 - 4)
  ------------------
  |  Branch (93:9): [True: 128, False: 0]
  ------------------
   94|    128|        memset(dst + ctr + 4, 64, 64 - 4 - ctr);
   95|    128|}
wedge.c:transpose:
   97|      2|static void transpose(uint8_t *const dst, const uint8_t *const src) {
   98|    130|    for (int y = 0, y_off = 0; y < 64; y++, y_off += 64)
  ------------------
  |  Branch (98:32): [True: 128, False: 2]
  ------------------
   99|  8.32k|        for (int x = 0, x_off = 0; x < 64; x++, x_off += 64)
  ------------------
  |  Branch (99:36): [True: 8.19k, False: 128]
  ------------------
  100|  8.19k|            dst[x_off + y] = src[y_off + x];
  101|      2|}
wedge.c:hflip:
  103|      2|static void hflip(uint8_t *const dst, const uint8_t *const src) {
  104|    130|    for (int y = 0, y_off = 0; y < 64; y++, y_off += 64)
  ------------------
  |  Branch (104:32): [True: 128, False: 2]
  ------------------
  105|  8.32k|        for (int x = 0; x < 64; x++)
  ------------------
  |  Branch (105:25): [True: 8.19k, False: 128]
  ------------------
  106|  8.19k|            dst[y_off + 64 - 1 - x] = src[y_off + x];
  107|      2|}
wedge.c:fill2d_16x2:
  153|      9|{
  154|      9|    const int n_stride_444 = (w * h);
  155|      9|    const int n_stride_422 = n_stride_444 >> 1;
  156|      9|    const int n_stride_420 = n_stride_444 >> 2;
  157|      9|    const int sign_stride_422 = 16 * n_stride_422;
  158|      9|    const int sign_stride_420 = 16 * n_stride_420;
  159|       |
  160|       |    // assign pointer offsets in lookup table
  161|    153|    for (int n = 0; n < 16; n++) {
  ------------------
  |  Branch (161:21): [True: 144, False: 9]
  ------------------
  162|    144|        const int sign = signs & 1;
  163|       |
  164|    144|        copy2d(masks_444, master[cb[n].direction], sign, w, h,
  165|    144|               32 - (w * cb[n].x_offset >> 3), 32 - (h * cb[n].y_offset >> 3));
  166|       |
  167|       |        // not using !sign is intentional here, since 444 does not require
  168|       |        // any rounding since no chroma subsampling is applied.
  169|    144|        dav1d_masks.offsets[0][bs].wedge[0][n] =
  170|    144|        dav1d_masks.offsets[0][bs].wedge[1][n] = MASK_OFFSET(masks_444);
  ------------------
  |  |  129|    144|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  ------------------
  171|       |
  172|    144|        dav1d_masks.offsets[1][bs].wedge[0][n] =
  173|    144|            init_chroma(&masks_422[ sign * sign_stride_422], masks_444, 0, w, h, 0);
  174|    144|        dav1d_masks.offsets[1][bs].wedge[1][n] =
  175|    144|            init_chroma(&masks_422[!sign * sign_stride_422], masks_444, 1, w, h, 0);
  176|    144|        dav1d_masks.offsets[2][bs].wedge[0][n] =
  177|    144|            init_chroma(&masks_420[ sign * sign_stride_420], masks_444, 0, w, h, 1);
  178|    144|        dav1d_masks.offsets[2][bs].wedge[1][n] =
  179|    144|            init_chroma(&masks_420[!sign * sign_stride_420], masks_444, 1, w, h, 1);
  180|       |
  181|    144|        signs >>= 1;
  182|    144|        masks_444 += n_stride_444;
  183|    144|        masks_422 += n_stride_422;
  184|    144|        masks_420 += n_stride_420;
  185|    144|    }
  186|      9|}
wedge.c:copy2d:
  111|    144|{
  112|    144|    src += y_off * 64 + x_off;
  113|    144|    if (sign) {
  ------------------
  |  Branch (113:9): [True: 109, False: 35]
  ------------------
  114|  2.14k|        for (int y = 0; y < h; y++) {
  ------------------
  |  Branch (114:25): [True: 2.03k, False: 109]
  ------------------
  115|  40.4k|            for (int x = 0; x < w; x++)
  ------------------
  |  Branch (115:29): [True: 38.4k, False: 2.03k]
  ------------------
  116|  38.4k|                dst[x] = 64 - src[x];
  117|  2.03k|            src += 64;
  118|  2.03k|            dst += w;
  119|  2.03k|        }
  120|    109|    } else {
  121|    691|        for (int y = 0; y < h; y++) {
  ------------------
  |  Branch (121:25): [True: 656, False: 35]
  ------------------
  122|    656|            memcpy(dst, src, w);
  123|    656|            src += 64;
  124|    656|            dst += w;
  125|    656|        }
  126|     35|    }
  127|    144|}
wedge.c:init_chroma:
  134|    576|{
  135|    576|    const uint16_t offset = MASK_OFFSET(chroma);
  ------------------
  |  |  129|    576|#define MASK_OFFSET(x) ((uint16_t)(((uintptr_t)(x) - (uintptr_t)&dav1d_masks) >> 3))
  ------------------
  136|  8.64k|    for (int y = 0; y < h; y += 1 + ss_ver) {
  ------------------
  |  Branch (136:21): [True: 8.06k, False: 576]
  ------------------
  137|  83.3k|        for (int x = 0; x < w; x += 2) {
  ------------------
  |  Branch (137:25): [True: 75.2k, False: 8.06k]
  ------------------
  138|  75.2k|            int sum = luma[x] + luma[x + 1] + 1;
  139|  75.2k|            if (ss_ver) sum += luma[w + x] + luma[w + x + 1] + 1;
  ------------------
  |  Branch (139:17): [True: 25.0k, False: 50.1k]
  ------------------
  140|  75.2k|            chroma[x >> 1] = (sum - sign) >> (1 + ss_ver);
  141|  75.2k|        }
  142|  8.06k|        luma += w << ss_ver;
  143|  8.06k|        chroma += w >> 1;
  144|  8.06k|    }
  145|    576|    return offset;
  146|    576|}
wedge.c:build_nondc_ii_masks:
  190|      9|{
  191|      9|    static const uint8_t ii_weights_1d[32] = {
  192|      9|        60, 52, 45, 39, 34, 30, 26, 22, 19, 17, 15, 13, 11, 10,  8,  7,
  193|      9|         6,  6,  5,  4,  4,  3,  3,  2,  2,  2,  2,  1,  1,  1,  1,  1,
  194|      9|    };
  195|       |
  196|      9|    uint8_t *const mask_h  = &mask_v[w * h];
  197|      9|    uint8_t *const mask_sm = &mask_h[w * h];
  198|    173|    for (int y = 0, off = 0; y < h; y++, off += w) {
  ------------------
  |  Branch (198:30): [True: 164, False: 9]
  ------------------
  199|    164|        memset(&mask_v[off], ii_weights_1d[y * step], w);
  200|  2.51k|        for (int x = 0; x < w; x++) {
  ------------------
  |  Branch (200:25): [True: 2.35k, False: 164]
  ------------------
  201|  2.35k|            mask_sm[off + x] = ii_weights_1d[imin(x, y) * step];
  202|  2.35k|            mask_h[off + x] = ii_weights_1d[x * step];
  203|  2.35k|        }
  204|    164|    }
  205|      9|}

de265_isOK:
  189|     33|{
  190|     33|  return err == DE265_OK || err >= 1000;
  ------------------
  |  Branch (190:10): [True: 33, False: 0]
  |  Branch (190:29): [True: 0, False: 0]
  ------------------
  191|     33|}
de265_init:
  205|     35|{
  206|     35|  std::lock_guard<std::mutex> lock(de265_init_mutex());
  207|       |
  208|     35|  de265_init_count++;
  209|       |
  210|     35|  if (de265_init_count > 1) {
  ------------------
  |  Branch (210:7): [True: 33, False: 2]
  ------------------
  211|       |    // we are not the first -> already initialized
  212|       |
  213|     33|    return DE265_OK;
  214|     33|  }
  215|       |
  216|       |
  217|       |  // do initializations
  218|       |
  219|      2|  init_scan_orders();
  220|       |
  221|      2|  if (!alloc_and_init_significant_coeff_ctxIdx_lookupTable()) {
  ------------------
  |  Branch (221:7): [True: 0, False: 2]
  ------------------
  222|      0|    de265_init_count--;
  223|      0|    return DE265_ERROR_LIBRARY_INITIALIZATION_FAILED;
  224|      0|  }
  225|       |
  226|      2|  return DE265_OK;
  227|      2|}
de265_free:
  230|     33|{
  231|     33|  std::lock_guard<std::mutex> lock(de265_init_mutex());
  232|       |
  233|     33|  if (de265_init_count<=0) {
  ------------------
  |  Branch (233:7): [True: 0, False: 33]
  ------------------
  234|      0|    return DE265_ERROR_LIBRARY_NOT_INITIALIZED;
  235|      0|  }
  236|       |
  237|     33|  de265_init_count--;
  238|       |
  239|     33|  if (de265_init_count==0) {
  ------------------
  |  Branch (239:7): [True: 0, False: 33]
  ------------------
  240|      0|    free_significant_coeff_ctxIdx_lookupTable();
  241|      0|  }
  242|       |
  243|     33|  return DE265_OK;
  244|     33|}
de265_new_decoder:
  248|     33|{
  249|     33|  de265_error init_err = de265_init();
  250|     33|  if (init_err != DE265_OK) {
  ------------------
  |  Branch (250:7): [True: 0, False: 33]
  ------------------
  251|      0|    return nullptr;
  252|      0|  }
  253|       |
  254|     33|  decoder_context* ctx = new decoder_context;
  255|     33|  if (!ctx) {
  ------------------
  |  Branch (255:7): [True: 0, False: 33]
  ------------------
  256|      0|    de265_free();
  257|      0|    return nullptr;
  258|      0|  }
  259|       |
  260|     33|  return reinterpret_cast<de265_decoder_context*>(ctx);
  261|     33|}
de265_free_decoder:
  265|     33|{
  266|     33|  decoder_context* ctx = reinterpret_cast<decoder_context*>(de265ctx);
  267|       |
  268|     33|  ctx->stop_thread_pool();
  269|       |
  270|     33|  delete ctx;
  271|       |
  272|     33|  return de265_free();
  273|     33|}
de265_start_worker_threads:
  277|     33|{
  278|     33|  decoder_context* ctx = reinterpret_cast<decoder_context*>(de265ctx);
  279|       |
  280|     33|  if (number_of_threads > MAX_THREADS) {
  ------------------
  |  Branch (280:7): [True: 0, False: 33]
  ------------------
  281|      0|    number_of_threads = MAX_THREADS;
  282|      0|  }
  283|       |
  284|     33|  if (number_of_threads>0) {
  ------------------
  |  Branch (284:7): [True: 33, False: 0]
  ------------------
  285|     33|    de265_error err = ctx->start_thread_pool(number_of_threads);
  286|     33|    if (de265_isOK(err)) {
  ------------------
  |  Branch (286:9): [True: 33, False: 0]
  ------------------
  287|     33|      err = DE265_OK;
  288|     33|    }
  289|     33|    return err;
  290|     33|  }
  291|      0|  else {
  292|      0|    return DE265_OK;
  293|      0|  }
  294|     33|}
de265_push_NAL:
  360|  46.2k|{
  361|  46.2k|  decoder_context* ctx = reinterpret_cast<decoder_context*>(de265ctx);
  362|  46.2k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(data8);
  363|       |
  364|       |  //printf("push NAL (size %d)\n",len);
  365|       |  //dumpdata(data8,16);
  366|       |
  367|  46.2k|  return ctx->nal_parser.push_NAL(data,len,pts,user_data);
  368|  46.2k|}
de265.cc:_ZL16de265_init_mutexv:
  198|     68|{
  199|     68|  static std::mutex de265_init_mutex;
  200|     68|  return de265_init_mutex;
  201|     68|}

_ZN12base_contextC2Ev:
  128|     33|{
  129|     33|  set_acceleration_functions(de265_acceleration_AUTO);
  130|     33|}
_ZN15decoder_contextC2Ev:
  134|     33|{
  135|     33|  param_image_allocation_functions = de265_image::default_image_allocation;
  136|     33|  compute_framedrop_table();
  137|     33|}
_ZN15decoder_contextD2Ev:
  141|     33|{
  142|     33|  while (!image_units.empty()) {
  ------------------
  |  Branch (142:10): [True: 0, False: 33]
  ------------------
  143|      0|    delete image_units.back();
  144|      0|    image_units.pop_back();
  145|      0|  }
  146|     33|}
_ZN15decoder_context17start_thread_poolEi:
  166|     33|{
  167|     33|  thread_pool_.start(nThreads);
  168|       |
  169|     33|  num_worker_threads = nThreads;
  170|       |
  171|     33|  return DE265_OK;
  172|     33|}
_ZN15decoder_context16stop_thread_poolEv:
  176|     33|{
  177|     33|  if (get_num_worker_threads()>0) {
  ------------------
  |  Branch (177:7): [True: 33, False: 0]
  ------------------
  178|       |    //flush_thread_pool(&ctx->thread_pool);
  179|     33|    thread_pool_.stop();
  180|     33|  }
  181|     33|}
_ZN12base_context26set_acceleration_functionsE18de265_acceleration:
  239|     33|{
  240|       |  // fill scalar functions first (so that function table is completely filled)
  241|       |
  242|     33|  init_acceleration_functions_fallback(&acceleration);
  243|       |
  244|       |
  245|       |  // override functions with optimized variants
  246|       |
  247|     33|#ifdef HAVE_SSE4_1
  248|     33|  if (l>=de265_acceleration_SSE) {
  ------------------
  |  Branch (248:7): [True: 33, False: 0]
  ------------------
  249|     33|    init_acceleration_functions_sse(&acceleration);
  250|     33|  }
  251|     33|#endif
  252|       |#ifdef HAVE_ARM32
  253|       |  if (l>=de265_acceleration_ARM) {
  254|       |    init_acceleration_functions_arm(&acceleration);
  255|       |  }
  256|       |#endif
  257|     33|}
_ZNK15decoder_context15get_highest_TIDEv:
 2023|     33|{
 2024|     33|  if (current_sps) { return current_sps->sps_max_sub_layers-1; }
  ------------------
  |  Branch (2024:7): [True: 0, False: 33]
  ------------------
 2025|     33|  if (current_vps) { return current_vps->vps_max_sub_layers-1; }
  ------------------
  |  Branch (2025:7): [True: 0, False: 33]
  ------------------
 2026|       |
 2027|     33|  return 6;
 2028|     33|}
_ZN15decoder_context23compute_framedrop_tableEv:
 2062|     33|{
 2063|     33|  int highestTID = get_highest_TID();
 2064|       |
 2065|    264|  for (int tid=highestTID ; tid>=0 ; tid--) {
  ------------------
  |  Branch (2065:29): [True: 231, False: 33]
  ------------------
 2066|    231|    int lower  = 100 *  tid   /(highestTID+1);
 2067|    231|    int higher = 100 * (tid+1)/(highestTID+1);
 2068|       |
 2069|  3.76k|    for (int l=lower; l<=higher; l++) {
  ------------------
  |  Branch (2069:23): [True: 3.53k, False: 231]
  ------------------
 2070|  3.53k|      int ratio = 100 * (l-lower) / (higher-lower);
 2071|       |
 2072|       |      // if we would exceed our TID limit, decode the highest TID at full frame-rate
 2073|  3.53k|      if (tid > limit_HighestTid) {
  ------------------
  |  Branch (2073:11): [True: 0, False: 3.53k]
  ------------------
 2074|      0|        tid   = limit_HighestTid;
 2075|      0|        ratio = 100;
 2076|      0|      }
 2077|       |
 2078|  3.53k|      framedrop_tab[l].tid   = tid;
 2079|  3.53k|      framedrop_tab[l].ratio = ratio;
 2080|  3.53k|    }
 2081|       |
 2082|    231|    framedrop_tid_index[tid] = higher;
 2083|    231|  }
 2084|       |
 2085|       |#if 0
 2086|       |  for (int i=0;i<=100;i++) {
 2087|       |    printf("%d%%: %d/%d",i, framedrop_tab[i].tid, framedrop_tab[i].ratio);
 2088|       |    for (int k=0;k<=highestTID;k++) {
 2089|       |      if (framedrop_tid_index[k] == i) printf(" ** TID=%d **",k);
 2090|       |    }
 2091|       |    printf("\n");
 2092|       |  }
 2093|       |#endif
 2094|     33|}

_ZN12base_contextD2Ev:
  278|     33|  virtual ~base_context() { }
_ZNK15decoder_context22get_num_worker_threadsEv:
  370|     33|  int get_num_worker_threads() const { return num_worker_threads; }

_ZN22decoded_picture_bufferD2Ev:
   28|     33|{
   29|     33|  for (size_t i=0;i<dpb.size();i++)
  ------------------
  |  Branch (29:19): [True: 0, False: 33]
  ------------------
   30|      0|    delete dpb[i];
   31|     33|}

_ZN22decoded_picture_bufferC2Ev:
   34|     33|  decoded_picture_buffer() = default;

_Z36init_acceleration_functions_fallbackP22acceleration_functions:
   27|     33|{
   28|     33|  accel->put_weighted_pred_avg_8 = put_weighted_pred_avg_8_fallback;
   29|     33|  accel->put_unweighted_pred_8   = put_unweighted_pred_8_fallback;
   30|     33|  accel->put_weighted_pred_8 = put_weighted_pred_8_fallback;
   31|     33|  accel->put_weighted_bipred_8 = put_weighted_bipred_8_fallback;
   32|       |
   33|     33|  accel->put_weighted_pred_avg_16 = put_weighted_pred_avg_16_fallback;
   34|     33|  accel->put_unweighted_pred_16   = put_unweighted_pred_16_fallback;
   35|     33|  accel->put_weighted_pred_16 = put_weighted_pred_16_fallback;
   36|     33|  accel->put_weighted_bipred_16 = put_weighted_bipred_16_fallback;
   37|       |
   38|       |
   39|     33|  accel->put_hevc_epel_8    = put_epel_8_fallback;
   40|     33|  accel->put_hevc_epel_h_8  = put_epel_hv_fallback<uint8_t>;
   41|     33|  accel->put_hevc_epel_v_8  = put_epel_hv_fallback<uint8_t>;
   42|     33|  accel->put_hevc_epel_hv_8 = put_epel_hv_fallback<uint8_t>;
   43|       |
   44|     33|  accel->put_hevc_qpel_8[0][0] = put_qpel_0_0_fallback;
   45|     33|  accel->put_hevc_qpel_8[0][1] = put_qpel_0_1_fallback;
   46|     33|  accel->put_hevc_qpel_8[0][2] = put_qpel_0_2_fallback;
   47|     33|  accel->put_hevc_qpel_8[0][3] = put_qpel_0_3_fallback;
   48|     33|  accel->put_hevc_qpel_8[1][0] = put_qpel_1_0_fallback;
   49|     33|  accel->put_hevc_qpel_8[1][1] = put_qpel_1_1_fallback;
   50|     33|  accel->put_hevc_qpel_8[1][2] = put_qpel_1_2_fallback;
   51|     33|  accel->put_hevc_qpel_8[1][3] = put_qpel_1_3_fallback;
   52|     33|  accel->put_hevc_qpel_8[2][0] = put_qpel_2_0_fallback;
   53|     33|  accel->put_hevc_qpel_8[2][1] = put_qpel_2_1_fallback;
   54|     33|  accel->put_hevc_qpel_8[2][2] = put_qpel_2_2_fallback;
   55|     33|  accel->put_hevc_qpel_8[2][3] = put_qpel_2_3_fallback;
   56|     33|  accel->put_hevc_qpel_8[3][0] = put_qpel_3_0_fallback;
   57|     33|  accel->put_hevc_qpel_8[3][1] = put_qpel_3_1_fallback;
   58|     33|  accel->put_hevc_qpel_8[3][2] = put_qpel_3_2_fallback;
   59|     33|  accel->put_hevc_qpel_8[3][3] = put_qpel_3_3_fallback;
   60|       |
   61|     33|  accel->put_hevc_epel_16    = put_epel_16_fallback;
   62|     33|  accel->put_hevc_epel_h_16  = put_epel_hv_fallback<uint16_t>;
   63|     33|  accel->put_hevc_epel_v_16  = put_epel_hv_fallback<uint16_t>;
   64|     33|  accel->put_hevc_epel_hv_16 = put_epel_hv_fallback<uint16_t>;
   65|       |
   66|     33|  accel->put_hevc_qpel_16[0][0] = put_qpel_0_0_fallback_16;
   67|     33|  accel->put_hevc_qpel_16[0][1] = put_qpel_0_1_fallback_16;
   68|     33|  accel->put_hevc_qpel_16[0][2] = put_qpel_0_2_fallback_16;
   69|     33|  accel->put_hevc_qpel_16[0][3] = put_qpel_0_3_fallback_16;
   70|     33|  accel->put_hevc_qpel_16[1][0] = put_qpel_1_0_fallback_16;
   71|     33|  accel->put_hevc_qpel_16[1][1] = put_qpel_1_1_fallback_16;
   72|     33|  accel->put_hevc_qpel_16[1][2] = put_qpel_1_2_fallback_16;
   73|     33|  accel->put_hevc_qpel_16[1][3] = put_qpel_1_3_fallback_16;
   74|     33|  accel->put_hevc_qpel_16[2][0] = put_qpel_2_0_fallback_16;
   75|     33|  accel->put_hevc_qpel_16[2][1] = put_qpel_2_1_fallback_16;
   76|     33|  accel->put_hevc_qpel_16[2][2] = put_qpel_2_2_fallback_16;
   77|     33|  accel->put_hevc_qpel_16[2][3] = put_qpel_2_3_fallback_16;
   78|     33|  accel->put_hevc_qpel_16[3][0] = put_qpel_3_0_fallback_16;
   79|     33|  accel->put_hevc_qpel_16[3][1] = put_qpel_3_1_fallback_16;
   80|     33|  accel->put_hevc_qpel_16[3][2] = put_qpel_3_2_fallback_16;
   81|     33|  accel->put_hevc_qpel_16[3][3] = put_qpel_3_3_fallback_16;
   82|       |
   83|       |
   84|       |
   85|     33|  accel->transform_skip_8 = transform_skip_8_fallback;
   86|     33|  accel->transform_skip_rdpcm_h_8 = transform_skip_rdpcm_h_8_fallback;
   87|     33|  accel->transform_skip_rdpcm_v_8 = transform_skip_rdpcm_v_8_fallback;
   88|     33|  accel->transform_bypass = transform_bypass_fallback;
   89|     33|  accel->transform_bypass_rdpcm_h = transform_bypass_rdpcm_h_fallback;
   90|     33|  accel->transform_bypass_rdpcm_v = transform_bypass_rdpcm_v_fallback;
   91|     33|  accel->transform_4x4_dst_add_8 = transform_4x4_luma_add_8_fallback;
   92|     33|  accel->transform_add_8[0] = transform_4x4_add_8_fallback;
   93|     33|  accel->transform_add_8[1] = transform_8x8_add_8_fallback;
   94|     33|  accel->transform_add_8[2] = transform_16x16_add_8_fallback;
   95|     33|  accel->transform_add_8[3] = transform_32x32_add_8_fallback;
   96|       |
   97|     33|  accel->transform_skip_16 = transform_skip_16_fallback;
   98|     33|  accel->transform_4x4_dst_add_16 = transform_4x4_luma_add_16_fallback;
   99|     33|  accel->transform_add_16[0] = transform_4x4_add_16_fallback;
  100|     33|  accel->transform_add_16[1] = transform_8x8_add_16_fallback;
  101|     33|  accel->transform_add_16[2] = transform_16x16_add_16_fallback;
  102|     33|  accel->transform_add_16[3] = transform_32x32_add_16_fallback;
  103|       |
  104|     33|  accel->rotate_coefficients = rotate_coefficients_fallback;
  105|     33|  accel->add_residual_8  = add_residual_fallback<uint8_t>;
  106|     33|  accel->add_residual_16 = add_residual_fallback<uint16_t>;
  107|     33|  accel->rdpcm_h = rdpcm_h_fallback;
  108|     33|  accel->rdpcm_v = rdpcm_v_fallback;
  109|     33|  accel->transform_skip_residual = transform_skip_residual_fallback;
  110|       |
  111|     33|  accel->transform_idst_4x4   = transform_idst_4x4_fallback;
  112|     33|  accel->transform_idct_4x4   = transform_idct_4x4_fallback;
  113|     33|  accel->transform_idct_8x8   = transform_idct_8x8_fallback;
  114|     33|  accel->transform_idct_16x16 = transform_idct_16x16_fallback;
  115|     33|  accel->transform_idct_32x32 = transform_idct_32x32_fallback;
  116|       |
  117|     33|  accel->fwd_transform_4x4_dst_8 = fdst_4x4_8_fallback;
  118|     33|  accel->fwd_transform_8[0] = fdct_4x4_8_fallback;
  119|     33|  accel->fwd_transform_8[1] = fdct_8x8_8_fallback;
  120|     33|  accel->fwd_transform_8[2] = fdct_16x16_8_fallback;
  121|     33|  accel->fwd_transform_8[3] = fdct_32x32_8_fallback;
  122|       |
  123|     33|  accel->hadamard_transform_8[0] = hadamard_4x4_8_fallback;
  124|     33|  accel->hadamard_transform_8[1] = hadamard_8x8_8_fallback;
  125|     33|  accel->hadamard_transform_8[2] = hadamard_16x16_8_fallback;
  126|     33|  accel->hadamard_transform_8[3] = hadamard_32x32_8_fallback;
  127|     33|}

_ZN8NAL_unitC2Ev:
   34|  46.2k|  : skipped_bytes(DE265_SKIPPED_BYTES_INITIAL_SIZE)
   35|  46.2k|{
   36|  46.2k|}
_ZN8NAL_unitD2Ev:
   39|  46.2k|{
   40|  46.2k|  free(nal_data);
   41|  46.2k|}
_ZN8NAL_unit5clearEv:
   44|  46.2k|{
   45|  46.2k|  header = nal_header();
   46|  46.2k|  pts = 0;
   47|  46.2k|  user_data = nullptr;
   48|       |
   49|       |  // set size to zero but keep memory
   50|  46.2k|  data_size = 0;
   51|       |
   52|  46.2k|  skipped_bytes.clear();
   53|  46.2k|}
_ZN8NAL_unit6resizeEi:
   56|  92.4k|{
   57|  92.4k|  if (capacity < new_size) {
  ------------------
  |  Branch (57:7): [True: 123, False: 92.3k]
  ------------------
   58|    123|    unsigned char* newbuffer = static_cast<unsigned char*>(malloc(new_size));
   59|    123|    if (newbuffer == nullptr) {
  ------------------
  |  Branch (59:9): [True: 0, False: 123]
  ------------------
   60|      0|      return false;
   61|      0|    }
   62|       |
   63|    123|    if (nal_data != nullptr) {
  ------------------
  |  Branch (63:9): [True: 0, False: 123]
  ------------------
   64|      0|      memcpy(newbuffer, nal_data, data_size);
   65|      0|      free(nal_data);
   66|      0|    }
   67|       |
   68|    123|    nal_data = newbuffer;
   69|    123|    capacity = new_size;
   70|    123|  }
   71|  92.4k|  return true;
   72|  92.4k|}
_ZN8NAL_unit8set_dataEPKhi:
   85|  46.2k|{
   86|  46.2k|  if (!resize(n)) {
  ------------------
  |  Branch (86:7): [True: 0, False: 46.2k]
  ------------------
   87|      0|    return false;
   88|      0|  }
   89|  46.2k|  memcpy(nal_data, in_data, n);
   90|  46.2k|  data_size = n;
   91|  46.2k|  return true;
   92|  46.2k|}
_ZN8NAL_unit19insert_skipped_byteEj:
   95|    419|{
   96|    419|  skipped_bytes.push_back(pos);
   97|    419|}
_ZN8NAL_unit21remove_stuffing_bytesEv:
  115|  46.2k|{
  116|  46.2k|  uint8_t* p = data();
  117|       |
  118|   300k|  for (int i=0;i<size()-2;i++)
  ------------------
  |  Branch (118:16): [True: 253k, False: 46.2k]
  ------------------
  119|   253k|    {
  120|       |#if 0
  121|       |        for (int k=i;k<i+64;k++) 
  122|       |          if (i*0+k<size()) {
  123|       |            printf("%c%02x", (k==i) ? '[':' ', data()[k]);
  124|       |          }
  125|       |        printf("\n");
  126|       |#endif
  127|       |
  128|   253k|      if (p[2]!=3 && p[2]!=0) {
  ------------------
  |  Branch (128:11): [True: 252k, False: 954]
  |  Branch (128:22): [True: 23.3k, False: 229k]
  ------------------
  129|       |        // fast forward 3 bytes (2+1)
  130|  23.3k|        p+=2;
  131|  23.3k|        i+=2;
  132|  23.3k|      }
  133|   230k|      else {
  134|   230k|        if (p[0]==0 && p[1]==0 && p[2]==3) {
  ------------------
  |  Branch (134:13): [True: 224k, False: 6.02k]
  |  Branch (134:24): [True: 223k, False: 858]
  |  Branch (134:35): [True: 419, False: 223k]
  ------------------
  135|       |          //printf("SKIP NAL @ %d\n",i+2+num_skipped_bytes);
  136|    419|          insert_skipped_byte(i+2 + num_skipped_bytes());
  137|       |
  138|    419|          memmove(p+2, p+3, size()-i-3);
  139|    419|          set_size(size()-1);
  140|       |
  141|    419|          p++;
  142|    419|          i++;
  143|    419|        }
  144|   230k|      }
  145|       |
  146|   253k|      p++;
  147|   253k|    }
  148|  46.2k|}
_ZN10NAL_ParserC2Ev:
  154|     33|NAL_Parser::NAL_Parser() = default;
_ZN10NAL_ParserD2Ev:
  158|     33|{
  159|       |  // --- free NAL queues ---
  160|       |
  161|       |  // empty NAL queue
  162|       |
  163|     33|  NAL_unit* nal;
  164|  46.2k|  while ( (nal = pop_from_NAL_queue()) ) {
  ------------------
  |  Branch (164:11): [True: 46.2k, False: 33]
  ------------------
  165|  46.2k|    free_NAL_unit(nal);
  166|  46.2k|  }
  167|       |
  168|       |  // free the pending input NAL
  169|       |
  170|     33|  if (pending_input_NAL != nullptr) {
  ------------------
  |  Branch (170:7): [True: 0, False: 33]
  ------------------
  171|      0|    free_NAL_unit(pending_input_NAL);
  172|      0|  }
  173|       |
  174|       |  // free all NALs in free-list
  175|       |
  176|    321|  for (size_t i=0;i<NAL_free_list.size();i++) {
  ------------------
  |  Branch (176:19): [True: 288, False: 33]
  ------------------
  177|    288|    delete NAL_free_list[i];
  178|    288|  }
  179|     33|}
_ZN10NAL_Parser14alloc_NAL_unitEi:
  183|  46.2k|{
  184|  46.2k|  NAL_unit* nal;
  185|       |
  186|       |  // --- get NAL-unit object ---
  187|       |
  188|  46.2k|  if (NAL_free_list.size() > 0) {
  ------------------
  |  Branch (188:7): [True: 0, False: 46.2k]
  ------------------
  189|      0|    nal = NAL_free_list.back();
  190|      0|    NAL_free_list.pop_back();
  191|      0|  }
  192|  46.2k|  else {
  193|  46.2k|    nal = new NAL_unit;
  194|  46.2k|  }
  195|       |
  196|  46.2k|  nal->clear();
  197|  46.2k|  if (!nal->resize(size)) {
  ------------------
  |  Branch (197:7): [True: 0, False: 46.2k]
  ------------------
  198|      0|    free_NAL_unit(nal);
  199|      0|    return nullptr;
  200|      0|  }
  201|       |
  202|  46.2k|  return nal;
  203|  46.2k|}
_ZN10NAL_Parser13free_NAL_unitEP8NAL_unit:
  206|  46.2k|{
  207|  46.2k|  if (nal == nullptr) {
  ------------------
  |  Branch (207:7): [True: 0, False: 46.2k]
  ------------------
  208|       |    // Allow calling with nullptr just like regular "free()"
  209|      0|    return;
  210|      0|  }
  211|  46.2k|  if (NAL_free_list.size() < DE265_NAL_FREE_LIST_SIZE) {
  ------------------
  |  Branch (211:7): [True: 288, False: 45.9k]
  ------------------
  212|    288|    NAL_free_list.push_back(nal);
  213|    288|  }
  214|  45.9k|  else {
  215|  45.9k|    delete nal;
  216|  45.9k|  }
  217|  46.2k|}
_ZN10NAL_Parser18pop_from_NAL_queueEv:
  220|  46.2k|{
  221|  46.2k|  if (NAL_queue.empty()) {
  ------------------
  |  Branch (221:7): [True: 33, False: 46.2k]
  ------------------
  222|     33|    return nullptr;
  223|     33|  }
  224|  46.2k|  else {
  225|  46.2k|    NAL_unit* nal = NAL_queue.front();
  226|  46.2k|    NAL_queue.pop();
  227|       |
  228|  46.2k|    nBytes_in_NAL_queue -= nal->size();
  229|       |
  230|  46.2k|    return nal;
  231|  46.2k|  }
  232|  46.2k|}
_ZN10NAL_Parser17push_to_NAL_queueEP8NAL_unit:
  235|  46.2k|{
  236|  46.2k|  NAL_queue.push(nal);
  237|  46.2k|  nBytes_in_NAL_queue += nal->size();
  238|  46.2k|}
_ZN10NAL_Parser8push_NALEPKhilPv:
  364|  46.2k|{
  365|       |
  366|       |  // Cannot use byte-stream input and NAL input at the same time.
  367|  46.2k|  assert(pending_input_NAL == nullptr);
  ------------------
  |  Branch (367:3): [True: 46.2k, False: 0]
  ------------------
  368|       |
  369|  46.2k|  end_of_frame = false;
  370|       |
  371|  46.2k|  NAL_unit* nal = alloc_NAL_unit(len);
  372|  46.2k|  if (nal == nullptr || !nal->set_data(data, len)) {
  ------------------
  |  Branch (372:7): [True: 0, False: 46.2k]
  |  Branch (372:25): [True: 0, False: 46.2k]
  ------------------
  373|      0|    free_NAL_unit(nal);
  374|      0|    return DE265_ERROR_OUT_OF_MEMORY;
  375|      0|  }
  376|  46.2k|  nal->pts = pts;
  377|  46.2k|  nal->user_data = user_data;
  378|       |
  379|  46.2k|  nal->remove_stuffing_bytes();
  380|       |
  381|  46.2k|  push_to_NAL_queue(nal);
  382|       |
  383|  46.2k|  return DE265_OK;
  384|  46.2k|}

_ZNK8NAL_unit4sizeEv:
   55|   393k|  int size() const { return data_size; }
_ZN8NAL_unit8set_sizeEi:
   56|    419|  void set_size(int s) { data_size=s; }
_ZN8NAL_unit4dataEv:
   57|  46.2k|  unsigned char* data() { return nal_data; }
_ZNK8NAL_unit17num_skipped_bytesEv:
   64|    419|  uint32_t num_skipped_bytes() const { return skipped_bytes.size(); }

_ZN10nal_headerC2Ev:
   35|  92.4k|  nal_header() {
   36|  92.4k|    nal_unit_type = 0;
   37|  92.4k|    nuh_layer_id = 0;
   38|  92.4k|    nuh_temporal_id = 0;
   39|  92.4k|  }

_Z14get_scan_orderii:
   81|  16.3k|{
   82|  16.3k|  switch (scanIdx) {
   83|  5.44k|  case 0: return scan_d[log2BlockSize];
  ------------------
  |  Branch (83:3): [True: 5.44k, False: 10.8k]
  ------------------
   84|  5.44k|  case 1: return scan_h[log2BlockSize];
  ------------------
  |  Branch (84:3): [True: 5.44k, False: 10.8k]
  ------------------
   85|  5.44k|  case 2: return scan_v[log2BlockSize];
  ------------------
  |  Branch (85:3): [True: 5.44k, False: 10.8k]
  ------------------
   86|      0|  default: return 0; // should never happen
  ------------------
  |  Branch (86:3): [True: 0, False: 16.3k]
  ------------------
   87|  16.3k|  }
   88|  16.3k|}
_Z16init_scan_ordersv:
  136|      2|{
  137|     12|  for (int log2size=1;log2size<=5;log2size++)
  ------------------
  |  Branch (137:23): [True: 10, False: 2]
  ------------------
  138|     10|    {
  139|     10|      init_scan_h(scan_h[log2size], 1<<log2size);
  140|     10|      init_scan_v(scan_v[log2size], 1<<log2size);
  141|     10|      init_scan_d(scan_d[log2size], 1<<log2size);
  142|     10|    }
  143|       |
  144|       |
  145|     10|  for (int log2size=2;log2size<=5;log2size++)
  ------------------
  |  Branch (145:23): [True: 8, False: 2]
  ------------------
  146|     32|    for (int scanIdx=0;scanIdx<3;scanIdx++)
  ------------------
  |  Branch (146:24): [True: 24, False: 8]
  ------------------
  147|    384|      for (int y=0;y<(1<<log2size);y++)
  ------------------
  |  Branch (147:20): [True: 360, False: 24]
  ------------------
  148|  8.52k|        for (int x=0;x<(1<<log2size);x++)
  ------------------
  |  Branch (148:22): [True: 8.16k, False: 360]
  ------------------
  149|  8.16k|          {
  150|  8.16k|            fill_scan_pos(&scanpos[scanIdx][log2size][ y*(1<<log2size) + x ],x,y,scanIdx,log2size);
  151|  8.16k|          }
  152|      2|}
scan.cc:_ZL11init_scan_hP8positioni:
   35|     10|{
   36|     10|  int i=0;
   37|    134|  for (int y=0;y<blkSize;y++)
  ------------------
  |  Branch (37:16): [True: 124, False: 10]
  ------------------
   38|  2.85k|    for (int x=0;x<blkSize;x++)
  ------------------
  |  Branch (38:18): [True: 2.72k, False: 124]
  ------------------
   39|  2.72k|      {
   40|  2.72k|        scan[i].x = x;
   41|  2.72k|        scan[i].y = y;
   42|  2.72k|        i++;
   43|  2.72k|      }
   44|     10|}
scan.cc:_ZL11init_scan_vP8positioni:
   47|     10|{
   48|     10|  int i=0;
   49|    134|  for (int x=0;x<blkSize;x++)
  ------------------
  |  Branch (49:16): [True: 124, False: 10]
  ------------------
   50|  2.85k|    for (int y=0;y<blkSize;y++)
  ------------------
  |  Branch (50:18): [True: 2.72k, False: 124]
  ------------------
   51|  2.72k|      {
   52|  2.72k|        scan[i].x = x;
   53|  2.72k|        scan[i].y = y;
   54|  2.72k|        i++;
   55|  2.72k|      }
   56|     10|}
scan.cc:_ZL11init_scan_dP8positioni:
   59|     10|{
   60|     10|  int i=0;
   61|     10|  int x=0,y=0;
   62|       |
   63|    238|  do {
   64|  5.57k|    while (y>=0) {
  ------------------
  |  Branch (64:12): [True: 5.33k, False: 238]
  ------------------
   65|  5.33k|      if (x<blkSize && y<blkSize) {
  ------------------
  |  Branch (65:11): [True: 4.03k, False: 1.30k]
  |  Branch (65:24): [True: 2.72k, False: 1.30k]
  ------------------
   66|  2.72k|        scan[i].x = x;
   67|  2.72k|        scan[i].y = y;
   68|  2.72k|        i++;
   69|  2.72k|      }
   70|  5.33k|      y--;
   71|  5.33k|      x++;
   72|  5.33k|    }
   73|       |
   74|    238|    y=x;
   75|    238|    x=0;
   76|    238|  } while (i < blkSize*blkSize);
  ------------------
  |  Branch (76:12): [True: 228, False: 10]
  ------------------
   77|     10|}
scan.cc:_ZL13fill_scan_posP13scan_positioniiii:
  109|  8.16k|{
  110|  8.16k|  int lastScanPos = 16;
  111|  8.16k|  int lastSubBlock = (1<<(log2TrafoSize-2)) * (1<<(log2TrafoSize-2)) -1;
  112|       |
  113|  8.16k|  const position* ScanOrderSub = get_scan_order(log2TrafoSize-2, scanIdx);
  114|  8.16k|  const position* ScanOrderPos = get_scan_order(2, scanIdx);
  115|       |
  116|  8.16k|  int xC,yC;
  117|  3.35M|  do {
  118|  3.35M|    if (lastScanPos==0) {
  ------------------
  |  Branch (118:9): [True: 205k, False: 3.15M]
  ------------------
  119|   205k|      lastScanPos=16;
  120|   205k|      lastSubBlock--;
  121|   205k|    }
  122|  3.35M|    lastScanPos--;
  123|       |
  124|  3.35M|    position S = ScanOrderSub[lastSubBlock];
  125|  3.35M|    xC = (S.x<<2) + ScanOrderPos[lastScanPos].x;
  126|  3.35M|    yC = (S.y<<2) + ScanOrderPos[lastScanPos].y;
  127|       |
  128|  3.35M|  } while ( (xC != x) || (yC != y));
  ------------------
  |  Branch (128:13): [True: 3.24M, False: 116k]
  |  Branch (128:26): [True: 108k, False: 8.16k]
  ------------------
  129|       |
  130|  8.16k|  pos->subBlock = lastSubBlock;
  131|  8.16k|  pos->scanPos  = lastScanPos;
  132|  8.16k|}

_Z51alloc_and_init_significant_coeff_ctxIdx_lookupTablev:
 1996|      2|{
 1997|      2|  int tableSize = 4 * 4 * (2) + 8 * 8 * (2 * 2 * 4) + 16 * 16 * (2 * 4) + 32 * 32 * (2 * 4);
 1998|       |
 1999|      2|  uint8_t* p = (uint8_t*) malloc(tableSize);
 2000|      2|  if (p == nullptr) {
  ------------------
  |  Branch (2000:7): [True: 0, False: 2]
  ------------------
 2001|      0|    return false;
 2002|      0|  }
 2003|       |
 2004|      2|  memset(p, 0xFF, tableSize); // just for debugging
 2005|       |
 2006|       |
 2007|       |  // --- Set pointers to memory areas. Note that some parameters share the same memory. ---
 2008|       |
 2009|       |  // 4x4
 2010|       |
 2011|      6|  for (int cIdx = 0; cIdx < 2; cIdx++) {
  ------------------
  |  Branch (2011:22): [True: 4, False: 2]
  ------------------
 2012|     12|    for (int scanIdx = 0; scanIdx < 2; scanIdx++)
  ------------------
  |  Branch (2012:27): [True: 8, False: 4]
  ------------------
 2013|     40|      for (int prevCsbf = 0; prevCsbf < 4; prevCsbf++)
  ------------------
  |  Branch (2013:30): [True: 32, False: 8]
  ------------------
 2014|     32|        ctxIdxLookup[0][cIdx][scanIdx][prevCsbf] = p;
 2015|       |
 2016|      4|    p += 4 * 4;
 2017|      4|  }
 2018|       |
 2019|       |  // 8x8
 2020|       |
 2021|      6|  for (int cIdx = 0; cIdx < 2; cIdx++)
  ------------------
  |  Branch (2021:22): [True: 4, False: 2]
  ------------------
 2022|     12|    for (int scanIdx = 0; scanIdx < 2; scanIdx++)
  ------------------
  |  Branch (2022:27): [True: 8, False: 4]
  ------------------
 2023|     40|      for (int prevCsbf = 0; prevCsbf < 4; prevCsbf++) {
  ------------------
  |  Branch (2023:30): [True: 32, False: 8]
  ------------------
 2024|     32|        ctxIdxLookup[1][cIdx][scanIdx][prevCsbf] = p;
 2025|     32|        p += 8 * 8;
 2026|     32|      }
 2027|       |
 2028|       |  // 16x16
 2029|       |
 2030|      6|  for (int cIdx = 0; cIdx < 2; cIdx++)
  ------------------
  |  Branch (2030:22): [True: 4, False: 2]
  ------------------
 2031|     20|    for (int prevCsbf = 0; prevCsbf < 4; prevCsbf++) {
  ------------------
  |  Branch (2031:28): [True: 16, False: 4]
  ------------------
 2032|     48|      for (int scanIdx = 0; scanIdx < 2; scanIdx++) {
  ------------------
  |  Branch (2032:29): [True: 32, False: 16]
  ------------------
 2033|     32|        ctxIdxLookup[2][cIdx][scanIdx][prevCsbf] = p;
 2034|     32|      }
 2035|       |
 2036|     16|      p += 16 * 16;
 2037|     16|    }
 2038|       |
 2039|       |  // 32x32
 2040|       |
 2041|      6|  for (int cIdx = 0; cIdx < 2; cIdx++)
  ------------------
  |  Branch (2041:22): [True: 4, False: 2]
  ------------------
 2042|     20|    for (int prevCsbf = 0; prevCsbf < 4; prevCsbf++) {
  ------------------
  |  Branch (2042:28): [True: 16, False: 4]
  ------------------
 2043|     48|      for (int scanIdx = 0; scanIdx < 2; scanIdx++) {
  ------------------
  |  Branch (2043:29): [True: 32, False: 16]
  ------------------
 2044|     32|        ctxIdxLookup[3][cIdx][scanIdx][prevCsbf] = p;
 2045|     32|      }
 2046|       |
 2047|     16|      p += 32 * 32;
 2048|     16|    }
 2049|       |
 2050|       |
 2051|       |  // --- precompute ctxIdx tables ---
 2052|       |
 2053|     10|  for (int log2w = 2; log2w <= 5; log2w++)
  ------------------
  |  Branch (2053:23): [True: 8, False: 2]
  ------------------
 2054|     24|    for (int cIdx = 0; cIdx < 2; cIdx++)
  ------------------
  |  Branch (2054:24): [True: 16, False: 8]
  ------------------
 2055|     48|      for (int scanIdx = 0; scanIdx < 2; scanIdx++)
  ------------------
  |  Branch (2055:29): [True: 32, False: 16]
  ------------------
 2056|    160|        for (int prevCsbf = 0; prevCsbf < 4; prevCsbf++) {
  ------------------
  |  Branch (2056:32): [True: 128, False: 32]
  ------------------
 2057|  2.04k|          for (int yC = 0; yC < (1 << log2w); yC++)
  ------------------
  |  Branch (2057:28): [True: 1.92k, False: 128]
  ------------------
 2058|  45.4k|            for (int xC = 0; xC < (1 << log2w); xC++) {
  ------------------
  |  Branch (2058:30): [True: 43.5k, False: 1.92k]
  ------------------
 2059|  43.5k|              int w = 1 << log2w;
 2060|  43.5k|              int sbWidth = w >> 2;
 2061|       |
 2062|  43.5k|              int sigCtx;
 2063|       |
 2064|       |              // if log2TrafoSize==2
 2065|  43.5k|              if (sbWidth == 1) {
  ------------------
  |  Branch (2065:19): [True: 512, False: 43.0k]
  ------------------
 2066|    512|                sigCtx = ctxIdxMap[(yC << 2) + xC];
 2067|    512|              }
 2068|  43.0k|              else if (xC + yC == 0) {
  ------------------
  |  Branch (2068:24): [True: 96, False: 42.9k]
  ------------------
 2069|     96|                sigCtx = 0;
 2070|     96|              }
 2071|  42.9k|              else {
 2072|  42.9k|                int xS = xC >> 2;
 2073|  42.9k|                int yS = yC >> 2;
 2074|       |                /*
 2075|       |                  int prevCsbf = 0;
 2076|       |
 2077|       |                  if (xS < sbWidth-1) { prevCsbf += coded_sub_block_flag[xS+1  +yS*sbWidth];    }
 2078|       |                  if (yS < sbWidth-1) { prevCsbf += coded_sub_block_flag[xS+(1+yS)*sbWidth]<<1; }
 2079|       |                */
 2080|  42.9k|                int xP = xC & 3;
 2081|  42.9k|                int yP = yC & 3;
 2082|       |
 2083|       |                //logtrace(LogSlice,"posInSubset: %d,%d\n",xP,yP);
 2084|       |                //logtrace(LogSlice,"prevCsbf: %d\n",prevCsbf);
 2085|       |
 2086|  42.9k|                switch (prevCsbf) {
 2087|  10.7k|                  case 0:
  ------------------
  |  Branch (2087:19): [True: 10.7k, False: 32.1k]
  ------------------
 2088|  10.7k|                    sigCtx = (xP + yP >= 3) ? 0 : (xP + yP > 0) ? 1 : 2;
  ------------------
  |  Branch (2088:30): [True: 6.72k, False: 4.00k]
  |  Branch (2088:51): [True: 3.36k, False: 648]
  ------------------
 2089|  10.7k|                    break;
 2090|  10.7k|                  case 1:
  ------------------
  |  Branch (2090:19): [True: 10.7k, False: 32.1k]
  ------------------
 2091|  10.7k|                    sigCtx = (yP == 0) ? 2 : (yP == 1) ? 1 : 0;
  ------------------
  |  Branch (2091:30): [True: 2.66k, False: 8.06k]
  |  Branch (2091:46): [True: 2.68k, False: 5.37k]
  ------------------
 2092|  10.7k|                    break;
 2093|  10.7k|                  case 2:
  ------------------
  |  Branch (2093:19): [True: 10.7k, False: 32.1k]
  ------------------
 2094|  10.7k|                    sigCtx = (xP == 0) ? 2 : (xP == 1) ? 1 : 0;
  ------------------
  |  Branch (2094:30): [True: 2.66k, False: 8.06k]
  |  Branch (2094:46): [True: 2.68k, False: 5.37k]
  ------------------
 2095|  10.7k|                    break;
 2096|  10.7k|                  default:
  ------------------
  |  Branch (2096:19): [True: 10.7k, False: 32.1k]
  ------------------
 2097|  10.7k|                    sigCtx = 2;
 2098|  10.7k|                    break;
 2099|  42.9k|                }
 2100|       |
 2101|       |                //logtrace(LogSlice,"a) sigCtx=%d\n",sigCtx);
 2102|       |
 2103|  42.9k|                if (cIdx == 0) {
  ------------------
  |  Branch (2103:21): [True: 21.4k, False: 21.4k]
  ------------------
 2104|  21.4k|                  if (xS + yS > 0) sigCtx += 3;
  ------------------
  |  Branch (2104:23): [True: 20.7k, False: 720]
  ------------------
 2105|       |
 2106|       |                  //logtrace(LogSlice,"b) sigCtx=%d\n",sigCtx);
 2107|       |
 2108|       |                  // if log2TrafoSize==3
 2109|  21.4k|                  if (sbWidth == 2) {
  ------------------
  |  Branch (2109:23): [True: 1.00k, False: 20.4k]
  ------------------
 2110|       |                    // 8x8 block
 2111|  1.00k|                    sigCtx += (scanIdx == 0) ? 9 : 15;
  ------------------
  |  Branch (2111:31): [True: 504, False: 504]
  ------------------
 2112|  1.00k|                  }
 2113|  20.4k|                  else {
 2114|  20.4k|                    sigCtx += 21;
 2115|  20.4k|                  }
 2116|       |
 2117|       |                  //logtrace(LogSlice,"c) sigCtx=%d\n",sigCtx);
 2118|  21.4k|                }
 2119|  21.4k|                else {
 2120|       |                  // if log2TrafoSize==3
 2121|  21.4k|                  if (sbWidth == 2) {
  ------------------
  |  Branch (2121:23): [True: 1.00k, False: 20.4k]
  ------------------
 2122|       |                    // 8x8 block
 2123|  1.00k|                    sigCtx += 9;
 2124|  1.00k|                  }
 2125|  20.4k|                  else {
 2126|  20.4k|                    sigCtx += 12;
 2127|  20.4k|                  }
 2128|  21.4k|                }
 2129|  42.9k|              }
 2130|       |
 2131|  43.5k|              int ctxIdxInc;
 2132|  43.5k|              if (cIdx == 0) { ctxIdxInc = sigCtx; }
  ------------------
  |  Branch (2132:19): [True: 21.7k, False: 21.7k]
  ------------------
 2133|  21.7k|              else { ctxIdxInc = 27 + sigCtx; }
 2134|       |
 2135|  43.5k|              if (ctxIdxLookup[log2w - 2][cIdx][scanIdx][prevCsbf][xC + (yC << log2w)] != 0xFF) {
  ------------------
  |  Branch (2135:19): [True: 20.9k, False: 22.5k]
  ------------------
 2136|  20.9k|                assert(ctxIdxLookup[log2w-2][cIdx][scanIdx][prevCsbf][xC+(yC<<log2w)] == ctxIdxInc);
  ------------------
  |  Branch (2136:17): [True: 20.9k, False: 0]
  ------------------
 2137|  20.9k|              }
 2138|       |
 2139|  43.5k|              ctxIdxLookup[log2w - 2][cIdx][scanIdx][prevCsbf][xC + (yC << log2w)] = ctxIdxInc;
 2140|       |
 2141|       |              //NOTE: when using this option, we have to include all three scanIdx in the table
 2142|       |              //ctxIdxLookup[log2w-2][cIdx][scanIdx][prevCsbf][s] = ctxIdxInc;
 2143|  43.5k|            }
 2144|    128|        }
 2145|       |
 2146|      2|  return true;
 2147|      2|}

_ZN11thread_pool5startEi:
  177|     33|{
  178|     33|  de265_error err = DE265_OK;
  179|       |
  180|       |  // limit number of threads to maximum
  181|       |
  182|     33|  if (num_threads_to_start > MAX_THREADS) {
  ------------------
  |  Branch (182:7): [True: 0, False: 33]
  ------------------
  183|      0|    num_threads_to_start = MAX_THREADS;
  184|      0|    err = DE265_WARNING_NUMBER_OF_THREADS_LIMITED_TO_MAXIMUM;
  185|      0|  }
  186|       |
  187|     33|  num_threads = 0; // will be increased below
  188|       |
  189|     33|  {
  190|     33|    std::unique_lock<std::mutex> lock(mutex);
  191|       |
  192|     33|    num_threads_working = 0;
  193|     33|    stopped = false;
  194|     33|  }
  195|       |
  196|       |  // start worker threads
  197|       |
  198|     66|  for (int i=0; i<num_threads_to_start; i++) {
  ------------------
  |  Branch (198:17): [True: 33, False: 33]
  ------------------
  199|     33|    thread[i] = std::thread(worker_thread, this);
  200|     33|    num_threads++;
  201|     33|  }
  202|       |
  203|     33|  return err;
  204|     33|}
_ZN11thread_pool4stopEv:
  208|     33|{
  209|     33|  {
  210|     33|    std::unique_lock<std::mutex> lock(mutex);
  211|     33|    stopped = true;
  212|     33|  }
  213|       |
  214|     33|  cond_var.notify_all();
  215|       |
  216|     66|  for (int i=0;i<num_threads;i++) {
  ------------------
  |  Branch (216:16): [True: 33, False: 33]
  ------------------
  217|     33|    thread[i].join();
  218|     33|  }
  219|     33|}
threads.cc:_ZL13worker_threadP11thread_pool:
  124|     33|{
  125|     33|  while(true) {
  ------------------
  |  Branch (125:9): [True: 33, Folded]
  ------------------
  126|       |
  127|     33|    thread_task* task = nullptr;
  128|       |
  129|     33|    {
  130|     33|      std::unique_lock<std::mutex> lock(pool->mutex);
  131|       |
  132|       |      // wait until we can pick a task or until the pool has been stopped
  133|       |
  134|     47|      for (;;) {
  135|       |        // end waiting if thread-pool has been stopped or we have a task to execute
  136|       |
  137|     47|        if (pool->stopped || pool->tasks.size()>0) {
  ------------------
  |  Branch (137:13): [True: 33, False: 14]
  |  Branch (137:30): [True: 0, False: 14]
  ------------------
  138|     33|          break;
  139|     33|        }
  140|       |
  141|       |        //printf("going idle\n");
  142|     14|        pool->cond_var.wait(lock);
  143|     14|      }
  144|       |
  145|       |      // if the pool was shut down, end the execution
  146|       |
  147|     33|      if (pool->stopped) {
  ------------------
  |  Branch (147:11): [True: 33, False: 0]
  ------------------
  148|     33|        return;
  149|     33|      }
  150|       |
  151|       |
  152|       |      // get a task
  153|       |
  154|      0|      task = pool->tasks.front();
  155|      0|      pool->tasks.pop_front();
  156|       |
  157|      0|      pool->num_threads_working++;
  158|       |
  159|       |      //printblks(pool);
  160|      0|    }
  161|       |
  162|       |    // execute the task
  163|       |
  164|      0|    task->work();
  165|       |
  166|       |    // end processing and check if this was the last task to be processed
  167|       |
  168|       |    // TODO: the num_threads_working can probably be an atomic integer
  169|      0|    std::unique_lock<std::mutex> lock(pool->mutex);
  170|       |
  171|      0|    pool->num_threads_working--;
  172|      0|  }
  173|     33|}

_Z31init_acceleration_functions_sseP22acceleration_functions:
   38|     33|{
   39|     33|  uint32_t ecx=0,edx=0;
   40|       |
   41|       |#ifdef _MSC_VER
   42|       |  uint32_t regs[4];
   43|       |  int a = 1;
   44|       |
   45|       |  __cpuid((int *)regs, (int)a);
   46|       |
   47|       |  ecx = regs[2];
   48|       |  edx = regs[3];
   49|       |#elif !defined(__EMSCRIPTEN__)
   50|       |  uint32_t eax,ebx;
   51|     33|  __get_cpuid(1, &eax,&ebx,&ecx,&edx);
   52|     33|#endif
   53|       |
   54|       |#ifdef __EMSCRIPTEN__
   55|       |  int have_SSE    = 0;
   56|       |  int have_SSE4_1 = 0;
   57|       |#ifdef __SSE__
   58|       |  have_SSE = 1;
   59|       |#endif
   60|       |#ifdef __SSE4_1__
   61|       |  have_SSE4_1 = 1;
   62|       |#endif
   63|       |#else
   64|       |  // printf("CPUID EAX=1 -> ECX=%x EDX=%x\n", regs[2], regs[3]);
   65|       |
   66|       |  //int have_MMX    = !!(edx & (1<<23));
   67|     33|  int have_SSE    = !!(edx & (1<<25));
   68|     33|  int have_SSE4_1 = !!(ecx & (1<<19));
   69|       |
   70|       |  // printf("MMX:%d SSE:%d SSE4_1:%d\n",have_MMX,have_SSE,have_SSE4_1);
   71|       |
   72|     33|  if (have_SSE) {
  ------------------
  |  Branch (72:7): [True: 33, False: 0]
  ------------------
   73|     33|  }
   74|     33|#endif
   75|       |
   76|     33|#if HAVE_SSE4_1
   77|     33|  if (have_SSE4_1) {
  ------------------
  |  Branch (77:7): [True: 33, False: 0]
  ------------------
   78|     33|    accel->put_unweighted_pred_8   = ff_hevc_put_unweighted_pred_8_sse;
   79|     33|    accel->put_weighted_pred_avg_8 = ff_hevc_put_weighted_pred_avg_8_sse;
   80|       |
   81|     33|    accel->put_hevc_epel_8    = ff_hevc_put_hevc_epel_pixels_8_sse;
   82|     33|    accel->put_hevc_epel_h_8  = ff_hevc_put_hevc_epel_h_8_sse;
   83|     33|    accel->put_hevc_epel_v_8  = ff_hevc_put_hevc_epel_v_8_sse;
   84|     33|    accel->put_hevc_epel_hv_8 = ff_hevc_put_hevc_epel_hv_8_sse;
   85|       |
   86|     33|    accel->put_hevc_qpel_8[0][0] = ff_hevc_put_hevc_qpel_pixels_8_sse;
   87|     33|    accel->put_hevc_qpel_8[0][1] = ff_hevc_put_hevc_qpel_v_1_8_sse;
   88|     33|    accel->put_hevc_qpel_8[0][2] = ff_hevc_put_hevc_qpel_v_2_8_sse;
   89|     33|    accel->put_hevc_qpel_8[0][3] = ff_hevc_put_hevc_qpel_v_3_8_sse;
   90|     33|    accel->put_hevc_qpel_8[1][0] = ff_hevc_put_hevc_qpel_h_1_8_sse;
   91|     33|    accel->put_hevc_qpel_8[1][1] = ff_hevc_put_hevc_qpel_h_1_v_1_sse;
   92|     33|    accel->put_hevc_qpel_8[1][2] = ff_hevc_put_hevc_qpel_h_1_v_2_sse;
   93|     33|    accel->put_hevc_qpel_8[1][3] = ff_hevc_put_hevc_qpel_h_1_v_3_sse;
   94|     33|    accel->put_hevc_qpel_8[2][0] = ff_hevc_put_hevc_qpel_h_2_8_sse;
   95|     33|    accel->put_hevc_qpel_8[2][1] = ff_hevc_put_hevc_qpel_h_2_v_1_sse;
   96|     33|    accel->put_hevc_qpel_8[2][2] = ff_hevc_put_hevc_qpel_h_2_v_2_sse;
   97|     33|    accel->put_hevc_qpel_8[2][3] = ff_hevc_put_hevc_qpel_h_2_v_3_sse;
   98|     33|    accel->put_hevc_qpel_8[3][0] = ff_hevc_put_hevc_qpel_h_3_8_sse;
   99|     33|    accel->put_hevc_qpel_8[3][1] = ff_hevc_put_hevc_qpel_h_3_v_1_sse;
  100|     33|    accel->put_hevc_qpel_8[3][2] = ff_hevc_put_hevc_qpel_h_3_v_2_sse;
  101|     33|    accel->put_hevc_qpel_8[3][3] = ff_hevc_put_hevc_qpel_h_3_v_3_sse;
  102|       |
  103|     33|    accel->transform_skip_8 = ff_hevc_transform_skip_8_sse;
  104|       |
  105|       |    // actually, for these two functions, the scalar fallback seems to be faster than the SSE code
  106|       |    //accel->transform_4x4_luma_add_8 = ff_hevc_transform_4x4_luma_add_8_sse4; // SSE-4 only TODO
  107|       |    //accel->transform_4x4_add_8   = ff_hevc_transform_4x4_add_8_sse4;
  108|       |
  109|     33|    accel->transform_add_8[1] = ff_hevc_transform_8x8_add_8_sse4;
  110|     33|    accel->transform_add_8[2] = ff_hevc_transform_16x16_add_8_sse4;
  111|     33|    accel->transform_add_8[3] = ff_hevc_transform_32x32_add_8_sse4;
  112|     33|  }
  113|     33|#endif
  114|     33|}

ojph_block_common.cpp:_ZN4ojph5localL15vlc_init_tablesEv:
  118|      2|    {
  119|      2|      const bool debug = false; //useful for checking 
  120|       |
  121|       |      //Data in the table is arranged in this format (taken from the standard)
  122|       |      // c_q is the context for a quad
  123|       |      // rho is the significance pattern for a quad
  124|       |      // u_off indicate if u value is 0 (u_off is 0), or communicated
  125|       |      // e_k, e_1 EMB patterns
  126|       |      // cwd VLC codeword
  127|       |      // cwd VLC codeword length
  128|      2|      struct vlc_src_table { int c_q, rho, u_off, e_k, e_1, cwd, cwd_len; };
  129|       |      // initial quad rows
  130|      2|      vlc_src_table tbl0[] = {
  131|      2|    #include "table0.h"
  ------------------
  |  |    1|      2|{0, 0x1, 0x0, 0x0, 0x0, 0x06, 4},
  |  |    2|      2|{0, 0x1, 0x1, 0x1, 0x1, 0x3F, 7},
  |  |    3|      2|{0, 0x2, 0x0, 0x0, 0x0, 0x00, 3},
  |  |    4|      2|{0, 0x2, 0x1, 0x2, 0x2, 0x7F, 7},
  |  |    5|      2|{0, 0x3, 0x0, 0x0, 0x0, 0x11, 5},
  |  |    6|      2|{0, 0x3, 0x1, 0x2, 0x2, 0x5F, 7},
  |  |    7|      2|{0, 0x3, 0x1, 0x3, 0x1, 0x1F, 7},
  |  |    8|      2|{0, 0x4, 0x0, 0x0, 0x0, 0x02, 3},
  |  |    9|      2|{0, 0x4, 0x1, 0x4, 0x4, 0x13, 6},
  |  |   10|      2|{0, 0x5, 0x0, 0x0, 0x0, 0x0E, 5},
  |  |   11|      2|{0, 0x5, 0x1, 0x4, 0x4, 0x23, 6},
  |  |   12|      2|{0, 0x5, 0x1, 0x5, 0x1, 0x0F, 7},
  |  |   13|      2|{0, 0x6, 0x0, 0x0, 0x0, 0x03, 6},
  |  |   14|      2|{0, 0x6, 0x1, 0x0, 0x0, 0x6F, 7},
  |  |   15|      2|{0, 0x7, 0x0, 0x0, 0x0, 0x2F, 7},
  |  |   16|      2|{0, 0x7, 0x1, 0x2, 0x2, 0x4F, 7},
  |  |   17|      2|{0, 0x7, 0x1, 0x2, 0x0, 0x0D, 6},
  |  |   18|      2|{0, 0x8, 0x0, 0x0, 0x0, 0x04, 3},
  |  |   19|      2|{0, 0x8, 0x1, 0x8, 0x8, 0x3D, 6},
  |  |   20|      2|{0, 0x9, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |   21|      2|{0, 0x9, 0x1, 0x0, 0x0, 0x2D, 6},
  |  |   22|      2|{0, 0xA, 0x0, 0x0, 0x0, 0x01, 5},
  |  |   23|      2|{0, 0xA, 0x1, 0x8, 0x8, 0x35, 6},
  |  |   24|      2|{0, 0xA, 0x1, 0xA, 0x2, 0x77, 7},
  |  |   25|      2|{0, 0xB, 0x0, 0x0, 0x0, 0x37, 7},
  |  |   26|      2|{0, 0xB, 0x1, 0x1, 0x1, 0x57, 7},
  |  |   27|      2|{0, 0xB, 0x1, 0x1, 0x0, 0x09, 6},
  |  |   28|      2|{0, 0xC, 0x0, 0x0, 0x0, 0x1E, 5},
  |  |   29|      2|{0, 0xC, 0x1, 0xC, 0xC, 0x17, 7},
  |  |   30|      2|{0, 0xC, 0x1, 0xC, 0x4, 0x15, 6},
  |  |   31|      2|{0, 0xC, 0x1, 0xC, 0x8, 0x25, 6},
  |  |   32|      2|{0, 0xD, 0x0, 0x0, 0x0, 0x67, 7},
  |  |   33|      2|{0, 0xD, 0x1, 0x1, 0x1, 0x27, 7},
  |  |   34|      2|{0, 0xD, 0x1, 0x5, 0x4, 0x47, 7},
  |  |   35|      2|{0, 0xD, 0x1, 0xD, 0x8, 0x07, 7},
  |  |   36|      2|{0, 0xE, 0x0, 0x0, 0x0, 0x7B, 7},
  |  |   37|      2|{0, 0xE, 0x1, 0x2, 0x2, 0x4B, 7},
  |  |   38|      2|{0, 0xE, 0x1, 0xA, 0x8, 0x05, 6},
  |  |   39|      2|{0, 0xE, 0x1, 0xE, 0x4, 0x3B, 7},
  |  |   40|      2|{0, 0xF, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |   41|      2|{0, 0xF, 0x1, 0x9, 0x9, 0x1B, 7},
  |  |   42|      2|{0, 0xF, 0x1, 0xB, 0xA, 0x6B, 7},
  |  |   43|      2|{0, 0xF, 0x1, 0xF, 0xC, 0x2B, 7},
  |  |   44|      2|{0, 0xF, 0x1, 0xF, 0x8, 0x39, 6},
  |  |   45|      2|{0, 0xF, 0x1, 0xE, 0x6, 0x73, 7},
  |  |   46|      2|{0, 0xF, 0x1, 0xE, 0x2, 0x19, 6},
  |  |   47|      2|{0, 0xF, 0x1, 0xF, 0x5, 0x0B, 7},
  |  |   48|      2|{0, 0xF, 0x1, 0xF, 0x4, 0x29, 6},
  |  |   49|      2|{0, 0xF, 0x1, 0xF, 0x1, 0x33, 7},
  |  |   50|      2|{1, 0x0, 0x0, 0x0, 0x0, 0x00, 2},
  |  |   51|      2|{1, 0x1, 0x0, 0x0, 0x0, 0x0E, 4},
  |  |   52|      2|{1, 0x1, 0x1, 0x1, 0x1, 0x1F, 7},
  |  |   53|      2|{1, 0x2, 0x0, 0x0, 0x0, 0x06, 4},
  |  |   54|      2|{1, 0x2, 0x1, 0x2, 0x2, 0x3B, 6},
  |  |   55|      2|{1, 0x3, 0x0, 0x0, 0x0, 0x1B, 6},
  |  |   56|      2|{1, 0x3, 0x1, 0x0, 0x0, 0x3D, 6},
  |  |   57|      2|{1, 0x4, 0x0, 0x0, 0x0, 0x0A, 4},
  |  |   58|      2|{1, 0x4, 0x1, 0x4, 0x4, 0x2B, 6},
  |  |   59|      2|{1, 0x5, 0x0, 0x0, 0x0, 0x0B, 6},
  |  |   60|      2|{1, 0x5, 0x1, 0x4, 0x4, 0x33, 6},
  |  |   61|      2|{1, 0x5, 0x1, 0x5, 0x1, 0x7F, 7},
  |  |   62|      2|{1, 0x6, 0x0, 0x0, 0x0, 0x13, 6},
  |  |   63|      2|{1, 0x6, 0x1, 0x0, 0x0, 0x23, 6},
  |  |   64|      2|{1, 0x7, 0x0, 0x0, 0x0, 0x3F, 7},
  |  |   65|      2|{1, 0x7, 0x1, 0x2, 0x2, 0x5F, 7},
  |  |   66|      2|{1, 0x7, 0x1, 0x2, 0x0, 0x03, 6},
  |  |   67|      2|{1, 0x8, 0x0, 0x0, 0x0, 0x02, 4},
  |  |   68|      2|{1, 0x8, 0x1, 0x8, 0x8, 0x1D, 6},
  |  |   69|      2|{1, 0x9, 0x0, 0x0, 0x0, 0x2D, 6},
  |  |   70|      2|{1, 0x9, 0x1, 0x0, 0x0, 0x0D, 6},
  |  |   71|      2|{1, 0xA, 0x0, 0x0, 0x0, 0x35, 6},
  |  |   72|      2|{1, 0xA, 0x1, 0x8, 0x8, 0x15, 6},
  |  |   73|      2|{1, 0xA, 0x1, 0xA, 0x2, 0x6F, 7},
  |  |   74|      2|{1, 0xB, 0x0, 0x0, 0x0, 0x2F, 7},
  |  |   75|      2|{1, 0xB, 0x1, 0x1, 0x1, 0x4F, 7},
  |  |   76|      2|{1, 0xB, 0x1, 0x1, 0x0, 0x11, 6},
  |  |   77|      2|{1, 0xC, 0x0, 0x0, 0x0, 0x01, 5},
  |  |   78|      2|{1, 0xC, 0x1, 0x8, 0x8, 0x25, 6},
  |  |   79|      2|{1, 0xC, 0x1, 0xC, 0x4, 0x05, 6},
  |  |   80|      2|{1, 0xD, 0x0, 0x0, 0x0, 0x0F, 7},
  |  |   81|      2|{1, 0xD, 0x1, 0x1, 0x1, 0x17, 7},
  |  |   82|      2|{1, 0xD, 0x1, 0x5, 0x4, 0x39, 6},
  |  |   83|      2|{1, 0xD, 0x1, 0xD, 0x8, 0x77, 7},
  |  |   84|      2|{1, 0xE, 0x0, 0x0, 0x0, 0x37, 7},
  |  |   85|      2|{1, 0xE, 0x1, 0x2, 0x2, 0x57, 7},
  |  |   86|      2|{1, 0xE, 0x1, 0xA, 0x8, 0x19, 6},
  |  |   87|      2|{1, 0xE, 0x1, 0xE, 0x4, 0x67, 7},
  |  |   88|      2|{1, 0xF, 0x0, 0x0, 0x0, 0x07, 7},
  |  |   89|      2|{1, 0xF, 0x1, 0xB, 0x8, 0x29, 6},
  |  |   90|      2|{1, 0xF, 0x1, 0x8, 0x8, 0x27, 7},
  |  |   91|      2|{1, 0xF, 0x1, 0xA, 0x2, 0x09, 6},
  |  |   92|      2|{1, 0xF, 0x1, 0xE, 0x4, 0x31, 6},
  |  |   93|      2|{1, 0xF, 0x1, 0xF, 0x1, 0x47, 7},
  |  |   94|      2|{2, 0x0, 0x0, 0x0, 0x0, 0x00, 2},
  |  |   95|      2|{2, 0x1, 0x0, 0x0, 0x0, 0x0E, 4},
  |  |   96|      2|{2, 0x1, 0x1, 0x1, 0x1, 0x1B, 6},
  |  |   97|      2|{2, 0x2, 0x0, 0x0, 0x0, 0x06, 4},
  |  |   98|      2|{2, 0x2, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |   99|      2|{2, 0x3, 0x0, 0x0, 0x0, 0x2B, 6},
  |  |  100|      2|{2, 0x3, 0x1, 0x1, 0x1, 0x33, 6},
  |  |  101|      2|{2, 0x3, 0x1, 0x3, 0x2, 0x7F, 7},
  |  |  102|      2|{2, 0x4, 0x0, 0x0, 0x0, 0x0A, 4},
  |  |  103|      2|{2, 0x4, 0x1, 0x4, 0x4, 0x0B, 6},
  |  |  104|      2|{2, 0x5, 0x0, 0x0, 0x0, 0x01, 5},
  |  |  105|      2|{2, 0x5, 0x1, 0x5, 0x5, 0x2F, 7},
  |  |  106|      2|{2, 0x5, 0x1, 0x5, 0x1, 0x13, 6},
  |  |  107|      2|{2, 0x5, 0x1, 0x5, 0x4, 0x23, 6},
  |  |  108|      2|{2, 0x6, 0x0, 0x0, 0x0, 0x03, 6},
  |  |  109|      2|{2, 0x6, 0x1, 0x0, 0x0, 0x5F, 7},
  |  |  110|      2|{2, 0x7, 0x0, 0x0, 0x0, 0x1F, 7},
  |  |  111|      2|{2, 0x7, 0x1, 0x2, 0x2, 0x6F, 7},
  |  |  112|      2|{2, 0x7, 0x1, 0x3, 0x1, 0x11, 6},
  |  |  113|      2|{2, 0x7, 0x1, 0x7, 0x4, 0x37, 7},
  |  |  114|      2|{2, 0x8, 0x0, 0x0, 0x0, 0x02, 4},
  |  |  115|      2|{2, 0x8, 0x1, 0x8, 0x8, 0x4F, 7},
  |  |  116|      2|{2, 0x9, 0x0, 0x0, 0x0, 0x3D, 6},
  |  |  117|      2|{2, 0x9, 0x1, 0x0, 0x0, 0x1D, 6},
  |  |  118|      2|{2, 0xA, 0x0, 0x0, 0x0, 0x2D, 6},
  |  |  119|      2|{2, 0xA, 0x1, 0x0, 0x0, 0x0D, 6},
  |  |  120|      2|{2, 0xB, 0x0, 0x0, 0x0, 0x0F, 7},
  |  |  121|      2|{2, 0xB, 0x1, 0x2, 0x2, 0x77, 7},
  |  |  122|      2|{2, 0xB, 0x1, 0x2, 0x0, 0x35, 6},
  |  |  123|      2|{2, 0xC, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  124|      2|{2, 0xC, 0x1, 0x4, 0x4, 0x25, 6},
  |  |  125|      2|{2, 0xC, 0x1, 0xC, 0x8, 0x57, 7},
  |  |  126|      2|{2, 0xD, 0x0, 0x0, 0x0, 0x17, 7},
  |  |  127|      2|{2, 0xD, 0x1, 0x8, 0x8, 0x05, 6},
  |  |  128|      2|{2, 0xD, 0x1, 0xC, 0x4, 0x39, 6},
  |  |  129|      2|{2, 0xD, 0x1, 0xD, 0x1, 0x67, 7},
  |  |  130|      2|{2, 0xE, 0x0, 0x0, 0x0, 0x27, 7},
  |  |  131|      2|{2, 0xE, 0x1, 0x2, 0x2, 0x7B, 7},
  |  |  132|      2|{2, 0xE, 0x1, 0x2, 0x0, 0x19, 6},
  |  |  133|      2|{2, 0xF, 0x0, 0x0, 0x0, 0x47, 7},
  |  |  134|      2|{2, 0xF, 0x1, 0xF, 0x1, 0x29, 6},
  |  |  135|      2|{2, 0xF, 0x1, 0x1, 0x1, 0x09, 6},
  |  |  136|      2|{2, 0xF, 0x1, 0x3, 0x2, 0x07, 7},
  |  |  137|      2|{2, 0xF, 0x1, 0x7, 0x4, 0x31, 6},
  |  |  138|      2|{2, 0xF, 0x1, 0xF, 0x8, 0x3B, 7},
  |  |  139|      2|{3, 0x0, 0x0, 0x0, 0x0, 0x00, 3},
  |  |  140|      2|{3, 0x1, 0x0, 0x0, 0x0, 0x04, 4},
  |  |  141|      2|{3, 0x1, 0x1, 0x1, 0x1, 0x3D, 6},
  |  |  142|      2|{3, 0x2, 0x0, 0x0, 0x0, 0x0C, 5},
  |  |  143|      2|{3, 0x2, 0x1, 0x2, 0x2, 0x4F, 7},
  |  |  144|      2|{3, 0x3, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  145|      2|{3, 0x3, 0x1, 0x1, 0x1, 0x05, 6},
  |  |  146|      2|{3, 0x3, 0x1, 0x3, 0x2, 0x7F, 7},
  |  |  147|      2|{3, 0x4, 0x0, 0x0, 0x0, 0x16, 5},
  |  |  148|      2|{3, 0x4, 0x1, 0x4, 0x4, 0x2D, 6},
  |  |  149|      2|{3, 0x5, 0x0, 0x0, 0x0, 0x06, 5},
  |  |  150|      2|{3, 0x5, 0x1, 0x5, 0x5, 0x1A, 5},
  |  |  151|      2|{3, 0x5, 0x1, 0x5, 0x1, 0x0D, 6},
  |  |  152|      2|{3, 0x5, 0x1, 0x5, 0x4, 0x35, 6},
  |  |  153|      2|{3, 0x6, 0x0, 0x0, 0x0, 0x3F, 7},
  |  |  154|      2|{3, 0x6, 0x1, 0x4, 0x4, 0x5F, 7},
  |  |  155|      2|{3, 0x6, 0x1, 0x6, 0x2, 0x1F, 7},
  |  |  156|      2|{3, 0x7, 0x0, 0x0, 0x0, 0x6F, 7},
  |  |  157|      2|{3, 0x7, 0x1, 0x6, 0x6, 0x2F, 7},
  |  |  158|      2|{3, 0x7, 0x1, 0x6, 0x4, 0x15, 6},
  |  |  159|      2|{3, 0x7, 0x1, 0x7, 0x3, 0x77, 7},
  |  |  160|      2|{3, 0x7, 0x1, 0x7, 0x1, 0x25, 6},
  |  |  161|      2|{3, 0x7, 0x1, 0x7, 0x2, 0x0F, 7},
  |  |  162|      2|{3, 0x8, 0x0, 0x0, 0x0, 0x0A, 5},
  |  |  163|      2|{3, 0x8, 0x1, 0x8, 0x8, 0x07, 7},
  |  |  164|      2|{3, 0x9, 0x0, 0x0, 0x0, 0x39, 6},
  |  |  165|      2|{3, 0x9, 0x1, 0x1, 0x1, 0x37, 7},
  |  |  166|      2|{3, 0x9, 0x1, 0x9, 0x8, 0x57, 7},
  |  |  167|      2|{3, 0xA, 0x0, 0x0, 0x0, 0x19, 6},
  |  |  168|      2|{3, 0xA, 0x1, 0x8, 0x8, 0x29, 6},
  |  |  169|      2|{3, 0xA, 0x1, 0xA, 0x2, 0x17, 7},
  |  |  170|      2|{3, 0xB, 0x0, 0x0, 0x0, 0x67, 7},
  |  |  171|      2|{3, 0xB, 0x1, 0xB, 0x1, 0x27, 7},
  |  |  172|      2|{3, 0xB, 0x1, 0x1, 0x1, 0x47, 7},
  |  |  173|      2|{3, 0xB, 0x1, 0x3, 0x2, 0x09, 6},
  |  |  174|      2|{3, 0xB, 0x1, 0xB, 0x8, 0x7B, 7},
  |  |  175|      2|{3, 0xC, 0x0, 0x0, 0x0, 0x31, 6},
  |  |  176|      2|{3, 0xC, 0x1, 0x4, 0x4, 0x11, 6},
  |  |  177|      2|{3, 0xC, 0x1, 0xC, 0x8, 0x3B, 7},
  |  |  178|      2|{3, 0xD, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |  179|      2|{3, 0xD, 0x1, 0x9, 0x9, 0x1B, 7},
  |  |  180|      2|{3, 0xD, 0x1, 0xD, 0x5, 0x2B, 7},
  |  |  181|      2|{3, 0xD, 0x1, 0xD, 0x1, 0x21, 6},
  |  |  182|      2|{3, 0xD, 0x1, 0xD, 0xC, 0x6B, 7},
  |  |  183|      2|{3, 0xD, 0x1, 0xD, 0x4, 0x01, 6},
  |  |  184|      2|{3, 0xD, 0x1, 0xD, 0x8, 0x4B, 7},
  |  |  185|      2|{3, 0xE, 0x0, 0x0, 0x0, 0x0B, 7},
  |  |  186|      2|{3, 0xE, 0x1, 0xE, 0x4, 0x73, 7},
  |  |  187|      2|{3, 0xE, 0x1, 0x4, 0x4, 0x13, 7},
  |  |  188|      2|{3, 0xE, 0x1, 0xC, 0x8, 0x3E, 6},
  |  |  189|      2|{3, 0xE, 0x1, 0xE, 0x2, 0x33, 7},
  |  |  190|      2|{3, 0xF, 0x0, 0x0, 0x0, 0x53, 7},
  |  |  191|      2|{3, 0xF, 0x1, 0xA, 0xA, 0x0E, 6},
  |  |  192|      2|{3, 0xF, 0x1, 0xB, 0x9, 0x63, 7},
  |  |  193|      2|{3, 0xF, 0x1, 0xF, 0xC, 0x03, 7},
  |  |  194|      2|{3, 0xF, 0x1, 0xF, 0x8, 0x12, 5},
  |  |  195|      2|{3, 0xF, 0x1, 0xE, 0x6, 0x23, 7},
  |  |  196|      2|{3, 0xF, 0x1, 0xF, 0x5, 0x1E, 6},
  |  |  197|      2|{3, 0xF, 0x1, 0xF, 0x4, 0x02, 5},
  |  |  198|      2|{3, 0xF, 0x1, 0xF, 0x3, 0x43, 7},
  |  |  199|      2|{3, 0xF, 0x1, 0xF, 0x1, 0x1C, 5},
  |  |  200|      2|{3, 0xF, 0x1, 0xF, 0x2, 0x2E, 6},
  |  |  201|      2|{4, 0x0, 0x0, 0x0, 0x0, 0x00, 2},
  |  |  202|      2|{4, 0x1, 0x0, 0x0, 0x0, 0x0E, 4},
  |  |  203|      2|{4, 0x1, 0x1, 0x1, 0x1, 0x3F, 7},
  |  |  204|      2|{4, 0x2, 0x0, 0x0, 0x0, 0x06, 4},
  |  |  205|      2|{4, 0x2, 0x1, 0x2, 0x2, 0x1B, 6},
  |  |  206|      2|{4, 0x3, 0x0, 0x0, 0x0, 0x2B, 6},
  |  |  207|      2|{4, 0x3, 0x1, 0x2, 0x2, 0x3D, 6},
  |  |  208|      2|{4, 0x3, 0x1, 0x3, 0x1, 0x7F, 7},
  |  |  209|      2|{4, 0x4, 0x0, 0x0, 0x0, 0x0A, 4},
  |  |  210|      2|{4, 0x4, 0x1, 0x4, 0x4, 0x5F, 7},
  |  |  211|      2|{4, 0x5, 0x0, 0x0, 0x0, 0x0B, 6},
  |  |  212|      2|{4, 0x5, 0x1, 0x0, 0x0, 0x33, 6},
  |  |  213|      2|{4, 0x6, 0x0, 0x0, 0x0, 0x13, 6},
  |  |  214|      2|{4, 0x6, 0x1, 0x0, 0x0, 0x23, 6},
  |  |  215|      2|{4, 0x7, 0x0, 0x0, 0x0, 0x1F, 7},
  |  |  216|      2|{4, 0x7, 0x1, 0x4, 0x4, 0x6F, 7},
  |  |  217|      2|{4, 0x7, 0x1, 0x4, 0x0, 0x03, 6},
  |  |  218|      2|{4, 0x8, 0x0, 0x0, 0x0, 0x02, 4},
  |  |  219|      2|{4, 0x8, 0x1, 0x8, 0x8, 0x1D, 6},
  |  |  220|      2|{4, 0x9, 0x0, 0x0, 0x0, 0x11, 6},
  |  |  221|      2|{4, 0x9, 0x1, 0x0, 0x0, 0x77, 7},
  |  |  222|      2|{4, 0xA, 0x0, 0x0, 0x0, 0x01, 5},
  |  |  223|      2|{4, 0xA, 0x1, 0xA, 0xA, 0x2F, 7},
  |  |  224|      2|{4, 0xA, 0x1, 0xA, 0x2, 0x2D, 6},
  |  |  225|      2|{4, 0xA, 0x1, 0xA, 0x8, 0x0D, 6},
  |  |  226|      2|{4, 0xB, 0x0, 0x0, 0x0, 0x4F, 7},
  |  |  227|      2|{4, 0xB, 0x1, 0xB, 0x2, 0x0F, 7},
  |  |  228|      2|{4, 0xB, 0x1, 0x0, 0x0, 0x35, 6},
  |  |  229|      2|{4, 0xC, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  230|      2|{4, 0xC, 0x1, 0x8, 0x8, 0x25, 6},
  |  |  231|      2|{4, 0xC, 0x1, 0xC, 0x4, 0x37, 7},
  |  |  232|      2|{4, 0xD, 0x0, 0x0, 0x0, 0x57, 7},
  |  |  233|      2|{4, 0xD, 0x1, 0x1, 0x1, 0x07, 7},
  |  |  234|      2|{4, 0xD, 0x1, 0x1, 0x0, 0x05, 6},
  |  |  235|      2|{4, 0xE, 0x0, 0x0, 0x0, 0x17, 7},
  |  |  236|      2|{4, 0xE, 0x1, 0x4, 0x4, 0x39, 6},
  |  |  237|      2|{4, 0xE, 0x1, 0xC, 0x8, 0x19, 6},
  |  |  238|      2|{4, 0xE, 0x1, 0xE, 0x2, 0x67, 7},
  |  |  239|      2|{4, 0xF, 0x0, 0x0, 0x0, 0x27, 7},
  |  |  240|      2|{4, 0xF, 0x1, 0x9, 0x9, 0x47, 7},
  |  |  241|      2|{4, 0xF, 0x1, 0x9, 0x1, 0x29, 6},
  |  |  242|      2|{4, 0xF, 0x1, 0x7, 0x6, 0x7B, 7},
  |  |  243|      2|{4, 0xF, 0x1, 0x7, 0x2, 0x09, 6},
  |  |  244|      2|{4, 0xF, 0x1, 0xB, 0x8, 0x31, 6},
  |  |  245|      2|{4, 0xF, 0x1, 0xF, 0x4, 0x3B, 7},
  |  |  246|      2|{5, 0x0, 0x0, 0x0, 0x0, 0x00, 3},
  |  |  247|      2|{5, 0x1, 0x0, 0x0, 0x0, 0x1A, 5},
  |  |  248|      2|{5, 0x1, 0x1, 0x1, 0x1, 0x7F, 7},
  |  |  249|      2|{5, 0x2, 0x0, 0x0, 0x0, 0x0A, 5},
  |  |  250|      2|{5, 0x2, 0x1, 0x2, 0x2, 0x1D, 6},
  |  |  251|      2|{5, 0x3, 0x0, 0x0, 0x0, 0x2D, 6},
  |  |  252|      2|{5, 0x3, 0x1, 0x3, 0x3, 0x5F, 7},
  |  |  253|      2|{5, 0x3, 0x1, 0x3, 0x2, 0x39, 6},
  |  |  254|      2|{5, 0x3, 0x1, 0x3, 0x1, 0x3F, 7},
  |  |  255|      2|{5, 0x4, 0x0, 0x0, 0x0, 0x12, 5},
  |  |  256|      2|{5, 0x4, 0x1, 0x4, 0x4, 0x1F, 7},
  |  |  257|      2|{5, 0x5, 0x0, 0x0, 0x0, 0x0D, 6},
  |  |  258|      2|{5, 0x5, 0x1, 0x4, 0x4, 0x35, 6},
  |  |  259|      2|{5, 0x5, 0x1, 0x5, 0x1, 0x6F, 7},
  |  |  260|      2|{5, 0x6, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  261|      2|{5, 0x6, 0x1, 0x2, 0x2, 0x25, 6},
  |  |  262|      2|{5, 0x6, 0x1, 0x6, 0x4, 0x2F, 7},
  |  |  263|      2|{5, 0x7, 0x0, 0x0, 0x0, 0x4F, 7},
  |  |  264|      2|{5, 0x7, 0x1, 0x6, 0x6, 0x57, 7},
  |  |  265|      2|{5, 0x7, 0x1, 0x6, 0x4, 0x05, 6},
  |  |  266|      2|{5, 0x7, 0x1, 0x7, 0x3, 0x0F, 7},
  |  |  267|      2|{5, 0x7, 0x1, 0x7, 0x2, 0x77, 7},
  |  |  268|      2|{5, 0x7, 0x1, 0x7, 0x1, 0x37, 7},
  |  |  269|      2|{5, 0x8, 0x0, 0x0, 0x0, 0x02, 5},
  |  |  270|      2|{5, 0x8, 0x1, 0x8, 0x8, 0x19, 6},
  |  |  271|      2|{5, 0x9, 0x0, 0x0, 0x0, 0x26, 6},
  |  |  272|      2|{5, 0x9, 0x1, 0x8, 0x8, 0x17, 7},
  |  |  273|      2|{5, 0x9, 0x1, 0x9, 0x1, 0x67, 7},
  |  |  274|      2|{5, 0xA, 0x0, 0x0, 0x0, 0x1C, 5},
  |  |  275|      2|{5, 0xA, 0x1, 0xA, 0xA, 0x29, 6},
  |  |  276|      2|{5, 0xA, 0x1, 0xA, 0x2, 0x09, 6},
  |  |  277|      2|{5, 0xA, 0x1, 0xA, 0x8, 0x31, 6},
  |  |  278|      2|{5, 0xB, 0x0, 0x0, 0x0, 0x27, 7},
  |  |  279|      2|{5, 0xB, 0x1, 0x9, 0x9, 0x07, 7},
  |  |  280|      2|{5, 0xB, 0x1, 0x9, 0x8, 0x11, 6},
  |  |  281|      2|{5, 0xB, 0x1, 0xB, 0x3, 0x47, 7},
  |  |  282|      2|{5, 0xB, 0x1, 0xB, 0x2, 0x21, 6},
  |  |  283|      2|{5, 0xB, 0x1, 0xB, 0x1, 0x7B, 7},
  |  |  284|      2|{5, 0xC, 0x0, 0x0, 0x0, 0x01, 6},
  |  |  285|      2|{5, 0xC, 0x1, 0x8, 0x8, 0x3E, 6},
  |  |  286|      2|{5, 0xC, 0x1, 0xC, 0x4, 0x3B, 7},
  |  |  287|      2|{5, 0xD, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |  288|      2|{5, 0xD, 0x1, 0x9, 0x9, 0x6B, 7},
  |  |  289|      2|{5, 0xD, 0x1, 0x9, 0x8, 0x1E, 6},
  |  |  290|      2|{5, 0xD, 0x1, 0xD, 0x5, 0x1B, 7},
  |  |  291|      2|{5, 0xD, 0x1, 0xD, 0x4, 0x2E, 6},
  |  |  292|      2|{5, 0xD, 0x1, 0xD, 0x1, 0x2B, 7},
  |  |  293|      2|{5, 0xE, 0x0, 0x0, 0x0, 0x4B, 7},
  |  |  294|      2|{5, 0xE, 0x1, 0x6, 0x6, 0x0B, 7},
  |  |  295|      2|{5, 0xE, 0x1, 0xE, 0xA, 0x33, 7},
  |  |  296|      2|{5, 0xE, 0x1, 0xE, 0x2, 0x0E, 6},
  |  |  297|      2|{5, 0xE, 0x1, 0xE, 0xC, 0x73, 7},
  |  |  298|      2|{5, 0xE, 0x1, 0xE, 0x8, 0x36, 6},
  |  |  299|      2|{5, 0xE, 0x1, 0xE, 0x4, 0x53, 7},
  |  |  300|      2|{5, 0xF, 0x0, 0x0, 0x0, 0x13, 7},
  |  |  301|      2|{5, 0xF, 0x1, 0x7, 0x7, 0x43, 7},
  |  |  302|      2|{5, 0xF, 0x1, 0x7, 0x6, 0x16, 6},
  |  |  303|      2|{5, 0xF, 0x1, 0x7, 0x5, 0x63, 7},
  |  |  304|      2|{5, 0xF, 0x1, 0xF, 0xC, 0x23, 7},
  |  |  305|      2|{5, 0xF, 0x1, 0xF, 0x4, 0x0C, 5},
  |  |  306|      2|{5, 0xF, 0x1, 0xD, 0x9, 0x03, 7},
  |  |  307|      2|{5, 0xF, 0x1, 0xF, 0xA, 0x3D, 7},
  |  |  308|      2|{5, 0xF, 0x1, 0xF, 0x8, 0x14, 5},
  |  |  309|      2|{5, 0xF, 0x1, 0xF, 0x3, 0x7D, 7},
  |  |  310|      2|{5, 0xF, 0x1, 0xF, 0x2, 0x04, 5},
  |  |  311|      2|{5, 0xF, 0x1, 0xF, 0x1, 0x06, 6},
  |  |  312|      2|{6, 0x0, 0x0, 0x0, 0x0, 0x00, 3},
  |  |  313|      2|{6, 0x1, 0x0, 0x0, 0x0, 0x04, 4},
  |  |  314|      2|{6, 0x1, 0x1, 0x1, 0x1, 0x03, 6},
  |  |  315|      2|{6, 0x2, 0x0, 0x0, 0x0, 0x0C, 5},
  |  |  316|      2|{6, 0x2, 0x1, 0x2, 0x2, 0x0D, 6},
  |  |  317|      2|{6, 0x3, 0x0, 0x0, 0x0, 0x1A, 5},
  |  |  318|      2|{6, 0x3, 0x1, 0x3, 0x3, 0x3D, 6},
  |  |  319|      2|{6, 0x3, 0x1, 0x3, 0x1, 0x1D, 6},
  |  |  320|      2|{6, 0x3, 0x1, 0x3, 0x2, 0x2D, 6},
  |  |  321|      2|{6, 0x4, 0x0, 0x0, 0x0, 0x0A, 5},
  |  |  322|      2|{6, 0x4, 0x1, 0x4, 0x4, 0x3F, 7},
  |  |  323|      2|{6, 0x5, 0x0, 0x0, 0x0, 0x35, 6},
  |  |  324|      2|{6, 0x5, 0x1, 0x1, 0x1, 0x15, 6},
  |  |  325|      2|{6, 0x5, 0x1, 0x5, 0x4, 0x7F, 7},
  |  |  326|      2|{6, 0x6, 0x0, 0x0, 0x0, 0x25, 6},
  |  |  327|      2|{6, 0x6, 0x1, 0x2, 0x2, 0x5F, 7},
  |  |  328|      2|{6, 0x6, 0x1, 0x6, 0x4, 0x1F, 7},
  |  |  329|      2|{6, 0x7, 0x0, 0x0, 0x0, 0x6F, 7},
  |  |  330|      2|{6, 0x7, 0x1, 0x6, 0x6, 0x4F, 7},
  |  |  331|      2|{6, 0x7, 0x1, 0x6, 0x4, 0x05, 6},
  |  |  332|      2|{6, 0x7, 0x1, 0x7, 0x3, 0x2F, 7},
  |  |  333|      2|{6, 0x7, 0x1, 0x7, 0x1, 0x36, 6},
  |  |  334|      2|{6, 0x7, 0x1, 0x7, 0x2, 0x77, 7},
  |  |  335|      2|{6, 0x8, 0x0, 0x0, 0x0, 0x12, 5},
  |  |  336|      2|{6, 0x8, 0x1, 0x8, 0x8, 0x0F, 7},
  |  |  337|      2|{6, 0x9, 0x0, 0x0, 0x0, 0x39, 6},
  |  |  338|      2|{6, 0x9, 0x1, 0x1, 0x1, 0x37, 7},
  |  |  339|      2|{6, 0x9, 0x1, 0x9, 0x8, 0x57, 7},
  |  |  340|      2|{6, 0xA, 0x0, 0x0, 0x0, 0x19, 6},
  |  |  341|      2|{6, 0xA, 0x1, 0x2, 0x2, 0x29, 6},
  |  |  342|      2|{6, 0xA, 0x1, 0xA, 0x8, 0x17, 7},
  |  |  343|      2|{6, 0xB, 0x0, 0x0, 0x0, 0x67, 7},
  |  |  344|      2|{6, 0xB, 0x1, 0x9, 0x9, 0x47, 7},
  |  |  345|      2|{6, 0xB, 0x1, 0x9, 0x1, 0x09, 6},
  |  |  346|      2|{6, 0xB, 0x1, 0xB, 0xA, 0x27, 7},
  |  |  347|      2|{6, 0xB, 0x1, 0xB, 0x2, 0x31, 6},
  |  |  348|      2|{6, 0xB, 0x1, 0xB, 0x8, 0x7B, 7},
  |  |  349|      2|{6, 0xC, 0x0, 0x0, 0x0, 0x11, 6},
  |  |  350|      2|{6, 0xC, 0x1, 0xC, 0xC, 0x07, 7},
  |  |  351|      2|{6, 0xC, 0x1, 0xC, 0x8, 0x21, 6},
  |  |  352|      2|{6, 0xC, 0x1, 0xC, 0x4, 0x3B, 7},
  |  |  353|      2|{6, 0xD, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |  354|      2|{6, 0xD, 0x1, 0x5, 0x5, 0x33, 7},
  |  |  355|      2|{6, 0xD, 0x1, 0x5, 0x4, 0x01, 6},
  |  |  356|      2|{6, 0xD, 0x1, 0xC, 0x8, 0x1B, 7},
  |  |  357|      2|{6, 0xD, 0x1, 0xD, 0x1, 0x6B, 7},
  |  |  358|      2|{6, 0xE, 0x0, 0x0, 0x0, 0x2B, 7},
  |  |  359|      2|{6, 0xE, 0x1, 0xE, 0x2, 0x4B, 7},
  |  |  360|      2|{6, 0xE, 0x1, 0x2, 0x2, 0x0B, 7},
  |  |  361|      2|{6, 0xE, 0x1, 0xE, 0xC, 0x73, 7},
  |  |  362|      2|{6, 0xE, 0x1, 0xE, 0x8, 0x3E, 6},
  |  |  363|      2|{6, 0xE, 0x1, 0xE, 0x4, 0x53, 7},
  |  |  364|      2|{6, 0xF, 0x0, 0x0, 0x0, 0x13, 7},
  |  |  365|      2|{6, 0xF, 0x1, 0x6, 0x6, 0x1E, 6},
  |  |  366|      2|{6, 0xF, 0x1, 0xE, 0xA, 0x2E, 6},
  |  |  367|      2|{6, 0xF, 0x1, 0xF, 0x3, 0x0E, 6},
  |  |  368|      2|{6, 0xF, 0x1, 0xF, 0x2, 0x02, 5},
  |  |  369|      2|{6, 0xF, 0x1, 0xB, 0x9, 0x63, 7},
  |  |  370|      2|{6, 0xF, 0x1, 0xF, 0xC, 0x16, 6},
  |  |  371|      2|{6, 0xF, 0x1, 0xF, 0x8, 0x06, 6},
  |  |  372|      2|{6, 0xF, 0x1, 0xF, 0x5, 0x23, 7},
  |  |  373|      2|{6, 0xF, 0x1, 0xF, 0x1, 0x1C, 5},
  |  |  374|      2|{6, 0xF, 0x1, 0xF, 0x4, 0x26, 6},
  |  |  375|      2|{7, 0x0, 0x0, 0x0, 0x0, 0x12, 5},
  |  |  376|      2|{7, 0x1, 0x0, 0x0, 0x0, 0x05, 6},
  |  |  377|      2|{7, 0x1, 0x1, 0x1, 0x1, 0x7F, 7},
  |  |  378|      2|{7, 0x2, 0x0, 0x0, 0x0, 0x39, 6},
  |  |  379|      2|{7, 0x2, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |  380|      2|{7, 0x3, 0x0, 0x0, 0x0, 0x5F, 7},
  |  |  381|      2|{7, 0x3, 0x1, 0x3, 0x3, 0x1F, 7},
  |  |  382|      2|{7, 0x3, 0x1, 0x3, 0x2, 0x6F, 7},
  |  |  383|      2|{7, 0x3, 0x1, 0x3, 0x1, 0x2F, 7},
  |  |  384|      2|{7, 0x4, 0x0, 0x0, 0x0, 0x4F, 7},
  |  |  385|      2|{7, 0x4, 0x1, 0x4, 0x4, 0x0F, 7},
  |  |  386|      2|{7, 0x5, 0x0, 0x0, 0x0, 0x57, 7},
  |  |  387|      2|{7, 0x5, 0x1, 0x1, 0x1, 0x19, 6},
  |  |  388|      2|{7, 0x5, 0x1, 0x5, 0x4, 0x77, 7},
  |  |  389|      2|{7, 0x6, 0x0, 0x0, 0x0, 0x37, 7},
  |  |  390|      2|{7, 0x6, 0x1, 0x0, 0x0, 0x29, 6},
  |  |  391|      2|{7, 0x7, 0x0, 0x0, 0x0, 0x17, 7},
  |  |  392|      2|{7, 0x7, 0x1, 0x6, 0x6, 0x67, 7},
  |  |  393|      2|{7, 0x7, 0x1, 0x7, 0x3, 0x27, 7},
  |  |  394|      2|{7, 0x7, 0x1, 0x7, 0x2, 0x47, 7},
  |  |  395|      2|{7, 0x7, 0x1, 0x7, 0x5, 0x1B, 7},
  |  |  396|      2|{7, 0x7, 0x1, 0x7, 0x1, 0x09, 6},
  |  |  397|      2|{7, 0x7, 0x1, 0x7, 0x4, 0x07, 7},
  |  |  398|      2|{7, 0x8, 0x0, 0x0, 0x0, 0x7B, 7},
  |  |  399|      2|{7, 0x8, 0x1, 0x8, 0x8, 0x3B, 7},
  |  |  400|      2|{7, 0x9, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |  401|      2|{7, 0x9, 0x1, 0x0, 0x0, 0x31, 6},
  |  |  402|      2|{7, 0xA, 0x0, 0x0, 0x0, 0x53, 7},
  |  |  403|      2|{7, 0xA, 0x1, 0x2, 0x2, 0x11, 6},
  |  |  404|      2|{7, 0xA, 0x1, 0xA, 0x8, 0x6B, 7},
  |  |  405|      2|{7, 0xB, 0x0, 0x0, 0x0, 0x2B, 7},
  |  |  406|      2|{7, 0xB, 0x1, 0x9, 0x9, 0x4B, 7},
  |  |  407|      2|{7, 0xB, 0x1, 0xB, 0x3, 0x0B, 7},
  |  |  408|      2|{7, 0xB, 0x1, 0xB, 0x1, 0x73, 7},
  |  |  409|      2|{7, 0xB, 0x1, 0xB, 0xA, 0x33, 7},
  |  |  410|      2|{7, 0xB, 0x1, 0xB, 0x2, 0x21, 6},
  |  |  411|      2|{7, 0xB, 0x1, 0xB, 0x8, 0x13, 7},
  |  |  412|      2|{7, 0xC, 0x0, 0x0, 0x0, 0x63, 7},
  |  |  413|      2|{7, 0xC, 0x1, 0x8, 0x8, 0x23, 7},
  |  |  414|      2|{7, 0xC, 0x1, 0xC, 0x4, 0x43, 7},
  |  |  415|      2|{7, 0xD, 0x0, 0x0, 0x0, 0x03, 7},
  |  |  416|      2|{7, 0xD, 0x1, 0x9, 0x9, 0x7D, 7},
  |  |  417|      2|{7, 0xD, 0x1, 0xD, 0x5, 0x5D, 7},
  |  |  418|      2|{7, 0xD, 0x1, 0xD, 0x1, 0x01, 6},
  |  |  419|      2|{7, 0xD, 0x1, 0xD, 0xC, 0x3D, 7},
  |  |  420|      2|{7, 0xD, 0x1, 0xD, 0x4, 0x3E, 6},
  |  |  421|      2|{7, 0xD, 0x1, 0xD, 0x8, 0x1D, 7},
  |  |  422|      2|{7, 0xE, 0x0, 0x0, 0x0, 0x6D, 7},
  |  |  423|      2|{7, 0xE, 0x1, 0x6, 0x6, 0x2D, 7},
  |  |  424|      2|{7, 0xE, 0x1, 0xE, 0xA, 0x0D, 7},
  |  |  425|      2|{7, 0xE, 0x1, 0xE, 0x2, 0x1E, 6},
  |  |  426|      2|{7, 0xE, 0x1, 0xE, 0xC, 0x4D, 7},
  |  |  427|      2|{7, 0xE, 0x1, 0xE, 0x8, 0x0E, 6},
  |  |  428|      2|{7, 0xE, 0x1, 0xE, 0x4, 0x75, 7},
  |  |  429|      2|{7, 0xF, 0x0, 0x0, 0x0, 0x15, 7},
  |  |  430|      2|{7, 0xF, 0x1, 0xF, 0xF, 0x06, 5},
  |  |  431|      2|{7, 0xF, 0x1, 0xF, 0xD, 0x35, 7},
  |  |  432|      2|{7, 0xF, 0x1, 0xF, 0x7, 0x55, 7},
  |  |  433|      2|{7, 0xF, 0x1, 0xF, 0x5, 0x1A, 5},
  |  |  434|      2|{7, 0xF, 0x1, 0xF, 0xB, 0x25, 7},
  |  |  435|      2|{7, 0xF, 0x1, 0xF, 0x3, 0x0A, 5},
  |  |  436|      2|{7, 0xF, 0x1, 0xF, 0x9, 0x2E, 6},
  |  |  437|      2|{7, 0xF, 0x1, 0xF, 0x1, 0x00, 4},
  |  |  438|      2|{7, 0xF, 0x1, 0xF, 0xE, 0x65, 7},
  |  |  439|      2|{7, 0xF, 0x1, 0xF, 0x6, 0x36, 6},
  |  |  440|      2|{7, 0xF, 0x1, 0xF, 0xA, 0x02, 5},
  |  |  441|      2|{7, 0xF, 0x1, 0xF, 0x2, 0x0C, 4},
  |  |  442|      2|{7, 0xF, 0x1, 0xF, 0xC, 0x16, 6},
  |  |  443|      2|{7, 0xF, 0x1, 0xF, 0x8, 0x04, 4},
  |  |  444|      2|{7, 0xF, 0x1, 0xF, 0x4, 0x08, 4}
  ------------------
  132|      2|      };
  133|       |      // number of entries in the table
  134|      2|      size_t tbl0_size = sizeof(tbl0) / sizeof(vlc_src_table); 
  135|       |
  136|       |      // nono-initial quad rows
  137|      2|      vlc_src_table tbl1[] = {
  138|      2|    #include "table1.h"
  ------------------
  |  |    1|      2|{0, 0x1, 0x0, 0x0, 0x0, 0x00, 3},
  |  |    2|      2|{0, 0x1, 0x1, 0x1, 0x1, 0x27, 6},
  |  |    3|      2|{0, 0x2, 0x0, 0x0, 0x0, 0x06, 3},
  |  |    4|      2|{0, 0x2, 0x1, 0x2, 0x2, 0x17, 6},
  |  |    5|      2|{0, 0x3, 0x0, 0x0, 0x0, 0x0D, 5},
  |  |    6|      2|{0, 0x3, 0x1, 0x0, 0x0, 0x3B, 6},
  |  |    7|      2|{0, 0x4, 0x0, 0x0, 0x0, 0x02, 3},
  |  |    8|      2|{0, 0x4, 0x1, 0x4, 0x4, 0x07, 6},
  |  |    9|      2|{0, 0x5, 0x0, 0x0, 0x0, 0x15, 5},
  |  |   10|      2|{0, 0x5, 0x1, 0x0, 0x0, 0x2B, 6},
  |  |   11|      2|{0, 0x6, 0x0, 0x0, 0x0, 0x01, 5},
  |  |   12|      2|{0, 0x6, 0x1, 0x0, 0x0, 0x7F, 7},
  |  |   13|      2|{0, 0x7, 0x0, 0x0, 0x0, 0x1F, 7},
  |  |   14|      2|{0, 0x7, 0x1, 0x0, 0x0, 0x1B, 6},
  |  |   15|      2|{0, 0x8, 0x0, 0x0, 0x0, 0x04, 3},
  |  |   16|      2|{0, 0x8, 0x1, 0x8, 0x8, 0x05, 5},
  |  |   17|      2|{0, 0x9, 0x0, 0x0, 0x0, 0x19, 5},
  |  |   18|      2|{0, 0x9, 0x1, 0x0, 0x0, 0x13, 6},
  |  |   19|      2|{0, 0xA, 0x0, 0x0, 0x0, 0x09, 5},
  |  |   20|      2|{0, 0xA, 0x1, 0x8, 0x8, 0x0B, 6},
  |  |   21|      2|{0, 0xA, 0x1, 0xA, 0x2, 0x3F, 7},
  |  |   22|      2|{0, 0xB, 0x0, 0x0, 0x0, 0x5F, 7},
  |  |   23|      2|{0, 0xB, 0x1, 0x0, 0x0, 0x33, 6},
  |  |   24|      2|{0, 0xC, 0x0, 0x0, 0x0, 0x11, 5},
  |  |   25|      2|{0, 0xC, 0x1, 0x8, 0x8, 0x23, 6},
  |  |   26|      2|{0, 0xC, 0x1, 0xC, 0x4, 0x6F, 7},
  |  |   27|      2|{0, 0xD, 0x0, 0x0, 0x0, 0x0F, 7},
  |  |   28|      2|{0, 0xD, 0x1, 0x0, 0x0, 0x03, 6},
  |  |   29|      2|{0, 0xE, 0x0, 0x0, 0x0, 0x2F, 7},
  |  |   30|      2|{0, 0xE, 0x1, 0x4, 0x4, 0x4F, 7},
  |  |   31|      2|{0, 0xE, 0x1, 0x4, 0x0, 0x3D, 6},
  |  |   32|      2|{0, 0xF, 0x0, 0x0, 0x0, 0x77, 7},
  |  |   33|      2|{0, 0xF, 0x1, 0x1, 0x1, 0x37, 7},
  |  |   34|      2|{0, 0xF, 0x1, 0x1, 0x0, 0x1D, 6},
  |  |   35|      2|{1, 0x0, 0x0, 0x0, 0x0, 0x00, 1},
  |  |   36|      2|{1, 0x1, 0x0, 0x0, 0x0, 0x05, 4},
  |  |   37|      2|{1, 0x1, 0x1, 0x1, 0x1, 0x7F, 7},
  |  |   38|      2|{1, 0x2, 0x0, 0x0, 0x0, 0x09, 4},
  |  |   39|      2|{1, 0x2, 0x1, 0x2, 0x2, 0x1F, 7},
  |  |   40|      2|{1, 0x3, 0x0, 0x0, 0x0, 0x1D, 5},
  |  |   41|      2|{1, 0x3, 0x1, 0x1, 0x1, 0x3F, 7},
  |  |   42|      2|{1, 0x3, 0x1, 0x3, 0x2, 0x5F, 7},
  |  |   43|      2|{1, 0x4, 0x0, 0x0, 0x0, 0x0D, 5},
  |  |   44|      2|{1, 0x4, 0x1, 0x4, 0x4, 0x37, 7},
  |  |   45|      2|{1, 0x5, 0x0, 0x0, 0x0, 0x03, 6},
  |  |   46|      2|{1, 0x5, 0x1, 0x0, 0x0, 0x6F, 7},
  |  |   47|      2|{1, 0x6, 0x0, 0x0, 0x0, 0x2F, 7},
  |  |   48|      2|{1, 0x6, 0x1, 0x0, 0x0, 0x4F, 7},
  |  |   49|      2|{1, 0x7, 0x0, 0x0, 0x0, 0x0F, 7},
  |  |   50|      2|{1, 0x7, 0x1, 0x0, 0x0, 0x77, 7},
  |  |   51|      2|{1, 0x8, 0x0, 0x0, 0x0, 0x01, 4},
  |  |   52|      2|{1, 0x8, 0x1, 0x8, 0x8, 0x17, 7},
  |  |   53|      2|{1, 0x9, 0x0, 0x0, 0x0, 0x0B, 6},
  |  |   54|      2|{1, 0x9, 0x1, 0x0, 0x0, 0x57, 7},
  |  |   55|      2|{1, 0xA, 0x0, 0x0, 0x0, 0x33, 6},
  |  |   56|      2|{1, 0xA, 0x1, 0x0, 0x0, 0x67, 7},
  |  |   57|      2|{1, 0xB, 0x0, 0x0, 0x0, 0x27, 7},
  |  |   58|      2|{1, 0xB, 0x1, 0x0, 0x0, 0x2B, 7},
  |  |   59|      2|{1, 0xC, 0x0, 0x0, 0x0, 0x13, 6},
  |  |   60|      2|{1, 0xC, 0x1, 0x0, 0x0, 0x47, 7},
  |  |   61|      2|{1, 0xD, 0x0, 0x0, 0x0, 0x07, 7},
  |  |   62|      2|{1, 0xD, 0x1, 0x0, 0x0, 0x7B, 7},
  |  |   63|      2|{1, 0xE, 0x0, 0x0, 0x0, 0x3B, 7},
  |  |   64|      2|{1, 0xE, 0x1, 0x0, 0x0, 0x5B, 7},
  |  |   65|      2|{1, 0xF, 0x0, 0x0, 0x0, 0x1B, 7},
  |  |   66|      2|{1, 0xF, 0x1, 0x4, 0x4, 0x6B, 7},
  |  |   67|      2|{1, 0xF, 0x1, 0x4, 0x0, 0x23, 6},
  |  |   68|      2|{2, 0x0, 0x0, 0x0, 0x0, 0x00, 1},
  |  |   69|      2|{2, 0x1, 0x0, 0x0, 0x0, 0x09, 4},
  |  |   70|      2|{2, 0x1, 0x1, 0x1, 0x1, 0x7F, 7},
  |  |   71|      2|{2, 0x2, 0x0, 0x0, 0x0, 0x01, 4},
  |  |   72|      2|{2, 0x2, 0x1, 0x2, 0x2, 0x23, 6},
  |  |   73|      2|{2, 0x3, 0x0, 0x0, 0x0, 0x3D, 6},
  |  |   74|      2|{2, 0x3, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |   75|      2|{2, 0x3, 0x1, 0x3, 0x1, 0x1F, 7},
  |  |   76|      2|{2, 0x4, 0x0, 0x0, 0x0, 0x15, 5},
  |  |   77|      2|{2, 0x4, 0x1, 0x4, 0x4, 0x5F, 7},
  |  |   78|      2|{2, 0x5, 0x0, 0x0, 0x0, 0x03, 6},
  |  |   79|      2|{2, 0x5, 0x1, 0x0, 0x0, 0x6F, 7},
  |  |   80|      2|{2, 0x6, 0x0, 0x0, 0x0, 0x2F, 7},
  |  |   81|      2|{2, 0x6, 0x1, 0x0, 0x0, 0x4F, 7},
  |  |   82|      2|{2, 0x7, 0x0, 0x0, 0x0, 0x0F, 7},
  |  |   83|      2|{2, 0x7, 0x1, 0x0, 0x0, 0x17, 7},
  |  |   84|      2|{2, 0x8, 0x0, 0x0, 0x0, 0x05, 5},
  |  |   85|      2|{2, 0x8, 0x1, 0x8, 0x8, 0x77, 7},
  |  |   86|      2|{2, 0x9, 0x0, 0x0, 0x0, 0x37, 7},
  |  |   87|      2|{2, 0x9, 0x1, 0x0, 0x0, 0x57, 7},
  |  |   88|      2|{2, 0xA, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |   89|      2|{2, 0xA, 0x1, 0xA, 0xA, 0x7B, 7},
  |  |   90|      2|{2, 0xA, 0x1, 0xA, 0x2, 0x2D, 6},
  |  |   91|      2|{2, 0xA, 0x1, 0xA, 0x8, 0x67, 7},
  |  |   92|      2|{2, 0xB, 0x0, 0x0, 0x0, 0x27, 7},
  |  |   93|      2|{2, 0xB, 0x1, 0xB, 0x2, 0x47, 7},
  |  |   94|      2|{2, 0xB, 0x1, 0x0, 0x0, 0x07, 7},
  |  |   95|      2|{2, 0xC, 0x0, 0x0, 0x0, 0x0D, 6},
  |  |   96|      2|{2, 0xC, 0x1, 0x0, 0x0, 0x3B, 7},
  |  |   97|      2|{2, 0xD, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |   98|      2|{2, 0xD, 0x1, 0x0, 0x0, 0x1B, 7},
  |  |   99|      2|{2, 0xE, 0x0, 0x0, 0x0, 0x6B, 7},
  |  |  100|      2|{2, 0xE, 0x1, 0x4, 0x4, 0x2B, 7},
  |  |  101|      2|{2, 0xE, 0x1, 0x4, 0x0, 0x4B, 7},
  |  |  102|      2|{2, 0xF, 0x0, 0x0, 0x0, 0x0B, 7},
  |  |  103|      2|{2, 0xF, 0x1, 0x4, 0x4, 0x73, 7},
  |  |  104|      2|{2, 0xF, 0x1, 0x5, 0x1, 0x33, 7},
  |  |  105|      2|{2, 0xF, 0x1, 0x7, 0x2, 0x53, 7},
  |  |  106|      2|{2, 0xF, 0x1, 0xF, 0x8, 0x13, 7},
  |  |  107|      2|{3, 0x0, 0x0, 0x0, 0x0, 0x00, 2},
  |  |  108|      2|{3, 0x1, 0x0, 0x0, 0x0, 0x0A, 4},
  |  |  109|      2|{3, 0x1, 0x1, 0x1, 0x1, 0x0B, 6},
  |  |  110|      2|{3, 0x2, 0x0, 0x0, 0x0, 0x02, 4},
  |  |  111|      2|{3, 0x2, 0x1, 0x2, 0x2, 0x23, 6},
  |  |  112|      2|{3, 0x3, 0x0, 0x0, 0x0, 0x0E, 5},
  |  |  113|      2|{3, 0x3, 0x1, 0x3, 0x3, 0x7F, 7},
  |  |  114|      2|{3, 0x3, 0x1, 0x3, 0x2, 0x33, 6},
  |  |  115|      2|{3, 0x3, 0x1, 0x3, 0x1, 0x13, 6},
  |  |  116|      2|{3, 0x4, 0x0, 0x0, 0x0, 0x16, 5},
  |  |  117|      2|{3, 0x4, 0x1, 0x4, 0x4, 0x3F, 7},
  |  |  118|      2|{3, 0x5, 0x0, 0x0, 0x0, 0x03, 6},
  |  |  119|      2|{3, 0x5, 0x1, 0x1, 0x1, 0x3D, 6},
  |  |  120|      2|{3, 0x5, 0x1, 0x5, 0x4, 0x1F, 7},
  |  |  121|      2|{3, 0x6, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  122|      2|{3, 0x6, 0x1, 0x0, 0x0, 0x5F, 7},
  |  |  123|      2|{3, 0x7, 0x0, 0x0, 0x0, 0x2D, 6},
  |  |  124|      2|{3, 0x7, 0x1, 0x4, 0x4, 0x2F, 7},
  |  |  125|      2|{3, 0x7, 0x1, 0x5, 0x1, 0x1E, 6},
  |  |  126|      2|{3, 0x7, 0x1, 0x7, 0x2, 0x6F, 7},
  |  |  127|      2|{3, 0x8, 0x0, 0x0, 0x0, 0x06, 5},
  |  |  128|      2|{3, 0x8, 0x1, 0x8, 0x8, 0x4F, 7},
  |  |  129|      2|{3, 0x9, 0x0, 0x0, 0x0, 0x0D, 6},
  |  |  130|      2|{3, 0x9, 0x1, 0x0, 0x0, 0x35, 6},
  |  |  131|      2|{3, 0xA, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  132|      2|{3, 0xA, 0x1, 0x2, 0x2, 0x25, 6},
  |  |  133|      2|{3, 0xA, 0x1, 0xA, 0x8, 0x0F, 7},
  |  |  134|      2|{3, 0xB, 0x0, 0x0, 0x0, 0x05, 6},
  |  |  135|      2|{3, 0xB, 0x1, 0x8, 0x8, 0x39, 6},
  |  |  136|      2|{3, 0xB, 0x1, 0xB, 0x3, 0x17, 7},
  |  |  137|      2|{3, 0xB, 0x1, 0xB, 0x2, 0x19, 6},
  |  |  138|      2|{3, 0xB, 0x1, 0xB, 0x1, 0x77, 7},
  |  |  139|      2|{3, 0xC, 0x0, 0x0, 0x0, 0x29, 6},
  |  |  140|      2|{3, 0xC, 0x1, 0x0, 0x0, 0x09, 6},
  |  |  141|      2|{3, 0xD, 0x0, 0x0, 0x0, 0x37, 7},
  |  |  142|      2|{3, 0xD, 0x1, 0x4, 0x4, 0x57, 7},
  |  |  143|      2|{3, 0xD, 0x1, 0x4, 0x0, 0x31, 6},
  |  |  144|      2|{3, 0xE, 0x0, 0x0, 0x0, 0x67, 7},
  |  |  145|      2|{3, 0xE, 0x1, 0x4, 0x4, 0x27, 7},
  |  |  146|      2|{3, 0xE, 0x1, 0xC, 0x8, 0x47, 7},
  |  |  147|      2|{3, 0xE, 0x1, 0xE, 0x2, 0x6B, 7},
  |  |  148|      2|{3, 0xF, 0x0, 0x0, 0x0, 0x11, 6},
  |  |  149|      2|{3, 0xF, 0x1, 0x6, 0x6, 0x07, 7},
  |  |  150|      2|{3, 0xF, 0x1, 0x7, 0x3, 0x7B, 7},
  |  |  151|      2|{3, 0xF, 0x1, 0xF, 0xA, 0x3B, 7},
  |  |  152|      2|{3, 0xF, 0x1, 0xF, 0x2, 0x21, 6},
  |  |  153|      2|{3, 0xF, 0x1, 0xF, 0x8, 0x01, 6},
  |  |  154|      2|{3, 0xF, 0x1, 0xA, 0x8, 0x5B, 7},
  |  |  155|      2|{3, 0xF, 0x1, 0xF, 0x5, 0x1B, 7},
  |  |  156|      2|{3, 0xF, 0x1, 0xF, 0x1, 0x3E, 6},
  |  |  157|      2|{3, 0xF, 0x1, 0xF, 0x4, 0x2B, 7},
  |  |  158|      2|{4, 0x0, 0x0, 0x0, 0x0, 0x00, 1},
  |  |  159|      2|{4, 0x1, 0x0, 0x0, 0x0, 0x0D, 5},
  |  |  160|      2|{4, 0x1, 0x1, 0x1, 0x1, 0x7F, 7},
  |  |  161|      2|{4, 0x2, 0x0, 0x0, 0x0, 0x15, 5},
  |  |  162|      2|{4, 0x2, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |  163|      2|{4, 0x3, 0x0, 0x0, 0x0, 0x5F, 7},
  |  |  164|      2|{4, 0x3, 0x1, 0x0, 0x0, 0x6F, 7},
  |  |  165|      2|{4, 0x4, 0x0, 0x0, 0x0, 0x09, 4},
  |  |  166|      2|{4, 0x4, 0x1, 0x4, 0x4, 0x23, 6},
  |  |  167|      2|{4, 0x5, 0x0, 0x0, 0x0, 0x33, 6},
  |  |  168|      2|{4, 0x5, 0x1, 0x0, 0x0, 0x1F, 7},
  |  |  169|      2|{4, 0x6, 0x0, 0x0, 0x0, 0x13, 6},
  |  |  170|      2|{4, 0x6, 0x1, 0x0, 0x0, 0x2F, 7},
  |  |  171|      2|{4, 0x7, 0x0, 0x0, 0x0, 0x4F, 7},
  |  |  172|      2|{4, 0x7, 0x1, 0x0, 0x0, 0x57, 7},
  |  |  173|      2|{4, 0x8, 0x0, 0x0, 0x0, 0x01, 4},
  |  |  174|      2|{4, 0x8, 0x1, 0x8, 0x8, 0x0F, 7},
  |  |  175|      2|{4, 0x9, 0x0, 0x0, 0x0, 0x77, 7},
  |  |  176|      2|{4, 0x9, 0x1, 0x0, 0x0, 0x37, 7},
  |  |  177|      2|{4, 0xA, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  178|      2|{4, 0xA, 0x1, 0x0, 0x0, 0x17, 7},
  |  |  179|      2|{4, 0xB, 0x0, 0x0, 0x0, 0x67, 7},
  |  |  180|      2|{4, 0xB, 0x1, 0x0, 0x0, 0x6B, 7},
  |  |  181|      2|{4, 0xC, 0x0, 0x0, 0x0, 0x05, 5},
  |  |  182|      2|{4, 0xC, 0x1, 0xC, 0xC, 0x27, 7},
  |  |  183|      2|{4, 0xC, 0x1, 0xC, 0x8, 0x47, 7},
  |  |  184|      2|{4, 0xC, 0x1, 0xC, 0x4, 0x07, 7},
  |  |  185|      2|{4, 0xD, 0x0, 0x0, 0x0, 0x7B, 7},
  |  |  186|      2|{4, 0xD, 0x1, 0x0, 0x0, 0x3B, 7},
  |  |  187|      2|{4, 0xE, 0x0, 0x0, 0x0, 0x5B, 7},
  |  |  188|      2|{4, 0xE, 0x1, 0x2, 0x2, 0x1B, 7},
  |  |  189|      2|{4, 0xE, 0x1, 0x2, 0x0, 0x03, 6},
  |  |  190|      2|{4, 0xF, 0x0, 0x0, 0x0, 0x2B, 7},
  |  |  191|      2|{4, 0xF, 0x1, 0x1, 0x1, 0x4B, 7},
  |  |  192|      2|{4, 0xF, 0x1, 0x3, 0x2, 0x0B, 7},
  |  |  193|      2|{4, 0xF, 0x1, 0x3, 0x0, 0x3D, 6},
  |  |  194|      2|{5, 0x0, 0x0, 0x0, 0x0, 0x00, 2},
  |  |  195|      2|{5, 0x1, 0x0, 0x0, 0x0, 0x1E, 5},
  |  |  196|      2|{5, 0x1, 0x1, 0x1, 0x1, 0x3B, 6},
  |  |  197|      2|{5, 0x2, 0x0, 0x0, 0x0, 0x0A, 5},
  |  |  198|      2|{5, 0x2, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |  199|      2|{5, 0x3, 0x0, 0x0, 0x0, 0x1B, 6},
  |  |  200|      2|{5, 0x3, 0x1, 0x0, 0x0, 0x0B, 6},
  |  |  201|      2|{5, 0x4, 0x0, 0x0, 0x0, 0x02, 4},
  |  |  202|      2|{5, 0x4, 0x1, 0x4, 0x4, 0x2B, 6},
  |  |  203|      2|{5, 0x5, 0x0, 0x0, 0x0, 0x0E, 5},
  |  |  204|      2|{5, 0x5, 0x1, 0x4, 0x4, 0x33, 6},
  |  |  205|      2|{5, 0x5, 0x1, 0x5, 0x1, 0x7F, 7},
  |  |  206|      2|{5, 0x6, 0x0, 0x0, 0x0, 0x13, 6},
  |  |  207|      2|{5, 0x6, 0x1, 0x0, 0x0, 0x6F, 7},
  |  |  208|      2|{5, 0x7, 0x0, 0x0, 0x0, 0x23, 6},
  |  |  209|      2|{5, 0x7, 0x1, 0x2, 0x2, 0x5F, 7},
  |  |  210|      2|{5, 0x7, 0x1, 0x2, 0x0, 0x15, 6},
  |  |  211|      2|{5, 0x8, 0x0, 0x0, 0x0, 0x16, 5},
  |  |  212|      2|{5, 0x8, 0x1, 0x8, 0x8, 0x03, 6},
  |  |  213|      2|{5, 0x9, 0x0, 0x0, 0x0, 0x3D, 6},
  |  |  214|      2|{5, 0x9, 0x1, 0x0, 0x0, 0x1F, 7},
  |  |  215|      2|{5, 0xA, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  216|      2|{5, 0xA, 0x1, 0x0, 0x0, 0x2D, 6},
  |  |  217|      2|{5, 0xB, 0x0, 0x0, 0x0, 0x0D, 6},
  |  |  218|      2|{5, 0xB, 0x1, 0x1, 0x1, 0x4F, 7},
  |  |  219|      2|{5, 0xB, 0x1, 0x1, 0x0, 0x35, 6},
  |  |  220|      2|{5, 0xC, 0x0, 0x0, 0x0, 0x06, 5},
  |  |  221|      2|{5, 0xC, 0x1, 0x4, 0x4, 0x25, 6},
  |  |  222|      2|{5, 0xC, 0x1, 0xC, 0x8, 0x2F, 7},
  |  |  223|      2|{5, 0xD, 0x0, 0x0, 0x0, 0x05, 6},
  |  |  224|      2|{5, 0xD, 0x1, 0x1, 0x1, 0x77, 7},
  |  |  225|      2|{5, 0xD, 0x1, 0x5, 0x4, 0x39, 6},
  |  |  226|      2|{5, 0xD, 0x1, 0xD, 0x8, 0x0F, 7},
  |  |  227|      2|{5, 0xE, 0x0, 0x0, 0x0, 0x19, 6},
  |  |  228|      2|{5, 0xE, 0x1, 0x2, 0x2, 0x57, 7},
  |  |  229|      2|{5, 0xE, 0x1, 0xA, 0x8, 0x01, 6},
  |  |  230|      2|{5, 0xE, 0x1, 0xE, 0x4, 0x37, 7},
  |  |  231|      2|{5, 0xF, 0x0, 0x0, 0x0, 0x1A, 5},
  |  |  232|      2|{5, 0xF, 0x1, 0x9, 0x9, 0x17, 7},
  |  |  233|      2|{5, 0xF, 0x1, 0xD, 0x5, 0x67, 7},
  |  |  234|      2|{5, 0xF, 0x1, 0xF, 0x3, 0x07, 7},
  |  |  235|      2|{5, 0xF, 0x1, 0xF, 0x1, 0x29, 6},
  |  |  236|      2|{5, 0xF, 0x1, 0x7, 0x6, 0x27, 7},
  |  |  237|      2|{5, 0xF, 0x1, 0xF, 0xC, 0x09, 6},
  |  |  238|      2|{5, 0xF, 0x1, 0xF, 0x4, 0x31, 6},
  |  |  239|      2|{5, 0xF, 0x1, 0xF, 0xA, 0x47, 7},
  |  |  240|      2|{5, 0xF, 0x1, 0xF, 0x8, 0x11, 6},
  |  |  241|      2|{5, 0xF, 0x1, 0xF, 0x2, 0x21, 6},
  |  |  242|      2|{6, 0x0, 0x0, 0x0, 0x0, 0x00, 3},
  |  |  243|      2|{6, 0x1, 0x0, 0x0, 0x0, 0x02, 4},
  |  |  244|      2|{6, 0x1, 0x1, 0x1, 0x1, 0x03, 6},
  |  |  245|      2|{6, 0x2, 0x0, 0x0, 0x0, 0x0C, 4},
  |  |  246|      2|{6, 0x2, 0x1, 0x2, 0x2, 0x3D, 6},
  |  |  247|      2|{6, 0x3, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  248|      2|{6, 0x3, 0x1, 0x2, 0x2, 0x0D, 6},
  |  |  249|      2|{6, 0x3, 0x1, 0x3, 0x1, 0x7F, 7},
  |  |  250|      2|{6, 0x4, 0x0, 0x0, 0x0, 0x04, 4},
  |  |  251|      2|{6, 0x4, 0x1, 0x4, 0x4, 0x2D, 6},
  |  |  252|      2|{6, 0x5, 0x0, 0x0, 0x0, 0x0A, 5},
  |  |  253|      2|{6, 0x5, 0x1, 0x4, 0x4, 0x35, 6},
  |  |  254|      2|{6, 0x5, 0x1, 0x5, 0x1, 0x2F, 7},
  |  |  255|      2|{6, 0x6, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  256|      2|{6, 0x6, 0x1, 0x2, 0x2, 0x3F, 7},
  |  |  257|      2|{6, 0x6, 0x1, 0x6, 0x4, 0x5F, 7},
  |  |  258|      2|{6, 0x7, 0x0, 0x0, 0x0, 0x25, 6},
  |  |  259|      2|{6, 0x7, 0x1, 0x2, 0x2, 0x29, 6},
  |  |  260|      2|{6, 0x7, 0x1, 0x3, 0x1, 0x1F, 7},
  |  |  261|      2|{6, 0x7, 0x1, 0x7, 0x4, 0x6F, 7},
  |  |  262|      2|{6, 0x8, 0x0, 0x0, 0x0, 0x16, 5},
  |  |  263|      2|{6, 0x8, 0x1, 0x8, 0x8, 0x05, 6},
  |  |  264|      2|{6, 0x9, 0x0, 0x0, 0x0, 0x39, 6},
  |  |  265|      2|{6, 0x9, 0x1, 0x0, 0x0, 0x19, 6},
  |  |  266|      2|{6, 0xA, 0x0, 0x0, 0x0, 0x06, 5},
  |  |  267|      2|{6, 0xA, 0x1, 0xA, 0xA, 0x0F, 7},
  |  |  268|      2|{6, 0xA, 0x1, 0xA, 0x2, 0x09, 6},
  |  |  269|      2|{6, 0xA, 0x1, 0xA, 0x8, 0x4F, 7},
  |  |  270|      2|{6, 0xB, 0x0, 0x0, 0x0, 0x0E, 6},
  |  |  271|      2|{6, 0xB, 0x1, 0xB, 0x2, 0x77, 7},
  |  |  272|      2|{6, 0xB, 0x1, 0x2, 0x2, 0x37, 7},
  |  |  273|      2|{6, 0xB, 0x1, 0xA, 0x8, 0x57, 7},
  |  |  274|      2|{6, 0xB, 0x1, 0xB, 0x1, 0x47, 7},
  |  |  275|      2|{6, 0xC, 0x0, 0x0, 0x0, 0x1A, 5},
  |  |  276|      2|{6, 0xC, 0x1, 0xC, 0xC, 0x17, 7},
  |  |  277|      2|{6, 0xC, 0x1, 0xC, 0x8, 0x67, 7},
  |  |  278|      2|{6, 0xC, 0x1, 0xC, 0x4, 0x27, 7},
  |  |  279|      2|{6, 0xD, 0x0, 0x0, 0x0, 0x31, 6},
  |  |  280|      2|{6, 0xD, 0x1, 0xD, 0x4, 0x07, 7},
  |  |  281|      2|{6, 0xD, 0x1, 0x4, 0x4, 0x7B, 7},
  |  |  282|      2|{6, 0xD, 0x1, 0xC, 0x8, 0x3B, 7},
  |  |  283|      2|{6, 0xD, 0x1, 0xD, 0x1, 0x2B, 7},
  |  |  284|      2|{6, 0xE, 0x0, 0x0, 0x0, 0x11, 6},
  |  |  285|      2|{6, 0xE, 0x1, 0xE, 0x4, 0x5B, 7},
  |  |  286|      2|{6, 0xE, 0x1, 0x4, 0x4, 0x1B, 7},
  |  |  287|      2|{6, 0xE, 0x1, 0xE, 0xA, 0x6B, 7},
  |  |  288|      2|{6, 0xE, 0x1, 0xE, 0x8, 0x21, 6},
  |  |  289|      2|{6, 0xE, 0x1, 0xE, 0x2, 0x33, 7},
  |  |  290|      2|{6, 0xF, 0x0, 0x0, 0x0, 0x01, 6},
  |  |  291|      2|{6, 0xF, 0x1, 0x3, 0x3, 0x4B, 7},
  |  |  292|      2|{6, 0xF, 0x1, 0x7, 0x6, 0x0B, 7},
  |  |  293|      2|{6, 0xF, 0x1, 0xF, 0xA, 0x73, 7},
  |  |  294|      2|{6, 0xF, 0x1, 0xF, 0x2, 0x3E, 6},
  |  |  295|      2|{6, 0xF, 0x1, 0xB, 0x9, 0x53, 7},
  |  |  296|      2|{6, 0xF, 0x1, 0xF, 0xC, 0x63, 7},
  |  |  297|      2|{6, 0xF, 0x1, 0xF, 0x8, 0x1E, 6},
  |  |  298|      2|{6, 0xF, 0x1, 0xF, 0x5, 0x13, 7},
  |  |  299|      2|{6, 0xF, 0x1, 0xF, 0x4, 0x2E, 6},
  |  |  300|      2|{6, 0xF, 0x1, 0xF, 0x1, 0x23, 7},
  |  |  301|      2|{7, 0x0, 0x0, 0x0, 0x0, 0x04, 4},
  |  |  302|      2|{7, 0x1, 0x0, 0x0, 0x0, 0x33, 6},
  |  |  303|      2|{7, 0x1, 0x1, 0x1, 0x1, 0x13, 6},
  |  |  304|      2|{7, 0x2, 0x0, 0x0, 0x0, 0x23, 6},
  |  |  305|      2|{7, 0x2, 0x1, 0x2, 0x2, 0x7F, 7},
  |  |  306|      2|{7, 0x3, 0x0, 0x0, 0x0, 0x03, 6},
  |  |  307|      2|{7, 0x3, 0x1, 0x1, 0x1, 0x3F, 7},
  |  |  308|      2|{7, 0x3, 0x1, 0x3, 0x2, 0x6F, 7},
  |  |  309|      2|{7, 0x4, 0x0, 0x0, 0x0, 0x2D, 6},
  |  |  310|      2|{7, 0x4, 0x1, 0x4, 0x4, 0x5F, 7},
  |  |  311|      2|{7, 0x5, 0x0, 0x0, 0x0, 0x16, 5},
  |  |  312|      2|{7, 0x5, 0x1, 0x1, 0x1, 0x3D, 6},
  |  |  313|      2|{7, 0x5, 0x1, 0x5, 0x4, 0x1F, 7},
  |  |  314|      2|{7, 0x6, 0x0, 0x0, 0x0, 0x1D, 6},
  |  |  315|      2|{7, 0x6, 0x1, 0x0, 0x0, 0x77, 7},
  |  |  316|      2|{7, 0x7, 0x0, 0x0, 0x0, 0x06, 5},
  |  |  317|      2|{7, 0x7, 0x1, 0x7, 0x4, 0x2F, 7},
  |  |  318|      2|{7, 0x7, 0x1, 0x4, 0x4, 0x4F, 7},
  |  |  319|      2|{7, 0x7, 0x1, 0x7, 0x3, 0x0F, 7},
  |  |  320|      2|{7, 0x7, 0x1, 0x7, 0x1, 0x0D, 6},
  |  |  321|      2|{7, 0x7, 0x1, 0x7, 0x2, 0x57, 7},
  |  |  322|      2|{7, 0x8, 0x0, 0x0, 0x0, 0x35, 6},
  |  |  323|      2|{7, 0x8, 0x1, 0x8, 0x8, 0x37, 7},
  |  |  324|      2|{7, 0x9, 0x0, 0x0, 0x0, 0x15, 6},
  |  |  325|      2|{7, 0x9, 0x1, 0x0, 0x0, 0x27, 7},
  |  |  326|      2|{7, 0xA, 0x0, 0x0, 0x0, 0x25, 6},
  |  |  327|      2|{7, 0xA, 0x1, 0x0, 0x0, 0x29, 6},
  |  |  328|      2|{7, 0xB, 0x0, 0x0, 0x0, 0x1A, 5},
  |  |  329|      2|{7, 0xB, 0x1, 0xB, 0x1, 0x17, 7},
  |  |  330|      2|{7, 0xB, 0x1, 0x1, 0x1, 0x67, 7},
  |  |  331|      2|{7, 0xB, 0x1, 0x3, 0x2, 0x05, 6},
  |  |  332|      2|{7, 0xB, 0x1, 0xB, 0x8, 0x7B, 7},
  |  |  333|      2|{7, 0xC, 0x0, 0x0, 0x0, 0x39, 6},
  |  |  334|      2|{7, 0xC, 0x1, 0x0, 0x0, 0x19, 6},
  |  |  335|      2|{7, 0xD, 0x0, 0x0, 0x0, 0x0C, 5},
  |  |  336|      2|{7, 0xD, 0x1, 0xD, 0x1, 0x47, 7},
  |  |  337|      2|{7, 0xD, 0x1, 0x1, 0x1, 0x07, 7},
  |  |  338|      2|{7, 0xD, 0x1, 0x5, 0x4, 0x09, 6},
  |  |  339|      2|{7, 0xD, 0x1, 0xD, 0x8, 0x1B, 7},
  |  |  340|      2|{7, 0xE, 0x0, 0x0, 0x0, 0x31, 6},
  |  |  341|      2|{7, 0xE, 0x1, 0xE, 0x2, 0x3B, 7},
  |  |  342|      2|{7, 0xE, 0x1, 0x2, 0x2, 0x5B, 7},
  |  |  343|      2|{7, 0xE, 0x1, 0xA, 0x8, 0x3E, 6},
  |  |  344|      2|{7, 0xE, 0x1, 0xE, 0x4, 0x0B, 7},
  |  |  345|      2|{7, 0xF, 0x0, 0x0, 0x0, 0x00, 3},
  |  |  346|      2|{7, 0xF, 0x1, 0xF, 0xF, 0x6B, 7},
  |  |  347|      2|{7, 0xF, 0x1, 0xF, 0x7, 0x2B, 7},
  |  |  348|      2|{7, 0xF, 0x1, 0xF, 0xB, 0x4B, 7},
  |  |  349|      2|{7, 0xF, 0x1, 0xF, 0x3, 0x11, 6},
  |  |  350|      2|{7, 0xF, 0x1, 0x7, 0x6, 0x21, 6},
  |  |  351|      2|{7, 0xF, 0x1, 0xF, 0xA, 0x01, 6},
  |  |  352|      2|{7, 0xF, 0x1, 0xF, 0x2, 0x0A, 5},
  |  |  353|      2|{7, 0xF, 0x1, 0xB, 0x9, 0x1E, 6},
  |  |  354|      2|{7, 0xF, 0x1, 0xF, 0xC, 0x0E, 6},
  |  |  355|      2|{7, 0xF, 0x1, 0xF, 0x8, 0x12, 5},
  |  |  356|      2|{7, 0xF, 0x1, 0xF, 0x5, 0x2E, 6},
  |  |  357|      2|{7, 0xF, 0x1, 0xF, 0x1, 0x02, 5},
  |  |  358|      2|{7, 0xF, 0x1, 0xF, 0x4, 0x1C, 5}
  ------------------
  139|      2|      };
  140|       |      // number of entries in the table
  141|      2|      size_t tbl1_size = sizeof(tbl1) / sizeof(vlc_src_table);
  142|       |
  143|      2|      if (debug) memset(vlc_tbl0, 0, sizeof(vlc_tbl0)); //unnecessary
  ------------------
  |  Branch (143:11): [Folded, False: 2]
  ------------------
  144|       |
  145|       |      // this is to convert table entries into values for decoder look up
  146|       |      // There can be at most 1024 possibilities, not all of them are valid.
  147|       |      // 
  148|  2.05k|      for (int i = 0; i < 1024; ++i)
  ------------------
  |  Branch (148:23): [True: 2.04k, False: 2]
  ------------------
  149|  2.04k|      {
  150|  2.04k|        int cwd = i & 0x7F; // from i extract codeword
  151|  2.04k|        int c_q = i >> 7;   // from i extract context
  152|       |        // See if this case exist in the table, if so then set the entry in
  153|       |        // vlc_tbl0
  154|   911k|        for (size_t j = 0; j < tbl0_size; ++j) 
  ------------------
  |  Branch (154:28): [True: 909k, False: 2.04k]
  ------------------
  155|   909k|          if (tbl0[j].c_q == c_q) // this is an and operation
  ------------------
  |  Branch (155:15): [True: 113k, False: 795k]
  ------------------
  156|   113k|            if (tbl0[j].cwd == (cwd & ((1 << tbl0[j].cwd_len) - 1)))
  ------------------
  |  Branch (156:17): [True: 2.04k, False: 111k]
  ------------------
  157|  2.04k|            {
  158|  2.04k|              if (debug) assert(vlc_tbl0[i] == 0);
  ------------------
  |  Branch (158:19): [Folded, False: 2.04k]
  ------------------
  159|       |              // Put this entry into the table
  160|  2.04k|              vlc_tbl0[i] = (ui16)((tbl0[j].rho << 4) | (tbl0[j].u_off << 3)
  161|  2.04k|                | (tbl0[j].e_k << 12) | (tbl0[j].e_1 << 8) | tbl0[j].cwd_len);
  162|  2.04k|            }
  163|  2.04k|      }
  164|       |
  165|      2|      if (debug) memset(vlc_tbl1, 0, sizeof(vlc_tbl1)); //unnecessary
  ------------------
  |  Branch (165:11): [Folded, False: 2]
  ------------------
  166|       |
  167|       |      // this the same as above but for non-initial rows
  168|  2.05k|      for (int i = 0; i < 1024; ++i)
  ------------------
  |  Branch (168:23): [True: 2.04k, False: 2]
  ------------------
  169|  2.04k|      {
  170|  2.04k|        int cwd = i & 0x7F; //7 bits
  171|  2.04k|        int c_q = i >> 7;
  172|   735k|        for (size_t j = 0; j < tbl1_size; ++j)
  ------------------
  |  Branch (172:28): [True: 733k, False: 2.04k]
  ------------------
  173|   733k|          if (tbl1[j].c_q == c_q) // this is an and operation
  ------------------
  |  Branch (173:15): [True: 91.6k, False: 641k]
  ------------------
  174|  91.6k|            if (tbl1[j].cwd == (cwd & ((1 << tbl1[j].cwd_len) - 1)))
  ------------------
  |  Branch (174:17): [True: 2.04k, False: 89.6k]
  ------------------
  175|  2.04k|            {
  176|  2.04k|              if (debug) assert(vlc_tbl1[i] == 0);
  ------------------
  |  Branch (176:19): [Folded, False: 2.04k]
  ------------------
  177|  2.04k|              vlc_tbl1[i] = (ui16)((tbl1[j].rho << 4) | (tbl1[j].u_off << 3)
  178|  2.04k|                | (tbl1[j].e_k << 12) | (tbl1[j].e_1 << 8) | tbl1[j].cwd_len);
  179|  2.04k|            }
  180|  2.04k|      }
  181|       |
  182|      2|      return true;
  183|      2|    }
ojph_block_common.cpp:_ZN4ojph5localL16uvlc_init_tablesEv:
  190|      2|    {
  191|       |      // table stores possible decoding three bits from vlc
  192|       |      // there are 8 entries for xx1, x10, 100, 000, where x means do not
  193|       |      // care table value is made up of
  194|       |      // 2 bits in the LSB for prefix length 
  195|       |      // 3 bits for suffix length
  196|       |      // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  197|      2|      static const ui8 dec[8] = { // the index is the prefix codeword
  198|      2|        3 | (5 << 2) | (5 << 5), //000 == 000, prefix codeword "000"
  199|      2|        1 | (0 << 2) | (1 << 5), //001 == xx1, prefix codeword "1"
  200|      2|        2 | (0 << 2) | (2 << 5), //010 == x10, prefix codeword "01"
  201|      2|        1 | (0 << 2) | (1 << 5), //011 == xx1, prefix codeword "1"
  202|      2|        3 | (1 << 2) | (3 << 5), //100 == 100, prefix codeword "001"
  203|      2|        1 | (0 << 2) | (1 << 5), //101 == xx1, prefix codeword "1"
  204|      2|        2 | (0 << 2) | (2 << 5), //110 == x10, prefix codeword "01"
  205|      2|        1 | (0 << 2) | (1 << 5)  //111 == xx1, prefix codeword "1"
  206|      2|      };
  207|       |
  208|    642|      for (ui32 i = 0; i < 256 + 64; ++i)
  ------------------
  |  Branch (208:24): [True: 640, False: 2]
  ------------------
  209|    640|      { 
  210|    640|        ui32 mode = i >> 6;
  211|    640|        ui32 vlc = i & 0x3F;
  212|       |
  213|    640|        if (mode == 0) {      // both u_off are 0
  ------------------
  |  Branch (213:13): [True: 128, False: 512]
  ------------------
  214|    128|          uvlc_tbl0[i] = 0;
  215|    128|          uvlc_bias[i] = 0;
  216|    128|        }
  217|    512|        else if (mode <= 2) // u_off are either 01 or 10
  ------------------
  |  Branch (217:18): [True: 256, False: 256]
  ------------------
  218|    256|        {
  219|    256|          ui32 d = dec[vlc & 0x7];   //look at the least significant 3 bits
  220|       |
  221|    256|          ui32 total_prefix = d & 0x3;
  222|    256|          ui32 total_suffix = (d >> 2) & 0x7;
  223|    256|          ui32 u0_suffix_len = (mode == 1) ? total_suffix : 0;
  ------------------
  |  Branch (223:32): [True: 128, False: 128]
  ------------------
  224|    256|          ui32 u0 = (mode == 1) ? (d >> 5) : 0;
  ------------------
  |  Branch (224:21): [True: 128, False: 128]
  ------------------
  225|    256|          ui32 u1 = (mode == 1) ? 0 : (d >> 5);
  ------------------
  |  Branch (225:21): [True: 128, False: 128]
  ------------------
  226|       |
  227|    256|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  228|    256|                               (total_suffix << 3) |
  229|    256|                               (u0_suffix_len << 7) |
  230|    256|                               (u0 << 10) |
  231|    256|                               (u1 << 13));
  232|       |          
  233|    256|        }
  234|    256|        else if (mode == 3) // both u_off are 1, and MEL event is 0
  ------------------
  |  Branch (234:18): [True: 128, False: 128]
  ------------------
  235|    128|        {
  236|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  237|    128|          vlc >>= d0 & 0x3;          // Consume bits
  238|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  239|       |
  240|    128|          ui32 total_prefix, u0_suffix_len, total_suffix, u0, u1;
  241|    128|          if ((d0 & 0x3) == 3)
  ------------------
  |  Branch (241:15): [True: 32, False: 96]
  ------------------
  242|     32|          {
  243|     32|            total_prefix = (d0 & 0x3) + 1;
  244|     32|            u0_suffix_len = (d0 >> 2) & 0x7;
  245|     32|            total_suffix = u0_suffix_len;
  246|     32|            u0 = d0 >> 5;
  247|     32|            u1 = (vlc & 1) + 1;
  248|     32|            uvlc_bias[i] = 4; // 0b00 for u0 and 0b01 for u1
  249|     32|          }
  250|     96|          else
  251|     96|          {
  252|     96|            total_prefix = (d0 & 0x3) + (d1 & 0x3);
  253|     96|            u0_suffix_len = (d0 >> 2) & 0x7;
  254|     96|            total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  255|     96|            u0 = d0 >> 5;
  256|     96|            u1 = d1 >> 5;
  257|     96|            uvlc_bias[i] = 0;
  258|     96|          }
  259|       |
  260|    128|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  261|    128|                               (total_suffix << 3) |
  262|    128|                               (u0_suffix_len << 7) |
  263|    128|                               (u0 << 10) |
  264|    128|                               (u1 << 13));
  265|    128|        }
  266|    128|        else if (mode == 4) // both u_off are 1, and MEL event is 1
  ------------------
  |  Branch (266:18): [True: 128, False: 0]
  ------------------
  267|    128|        {
  268|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  269|    128|          vlc >>= d0 & 0x3;          // Consume bits
  270|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  271|       |
  272|    128|          ui32 total_prefix = (d0 & 0x3) + (d1 & 0x3);
  273|    128|          ui32 u0_suffix_len = (d0 >> 2) & 0x7;
  274|    128|          ui32 total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  275|    128|          ui32 u0 = (d0 >> 5) + 2;
  276|    128|          ui32 u1 = (d1 >> 5) + 2;
  277|       |
  278|    128|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  279|    128|                               (total_suffix << 3) |
  280|    128|                               (u0_suffix_len << 7) |
  281|    128|                               (u0 << 10) |
  282|    128|                               (u1 << 13));
  283|    128|          uvlc_bias[i] = 10; // 0b10 for u0 and 0b10 for u1
  284|    128|        }
  285|    640|      }
  286|       |
  287|    514|      for (ui32 i = 0; i < 256; ++i)
  ------------------
  |  Branch (287:24): [True: 512, False: 2]
  ------------------
  288|    512|      {
  289|    512|        ui32 mode = i >> 6;
  290|    512|        ui32 vlc = i & 0x3F;
  291|       |
  292|    512|        if (mode == 0)       // both u_off are 0
  ------------------
  |  Branch (292:13): [True: 128, False: 384]
  ------------------
  293|    128|          uvlc_tbl1[i] = 0;
  294|    384|        else if (mode <= 2)  // u_off are either 01 or 10
  ------------------
  |  Branch (294:18): [True: 256, False: 128]
  ------------------
  295|    256|        {
  296|    256|          ui32 d = dec[vlc & 0x7];   // look at the 3 LSB bits
  297|       |
  298|    256|          ui32 total_prefix = d & 0x3;
  299|    256|          ui32 total_suffix = (d >> 2) & 0x7;
  300|    256|          ui32 u0_suffix_len = (mode == 1) ? total_suffix : 0;
  ------------------
  |  Branch (300:32): [True: 128, False: 128]
  ------------------
  301|    256|          ui32 u0 = (mode == 1) ? (d >> 5) : 0;
  ------------------
  |  Branch (301:21): [True: 128, False: 128]
  ------------------
  302|    256|          ui32 u1 = (mode == 1) ? 0 : (d >> 5);
  ------------------
  |  Branch (302:21): [True: 128, False: 128]
  ------------------
  303|       |
  304|    256|          uvlc_tbl1[i] = (ui16)(total_prefix | 
  305|    256|                               (total_suffix << 3) |
  306|    256|                               (u0_suffix_len << 7) |
  307|    256|                               (u0 << 10) |
  308|    256|                               (u1 << 13));
  309|    256|        }
  310|    128|        else if (mode == 3) // both u_off are 1
  ------------------
  |  Branch (310:18): [True: 128, False: 0]
  ------------------
  311|    128|        {
  312|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  313|    128|          vlc >>= d0 & 0x3;          // Consume bits
  314|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  315|       |
  316|    128|          ui32 total_prefix = (d0 & 0x3) + (d1 & 0x3);
  317|    128|          ui32 u0_suffix_len = (d0 >> 2) & 0x7;
  318|    128|          ui32 total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  319|    128|          ui32 u0 = d0 >> 5;
  320|    128|          ui32 u1 = d1 >> 5;
  321|       |
  322|    128|          uvlc_tbl1[i] = (ui16)(total_prefix | 
  323|    128|                               (total_suffix << 3) |
  324|    128|                               (u0_suffix_len << 7) |
  325|    128|                               (u0 << 10) |
  326|    128|                               (u1 << 13));
  327|    128|        }
  328|    512|      }
  329|      2|      return true;
  330|      2|    }

ojph_codestream.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_local.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_params.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_tile.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_tile_comp.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_file.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_mem.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_message.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_colour.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_colour_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_colour_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_colour_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_colour_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_transform_avx512.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_resolution.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_subband.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_arch.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codeblock.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codeblock_fun.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_gen.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_precinct.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_decoder32.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_decoder64.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_encoder.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_decoder_ssse3.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_codestream_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_decoder_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_encoder_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }
ojph_block_encoder_avx512.cpp:_ZN4ojphL19count_leading_zerosEj:
  178|      2|  {
  179|       |  #ifdef OJPH_COMPILER_MSVC
  180|       |    unsigned long result = 0;
  181|       |    _BitScanReverse(&result, val);
  182|       |    return 31 ^ (ui32)result;
  183|       |  #elif (defined OJPH_COMPILER_GNUC)
  184|       |    return (ui32)__builtin_clz(val);
  185|       |  #else
  186|       |    val |= (val >> 1);
  187|       |    val |= (val >> 2);
  188|       |    val |= (val >> 4);
  189|       |    val |= (val >> 8);
  190|       |    val |= (val >> 16);
  191|       |    return 32 - population_count(val);
  192|       |  #endif
  193|      2|  }

_ZN4ojph9run_cpuidEjjPj:
   53|      4|  {
   54|       |  #ifdef OJPH_COMPILER_MSVC
   55|       |    __cpuidex((int *)abcd, eax, ecx);
   56|       |  #else
   57|      4|    uint32_t ebx = 0, edx = 0;
   58|       |  #if defined( __i386__ ) && defined ( __PIC__ )
   59|       |    /* in case of PIC under 32-bit EBX cannot be clobbered */
   60|       |    __asm__ ( "movl %%ebx, %%edi \n\t cpuid \n\t xchgl %%ebx, %%edi"
   61|       |              : "=D" (ebx), "+a" (eax), "+c" (ecx), "=d" (edx) );
   62|       |  #else
   63|      4|    __asm__ ( "cpuid" : "+b" (ebx), "+a" (eax), "+c" (ecx), "=d" (edx) );
   64|      4|  #endif
   65|      4|    abcd[0] = eax; abcd[1] = ebx; abcd[2] = ecx; abcd[3] = edx;
   66|      4|  #endif
   67|      4|    return true;
   68|      4|  }
_ZN4ojph8read_xcrEj:
   72|      2|  {
   73|       |  #ifdef OJPH_COMPILER_MSVC
   74|       |    return _xgetbv(index);
   75|       |  #else
   76|      2|    uint32_t eax = 0, edx = 0;
   77|      2|    __asm__ ( "xgetbv" : "=a" (eax), "=d" (edx) : "c" (index) );
   78|      2|    return ((uint64_t)edx << 32) | eax;
   79|      2|  #endif
   80|      2|  }
_ZN4ojph18init_cpu_ext_levelERi:
   84|      2|  {
   85|      2|    uint32_t mmx_abcd[4];
   86|      2|    run_cpuid(1, 0, mmx_abcd);
   87|      2|    bool mmx_avail = ((mmx_abcd[3] & 0x00800000) == 0x00800000);
   88|       |
   89|      2|    level = 0;
   90|      2|    if (mmx_avail)
  ------------------
  |  Branch (90:9): [True: 2, False: 0]
  ------------------
   91|      2|    {
   92|      2|      level = X86_CPU_EXT_LEVEL_MMX;
   93|      2|      bool sse_avail = ((mmx_abcd[3] & 0x02000000) == 0x02000000);
   94|      2|      if (sse_avail)
  ------------------
  |  Branch (94:11): [True: 2, False: 0]
  ------------------
   95|      2|      {
   96|      2|        level = X86_CPU_EXT_LEVEL_SSE;
   97|      2|        bool sse2_avail = ((mmx_abcd[3] & 0x04000000) == 0x04000000);
   98|      2|        if (sse2_avail)
  ------------------
  |  Branch (98:13): [True: 2, False: 0]
  ------------------
   99|      2|        {
  100|      2|          level = X86_CPU_EXT_LEVEL_SSE2;
  101|      2|          bool sse3_avail = ((mmx_abcd[2] & 0x00000001) == 0x00000001);
  102|      2|          if (sse3_avail)
  ------------------
  |  Branch (102:15): [True: 2, False: 0]
  ------------------
  103|      2|          {
  104|      2|            level = X86_CPU_EXT_LEVEL_SSE3;
  105|      2|            bool ssse3_avail = ((mmx_abcd[2] & 0x00000200) == 0x00000200);
  106|      2|            if (ssse3_avail)
  ------------------
  |  Branch (106:17): [True: 2, False: 0]
  ------------------
  107|      2|            {
  108|      2|              level = X86_CPU_EXT_LEVEL_SSSE3;
  109|      2|              bool sse41_avail = ((mmx_abcd[2] & 0x00080000) == 0x00080000);
  110|      2|              if (sse41_avail) {
  ------------------
  |  Branch (110:19): [True: 2, False: 0]
  ------------------
  111|      2|                level = X86_CPU_EXT_LEVEL_SSE41;
  112|      2|                bool sse42_avail = ((mmx_abcd[2] & 0x00100000) == 0x00100000);
  113|      2|                if (sse42_avail)
  ------------------
  |  Branch (113:21): [True: 2, False: 0]
  ------------------
  114|      2|                {
  115|      2|                  level = X86_CPU_EXT_LEVEL_SSE42;
  116|       |                  
  117|      2|                  uint64_t xcr_val = 0;
  118|      2|                  bool osxsave_avail, ymm_avail, avx_avail = false;
  119|      2|                  osxsave_avail = ((mmx_abcd[2] & 0x08000000) == 0x08000000);
  120|      2|                  if (osxsave_avail)
  ------------------
  |  Branch (120:23): [True: 2, False: 0]
  ------------------
  121|      2|                  {
  122|      2|                    xcr_val = read_xcr(0); // _XCR_XFEATURE_ENABLED_MASK = 0
  123|      2|                    ymm_avail = osxsave_avail && ((xcr_val & 0x6) == 0x6);
  ------------------
  |  Branch (123:33): [True: 2, False: 0]
  |  Branch (123:50): [True: 2, False: 0]
  ------------------
  124|      2|                    avx_avail = ymm_avail && (mmx_abcd[2] & 0x10000000);
  ------------------
  |  Branch (124:33): [True: 2, False: 0]
  |  Branch (124:46): [True: 2, False: 0]
  ------------------
  125|      2|                  }
  126|      2|                  if (avx_avail)
  ------------------
  |  Branch (126:23): [True: 2, False: 0]
  ------------------
  127|      2|                  {
  128|      2|                    level = X86_CPU_EXT_LEVEL_AVX;
  129|       |
  130|      2|                    uint32_t avx2_abcd[4];
  131|      2|                    run_cpuid(7, 0, avx2_abcd);
  132|      2|                    bool avx2_avail = (avx2_abcd[1] & 0x20) != 0;
  133|      2|                    if (avx2_avail)
  ------------------
  |  Branch (133:25): [True: 2, False: 0]
  ------------------
  134|      2|                    {
  135|      2|                      level = X86_CPU_EXT_LEVEL_AVX2;
  136|      2|                      bool avx2fma_avail =
  137|      2|                        avx2_avail && ((mmx_abcd[2] & 0x1000) == 0x1000);
  ------------------
  |  Branch (137:25): [True: 2, False: 0]
  |  Branch (137:39): [True: 2, False: 0]
  ------------------
  138|      2|                      if (avx2fma_avail)
  ------------------
  |  Branch (138:27): [True: 2, False: 0]
  ------------------
  139|      2|                      {
  140|      2|                        level = X86_CPU_EXT_LEVEL_AVX2FMA;
  141|       |
  142|      2|                        bool zmm_avail =
  143|      2|                          osxsave_avail && ((xcr_val & 0xE0) == 0xE0);
  ------------------
  |  Branch (143:27): [True: 2, False: 0]
  |  Branch (143:44): [True: 0, False: 2]
  ------------------
  144|      2|                        bool avx512f_avail = (avx2_abcd[1] & 0x10000) != 0;
  145|      2|                        bool avx512cd_avail = (avx2_abcd[1] & 0x10000000) != 0;
  146|      2|                        bool avx512_avail = 
  147|      2|                          zmm_avail && avx512f_avail && avx512cd_avail;
  ------------------
  |  Branch (147:27): [True: 0, False: 2]
  |  Branch (147:40): [True: 0, False: 0]
  |  Branch (147:57): [True: 0, False: 0]
  ------------------
  148|      2|                        if (avx512_avail)
  ------------------
  |  Branch (148:29): [True: 0, False: 2]
  ------------------
  149|      0|                          level = X86_CPU_EXT_LEVEL_AVX512;
  150|      2|                      }
  151|      2|                    }
  152|      2|                  }
  153|      2|                }
  154|      2|              }
  155|      2|            }
  156|      2|          }
  157|      2|        }
  158|      2|      }
  159|      2|    }
  160|      2|    return true;
  161|      2|  }

_ZN5vvdec12PelBufferOpsC2Ev:
  341|      2|{
  342|      2|  addAvg4  = addAvgCore<Pel>;
  343|      2|  addAvg8  = addAvgCore<Pel>;
  344|      2|  addAvg16 = addAvgCore<Pel>;
  345|       |
  346|      2|  reco4 = reconstructCore<Pel>;
  347|      2|  reco8 = reconstructCore<Pel>;
  348|       |
  349|      2|  linTf4 = linTfCore<Pel>;
  350|      2|  linTf8 = linTfCore<Pel>;
  351|       |
  352|      2|  wghtAvg4 = addWeightedAvgCore<Pel>;
  353|      2|  wghtAvg8 = addWeightedAvgCore<Pel>;
  354|       |
  355|      2|  copyBuffer = copyBufferCore;
  356|       |
  357|      2|  transpose4x4 = transpose4x4Core<Pel>;
  358|      2|  transpose8x8 = transpose8x8Core<Pel>;
  359|       |
  360|      2|  applyLut = applyLutCore;
  361|      2|  rspFwd   = rspFwdCore;
  362|      2|  rspBcw   = nullptr;
  363|       |
  364|      2|  fillN_CU = fillN_CuCore;
  365|       |
  366|      2|  sampleRateConv = sampleRateConvCore;
  367|      2|}

_ZN5vvdec6CtxSetC2ESt16initializer_listIS0_E:
   82|      4|{
   83|      4|  uint16_t minOffset = std::numeric_limits<uint16_t>::max();
   84|      4|  uint16_t maxOffset = 0;
   85|      4|  for( auto& set: ctxSets )
  ------------------
  |  Branch (85:17): [True: 10, False: 4]
  ------------------
   86|     10|  {
   87|     10|    minOffset = std::min<uint16_t>( minOffset, set.Offset );
   88|     10|    maxOffset = std::max<uint16_t>( maxOffset, set.Offset + set.Size );
   89|     10|  }
   90|      4|  Offset = minOffset;
   91|      4|  Size   = maxOffset - minOffset;
   92|      4|}
_ZN5vvdec13ContextSetCfg9addCtxSetESt16initializer_listIS1_IhEE:
  103|    164|{
  104|    164|  const std::size_t startIdx  = sm_InitTables[0].size();
  105|    164|  const std::size_t numValues = ( *initSet2d.begin() ).size();
  106|    164|        std::size_t setId     = 0;
  107|    164|  for( auto& initSet: initSet2d )
  ------------------
  |  Branch (107:21): [True: 656, False: 164]
  ------------------
  108|    656|  {
  109|    656|    if( setId >= sm_InitTables.size() )
  ------------------
  |  Branch (109:9): [True: 0, False: 656]
  ------------------
  110|      0|      break;
  111|       |
  112|    656|    CHECK( initSet.size() != numValues,
  ------------------
  |  |  830|    656|#define CHECK( cond, msg )             { if UNLIKELY( cond ) { THROW_RECOVERABLE( msg << "\nERROR CONDITION: "   << #cond ); } }
  |  |  ------------------
  |  |  |  |  793|    656|#    define UNLIKELY( expr ) ( expr ) [[unlikely]]
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (793:32): [True: 0, False: 656]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CHECK( cond, msg )             { if UNLIKELY( cond ) { THROW_RECOVERABLE( msg << "\nERROR CONDITION: "   << #cond ); } }
  |  |  ------------------
  |  |  |  |  820|      0|#  define THROW_RECOVERABLE( msg )     throw( RecoverableException       ( "\nERROR: " ) << FMT_ERROR_LOCATION << msg )
  |  |  |  |  ------------------
  |  |  |  |  |  |  813|      0|#define FMT_ERROR_LOCATION "In function \"" << __PRETTY_FUNCTION__ << "\" in " << __FILE__ ":" << __LINE__ << ": "
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  113|    656|                       "Number of init values do not match for all sets (" << initSet.size() << " != " << numValues << ")." );
  114|       |
  115|    656|    for( auto& elemIter: initSet )
  ------------------
  |  Branch (115:24): [True: 2.97k, False: 656]
  ------------------
  116|  2.97k|    {
  117|  2.97k|      sm_InitTables[setId].push_back( elemIter );
  118|  2.97k|    }
  119|       |
  120|    656|    setId++;
  121|    656|  }
  122|    164|  return CtxSet( (uint16_t)startIdx, (uint16_t)numValues );
  123|    164|}

_ZN5vvdec6CtxSetC2Ett:
  154|    164|  CtxSet( uint16_t offset, uint16_t size ) : Offset( offset ), Size( size ) {}

_ZN5vvdec9TCoeffOpsC2Ev:
  408|      2|{
  409|      2|  cpyResiClip[0] = cpyResiClipCore; //  1
  410|      2|  cpyResiClip[1] = cpyResiClipCore; //  2
  411|      2|  cpyResiClip[2] = cpyResiClipCore; //  4
  412|      2|  cpyResiClip[3] = cpyResiClipCore; //  8
  413|      2|  cpyResiClip[4] = cpyResiClipCore; // 16
  414|      2|  cpyResiClip[5] = cpyResiClipCore; // 32
  415|      2|  cpyResiClip[6] = cpyResiClipCore; // 64
  416|      2|  roundClip4     = clipCore;
  417|      2|  roundClip8     = clipCore;
  418|      2|  fastInvCore[0] = fastInvCore_< 4>;
  419|      2|  fastInvCore[1] = fastInvCore_< 8>;
  420|      2|  fastInvCore[2] = fastInvCore_<16>;
  421|      2|  fastInvCore[3] = fastInvCore_<32>;
  422|      2|  fastInvCore[4] = fastInvCore_<64>;
  423|      2|}

ThreadPool.cpp:_ZNK5vvdec3$_0clEv:
   59|      2|const static auto VVDEC_BUSY_WAIT_TIME_MIN = [] {
   60|      2|  const char* env = getenv( "VVDEC_BUSY_WAIT_TIME_MIN" );
   61|      2|  if( env )
  ------------------
  |  Branch (61:7): [True: 0, False: 2]
  ------------------
   62|      0|    return std::chrono::microseconds( int( atof( env ) * 1000 ) );
   63|      2|  return std::chrono::microseconds( 1ms );
   64|      2|}();
ThreadPool.cpp:_ZNK5vvdec3$_1clEv:
   67|      2|const static auto VVDEC_BUSY_WAIT_TIME_MAX = [] {
   68|      2|  const char* env = getenv( "VVDEC_BUSY_WAIT_TIME_MAX" );
   69|      2|  if( env )
  ------------------
  |  Branch (69:7): [True: 0, False: 2]
  ------------------
   70|      0|    return atoi( env ) * 1ms;
   71|      2|  return 5ms;
   72|      2|}();

_ZN5vvenc12PelBufferOpsC2Ev:
  449|      2|{
  450|      2|  isInitX86Done = false;
  451|       |
  452|      2|  addAvg            = addAvgCore<Pel>;
  453|      2|  reco              = recoCore<Pel>;
  454|      2|  copyClip          = copyClipCore<Pel>;
  455|      2|  roundGeo          = roundGeoCore<Pel>;
  456|       |
  457|      2|  addAvg4           = addAvgCore<Pel>;
  458|      2|  addAvg8           = addAvgCore<Pel>;
  459|      2|  addAvg16          = addAvgCore<Pel>;
  460|       |
  461|      2|  sub4              = subsCore<Pel>;
  462|      2|  sub8              = subsCore<Pel>;
  463|       |
  464|      2|  wghtAvg4          = addWeightedAvgCore<Pel>;
  465|      2|  wghtAvg8          = addWeightedAvgCore<Pel>;
  466|       |
  467|      2|  copyClip4         = copyClipCore<Pel>;
  468|      2|  copyClip8         = copyClipCore<Pel>;
  469|       |
  470|      2|  reco4             = reconstructCore<Pel>;
  471|      2|  reco8             = reconstructCore<Pel>;
  472|       |
  473|      2|  linTf4            = linTfCore<Pel>;
  474|      2|  linTf8            = linTfCore<Pel>;
  475|       |
  476|      2|  copyBuffer        = copyBufferCore;
  477|       |
  478|      2|  removeHighFreq8   = removeHighFreq;
  479|      2|  removeHighFreq4   = removeHighFreq;
  480|       |
  481|      2|  transpose4x4      = transposeNxNCore<Pel,4>;
  482|      2|  transpose8x8      = transposeNxNCore<Pel,8>;
  483|      2|  mipMatrixMul_4_4  = mipMatrixMulCore<4,4>;
  484|      2|  mipMatrixMul_8_4  = mipMatrixMulCore<8,4>;
  485|      2|  mipMatrixMul_8_8  = mipMatrixMulCore<8,8>;
  486|      2|  weightCiip        = weightCiipCore;
  487|      2|  roundIntVector    = nullptr;
  488|       |
  489|      2|  applyLut          = applyLutCore;
  490|       |
  491|      2|  fillPtrMap        = fillMapPtr_Core;
  492|      2|  AvgHighPassWithDownsampling = AvgHighPassWithDownsamplingCore;
  493|      2|  AvgHighPass = AvgHighPassCore;
  494|      2|  AvgHighPassWithDownsamplingDiff1st = AvgHighPassWithDownsamplingDiff1stCore;
  495|      2|  AvgHighPassWithDownsamplingDiff2nd = AvgHighPassWithDownsamplingDiff2ndCore;
  496|      2|  HDHighPass = HDHighPassCore;
  497|      2|  HDHighPass2 = HDHighPass2Core;
  498|      2|}

_ZN5vvenc9UnitScaleC2Eii:
  127|      2|  UnitScale( int sx, int sy ) : posx(sx), posy(sy), area(posx+posy) {}

Rom.cpp:_ZN5vvencL5Clip3IiEET_S1_S1_S1_:
  570|   150k|template <typename T> constexpr static inline T Clip3  ( const T minVal, const T maxVal, const T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); }  ///< general min/max clip

_ZN5vvenc6CtxSetC2ESt16initializer_listIS0_E:
  151|      4|{
  152|      4|  uint16_t  minOffset = std::numeric_limits<uint16_t>::max();
  153|      4|  uint16_t  maxOffset = 0;
  154|     14|  for( auto iter = ctxSets.begin(); iter != ctxSets.end(); iter++ )
  ------------------
  |  Branch (154:37): [True: 10, False: 4]
  ------------------
  155|     10|  {
  156|     10|    minOffset = std::min<uint16_t>( minOffset, (*iter).Offset              );
  157|     10|    maxOffset = std::max<uint16_t>( maxOffset, (*iter).Offset+(*iter).Size );
  158|     10|  }
  159|      4|  Offset  = minOffset;
  160|      4|  Size    = maxOffset - minOffset;
  161|      4|}
_ZN5vvenc13ContextSetCfg9addCtxSetESt16initializer_listIS1_IhEE:
  176|    164|{
  177|    164|  const std::size_t startIdx  = sm_InitTables[0].size();
  178|    164|  const std::size_t numValues = ( *initSet2d.begin() ).size();
  179|    164|        std::size_t setId     = 0;
  180|    820|  for( auto setIter = initSet2d.begin(); setIter != initSet2d.end() && setId < sm_InitTables.size(); setIter++, setId++ )
  ------------------
  |  Branch (180:42): [True: 656, False: 164]
  |  Branch (180:72): [True: 656, False: 0]
  ------------------
  181|    656|  {
  182|    656|    const std::initializer_list<uint8_t>& initSet   = *setIter;
  183|    656|    std::vector<uint8_t>&           initTable = sm_InitTables[setId];
  184|    656|    CHECK( initSet.size() != numValues,
  ------------------
  |  |  647|    656|#define CHECK(c,x)          if(c){ THROW(x); }
  |  |  ------------------
  |  |  |  |  646|      0|#define THROW(x)            throw( Exception( "ERROR: In function \"" ) << __FUNCTION__ << "\" in " << __FILE__ << ":" << __LINE__ << ": " << x )
  |  |  ------------------
  |  |  |  Branch (647:32): [True: 0, False: 656]
  |  |  ------------------
  ------------------
  185|    656|           "Number of init values do not match for all sets (" << initSet.size() << " != " << numValues << ")." );
  186|    656|    initTable.resize( startIdx + numValues );
  187|    656|    std::size_t elemId = startIdx;
  188|  3.60k|    for( auto elemIter = ( *setIter ).begin(); elemIter != ( *setIter ).end(); elemIter++, elemId++ )
  ------------------
  |  Branch (188:48): [True: 2.95k, False: 656]
  ------------------
  189|  2.95k|    {
  190|  2.95k|      initTable[elemId] = *elemIter;
  191|  2.95k|    }
  192|    656|  }
  193|    164|  return CtxSet( (uint16_t)startIdx, (uint16_t)numValues );
  194|    164|}

_ZN5vvenc6CtxSetC2Ett:
  159|    164|  CtxSet( uint16_t offset, uint16_t size ) : Offset( offset ), Size( size ) {}
_ZN5vvenc6CtxSetC2ERKS0_:
  160|     10|  CtxSet( const CtxSet& ctxSet ) : Offset( ctxSet.Offset ), Size( ctxSet.Size ) {}

_ZN5vvenc2MvC2Eii:
   90|     36|  Mv( int iHor, int iVer ) : hor( iHor ), ver( iVer ) {}

_ZNK5vvenc10InitGeoRom15initGeoTemplateEv:
 1305|      2|{
 1306|      2|  int modeIdx = 0;
 1307|     66|  for (int angleIdx = 0; angleIdx < GEO_NUM_ANGLES; angleIdx++)
  ------------------
  |  Branch (1307:26): [True: 64, False: 2]
  ------------------
 1308|     64|  {
 1309|    320|    for (int distanceIdx = 0; distanceIdx < GEO_NUM_DISTANCES; distanceIdx++)
  ------------------
  |  Branch (1309:31): [True: 256, False: 64]
  ------------------
 1310|    256|    {
 1311|    256|      if ((distanceIdx == 0 && angleIdx >= 16)
  ------------------
  |  Branch (1311:12): [True: 64, False: 192]
  |  Branch (1311:32): [True: 32, False: 32]
  ------------------
 1312|    224|          || ((distanceIdx == 2 || distanceIdx == 0) && (g_angle2mask[angleIdx] == 0 || g_angle2mask[angleIdx] == 5))
  ------------------
  |  Branch (1312:16): [True: 64, False: 160]
  |  Branch (1312:36): [True: 32, False: 128]
  |  Branch (1312:58): [True: 6, False: 90]
  |  Branch (1312:89): [True: 6, False: 84]
  ------------------
 1313|    212|          || g_angle2mask[angleIdx] == -1)
  ------------------
  |  Branch (1313:14): [True: 84, False: 128]
  ------------------
 1314|    128|        continue;
 1315|    128|      g_GeoParams[modeIdx][0] = (int16_t) angleIdx;
 1316|    128|      g_GeoParams[modeIdx][1] = (int16_t) distanceIdx;
 1317|    128|      modeIdx++;
 1318|    128|    }
 1319|     64|  }
 1320|     20|  for (int angleIdx = 0; angleIdx < (GEO_NUM_ANGLES >> 2) + 1; angleIdx++)
  ------------------
  |  Branch (1320:26): [True: 18, False: 2]
  ------------------
 1321|     18|  {
 1322|     18|    if (g_angle2mask[angleIdx] == -1)
  ------------------
  |  Branch (1322:9): [True: 6, False: 12]
  ------------------
 1323|      6|      continue;
 1324|       |
 1325|     12|    int     distanceX = angleIdx;
 1326|     12|    int     distanceY = (distanceX + (GEO_NUM_ANGLES >> 2)) % GEO_NUM_ANGLES;
 1327|     12|    int16_t rho = (g_Dis[distanceX] * 2 * GEO_MAX_CU_SIZE) + (g_Dis[distanceY] * 2 * GEO_MAX_CU_SIZE);
 1328|     12|    static const int16_t maskOffset = (2 * GEO_MAX_CU_SIZE - GEO_WEIGHT_MASK_SIZE) >> 1;
 1329|     12|    int                  index      = 0;
 1330|  1.35k|    for (int y = 0; y < GEO_WEIGHT_MASK_SIZE; y++)
  ------------------
  |  Branch (1330:21): [True: 1.34k, False: 12]
  ------------------
 1331|  1.34k|    {
 1332|  1.34k|      int16_t lookUpY = (((y + maskOffset) << 1) + 1) * g_Dis[distanceY];
 1333|   151k|      for (int x = 0; x < GEO_WEIGHT_MASK_SIZE; x++, index++)
  ------------------
  |  Branch (1333:23): [True: 150k, False: 1.34k]
  ------------------
 1334|   150k|      {
 1335|   150k|        int16_t sx_i                                         = ((x + maskOffset) << 1) + 1;
 1336|   150k|        int16_t weightIdx                                    = sx_i * g_Dis[distanceX] + lookUpY - rho;
 1337|   150k|        int     weightLinearIdx                              = 32 + weightIdx;
 1338|   150k|        g_globalGeoWeights[g_angle2mask[angleIdx]][index]    = Clip3(0, 8, (weightLinearIdx + 4) >> 3);
 1339|   150k|        g_globalGeoEncSADmask[g_angle2mask[angleIdx]][index] = weightIdx > 0 ? 1 : 0;
  ------------------
  |  Branch (1339:64): [True: 75.1k, False: 75.3k]
  ------------------
 1340|   150k|      }
 1341|  1.34k|    }
 1342|     12|  }
 1343|       |
 1344|     10|  for (int hIdx = 0; hIdx < GEO_NUM_CU_SIZE; hIdx++)
  ------------------
  |  Branch (1344:22): [True: 8, False: 2]
  ------------------
 1345|      8|  {
 1346|      8|    int16_t height = 1 << (hIdx + GEO_MIN_CU_LOG2);
 1347|     40|    for (int wIdx = 0; wIdx < GEO_NUM_CU_SIZE; wIdx++)
  ------------------
  |  Branch (1347:24): [True: 32, False: 8]
  ------------------
 1348|     32|    {
 1349|     32|      int16_t width = 1 << (wIdx + GEO_MIN_CU_LOG2);
 1350|  2.08k|      for (int splitDir = 0; splitDir < GEO_NUM_PARTITION_MODE; splitDir++)
  ------------------
  |  Branch (1350:30): [True: 2.04k, False: 32]
  ------------------
 1351|  2.04k|      {
 1352|  2.04k|        int16_t angle    = g_GeoParams[splitDir][0];
 1353|  2.04k|        int16_t distance = g_GeoParams[splitDir][1];
 1354|  2.04k|        int16_t offsetX  = (GEO_WEIGHT_MASK_SIZE - width) >> 1;
 1355|  2.04k|        int16_t offsetY  = (GEO_WEIGHT_MASK_SIZE - height) >> 1;
 1356|  2.04k|        if (distance > 0)
  ------------------
  |  Branch (1356:13): [True: 1.79k, False: 256]
  ------------------
 1357|  1.79k|        {
 1358|  1.79k|          if (angle % 16 == 8 || (angle % 16 != 0 && height >= width))
  ------------------
  |  Branch (1358:15): [True: 128, False: 1.66k]
  |  Branch (1358:35): [True: 1.53k, False: 128]
  |  Branch (1358:54): [True: 960, False: 576]
  ------------------
 1359|  1.08k|          {
 1360|  1.08k|            offsetY += angle < 16 ? ((distance * (int32_t) height) >> 3) : -((distance * (int32_t) height) >> 3);
  ------------------
  |  Branch (1360:24): [True: 544, False: 544]
  ------------------
 1361|  1.08k|          }
 1362|    704|          else
 1363|    704|          {
 1364|    704|            offsetX += angle < 16 ? ((distance * (int32_t) width) >> 3) : -((distance * (int32_t) width) >> 3);
  ------------------
  |  Branch (1364:24): [True: 352, False: 352]
  ------------------
 1365|    704|          }
 1366|  1.79k|        }
 1367|  2.04k|        g_weightOffset[hIdx][wIdx][splitDir][0] = offsetX;
 1368|  2.04k|        g_weightOffset[hIdx][wIdx][splitDir][1] = offsetY;
 1369|  2.04k|      }
 1370|     32|    }
 1371|      8|  }
 1372|      2|}

_ZN5vvenc10InitGeoRomC2Ev:
   91|      2|    InitGeoRom() { initGeoTemplate(); }

_ZN5vvenc9TCoeffOpsC2Ev:
 2004|      2|{
 2005|      2|  cpyResi4        = cpyResiCore;
 2006|      2|  cpyResi8        = cpyResiCore;
 2007|      2|  cpyCoeff4       = cpyCoeffCore;
 2008|      2|  cpyCoeff8       = cpyCoeffCore;
 2009|      2|  roundClip4      = clipCore;
 2010|      2|  roundClip8      = clipCore;
 2011|      2|  fastInvCore[0]  = fastInvCore_< 4>;
 2012|      2|  fastInvCore[1]  = fastInvCore_< 8>;
 2013|      2|  fastInvCore[2]  = fastInvCore_<16>;
 2014|      2|  fastInvCore[3]  = fastInvCore_<32>;
 2015|      2|  fastInvCore[4]  = fastInvCore_<64>;
 2016|      2|  fastFwdCore_1D[0] = fastFwdCore< 4>;
 2017|      2|  fastFwdCore_1D[1] = fastFwdCore< 8>;
 2018|      2|  fastFwdCore_1D[2] = fastFwdCore<16>;
 2019|      2|  fastFwdCore_1D[3] = fastFwdCore<32>;
 2020|      2|  fastFwdCore_1D[4] = fastFwdCore<64>;
 2021|      2|  fastFwdCore_2D[0] = fastFwdCore< 4>;
 2022|      2|  fastFwdCore_2D[1] = fastFwdCore< 8>;
 2023|      2|  fastFwdCore_2D[2] = fastFwdCore<16>;
 2024|      2|  fastFwdCore_2D[3] = fastFwdCore<32>;
 2025|      2|  fastFwdCore_2D[4] = fastFwdCore<64>;
 2026|      2|}

vvencimpl.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncLib.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
NoMallocThreadPool.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
MCTF.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncGOP.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncPicture.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncSlice.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncAdaptiveLoopFilter.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
EncCu.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();
IntraSearch.cpp:_ZNK5vvenc3$_0clEv:
   85|      2|const static auto BUSY_WAIT_TIME = [] {
   86|      2|  const char *env = getenv( "BUSY_WAIT_TIME" );
   87|      2|  if( env )
  ------------------
  |  Branch (87:7): [True: 0, False: 2]
  ------------------
   88|      0|    return std::chrono::milliseconds( atoi( env ) );
   89|      2|  return std::chrono::milliseconds( 1 );
   90|      2|}();

_ZN8apputils15program_options13ErrorReporterC2Ev:
   80|      2|  ErrorReporter() : is_errored(0) {}

_ZN4x2652MVC2Eii:
   49|     98|    MV(int32_t _x, int32_t _y) : x(_x), y(_y)  {}

