ojph_block_common.cpp:_ZN4ojph5localL15vlc_init_tablesEv:
  125|      2|    {
  126|      2|      const bool debug = false; //useful for checking 
  127|       |
  128|       |      //Data in the table is arranged in this format (taken from the standard)
  129|       |      // c_q is the context for a quad
  130|       |      // rho is the significance pattern for a quad
  131|       |      // u_off indicate if u value is 0 (u_off is 0), or communicated
  132|       |      // e_k, e_1 EMB patterns
  133|       |      // cwd VLC codeword
  134|       |      // cwd VLC codeword length
  135|      2|      struct vlc_src_table { int c_q, rho, u_off, e_k, e_1, cwd, cwd_len; };
  136|       |      // initial quad rows
  137|      2|      vlc_src_table tbl0[] = {
  138|      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}
  ------------------
  139|      2|      };
  140|       |      // number of entries in the table
  141|      2|      size_t tbl0_size = sizeof(tbl0) / sizeof(vlc_src_table); 
  142|       |
  143|       |      // nono-initial quad rows
  144|      2|      vlc_src_table tbl1[] = {
  145|      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}
  ------------------
  146|      2|      };
  147|       |      // number of entries in the table
  148|      2|      size_t tbl1_size = sizeof(tbl1) / sizeof(vlc_src_table);
  149|       |
  150|      2|      if (debug) memset(vlc_tbl0, 0, sizeof(vlc_tbl0)); //unnecessary
  ------------------
  |  Branch (150:11): [Folded, False: 2]
  ------------------
  151|       |
  152|       |      // this is to convert table entries into values for decoder look up
  153|       |      // There can be at most 1024 possibilities, not all of them are valid.
  154|       |      // 
  155|  2.05k|      for (int i = 0; i < 1024; ++i)
  ------------------
  |  Branch (155:23): [True: 2.04k, False: 2]
  ------------------
  156|  2.04k|      {
  157|  2.04k|        int cwd = i & 0x7F; // from i extract codeword
  158|  2.04k|        int c_q = i >> 7;   // from i extract context
  159|       |        // See if this case exist in the table, if so then set the entry in
  160|       |        // vlc_tbl0
  161|   911k|        for (size_t j = 0; j < tbl0_size; ++j) 
  ------------------
  |  Branch (161:28): [True: 909k, False: 2.04k]
  ------------------
  162|   909k|          if (tbl0[j].c_q == c_q) // this is an and operation
  ------------------
  |  Branch (162:15): [True: 113k, False: 795k]
  ------------------
  163|   113k|            if (tbl0[j].cwd == (cwd & ((1 << tbl0[j].cwd_len) - 1)))
  ------------------
  |  Branch (163:17): [True: 2.04k, False: 111k]
  ------------------
  164|  2.04k|            {
  165|  2.04k|              if (debug) assert(vlc_tbl0[i] == 0);
  ------------------
  |  Branch (165:19): [Folded, False: 2.04k]
  ------------------
  166|       |              // Put this entry into the table
  167|  2.04k|              vlc_tbl0[i] = (ui16)((tbl0[j].rho << 4) | (tbl0[j].u_off << 3)
  168|  2.04k|                | (tbl0[j].e_k << 12) | (tbl0[j].e_1 << 8) | tbl0[j].cwd_len);
  169|  2.04k|            }
  170|  2.04k|      }
  171|       |
  172|      2|      if (debug) memset(vlc_tbl1, 0, sizeof(vlc_tbl1)); //unnecessary
  ------------------
  |  Branch (172:11): [Folded, False: 2]
  ------------------
  173|       |
  174|       |      // this the same as above but for non-initial rows
  175|  2.05k|      for (int i = 0; i < 1024; ++i)
  ------------------
  |  Branch (175:23): [True: 2.04k, False: 2]
  ------------------
  176|  2.04k|      {
  177|  2.04k|        int cwd = i & 0x7F; //7 bits
  178|  2.04k|        int c_q = i >> 7;
  179|   735k|        for (size_t j = 0; j < tbl1_size; ++j)
  ------------------
  |  Branch (179:28): [True: 733k, False: 2.04k]
  ------------------
  180|   733k|          if (tbl1[j].c_q == c_q) // this is an and operation
  ------------------
  |  Branch (180:15): [True: 91.6k, False: 641k]
  ------------------
  181|  91.6k|            if (tbl1[j].cwd == (cwd & ((1 << tbl1[j].cwd_len) - 1)))
  ------------------
  |  Branch (181:17): [True: 2.04k, False: 89.6k]
  ------------------
  182|  2.04k|            {
  183|  2.04k|              if (debug) assert(vlc_tbl1[i] == 0);
  ------------------
  |  Branch (183:19): [Folded, False: 2.04k]
  ------------------
  184|  2.04k|              vlc_tbl1[i] = (ui16)((tbl1[j].rho << 4) | (tbl1[j].u_off << 3)
  185|  2.04k|                | (tbl1[j].e_k << 12) | (tbl1[j].e_1 << 8) | tbl1[j].cwd_len);
  186|  2.04k|            }
  187|  2.04k|      }
  188|       |
  189|      2|      return true;
  190|      2|    }
ojph_block_common.cpp:_ZN4ojph5localL16uvlc_init_tablesEv:
  197|      2|    {
  198|       |      // table stores possible decoding three bits from vlc
  199|       |      // there are 8 entries for xx1, x10, 100, 000, where x means do not
  200|       |      // care table value is made up of
  201|       |      // 2 bits in the LSB for prefix length 
  202|       |      // 3 bits for suffix length
  203|       |      // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  204|      2|      static const ui8 dec[8] = { // the index is the prefix codeword
  205|      2|        3 | (5 << 2) | (5 << 5), //000 == 000, prefix codeword "000"
  206|      2|        1 | (0 << 2) | (1 << 5), //001 == xx1, prefix codeword "1"
  207|      2|        2 | (0 << 2) | (2 << 5), //010 == x10, prefix codeword "01"
  208|      2|        1 | (0 << 2) | (1 << 5), //011 == xx1, prefix codeword "1"
  209|      2|        3 | (1 << 2) | (3 << 5), //100 == 100, prefix codeword "001"
  210|      2|        1 | (0 << 2) | (1 << 5), //101 == xx1, prefix codeword "1"
  211|      2|        2 | (0 << 2) | (2 << 5), //110 == x10, prefix codeword "01"
  212|      2|        1 | (0 << 2) | (1 << 5)  //111 == xx1, prefix codeword "1"
  213|      2|      };
  214|       |
  215|    642|      for (ui32 i = 0; i < 256 + 64; ++i)
  ------------------
  |  Branch (215:24): [True: 640, False: 2]
  ------------------
  216|    640|      { 
  217|    640|        ui32 mode = i >> 6;
  218|    640|        ui32 vlc = i & 0x3F;
  219|       |
  220|    640|        if (mode == 0) {      // both u_off are 0
  ------------------
  |  Branch (220:13): [True: 128, False: 512]
  ------------------
  221|    128|          uvlc_tbl0[i] = 0;
  222|    128|          uvlc_bias[i] = 0;
  223|    128|        }
  224|    512|        else if (mode <= 2) // u_off are either 01 or 10
  ------------------
  |  Branch (224:18): [True: 256, False: 256]
  ------------------
  225|    256|        {
  226|    256|          ui32 d = dec[vlc & 0x7];   //look at the least significant 3 bits
  227|       |
  228|    256|          ui32 total_prefix = d & 0x3;
  229|    256|          ui32 total_suffix = (d >> 2) & 0x7;
  230|    256|          ui32 u0_suffix_len = (mode == 1) ? total_suffix : 0;
  ------------------
  |  Branch (230:32): [True: 128, False: 128]
  ------------------
  231|    256|          ui32 u0 = (mode == 1) ? (d >> 5) : 0;
  ------------------
  |  Branch (231:21): [True: 128, False: 128]
  ------------------
  232|    256|          ui32 u1 = (mode == 1) ? 0 : (d >> 5);
  ------------------
  |  Branch (232:21): [True: 128, False: 128]
  ------------------
  233|       |
  234|    256|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  235|    256|                               (total_suffix << 3) |
  236|    256|                               (u0_suffix_len << 7) |
  237|    256|                               (u0 << 10) |
  238|    256|                               (u1 << 13));
  239|       |          
  240|    256|        }
  241|    256|        else if (mode == 3) // both u_off are 1, and MEL event is 0
  ------------------
  |  Branch (241:18): [True: 128, False: 128]
  ------------------
  242|    128|        {
  243|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  244|    128|          vlc >>= d0 & 0x3;          // Consume bits
  245|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  246|       |
  247|    128|          ui32 total_prefix, u0_suffix_len, total_suffix, u0, u1;
  248|    128|          if ((d0 & 0x3) == 3)
  ------------------
  |  Branch (248:15): [True: 32, False: 96]
  ------------------
  249|     32|          {
  250|     32|            total_prefix = (d0 & 0x3) + 1;
  251|     32|            u0_suffix_len = (d0 >> 2) & 0x7;
  252|     32|            total_suffix = u0_suffix_len;
  253|     32|            u0 = d0 >> 5;
  254|     32|            u1 = (vlc & 1) + 1;
  255|     32|            uvlc_bias[i] = 4; // 0b00 for u0 and 0b01 for u1
  256|     32|          }
  257|     96|          else
  258|     96|          {
  259|     96|            total_prefix = (d0 & 0x3) + (d1 & 0x3);
  260|     96|            u0_suffix_len = (d0 >> 2) & 0x7;
  261|     96|            total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  262|     96|            u0 = d0 >> 5;
  263|     96|            u1 = d1 >> 5;
  264|     96|            uvlc_bias[i] = 0;
  265|     96|          }
  266|       |
  267|    128|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  268|    128|                               (total_suffix << 3) |
  269|    128|                               (u0_suffix_len << 7) |
  270|    128|                               (u0 << 10) |
  271|    128|                               (u1 << 13));
  272|    128|        }
  273|    128|        else if (mode == 4) // both u_off are 1, and MEL event is 1
  ------------------
  |  Branch (273:18): [True: 128, False: 0]
  ------------------
  274|    128|        {
  275|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  276|    128|          vlc >>= d0 & 0x3;          // Consume bits
  277|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  278|       |
  279|    128|          ui32 total_prefix = (d0 & 0x3) + (d1 & 0x3);
  280|    128|          ui32 u0_suffix_len = (d0 >> 2) & 0x7;
  281|    128|          ui32 total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  282|    128|          ui32 u0 = (d0 >> 5) + 2;
  283|    128|          ui32 u1 = (d1 >> 5) + 2;
  284|       |
  285|    128|          uvlc_tbl0[i] = (ui16)(total_prefix | 
  286|    128|                               (total_suffix << 3) |
  287|    128|                               (u0_suffix_len << 7) |
  288|    128|                               (u0 << 10) |
  289|    128|                               (u1 << 13));
  290|    128|          uvlc_bias[i] = 10; // 0b10 for u0 and 0b10 for u1
  291|    128|        }
  292|    640|      }
  293|       |
  294|    514|      for (ui32 i = 0; i < 256; ++i)
  ------------------
  |  Branch (294:24): [True: 512, False: 2]
  ------------------
  295|    512|      {
  296|    512|        ui32 mode = i >> 6;
  297|    512|        ui32 vlc = i & 0x3F;
  298|       |
  299|    512|        if (mode == 0)       // both u_off are 0
  ------------------
  |  Branch (299:13): [True: 128, False: 384]
  ------------------
  300|    128|          uvlc_tbl1[i] = 0;
  301|    384|        else if (mode <= 2)  // u_off are either 01 or 10
  ------------------
  |  Branch (301:18): [True: 256, False: 128]
  ------------------
  302|    256|        {
  303|    256|          ui32 d = dec[vlc & 0x7];   // look at the 3 LSB bits
  304|       |
  305|    256|          ui32 total_prefix = d & 0x3;
  306|    256|          ui32 total_suffix = (d >> 2) & 0x7;
  307|    256|          ui32 u0_suffix_len = (mode == 1) ? total_suffix : 0;
  ------------------
  |  Branch (307:32): [True: 128, False: 128]
  ------------------
  308|    256|          ui32 u0 = (mode == 1) ? (d >> 5) : 0;
  ------------------
  |  Branch (308:21): [True: 128, False: 128]
  ------------------
  309|    256|          ui32 u1 = (mode == 1) ? 0 : (d >> 5);
  ------------------
  |  Branch (309:21): [True: 128, False: 128]
  ------------------
  310|       |
  311|    256|          uvlc_tbl1[i] = (ui16)(total_prefix | 
  312|    256|                               (total_suffix << 3) |
  313|    256|                               (u0_suffix_len << 7) |
  314|    256|                               (u0 << 10) |
  315|    256|                               (u1 << 13));
  316|    256|        }
  317|    128|        else if (mode == 3) // both u_off are 1
  ------------------
  |  Branch (317:18): [True: 128, False: 0]
  ------------------
  318|    128|        {
  319|    128|          ui32 d0 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  320|    128|          vlc >>= d0 & 0x3;          // Consume bits
  321|    128|          ui32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  322|       |
  323|    128|          ui32 total_prefix = (d0 & 0x3) + (d1 & 0x3);
  324|    128|          ui32 u0_suffix_len = (d0 >> 2) & 0x7;
  325|    128|          ui32 total_suffix = u0_suffix_len + ((d1 >> 2) & 0x7);
  326|    128|          ui32 u0 = d0 >> 5;
  327|    128|          ui32 u1 = d1 >> 5;
  328|       |
  329|    128|          uvlc_tbl1[i] = (ui16)(total_prefix | 
  330|    128|                               (total_suffix << 3) |
  331|    128|                               (u0_suffix_len << 7) |
  332|    128|                               (u0 << 10) |
  333|    128|                               (u1 << 13));
  334|    128|        }
  335|    512|      }
  336|      2|      return true;
  337|      2|    }
ojph_block_common.cpp:_ZN4ojph5localL20uvlc_init_wide_tableEv:
  347|      2|    {
  348|      2|      static const ui8 dec[8] = {
  349|      2|        3 | (5 << 2) | (5 << 5), //000
  350|      2|        1 | (0 << 2) | (1 << 5), //xx1
  351|      2|        2 | (0 << 2) | (2 << 5), //x10
  352|      2|        1 | (0 << 2) | (1 << 5), //xx1
  353|      2|        3 | (1 << 2) | (3 << 5), //100
  354|      2|        1 | (0 << 2) | (1 << 5), //xx1
  355|      2|        2 | (0 << 2) | (2 << 5), //x10
  356|      2|        1 | (0 << 2) | (1 << 5)  //xx1
  357|      2|      };
  358|       |
  359|  8.19k|      for (ui32 idx = 0; idx < 4096; ++idx)
  ------------------
  |  Branch (359:26): [True: 8.19k, False: 2]
  ------------------
  360|  8.19k|      {
  361|  8.19k|        ui32 mode = idx >> 10;       // 2 bits
  362|  8.19k|        ui32 vlc = idx & 0x3FF;      // 10 bits
  363|       |
  364|  8.19k|        if (mode == 0) {
  ------------------
  |  Branch (364:13): [True: 2.04k, False: 6.14k]
  ------------------
  365|  2.04k|          uvlc_tbl1_wide[idx] = 0;
  366|  2.04k|          continue;
  367|  2.04k|        }
  368|       |
  369|  6.14k|        if (mode <= 2) // single UVLC (one u_off set)
  ------------------
  |  Branch (369:13): [True: 4.09k, False: 2.04k]
  ------------------
  370|  4.09k|        {
  371|  4.09k|          ui32 d = dec[vlc & 0x7];
  372|  4.09k|          ui32 prefix_len = d & 0x3;
  373|  4.09k|          ui32 suffix_len = (d >> 2) & 0x7;
  374|  4.09k|          ui32 u_pfx = d >> 5;
  375|  4.09k|          ui32 suffix_val = (vlc >> prefix_len) & ((1u << suffix_len) - 1);
  376|  4.09k|          ui32 u_val = u_pfx + suffix_val;
  377|  4.09k|          ui32 total = prefix_len + suffix_len;
  378|  4.09k|          ui32 u_q0 = (mode == 1) ? u_val : 0;
  ------------------
  |  Branch (378:23): [True: 2.04k, False: 2.04k]
  ------------------
  379|  4.09k|          ui32 u_q1 = (mode == 2) ? u_val : 0;
  ------------------
  |  Branch (379:23): [True: 2.04k, False: 2.04k]
  ------------------
  380|  4.09k|          uvlc_tbl1_wide[idx] = total | (u_q0 << 5) | (u_q1 << 13);
  381|  4.09k|          continue;
  382|  4.09k|        }
  383|       |
  384|       |        // mode == 3: both u_off set
  385|       |        // Bitstream layout: [prefix0][prefix1][suffix0][suffix1]
  386|  2.04k|        ui32 d0 = dec[vlc & 0x7];
  387|  2.04k|        ui32 p0_len = d0 & 0x3;
  388|  2.04k|        ui32 s0_len = (d0 >> 2) & 0x7;
  389|  2.04k|        ui32 u0_pfx = d0 >> 5;
  390|       |
  391|  2.04k|        ui32 vlc1 = vlc >> p0_len;  // consume prefix0
  392|  2.04k|        ui32 d1 = dec[vlc1 & 0x7];
  393|  2.04k|        ui32 p1_len = d1 & 0x3;
  394|  2.04k|        ui32 s1_len = (d1 >> 2) & 0x7;
  395|  2.04k|        ui32 u1_pfx = d1 >> 5;
  396|       |
  397|  2.04k|        ui32 total_prefix = p0_len + p1_len;
  398|  2.04k|        ui32 total_suffix = s0_len + s1_len;
  399|  2.04k|        ui32 total = total_prefix + total_suffix;
  400|       |
  401|  2.04k|        if (total > 10) {
  ------------------
  |  Branch (401:13): [True: 96, False: 1.95k]
  ------------------
  402|     96|          uvlc_tbl1_wide[idx] = 0x1F; // fallback sentinel
  403|     96|          continue;
  404|     96|        }
  405|       |
  406|       |        // suffixes follow both prefixes in the bitstream
  407|  1.95k|        ui32 suffix_bits = vlc >> total_prefix;
  408|  1.95k|        ui32 s0_val = suffix_bits & ((1u << s0_len) - 1);
  409|  1.95k|        ui32 s1_val = (suffix_bits >> s0_len) & ((1u << s1_len) - 1);
  410|       |
  411|  1.95k|        ui32 u_q0 = u0_pfx + s0_val;
  412|  1.95k|        ui32 u_q1 = u1_pfx + s1_val;
  413|  1.95k|        uvlc_tbl1_wide[idx] = total | (u_q0 << 5) | (u_q1 << 13);
  414|  1.95k|      }
  415|      2|      return true;
  416|      2|    }

internal_ht.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_local.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_params.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_tile.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_tile_comp.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_file.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_mem.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_message.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_colour.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_colour_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_colour_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_colour_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_colour_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_transform_avx512.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_resolution.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_subband.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_arch.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codeblock.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codeblock_fun.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_gen.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_precinct.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_decoder32.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_decoder64.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_encoder.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_sse.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_sse2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_decoder_ssse3.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_avx.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_codestream_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_decoder_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_encoder_avx2.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }
ojph_block_encoder_avx512.cpp:_ZN4ojphL19count_leading_zerosEj:
  207|      2|  {
  208|       |  #ifdef OJPH_COMPILER_MSVC
  209|       |    unsigned long result = 0;
  210|       |    _BitScanReverse(&result, val);
  211|       |    return 31 ^ (ui32)result;
  212|       |  #elif (defined OJPH_COMPILER_GNUC)
  213|       |    return (ui32)__builtin_clz(val);
  214|       |  #else
  215|       |    val |= (val >> 1);
  216|       |    val |= (val >> 2);
  217|       |    val |= (val >> 4);
  218|       |    val |= (val >> 8);
  219|       |    val |= (val >> 16);
  220|       |    return 32 - population_count(val);
  221|       |  #endif
  222|      2|  }

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

exr_attr_list_destroy:
  292|  10.5k|{
  293|  10.5k|    exr_attribute_list_t nil = {0};
  294|  10.5k|    exr_result_t         arv;
  295|  10.5k|    exr_result_t         rv = EXR_ERR_SUCCESS;
  296|       |
  297|  10.5k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (297:9): [True: 0, False: 10.5k]
  ------------------
  298|       |
  299|  10.5k|    if (list)
  ------------------
  |  Branch (299:9): [True: 10.5k, False: 0]
  ------------------
  300|  10.5k|    {
  301|  10.5k|        if (list->entries)
  ------------------
  |  Branch (301:13): [True: 7.43k, False: 3.07k]
  ------------------
  302|  7.43k|        {
  303|  84.0k|            for (int i = 0; i < list->num_attributes; ++i)
  ------------------
  |  Branch (303:29): [True: 76.6k, False: 7.43k]
  ------------------
  304|  76.6k|            {
  305|  76.6k|                arv = attr_destroy (ctxt, list->entries[i]);
  306|  76.6k|                if (arv != EXR_ERR_SUCCESS) rv = arv;
  ------------------
  |  Branch (306:21): [True: 0, False: 76.6k]
  ------------------
  307|  76.6k|            }
  308|  7.43k|            ctxt->free_fn (list->entries);
  309|  7.43k|        }
  310|  10.5k|        *list = nil;
  311|  10.5k|    }
  312|  10.5k|    return rv;
  313|  10.5k|}
exr_attr_list_find_by_name:
  433|  86.4k|{
  434|  86.4k|    exr_attribute_t** it    = NULL;
  435|  86.4k|    exr_attribute_t** first = NULL;
  436|  86.4k|    exr_attribute_t** end   = NULL;
  437|  86.4k|    int               step, count, cmp;
  438|       |
  439|  86.4k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (439:9): [True: 0, False: 86.4k]
  ------------------
  440|       |
  441|  86.4k|    if (!out)
  ------------------
  |  Branch (441:9): [True: 0, False: 86.4k]
  ------------------
  442|      0|        return ctxt->report_error (
  443|      0|            ctxt,
  444|      0|            EXR_ERR_INVALID_ARGUMENT,
  445|      0|            "Invalid output pointer passed to find_by_name");
  446|       |
  447|  86.4k|    if (!name || name[0] == '\0')
  ------------------
  |  Branch (447:9): [True: 0, False: 86.4k]
  |  Branch (447:18): [True: 1.01k, False: 85.4k]
  ------------------
  448|  1.01k|        return ctxt->report_error (
  449|  1.01k|            ctxt,
  450|  1.01k|            EXR_ERR_INVALID_ARGUMENT,
  451|  1.01k|            "Invalid name passed to find_by_name");
  452|       |
  453|  85.4k|    if (!list)
  ------------------
  |  Branch (453:9): [True: 0, False: 85.4k]
  ------------------
  454|      0|        return ctxt->report_error (
  455|      0|            ctxt,
  456|      0|            EXR_ERR_INVALID_ARGUMENT,
  457|      0|            "Invalid list pointer passed to find_by_name");
  458|       |
  459|  85.4k|    if (list->sorted_entries)
  ------------------
  |  Branch (459:9): [True: 77.9k, False: 7.43k]
  ------------------
  460|  77.9k|    {
  461|  77.9k|        first = list->sorted_entries;
  462|  77.9k|        count = list->num_attributes;
  463|  77.9k|        end   = first + count;
  464|       |        /* lower bound search w/ equality check */
  465|   280k|        while (count > 0)
  ------------------
  |  Branch (465:16): [True: 204k, False: 76.6k]
  ------------------
  466|   204k|        {
  467|   204k|            it   = first;
  468|   204k|            step = count / 2;
  469|   204k|            it += step;
  470|   204k|            cmp = strcmp ((*it)->name, name);
  471|   204k|            if (cmp == 0)
  ------------------
  |  Branch (471:17): [True: 1.31k, False: 202k]
  ------------------
  472|  1.31k|            {
  473|       |                // early exit
  474|  1.31k|                *out = (*it);
  475|  1.31k|                return EXR_ERR_SUCCESS;
  476|  1.31k|            }
  477|       |
  478|   202k|            if (cmp < 0)
  ------------------
  |  Branch (478:17): [True: 95.4k, False: 107k]
  ------------------
  479|  95.4k|            {
  480|  95.4k|                first = ++it;
  481|  95.4k|                count -= step + 1;
  482|  95.4k|            }
  483|   107k|            else
  484|   107k|                count = step;
  485|   202k|        }
  486|       |
  487|  76.6k|        if (first && first < end && 0 == strcmp ((*first)->name, name))
  ------------------
  |  Branch (487:13): [True: 76.6k, False: 0]
  |  Branch (487:22): [True: 70.1k, False: 6.57k]
  |  Branch (487:37): [True: 0, False: 70.1k]
  ------------------
  488|      0|        {
  489|      0|            *out = (*first);
  490|      0|            return EXR_ERR_SUCCESS;
  491|      0|        }
  492|  76.6k|    }
  493|       |
  494|  84.1k|    return EXR_ERR_NO_ATTR_BY_NAME;
  495|  85.4k|}
exr_attr_list_add:
  893|  59.5k|{
  894|  59.5k|    const struct _internal_exr_attr_map* known = NULL;
  895|       |
  896|  59.5k|    exr_result_t     rval = EXR_ERR_INVALID_ARGUMENT;
  897|  59.5k|    int32_t          nlen, tidx, mlen;
  898|  59.5k|    size_t           slen;
  899|  59.5k|    exr_attribute_t* nattr = NULL;
  900|       |
  901|  59.5k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (901:9): [True: 0, False: 59.5k]
  ------------------
  902|       |
  903|  59.5k|    rval = validate_attr_arguments (ctxt, list, name, data_len, data_ptr, attr);
  904|  59.5k|    if (rval != EXR_ERR_SUCCESS)
  ------------------
  |  Branch (904:9): [True: 43, False: 59.5k]
  ------------------
  905|     43|    {
  906|     43|        if (rval < 0)
  ------------------
  |  Branch (906:13): [True: 43, False: 0]
  ------------------
  907|     43|        {
  908|     43|            if ((*attr)->type != type)
  ------------------
  |  Branch (908:17): [True: 43, False: 0]
  ------------------
  909|     43|            {
  910|     43|                nattr = *attr;
  911|     43|                *attr = NULL;
  912|     43|                return ctxt->print_error (
  913|     43|                    ctxt,
  914|     43|                    EXR_ERR_INVALID_ARGUMENT,
  915|     43|                    "Entry '%s' already in list but with different type ('%s')",
  916|     43|                    name,
  917|     43|                    nattr->type_name);
  918|     43|            }
  919|      0|            return EXR_ERR_SUCCESS;
  920|     43|        }
  921|      0|        return rval;
  922|     43|    }
  923|       |
  924|  59.5k|    slen = strlen (name);
  925|  59.5k|    mlen = (int32_t) ctxt->max_name_length;
  926|  59.5k|    if (slen > (size_t) mlen)
  ------------------
  |  Branch (926:9): [True: 0, False: 59.5k]
  ------------------
  927|      0|    {
  928|      0|        return ctxt->print_error (
  929|      0|            ctxt,
  930|      0|            EXR_ERR_NAME_TOO_LONG,
  931|      0|            "Provided name '%s' too long for file (len %d, max %d)",
  932|      0|            name,
  933|      0|            (int) slen,
  934|      0|            mlen);
  935|      0|    }
  936|  59.5k|    nlen = (int32_t) slen;
  937|       |
  938|  59.5k|    tidx = ((int) type) - 1;
  939|  59.5k|    if (tidx < 0 || tidx >= the_predefined_attr_count)
  ------------------
  |  Branch (939:9): [True: 0, False: 59.5k]
  |  Branch (939:21): [True: 0, False: 59.5k]
  ------------------
  940|      0|    {
  941|      0|        if (type == EXR_ATTR_OPAQUE)
  ------------------
  |  Branch (941:13): [True: 0, False: 0]
  ------------------
  942|      0|            return ctxt->print_error (
  943|      0|                ctxt,
  944|      0|                EXR_ERR_INVALID_ARGUMENT,
  945|      0|                "Invalid type enum for '%s': the opaque type is not actually a built-in type",
  946|      0|                name);
  947|       |
  948|      0|        return ctxt->print_error (
  949|      0|            ctxt,
  950|      0|            EXR_ERR_INVALID_ARGUMENT,
  951|      0|            "Invalid type enum for '%s' in create by builtin type (type %d)",
  952|      0|            name,
  953|      0|            (int) type);
  954|      0|    }
  955|       |
  956|  59.5k|    known = &(the_predefined_attr_typenames[tidx]);
  957|       |
  958|  59.5k|    rval = create_attr_block (
  959|  59.5k|        ctxt, &nattr, known->exp_size, data_len, data_ptr, name, nlen, NULL, 0);
  960|       |
  961|  59.5k|    if (rval == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (961:9): [True: 59.5k, False: 0]
  ------------------
  962|  59.5k|    {
  963|  59.5k|        nattr->type_name        = known->name;
  964|  59.5k|        nattr->type_name_length = (uint8_t) known->name_len;
  965|  59.5k|        nattr->type             = known->type;
  966|  59.5k|        rval                    = add_to_list (ctxt, list, nattr, name);
  967|  59.5k|    }
  968|       |
  969|  59.5k|    if (rval == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (969:9): [True: 59.5k, False: 0]
  ------------------
  970|  59.5k|    {
  971|  59.5k|        *attr = nattr;
  972|  59.5k|        check_attr_handler (ctxt, nattr);
  973|  59.5k|    }
  974|      0|    else if (data_ptr)
  ------------------
  |  Branch (974:14): [True: 0, False: 0]
  ------------------
  975|      0|        *data_ptr = NULL;
  976|  59.5k|    return rval;
  977|  59.5k|}
exr_attr_list_add_static_name:
  990|  17.0k|{
  991|  17.0k|    const struct _internal_exr_attr_map* known = NULL;
  992|       |
  993|  17.0k|    int              rval = EXR_ERR_INVALID_ARGUMENT;
  994|  17.0k|    int32_t          nlen, tidx, mlen;
  995|  17.0k|    size_t           slen;
  996|  17.0k|    exr_attribute_t* nattr = NULL;
  997|       |
  998|  17.0k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (998:9): [True: 0, False: 17.0k]
  ------------------
  999|       |
 1000|  17.0k|    rval = validate_attr_arguments (ctxt, list, name, data_len, data_ptr, attr);
 1001|  17.0k|    if (rval != EXR_ERR_SUCCESS)
  ------------------
  |  Branch (1001:9): [True: 0, False: 17.0k]
  ------------------
 1002|      0|    {
 1003|      0|        if (rval < 0)
  ------------------
  |  Branch (1003:13): [True: 0, False: 0]
  ------------------
 1004|      0|        {
 1005|      0|            if ((*attr)->type != type)
  ------------------
  |  Branch (1005:17): [True: 0, False: 0]
  ------------------
 1006|      0|            {
 1007|      0|                nattr = *attr;
 1008|      0|                *attr = NULL;
 1009|      0|                return ctxt->print_error (
 1010|      0|                    ctxt,
 1011|      0|                    EXR_ERR_INVALID_ARGUMENT,
 1012|      0|                    "Entry '%s' already in list but with different type ('%s')",
 1013|      0|                    name,
 1014|      0|                    nattr->type_name);
 1015|      0|            }
 1016|      0|            return EXR_ERR_SUCCESS;
 1017|      0|        }
 1018|      0|        return rval;
 1019|      0|    }
 1020|       |
 1021|  17.0k|    mlen = (int32_t) ctxt->max_name_length;
 1022|  17.0k|    slen = strlen (name);
 1023|  17.0k|    if (slen > (size_t) mlen)
  ------------------
  |  Branch (1023:9): [True: 0, False: 17.0k]
  ------------------
 1024|      0|    {
 1025|      0|        return ctxt->print_error (
 1026|      0|            ctxt,
 1027|      0|            EXR_ERR_NAME_TOO_LONG,
 1028|      0|            "Provided name '%s' too long for file (len %d, max %d)",
 1029|      0|            name,
 1030|      0|            (int) slen,
 1031|      0|            mlen);
 1032|      0|    }
 1033|  17.0k|    nlen = (int32_t) slen;
 1034|       |
 1035|  17.0k|    tidx = ((int) type) - 1;
 1036|  17.0k|    if (tidx < 0 || tidx >= the_predefined_attr_count)
  ------------------
  |  Branch (1036:9): [True: 0, False: 17.0k]
  |  Branch (1036:21): [True: 0, False: 17.0k]
  ------------------
 1037|      0|    {
 1038|      0|        if (type == EXR_ATTR_OPAQUE)
  ------------------
  |  Branch (1038:13): [True: 0, False: 0]
  ------------------
 1039|      0|            return ctxt->print_error (
 1040|      0|                ctxt,
 1041|      0|                EXR_ERR_INVALID_ARGUMENT,
 1042|      0|                "Invalid type enum for '%s': the opaque type is not actually a built-in type",
 1043|      0|                name);
 1044|       |
 1045|      0|        return ctxt->print_error (
 1046|      0|            ctxt,
 1047|      0|            EXR_ERR_INVALID_ARGUMENT,
 1048|      0|            "Invalid type enum for '%s' in create by builtin type (type %d)",
 1049|      0|            name,
 1050|      0|            (int) type);
 1051|      0|    }
 1052|  17.0k|    known = &(the_predefined_attr_typenames[tidx]);
 1053|       |
 1054|  17.0k|    rval = create_attr_block (
 1055|  17.0k|        ctxt, &nattr, known->exp_size, data_len, data_ptr, NULL, 0, NULL, 0);
 1056|       |
 1057|  17.0k|    if (rval == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (1057:9): [True: 17.0k, False: 0]
  ------------------
 1058|  17.0k|    {
 1059|  17.0k|        nattr->name             = name;
 1060|  17.0k|        nattr->type_name        = known->name;
 1061|  17.0k|        nattr->name_length      = (uint8_t) nlen;
 1062|  17.0k|        nattr->type_name_length = (uint8_t) known->name_len;
 1063|  17.0k|        nattr->type             = known->type;
 1064|  17.0k|        rval                    = add_to_list (ctxt, list, nattr, name);
 1065|  17.0k|    }
 1066|       |
 1067|  17.0k|    if (rval == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (1067:9): [True: 17.0k, False: 0]
  ------------------
 1068|  17.0k|    {
 1069|  17.0k|        *attr = nattr;
 1070|  17.0k|        check_attr_handler (ctxt, nattr);
 1071|  17.0k|    }
 1072|      0|    else if (data_ptr)
  ------------------
  |  Branch (1072:14): [True: 0, False: 0]
  ------------------
 1073|      0|        *data_ptr = NULL;
 1074|  17.0k|    return rval;
 1075|  17.0k|}
attributes.c:attr_destroy:
  216|  76.6k|{
  217|  76.6k|    exr_result_t rv = EXR_ERR_SUCCESS;
  218|  76.6k|    switch (attr->type)
  219|  76.6k|    {
  220|      0|        case EXR_ATTR_CHLIST:
  ------------------
  |  Branch (220:9): [True: 0, False: 76.6k]
  ------------------
  221|      0|            rv = exr_attr_chlist_destroy (ctxt, attr->chlist);
  222|      0|            break;
  223|      0|        case EXR_ATTR_FLOAT_VECTOR:
  ------------------
  |  Branch (223:9): [True: 0, False: 76.6k]
  ------------------
  224|      0|            rv = exr_attr_float_vector_destroy (ctxt, attr->floatvector);
  225|      0|            break;
  226|      0|        case EXR_ATTR_PREVIEW:
  ------------------
  |  Branch (226:9): [True: 0, False: 76.6k]
  ------------------
  227|      0|            rv = exr_attr_preview_destroy (ctxt, attr->preview);
  228|      0|            break;
  229|  17.6k|        case EXR_ATTR_STRING:
  ------------------
  |  Branch (229:9): [True: 17.6k, False: 58.9k]
  ------------------
  230|  17.6k|            rv = exr_attr_string_destroy (ctxt, attr->string);
  231|  17.6k|            break;
  232|      0|        case EXR_ATTR_STRING_VECTOR:
  ------------------
  |  Branch (232:9): [True: 0, False: 76.6k]
  ------------------
  233|      0|            rv = exr_attr_string_vector_destroy (ctxt, attr->stringvector);
  234|      0|            break;
  235|      0|        case EXR_ATTR_OPAQUE:
  ------------------
  |  Branch (235:9): [True: 0, False: 76.6k]
  ------------------
  236|      0|            rv = exr_attr_opaquedata_destroy (ctxt, attr->opaque);
  237|      0|            break;
  238|      0|        case EXR_ATTR_BYTES:
  ------------------
  |  Branch (238:9): [True: 0, False: 76.6k]
  ------------------
  239|      0|            rv = exr_attr_bytes_destroy(ctxt, attr->bytes);
  240|      0|            break;
  241|  15.9k|        case EXR_ATTR_BOX2I:
  ------------------
  |  Branch (241:9): [True: 15.9k, False: 60.6k]
  ------------------
  242|  15.9k|        case EXR_ATTR_BOX2F:
  ------------------
  |  Branch (242:9): [True: 0, False: 76.6k]
  ------------------
  243|  15.9k|        case EXR_ATTR_CHROMATICITIES:
  ------------------
  |  Branch (243:9): [True: 0, False: 76.6k]
  ------------------
  244|  23.4k|        case EXR_ATTR_COMPRESSION:
  ------------------
  |  Branch (244:9): [True: 7.43k, False: 69.1k]
  ------------------
  245|  23.4k|        case EXR_ATTR_ENVMAP:
  ------------------
  |  Branch (245:9): [True: 0, False: 76.6k]
  ------------------
  246|  30.8k|        case EXR_ATTR_LINEORDER:
  ------------------
  |  Branch (246:9): [True: 7.43k, False: 69.1k]
  ------------------
  247|  30.8k|        case EXR_ATTR_DOUBLE:
  ------------------
  |  Branch (247:9): [True: 0, False: 76.6k]
  ------------------
  248|  47.0k|        case EXR_ATTR_FLOAT:
  ------------------
  |  Branch (248:9): [True: 16.2k, False: 60.3k]
  ------------------
  249|  50.7k|        case EXR_ATTR_INT:
  ------------------
  |  Branch (249:9): [True: 3.67k, False: 72.9k]
  ------------------
  250|  50.7k|        case EXR_ATTR_KEYCODE:
  ------------------
  |  Branch (250:9): [True: 0, False: 76.6k]
  ------------------
  251|  50.7k|        case EXR_ATTR_M33F:
  ------------------
  |  Branch (251:9): [True: 0, False: 76.6k]
  ------------------
  252|  50.7k|        case EXR_ATTR_M33D:
  ------------------
  |  Branch (252:9): [True: 0, False: 76.6k]
  ------------------
  253|  50.7k|        case EXR_ATTR_M44F:
  ------------------
  |  Branch (253:9): [True: 0, False: 76.6k]
  ------------------
  254|  50.7k|        case EXR_ATTR_M44D:
  ------------------
  |  Branch (254:9): [True: 0, False: 76.6k]
  ------------------
  255|  50.7k|        case EXR_ATTR_RATIONAL:
  ------------------
  |  Branch (255:9): [True: 0, False: 76.6k]
  ------------------
  256|  50.7k|        case EXR_ATTR_TILEDESC:
  ------------------
  |  Branch (256:9): [True: 0, False: 76.6k]
  ------------------
  257|  50.7k|        case EXR_ATTR_TIMECODE:
  ------------------
  |  Branch (257:9): [True: 0, False: 76.6k]
  ------------------
  258|  51.4k|        case EXR_ATTR_V2I:
  ------------------
  |  Branch (258:9): [True: 746, False: 75.8k]
  ------------------
  259|  58.9k|        case EXR_ATTR_V2F:
  ------------------
  |  Branch (259:9): [True: 7.43k, False: 69.1k]
  ------------------
  260|  58.9k|        case EXR_ATTR_V2D:
  ------------------
  |  Branch (260:9): [True: 0, False: 76.6k]
  ------------------
  261|  58.9k|        case EXR_ATTR_V3I:
  ------------------
  |  Branch (261:9): [True: 0, False: 76.6k]
  ------------------
  262|  58.9k|        case EXR_ATTR_V3F:
  ------------------
  |  Branch (262:9): [True: 0, False: 76.6k]
  ------------------
  263|  58.9k|        case EXR_ATTR_V3D:
  ------------------
  |  Branch (263:9): [True: 0, False: 76.6k]
  ------------------
  264|  58.9k|        case EXR_ATTR_DEEP_IMAGE_STATE:
  ------------------
  |  Branch (264:9): [True: 0, False: 76.6k]
  ------------------
  265|  58.9k|        case EXR_ATTR_UNKNOWN:
  ------------------
  |  Branch (265:9): [True: 0, False: 76.6k]
  ------------------
  266|  58.9k|        case EXR_ATTR_LAST_KNOWN_TYPE:
  ------------------
  |  Branch (266:9): [True: 0, False: 76.6k]
  ------------------
  267|  58.9k|        default: break;
  ------------------
  |  Branch (267:9): [True: 0, False: 76.6k]
  ------------------
  268|  76.6k|    }
  269|       |    /* we don't care about the string because they were built into the
  270|       |     * allocation block of the attribute as necessary */
  271|  76.6k|    ctxt->free_fn (attr);
  272|  76.6k|    return rv;
  273|  76.6k|}
attributes.c:validate_attr_arguments:
  572|  76.6k|{
  573|  76.6k|    exr_attribute_t* nattr = NULL;
  574|  76.6k|    exr_result_t     rv;
  575|  76.6k|    if (!list)
  ------------------
  |  Branch (575:9): [True: 0, False: 76.6k]
  ------------------
  576|      0|    {
  577|      0|        return ctxt->report_error (
  578|      0|            ctxt,
  579|      0|            EXR_ERR_INVALID_ARGUMENT,
  580|      0|            "Invalid list pointer to attr_list_add");
  581|      0|    }
  582|       |
  583|  76.6k|    if (!attr)
  ------------------
  |  Branch (583:9): [True: 0, False: 76.6k]
  ------------------
  584|      0|    {
  585|      0|        return ctxt->report_error (
  586|      0|            ctxt,
  587|      0|            EXR_ERR_INVALID_ARGUMENT,
  588|      0|            "Invalid output attribute pointer location to attr_list_add");
  589|      0|    }
  590|       |
  591|  76.6k|    *attr = NULL;
  592|       |
  593|  76.6k|    if (data_len < 0)
  ------------------
  |  Branch (593:9): [True: 0, False: 76.6k]
  ------------------
  594|      0|    {
  595|      0|        return ctxt->print_error (
  596|      0|            ctxt,
  597|      0|            EXR_ERR_INVALID_ARGUMENT,
  598|      0|            "Extra data storage requested negative length (%d)",
  599|      0|            data_len);
  600|      0|    }
  601|  76.6k|    else if (data_len > 0 && !data_ptr)
  ------------------
  |  Branch (601:14): [True: 0, False: 76.6k]
  |  Branch (601:30): [True: 0, False: 0]
  ------------------
  602|      0|    {
  603|      0|        return ctxt->print_error (
  604|      0|            ctxt,
  605|      0|            EXR_ERR_INVALID_ARGUMENT,
  606|      0|            "Extra data storage output pointer must be provided when requesting extra data (%d)",
  607|      0|            data_len);
  608|      0|    }
  609|  76.6k|    else if (data_ptr)
  ------------------
  |  Branch (609:14): [True: 0, False: 76.6k]
  ------------------
  610|      0|        *data_ptr = NULL;
  611|       |
  612|  76.6k|    if (!name || name[0] == '\0')
  ------------------
  |  Branch (612:9): [True: 0, False: 76.6k]
  |  Branch (612:18): [True: 0, False: 76.6k]
  ------------------
  613|      0|    {
  614|      0|        return ctxt->report_error (
  615|      0|            ctxt, EXR_ERR_INVALID_ARGUMENT, "Invalid name to add_by_type");
  616|      0|    }
  617|       |
  618|       |    /* is it already in the list? */
  619|  76.6k|    rv = exr_attr_list_find_by_name (ctxt, list, name, &nattr);
  620|       |
  621|  76.6k|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (621:9): [True: 43, False: 76.6k]
  ------------------
  622|     43|    {
  623|     43|        if (data_ptr && data_len > 0)
  ------------------
  |  Branch (623:13): [True: 0, False: 43]
  |  Branch (623:25): [True: 0, False: 0]
  ------------------
  624|      0|        {
  625|      0|            return ctxt->print_error (
  626|      0|                ctxt,
  627|      0|                EXR_ERR_INVALID_ARGUMENT,
  628|      0|                "Attribute '%s' (type %s) already in list but requesting additional data",
  629|      0|                name,
  630|      0|                nattr->type_name);
  631|      0|        }
  632|       |
  633|     43|        *attr = nattr;
  634|     43|        return -1;
  635|     43|    }
  636|       |
  637|  76.6k|    return EXR_ERR_SUCCESS;
  638|  76.6k|}
attributes.c:create_attr_block:
  673|  76.6k|{
  674|  76.6k|    size_t           alignpad1, alignpad2;
  675|  76.6k|    size_t           attrblocksz = sizeof (exr_attribute_t);
  676|  76.6k|    uint8_t*         ptr;
  677|  76.6k|    exr_attribute_t* nattr;
  678|  76.6k|    exr_attribute_t  nil = {0};
  679|       |    // not all compilers have this :(
  680|       |    //const size_t ptralign = _Alignof(void*);
  681|  76.6k|    const size_t ptralign = 8;
  682|       |
  683|  76.6k|    if (nlen > 0) attrblocksz += (size_t) (nlen + 1);
  ------------------
  |  Branch (683:9): [True: 59.5k, False: 17.0k]
  ------------------
  684|  76.6k|    if (tlen > 0) attrblocksz += (size_t) (tlen + 1);
  ------------------
  |  Branch (684:9): [True: 0, False: 76.6k]
  ------------------
  685|       |
  686|  76.6k|    if (dblocksize > 0)
  ------------------
  |  Branch (686:9): [True: 41.8k, False: 34.7k]
  ------------------
  687|  41.8k|    {
  688|  41.8k|        alignpad1 = ptralign - (attrblocksz % ptralign);
  689|  41.8k|        if (alignpad1 == ptralign) alignpad1 = 0;
  ------------------
  |  Branch (689:13): [True: 15.0k, False: 26.7k]
  ------------------
  690|  41.8k|        attrblocksz += alignpad1;
  691|  41.8k|        attrblocksz += dblocksize;
  692|  41.8k|    }
  693|  34.7k|    else
  694|  34.7k|        alignpad1 = 0;
  695|       |
  696|  76.6k|    if (data_len > 0)
  ------------------
  |  Branch (696:9): [True: 0, False: 76.6k]
  ------------------
  697|      0|    {
  698|       |        /* align the extra data to a pointer */
  699|      0|        alignpad2 = ptralign - (attrblocksz % ptralign);
  700|      0|        if (alignpad2 == ptralign) alignpad2 = 0;
  ------------------
  |  Branch (700:13): [True: 0, False: 0]
  ------------------
  701|      0|        attrblocksz += alignpad2;
  702|      0|        attrblocksz += (size_t) data_len;
  703|      0|    }
  704|  76.6k|    else
  705|  76.6k|        alignpad2 = 0;
  706|       |
  707|  76.6k|    ptr = (uint8_t*) ctxt->alloc_fn (attrblocksz);
  708|  76.6k|    if (!ptr) return ctxt->standard_error (ctxt, EXR_ERR_OUT_OF_MEMORY);
  ------------------
  |  Branch (708:9): [True: 0, False: 76.6k]
  ------------------
  709|       |
  710|  76.6k|    nattr  = (exr_attribute_t*) ptr;
  711|  76.6k|    *nattr = nil;
  712|  76.6k|    *attr  = nattr;
  713|  76.6k|    ptr += sizeof (exr_attribute_t);
  714|  76.6k|    if (nlen > 0)
  ------------------
  |  Branch (714:9): [True: 59.5k, False: 17.0k]
  ------------------
  715|  59.5k|    {
  716|  59.5k|        memcpy (ptr, name, (size_t) (nlen + 1));
  717|  59.5k|        nattr->name        = (char*) ptr;
  718|  59.5k|        nattr->name_length = (uint8_t) nlen;
  719|       |
  720|  59.5k|        ptr += nlen + 1;
  721|  59.5k|    }
  722|  76.6k|    if (tlen > 0)
  ------------------
  |  Branch (722:9): [True: 0, False: 76.6k]
  ------------------
  723|      0|    {
  724|      0|        memcpy (ptr, type, (size_t) (tlen + 1));
  725|      0|        nattr->type_name        = (char*) ptr;
  726|      0|        nattr->type_name_length = (uint8_t) tlen;
  727|       |
  728|      0|        ptr += tlen + 1;
  729|      0|    }
  730|  76.6k|    ptr += alignpad1;
  731|  76.6k|    if (dblocksize > 0)
  ------------------
  |  Branch (731:9): [True: 41.8k, False: 34.7k]
  ------------------
  732|  41.8k|    {
  733|  41.8k|        nattr->rawptr = ptr;
  734|  41.8k|        ptr += dblocksize;
  735|  41.8k|    }
  736|  76.6k|    if (data_ptr)
  ------------------
  |  Branch (736:9): [True: 0, False: 76.6k]
  ------------------
  737|      0|    {
  738|      0|        if (data_len > 0)
  ------------------
  |  Branch (738:13): [True: 0, False: 0]
  ------------------
  739|      0|        {
  740|      0|            ptr += alignpad2;
  741|      0|            *data_ptr = ptr;
  742|      0|        }
  743|      0|        else
  744|      0|            *data_ptr = NULL;
  745|      0|    }
  746|  76.6k|    return EXR_ERR_SUCCESS;
  747|  76.6k|}
attributes.c:add_to_list:
  505|  76.6k|{
  506|  76.6k|    int               cattrsz = list->num_attributes;
  507|  76.6k|    int               nattrsz = cattrsz + 1;
  508|  76.6k|    int               insertpos;
  509|  76.6k|    exr_attribute_t** attrs        = list->entries;
  510|  76.6k|    exr_attribute_t** sorted_attrs = list->sorted_entries;
  511|  76.6k|    exr_result_t      rv           = EXR_ERR_SUCCESS;
  512|       |
  513|  76.6k|    (void) name;
  514|  76.6k|    if (nattrsz > list->num_alloced)
  ------------------
  |  Branch (514:9): [True: 29.7k, False: 46.8k]
  ------------------
  515|  29.7k|    {
  516|  29.7k|        size_t nsize = (size_t) (list->num_alloced) * 2;
  517|  29.7k|        if ((size_t) nattrsz > nsize) nsize = (size_t) (nattrsz) + 1;
  ------------------
  |  Branch (517:13): [True: 7.43k, False: 22.2k]
  ------------------
  518|  29.7k|        attrs = (exr_attribute_t**) ctxt->alloc_fn (
  519|  29.7k|            sizeof (exr_attribute_t*) * nsize * 2);
  520|  29.7k|        if (!attrs)
  ------------------
  |  Branch (520:13): [True: 0, False: 29.7k]
  ------------------
  521|      0|        {
  522|      0|            ctxt->free_fn (nattr);
  523|      0|            return ctxt->standard_error (ctxt, EXR_ERR_OUT_OF_MEMORY);
  524|      0|        }
  525|       |
  526|  29.7k|        list->num_alloced = (int32_t) nsize;
  527|  29.7k|        sorted_attrs      = attrs + nsize;
  528|       |
  529|   133k|        for (int i = 0; i < cattrsz; ++i)
  ------------------
  |  Branch (529:25): [True: 104k, False: 29.7k]
  ------------------
  530|   104k|        {
  531|   104k|            attrs[i]        = list->entries[i];
  532|   104k|            sorted_attrs[i] = list->sorted_entries[i];
  533|   104k|        }
  534|       |
  535|  29.7k|        if (list->entries) ctxt->free_fn (list->entries);
  ------------------
  |  Branch (535:13): [True: 22.2k, False: 7.43k]
  ------------------
  536|  29.7k|        list->entries        = attrs;
  537|  29.7k|        list->sorted_entries = sorted_attrs;
  538|  29.7k|    }
  539|  76.6k|    attrs[cattrsz]        = nattr;
  540|  76.6k|    sorted_attrs[cattrsz] = nattr;
  541|  76.6k|    insertpos             = cattrsz - 1;
  542|       |
  543|       |    // FYI: qsort is shockingly slow, just do a quick search and
  544|       |    // bubble it up until it's in the correct location
  545|   220k|    while (insertpos >= 0)
  ------------------
  |  Branch (545:12): [True: 195k, False: 24.4k]
  ------------------
  546|   195k|    {
  547|   195k|        exr_attribute_t* prev = sorted_attrs[insertpos];
  548|       |
  549|   195k|        if (strcmp (nattr->name, prev->name) >= 0) break;
  ------------------
  |  Branch (549:13): [True: 52.1k, False: 143k]
  ------------------
  550|       |
  551|   143k|        sorted_attrs[insertpos + 1] = prev;
  552|   143k|        sorted_attrs[insertpos]     = nattr;
  553|   143k|        --insertpos;
  554|   143k|    }
  555|       |
  556|  76.6k|    list->num_attributes = nattrsz;
  557|  76.6k|    rv                   = attr_init (ctxt, nattr);
  558|  76.6k|    if (rv != EXR_ERR_SUCCESS) exr_attr_list_remove (ctxt, list, nattr);
  ------------------
  |  Branch (558:9): [True: 0, False: 76.6k]
  ------------------
  559|  76.6k|    return rv;
  560|  76.6k|}
attributes.c:attr_init:
   68|  76.6k|{
   69|  76.6k|    switch (nattr->type)
   70|  76.6k|    {
   71|  15.9k|        case EXR_ATTR_BOX2I: {
  ------------------
  |  Branch (71:9): [True: 15.9k, False: 60.6k]
  ------------------
   72|  15.9k|            exr_attr_box2i_t nil = {{0}};
   73|  15.9k|            *(nattr->box2i)      = nil;
   74|  15.9k|            break;
   75|      0|        }
   76|      0|        case EXR_ATTR_BOX2F: {
  ------------------
  |  Branch (76:9): [True: 0, False: 76.6k]
  ------------------
   77|      0|            exr_attr_box2f_t nil = {{0}};
   78|      0|            *(nattr->box2f)      = nil;
   79|      0|            break;
   80|      0|        }
   81|      0|        case EXR_ATTR_BYTES: {
  ------------------
  |  Branch (81:9): [True: 0, False: 76.6k]
  ------------------
   82|      0|            exr_attr_bytes_t nil = {0};
   83|      0|            *(nattr->bytes) = nil;
   84|      0|            break;
   85|      0|        }
   86|      0|        case EXR_ATTR_CHLIST: {
  ------------------
  |  Branch (86:9): [True: 0, False: 76.6k]
  ------------------
   87|      0|            exr_attr_chlist_t nil = {0};
   88|      0|            *(nattr->chlist)      = nil;
   89|      0|            break;
   90|      0|        }
   91|      0|        case EXR_ATTR_CHROMATICITIES: {
  ------------------
  |  Branch (91:9): [True: 0, False: 76.6k]
  ------------------
   92|      0|            exr_attr_chromaticities_t nil = {0};
   93|      0|            *(nattr->chromaticities)      = nil;
   94|      0|            break;
   95|      0|        }
   96|  7.43k|        case EXR_ATTR_COMPRESSION:
  ------------------
  |  Branch (96:9): [True: 7.43k, False: 69.1k]
  ------------------
   97|  7.43k|        case EXR_ATTR_ENVMAP:
  ------------------
  |  Branch (97:9): [True: 0, False: 76.6k]
  ------------------
   98|  14.8k|        case EXR_ATTR_LINEORDER:
  ------------------
  |  Branch (98:9): [True: 7.43k, False: 69.1k]
  ------------------
   99|  14.8k|        case EXR_ATTR_DEEP_IMAGE_STATE: nattr->uc = 0; break;
  ------------------
  |  Branch (99:9): [True: 0, False: 76.6k]
  ------------------
  100|      0|        case EXR_ATTR_DOUBLE: nattr->d = 0.0; break;
  ------------------
  |  Branch (100:9): [True: 0, False: 76.6k]
  ------------------
  101|  16.2k|        case EXR_ATTR_FLOAT: nattr->f = 0.0f; break;
  ------------------
  |  Branch (101:9): [True: 16.2k, False: 60.3k]
  ------------------
  102|      0|        case EXR_ATTR_FLOAT_VECTOR: {
  ------------------
  |  Branch (102:9): [True: 0, False: 76.6k]
  ------------------
  103|      0|            exr_attr_float_vector_t nil = {0};
  104|      0|            *(nattr->floatvector)       = nil;
  105|      0|            break;
  106|  14.8k|        }
  107|  3.67k|        case EXR_ATTR_INT: nattr->i = 0; break;
  ------------------
  |  Branch (107:9): [True: 3.67k, False: 72.9k]
  ------------------
  108|      0|        case EXR_ATTR_KEYCODE: {
  ------------------
  |  Branch (108:9): [True: 0, False: 76.6k]
  ------------------
  109|      0|            exr_attr_keycode_t nil = {0};
  110|      0|            *(nattr->keycode)      = nil;
  111|      0|            break;
  112|  14.8k|        }
  113|      0|        case EXR_ATTR_M33F: {
  ------------------
  |  Branch (113:9): [True: 0, False: 76.6k]
  ------------------
  114|      0|            exr_attr_m33f_t nil = {0};
  115|      0|            *(nattr->m33f)      = nil;
  116|      0|            break;
  117|  14.8k|        }
  118|      0|        case EXR_ATTR_M33D: {
  ------------------
  |  Branch (118:9): [True: 0, False: 76.6k]
  ------------------
  119|      0|            exr_attr_m33d_t nil = {0};
  120|      0|            *(nattr->m33d)      = nil;
  121|      0|            break;
  122|  14.8k|        }
  123|      0|        case EXR_ATTR_M44F: {
  ------------------
  |  Branch (123:9): [True: 0, False: 76.6k]
  ------------------
  124|      0|            exr_attr_m44f_t nil = {0};
  125|      0|            *(nattr->m44f)      = nil;
  126|      0|            break;
  127|  14.8k|        }
  128|      0|        case EXR_ATTR_M44D: {
  ------------------
  |  Branch (128:9): [True: 0, False: 76.6k]
  ------------------
  129|      0|            exr_attr_m44f_t nil = {0};
  130|      0|            *(nattr->m44f)      = nil;
  131|      0|            break;
  132|  14.8k|        }
  133|      0|        case EXR_ATTR_PREVIEW: {
  ------------------
  |  Branch (133:9): [True: 0, False: 76.6k]
  ------------------
  134|      0|            exr_attr_preview_t nil = {0};
  135|      0|            *(nattr->preview)      = nil;
  136|      0|            break;
  137|  14.8k|        }
  138|      0|        case EXR_ATTR_RATIONAL: {
  ------------------
  |  Branch (138:9): [True: 0, False: 76.6k]
  ------------------
  139|      0|            exr_attr_rational_t nil = {0};
  140|      0|            *(nattr->rational)      = nil;
  141|      0|            break;
  142|  14.8k|        }
  143|  17.6k|        case EXR_ATTR_STRING: {
  ------------------
  |  Branch (143:9): [True: 17.6k, False: 58.9k]
  ------------------
  144|  17.6k|            exr_attr_string_t nil = {0};
  145|  17.6k|            *(nattr->string)      = nil;
  146|  17.6k|            break;
  147|  14.8k|        }
  148|      0|        case EXR_ATTR_STRING_VECTOR: {
  ------------------
  |  Branch (148:9): [True: 0, False: 76.6k]
  ------------------
  149|      0|            exr_attr_string_vector_t nil = {0};
  150|      0|            *(nattr->stringvector)       = nil;
  151|      0|            break;
  152|  14.8k|        }
  153|      0|        case EXR_ATTR_TILEDESC: {
  ------------------
  |  Branch (153:9): [True: 0, False: 76.6k]
  ------------------
  154|      0|            exr_attr_tiledesc_t nil = {0};
  155|      0|            *(nattr->tiledesc)      = nil;
  156|      0|            break;
  157|  14.8k|        }
  158|      0|        case EXR_ATTR_TIMECODE: {
  ------------------
  |  Branch (158:9): [True: 0, False: 76.6k]
  ------------------
  159|      0|            exr_attr_timecode_t nil = {0};
  160|      0|            *(nattr->timecode)      = nil;
  161|      0|            break;
  162|  14.8k|        }
  163|    746|        case EXR_ATTR_V2I: {
  ------------------
  |  Branch (163:9): [True: 746, False: 75.8k]
  ------------------
  164|    746|            exr_attr_v2i_t nil = {0};
  165|    746|            *(nattr->v2i)      = nil;
  166|    746|            break;
  167|  14.8k|        }
  168|  7.43k|        case EXR_ATTR_V2F: {
  ------------------
  |  Branch (168:9): [True: 7.43k, False: 69.1k]
  ------------------
  169|  7.43k|            exr_attr_v2f_t nil = {0};
  170|  7.43k|            *(nattr->v2f)      = nil;
  171|  7.43k|            break;
  172|  14.8k|        }
  173|      0|        case EXR_ATTR_V2D: {
  ------------------
  |  Branch (173:9): [True: 0, False: 76.6k]
  ------------------
  174|      0|            exr_attr_v2d_t nil = {0};
  175|      0|            *(nattr->v2d)      = nil;
  176|      0|            break;
  177|  14.8k|        }
  178|      0|        case EXR_ATTR_V3I: {
  ------------------
  |  Branch (178:9): [True: 0, False: 76.6k]
  ------------------
  179|      0|            exr_attr_v3i_t nil = {0};
  180|      0|            *(nattr->v3i)      = nil;
  181|      0|            break;
  182|  14.8k|        }
  183|      0|        case EXR_ATTR_V3F: {
  ------------------
  |  Branch (183:9): [True: 0, False: 76.6k]
  ------------------
  184|      0|            exr_attr_v3f_t nil = {0};
  185|      0|            *(nattr->v3f)      = nil;
  186|      0|            break;
  187|  14.8k|        }
  188|      0|        case EXR_ATTR_V3D: {
  ------------------
  |  Branch (188:9): [True: 0, False: 76.6k]
  ------------------
  189|      0|            exr_attr_v3d_t nil = {0};
  190|      0|            *(nattr->v3d)      = nil;
  191|      0|            break;
  192|  14.8k|        }
  193|      0|        case EXR_ATTR_OPAQUE: {
  ------------------
  |  Branch (193:9): [True: 0, False: 76.6k]
  ------------------
  194|      0|            exr_attr_opaquedata_t nil = {0};
  195|      0|            *(nattr->opaque)          = nil;
  196|      0|            break;
  197|  14.8k|        }
  198|      0|        case EXR_ATTR_UNKNOWN:
  ------------------
  |  Branch (198:9): [True: 0, False: 76.6k]
  ------------------
  199|      0|        case EXR_ATTR_LAST_KNOWN_TYPE:
  ------------------
  |  Branch (199:9): [True: 0, False: 76.6k]
  ------------------
  200|      0|        default:
  ------------------
  |  Branch (200:9): [True: 0, False: 76.6k]
  ------------------
  201|      0|            if (ctxt)
  ------------------
  |  Branch (201:17): [True: 0, False: 0]
  ------------------
  202|      0|                ctxt->print_error (
  203|      0|                    ctxt,
  204|      0|                    EXR_ERR_INVALID_ARGUMENT,
  205|      0|                    "Invalid / unimplemented type (%s) in attr_init",
  206|      0|                    nattr->type_name);
  207|      0|            return EXR_ERR_INVALID_ARGUMENT;
  208|  76.6k|    }
  209|  76.6k|    return EXR_ERR_SUCCESS;
  210|  76.6k|}
attributes.c:check_attr_handler:
  644|  76.6k|{
  645|  76.6k|    if (attr->type == EXR_ATTR_OPAQUE)
  ------------------
  |  Branch (645:9): [True: 0, False: 76.6k]
  ------------------
  646|      0|    {
  647|      0|        exr_attribute_t* handler = NULL;
  648|      0|        exr_result_t     rv      = exr_attr_list_find_by_name (
  649|      0|            ctxt, &(ctxt->custom_handlers), attr->type_name, &handler);
  650|      0|        if (rv == EXR_ERR_SUCCESS && handler)
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  |  Branch (650:38): [True: 0, False: 0]
  ------------------
  651|      0|        {
  652|      0|            attr->opaque->unpack_func_ptr = handler->opaque->unpack_func_ptr;
  653|      0|            attr->opaque->pack_func_ptr   = handler->opaque->pack_func_ptr;
  654|      0|            attr->opaque->destroy_unpacked_func_ptr =
  655|      0|                handler->opaque->destroy_unpacked_func_ptr;
  656|      0|        }
  657|      0|    }
  658|  76.6k|}

exr_get_error_code_as_string:
  120|  4.83k|{
  121|  4.83k|    int idx = (int) code;
  122|  4.83k|    if (idx < 0 || idx >= the_error_code_count) idx = the_error_code_count - 1;
  ------------------
  |  Branch (122:9): [True: 0, False: 4.83k]
  |  Branch (122:20): [True: 0, False: 4.83k]
  ------------------
  123|  4.83k|    return the_error_code_names[idx];
  124|  4.83k|}
exr_get_default_maximum_image_size:
  145|  3.07k|{
  146|  3.07k|    if (w) *w = sMaxW;
  ------------------
  |  Branch (146:9): [True: 3.07k, False: 0]
  ------------------
  147|  3.07k|    if (h) *h = sMaxH;
  ------------------
  |  Branch (147:9): [True: 3.07k, False: 0]
  ------------------
  148|  3.07k|}
exr_get_default_maximum_tile_size:
  169|  3.07k|{
  170|  3.07k|    if (w) *w = sTileMaxW;
  ------------------
  |  Branch (170:9): [True: 3.07k, False: 0]
  ------------------
  171|  3.07k|    if (h) *h = sTileMaxH;
  ------------------
  |  Branch (171:9): [True: 3.07k, False: 0]
  ------------------
  172|  3.07k|}
exr_get_default_zip_compression_level:
  190|  3.07k|{
  191|  3.07k|    if (l) *l = sDefaultZipLevel;
  ------------------
  |  Branch (191:9): [True: 3.07k, False: 0]
  ------------------
  192|  3.07k|}
exr_get_default_dwa_compression_quality:
  210|  3.07k|{
  211|  3.07k|    if (q) *q = sDefaultDwaLevel;
  ------------------
  |  Branch (211:9): [True: 3.07k, False: 0]
  ------------------
  212|  3.07k|}

exr_compression_lines_per_chunk:
  235|  7.43k|{
  236|  7.43k|    int linePerChunk = -1;
  237|       |
  238|  7.43k|    switch (comptype)
  239|  7.43k|    {
  240|  7.43k|        case EXR_COMPRESSION_NONE:
  ------------------
  |  Branch (240:9): [True: 7.43k, False: 0]
  ------------------
  241|  7.43k|        case EXR_COMPRESSION_RLE:
  ------------------
  |  Branch (241:9): [True: 0, False: 7.43k]
  ------------------
  242|  7.43k|        case EXR_COMPRESSION_ZIPS: linePerChunk = 1; break;
  ------------------
  |  Branch (242:9): [True: 0, False: 7.43k]
  ------------------
  243|      0|        case EXR_COMPRESSION_ZIP:
  ------------------
  |  Branch (243:9): [True: 0, False: 7.43k]
  ------------------
  244|      0|        case EXR_COMPRESSION_PXR24: linePerChunk = 16; break;
  ------------------
  |  Branch (244:9): [True: 0, False: 7.43k]
  ------------------
  245|      0|        case EXR_COMPRESSION_PIZ:
  ------------------
  |  Branch (245:9): [True: 0, False: 7.43k]
  ------------------
  246|      0|        case EXR_COMPRESSION_B44:
  ------------------
  |  Branch (246:9): [True: 0, False: 7.43k]
  ------------------
  247|      0|        case EXR_COMPRESSION_B44A:
  ------------------
  |  Branch (247:9): [True: 0, False: 7.43k]
  ------------------
  248|      0|        case EXR_COMPRESSION_HTJ2K32:
  ------------------
  |  Branch (248:9): [True: 0, False: 7.43k]
  ------------------
  249|      0|        case EXR_COMPRESSION_DWAA: linePerChunk = 32; break;
  ------------------
  |  Branch (249:9): [True: 0, False: 7.43k]
  ------------------
  250|      0|        case EXR_COMPRESSION_DWAB: linePerChunk = 256; break;
  ------------------
  |  Branch (250:9): [True: 0, False: 7.43k]
  ------------------
  251|      0|        case EXR_COMPRESSION_HTJ2K256: linePerChunk = 256; break;
  ------------------
  |  Branch (251:9): [True: 0, False: 7.43k]
  ------------------
  252|      0|        case EXR_COMPRESSION_LAST_TYPE:
  ------------------
  |  Branch (252:9): [True: 0, False: 7.43k]
  ------------------
  253|      0|        default:
  ------------------
  |  Branch (253:9): [True: 0, False: 7.43k]
  ------------------
  254|       |            /* ERROR CONDITION */
  255|      0|            break;
  256|  7.43k|    }
  257|  7.43k|    return linePerChunk;
  258|  7.43k|}

exr_finish:
  198|  3.07k|{
  199|  3.07k|    exr_context_t ctxt;
  200|  3.07k|    exr_result_t  rv = EXR_ERR_SUCCESS;
  201|       |
  202|  3.07k|    if (!pctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (202:9): [True: 0, False: 3.07k]
  ------------------
  203|       |
  204|  3.07k|    ctxt = *pctxt;
  205|  3.07k|    if (ctxt)
  ------------------
  |  Branch (205:9): [True: 3.07k, False: 0]
  ------------------
  206|  3.07k|    {
  207|  3.07k|        int failed = 0;
  208|  3.07k|        if (ctxt->mode == EXR_CONTEXT_WRITE ||
  ------------------
  |  Branch (208:13): [True: 3.07k, False: 0]
  ------------------
  209|      0|            ctxt->mode == EXR_CONTEXT_WRITING_DATA)
  ------------------
  |  Branch (209:13): [True: 0, False: 0]
  ------------------
  210|  3.07k|            failed = 1;
  211|       |
  212|  3.07k|        if (ctxt->mode != EXR_CONTEXT_READ &&
  ------------------
  |  Branch (212:13): [True: 3.07k, False: 0]
  ------------------
  213|  3.07k|            ctxt->mode != EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (213:13): [True: 3.07k, False: 0]
  ------------------
  214|  3.07k|            rv = finalize_write (ctxt, failed);
  215|       |
  216|  3.07k|        if (ctxt->destroy_fn) ctxt->destroy_fn (ctxt, ctxt->user_data, failed);
  ------------------
  |  Branch (216:13): [True: 0, False: 3.07k]
  ------------------
  217|       |
  218|  3.07k|        internal_exr_destroy_context (ctxt);
  219|  3.07k|    }
  220|  3.07k|    *pctxt = NULL;
  221|       |
  222|  3.07k|    return rv;
  223|  3.07k|}
exr_start_write:
  300|  3.07k|{
  301|  3.07k|    int                       rv    = EXR_ERR_UNKNOWN;
  302|  3.07k|    exr_context_t             ret   = NULL;
  303|  3.07k|    exr_context_initializer_t inits = fill_context_data (ctxtdata);
  304|       |
  305|  3.07k|    if (!ctxt)
  ------------------
  |  Branch (305:9): [True: 0, False: 3.07k]
  ------------------
  306|      0|    {
  307|      0|        inits.error_handler_fn (
  308|      0|            NULL,
  309|      0|            EXR_ERR_INVALID_ARGUMENT,
  310|      0|            "Invalid context handle passed to start_read function");
  311|      0|        return EXR_ERR_INVALID_ARGUMENT;
  312|      0|    }
  313|       |
  314|  3.07k|    if (filename)
  ------------------
  |  Branch (314:9): [True: 3.07k, False: 0]
  ------------------
  315|  3.07k|    {
  316|  3.07k|        rv = internal_exr_alloc_context (
  317|  3.07k|            &ret,
  318|  3.07k|            &inits,
  319|  3.07k|            EXR_CONTEXT_WRITE,
  320|  3.07k|            sizeof (struct _internal_exr_filehandle));
  321|  3.07k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (321:13): [True: 3.07k, False: 0]
  ------------------
  322|  3.07k|        {
  323|  3.07k|            ret->do_write = &dispatch_write;
  324|       |
  325|  3.07k|            rv = exr_attr_string_create (
  326|  3.07k|                (exr_context_t) ret, &(ret->filename), filename);
  327|       |
  328|  3.07k|            if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (328:17): [True: 3.07k, False: 0]
  ------------------
  329|  3.07k|            {
  330|  3.07k|                if (!inits.write_fn)
  ------------------
  |  Branch (330:21): [True: 0, False: 3.07k]
  ------------------
  331|      0|                {
  332|      0|                    if (default_mode == EXR_INTERMEDIATE_TEMP_FILE)
  ------------------
  |  Branch (332:25): [True: 0, False: 0]
  ------------------
  333|      0|                        rv = make_temp_filename (ret);
  334|      0|                    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (334:25): [True: 0, False: 0]
  ------------------
  335|      0|                        rv = default_init_write_file (ret);
  336|      0|                }
  337|  3.07k|            }
  338|       |
  339|  3.07k|            if (rv != EXR_ERR_SUCCESS) exr_finish ((exr_context_t*) &ret);
  ------------------
  |  Branch (339:17): [True: 0, False: 3.07k]
  ------------------
  340|  3.07k|        }
  341|      0|        else
  342|      0|            rv = EXR_ERR_OUT_OF_MEMORY;
  343|  3.07k|    }
  344|      0|    else
  345|      0|    {
  346|      0|        inits.error_handler_fn (
  347|      0|            NULL,
  348|      0|            EXR_ERR_INVALID_ARGUMENT,
  349|      0|            "Invalid filename passed to start_write function");
  350|      0|        rv = EXR_ERR_INVALID_ARGUMENT;
  351|      0|    }
  352|       |
  353|  3.07k|    *ctxt = (exr_context_t) ret;
  354|  3.07k|    return rv;
  355|  3.07k|}
exr_write_header:
  637|  3.07k|{
  638|  3.07k|    exr_result_t rv = EXR_ERR_SUCCESS;
  639|       |
  640|  3.07k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (640:9): [True: 0, False: 3.07k]
  ------------------
  641|  3.07k|    internal_exr_lock (ctxt);
  642|       |
  643|  3.07k|    if (ctxt->mode != EXR_CONTEXT_WRITE)
  ------------------
  |  Branch (643:9): [True: 0, False: 3.07k]
  ------------------
  644|      0|        return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  645|  3.07k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));
  646|       |
  647|  3.07k|    if (ctxt->num_parts == 0)
  ------------------
  |  Branch (647:9): [True: 0, False: 3.07k]
  ------------------
  648|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->report_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  649|  3.07k|            ctxt,
  650|  3.07k|            EXR_ERR_FILE_BAD_HEADER,
  651|  3.07k|            "No parts defined in file prior to writing data"));
  652|       |
  653|       |    /* add part and set name should have already validated the uniqueness
  654|       |     * so just ensure the name has been set for multi part files
  655|       |     */
  656|  9.99k|    for ( int p = ctxt->num_parts > 1 ? 0 : 1; p < ctxt->num_parts; ++p )
  ------------------
  |  Branch (656:19): [True: 2.56k, False: 504]
  |  Branch (656:48): [True: 6.92k, False: 3.07k]
  ------------------
  657|  6.92k|    {
  658|  6.92k|        const exr_attribute_t* pname = ctxt->parts[p]->name;
  659|  6.92k|        if (!pname)
  ------------------
  |  Branch (659:13): [True: 0, False: 6.92k]
  ------------------
  660|      0|        {
  661|      0|            return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  662|      0|                ctxt->print_error (
  663|      0|                    ctxt,
  664|      0|                    EXR_ERR_INVALID_ARGUMENT,
  665|      0|                    "Part %d missing required name for multi-part file",
  666|      0|                    p));
  667|      0|        }
  668|  6.92k|    }
  669|       |
  670|  3.07k|    for (int p = 0; rv == EXR_ERR_SUCCESS && p < ctxt->num_parts; ++p)
  ------------------
  |  Branch (670:21): [True: 3.07k, False: 0]
  |  Branch (670:46): [True: 3.07k, False: 0]
  ------------------
  671|  3.07k|    {
  672|  3.07k|        exr_priv_part_t curp = ctxt->parts[p];
  673|       |
  674|  3.07k|        int32_t ccount = 0;
  675|       |
  676|  3.07k|        if (!curp->channels)
  ------------------
  |  Branch (676:13): [True: 3.07k, False: 0]
  ------------------
  677|  3.07k|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|  3.07k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  678|  3.07k|                ctxt,
  679|  3.07k|                EXR_ERR_MISSING_REQ_ATTR,
  680|  3.07k|                "Part %d is missing channel list",
  681|  3.07k|                p));
  682|       |
  683|      0|        rv = internal_exr_compute_tile_information (ctxt, curp, 0);
  684|      0|        if (rv != EXR_ERR_SUCCESS) break;
  ------------------
  |  Branch (684:13): [True: 0, False: 0]
  ------------------
  685|       |
  686|      0|        ccount = internal_exr_compute_chunk_offset_size (curp);
  687|      0|        if (ccount < 0)
  ------------------
  |  Branch (687:13): [True: 0, False: 0]
  ------------------
  688|      0|            return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  689|      0|                ctxt->report_error (
  690|      0|                    ctxt,
  691|      0|                    EXR_ERR_FILE_BAD_HEADER,
  692|      0|                    "Invalid part specification computing number of chunks in file"));
  693|       |
  694|      0|        curp->chunk_count = ccount;
  695|       |
  696|      0|        if (ctxt->has_nonimage_data || ctxt->is_multipart)
  ------------------
  |  Branch (696:13): [True: 0, False: 0]
  |  Branch (696:40): [True: 0, False: 0]
  ------------------
  697|      0|        {
  698|      0|            internal_exr_unlock (ctxt);
  699|      0|            rv = exr_attr_set_int (ctxt, p, EXR_REQ_CHUNK_COUNT_STR, ccount);
  ------------------
  |  |   22|      0|#define EXR_REQ_CHUNK_COUNT_STR "chunkCount"
  ------------------
  700|      0|            internal_exr_lock (ctxt);
  701|      0|            if (rv != EXR_ERR_SUCCESS) break;
  ------------------
  |  Branch (701:17): [True: 0, False: 0]
  ------------------
  702|      0|        }
  703|       |
  704|      0|        rv = internal_exr_validate_write_part (ctxt, curp);
  705|      0|    }
  706|       |
  707|      0|    ctxt->output_file_offset = 0;
  708|       |
  709|      0|    if (rv == EXR_ERR_SUCCESS) rv = internal_exr_write_header (ctxt);
  ------------------
  |  Branch (709:9): [True: 0, False: 0]
  ------------------
  710|       |
  711|      0|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (711:9): [True: 0, False: 0]
  ------------------
  712|      0|    {
  713|      0|        ctxt->mode               = EXR_CONTEXT_WRITING_DATA;
  714|      0|        ctxt->cur_output_part    = 0;
  715|      0|        ctxt->last_output_chunk  = -1;
  716|      0|        ctxt->output_chunk_count = 0;
  717|      0|        for (int p = 0; rv == EXR_ERR_SUCCESS && p < ctxt->num_parts; ++p)
  ------------------
  |  Branch (717:25): [True: 0, False: 0]
  |  Branch (717:50): [True: 0, False: 0]
  ------------------
  718|      0|        {
  719|      0|            exr_priv_part_t curp = ctxt->parts[p];
  720|       |
  721|      0|            curp->chunk_table_offset = ctxt->output_file_offset;
  722|      0|            ctxt->output_file_offset +=
  723|      0|                (uint64_t) (curp->chunk_count) * sizeof (uint64_t);
  724|      0|        }
  725|      0|    }
  726|       |
  727|      0|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  728|  3.07k|}
context.c:fill_context_data:
  112|  3.07k|{
  113|  3.07k|    exr_context_initializer_t inits = EXR_DEFAULT_CONTEXT_INITIALIZER;
  ------------------
  |  |  356|  3.07k|    { sizeof (exr_context_initializer_t), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -1.f, 0, { 0, 0, 0, 0 } }
  ------------------
  114|  3.07k|    if (ctxtdata)
  ------------------
  |  Branch (114:9): [True: 3.07k, False: 0]
  ------------------
  115|  3.07k|    {
  116|  3.07k|        inits.error_handler_fn = ctxtdata->error_handler_fn;
  117|  3.07k|        inits.alloc_fn         = ctxtdata->alloc_fn;
  118|  3.07k|        inits.free_fn          = ctxtdata->free_fn;
  119|  3.07k|        inits.user_data        = ctxtdata->user_data;
  120|  3.07k|        inits.read_fn          = ctxtdata->read_fn;
  121|  3.07k|        inits.size_fn          = ctxtdata->size_fn;
  122|  3.07k|        inits.write_fn         = ctxtdata->write_fn;
  123|  3.07k|        inits.destroy_fn       = ctxtdata->destroy_fn;
  124|  3.07k|        inits.max_image_width  = ctxtdata->max_image_width;
  125|  3.07k|        inits.max_image_height = ctxtdata->max_image_height;
  126|  3.07k|        inits.max_tile_width   = ctxtdata->max_tile_width;
  127|  3.07k|        inits.max_tile_height  = ctxtdata->max_tile_height;
  128|  3.07k|        if (ctxtdata->size >= sizeof (struct _exr_context_initializer_v2))
  ------------------
  |  Branch (128:13): [True: 3.07k, False: 0]
  ------------------
  129|  3.07k|        {
  130|  3.07k|            inits.zip_level   = ctxtdata->zip_level;
  131|  3.07k|            inits.dwa_quality = ctxtdata->dwa_quality;
  132|  3.07k|        }
  133|  3.07k|        if (ctxtdata->size >= sizeof (struct _exr_context_initializer_v3))
  ------------------
  |  Branch (133:13): [True: 3.07k, False: 0]
  ------------------
  134|  3.07k|        {
  135|  3.07k|            inits.flags = ctxtdata->flags;
  136|  3.07k|        }
  137|  3.07k|    }
  138|       |
  139|  3.07k|    internal_exr_update_default_handlers (&inits);
  140|  3.07k|    return inits;
  141|  3.07k|}

context.c:finalize_write:
   70|  3.07k|{
   71|  3.07k|    exr_result_t rv = EXR_ERR_SUCCESS;
   72|       |
   73|       |    /* TODO: Do we actually want to do this or leave the garbage file there */
   74|  3.07k|    if (failed && pf->destroy_fn == &default_shutdown)
  ------------------
  |  Branch (74:9): [True: 3.07k, False: 0]
  |  Branch (74:19): [True: 0, False: 3.07k]
  ------------------
   75|      0|    {
   76|      0|        if (pf->tmp_filename.str)
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            unlink (pf->tmp_filename.str);
   78|      0|        else
   79|      0|            unlink (pf->filename.str);
   80|      0|    }
   81|       |
   82|  3.07k|    if (!failed && pf->tmp_filename.str)
  ------------------
  |  Branch (82:9): [True: 0, False: 3.07k]
  |  Branch (82:20): [True: 0, False: 0]
  ------------------
   83|      0|    {
   84|      0|        int mvret = rename (pf->tmp_filename.str, pf->filename.str);
   85|      0|        if (mvret < 0)
  ------------------
  |  Branch (85:13): [True: 0, False: 0]
  ------------------
   86|      0|            return pf->print_error (
   87|      0|                pf,
   88|      0|                EXR_ERR_FILE_ACCESS,
   89|      0|                "Unable to rename temporary file: %s",
   90|      0|                strerror (rv));
   91|      0|    }
   92|       |
   93|  3.07k|    return rv;
   94|  3.07k|}

internal_exr_add_part:
  190|  7.43k|{
  191|  7.43k|    int              ncount = f->num_parts + 1;
  192|  7.43k|    exr_priv_part_t  part;
  193|  7.43k|    exr_priv_part_t* nptrs = NULL;
  194|       |
  195|  7.43k|    if (new_index) *new_index = f->num_parts;
  ------------------
  |  Branch (195:9): [True: 7.43k, False: 0]
  ------------------
  196|       |
  197|  7.43k|    if (ncount == 1)
  ------------------
  |  Branch (197:9): [True: 3.07k, False: 4.36k]
  ------------------
  198|  3.07k|    {
  199|       |        /* avoid an initial malloc by embedding a part in the struct... */
  200|  3.07k|        part         = &(f->first_part);
  201|       |        /* also need a pointer to pointer... */
  202|  3.07k|        f->init_part = part;
  203|  3.07k|        nptrs        = &(f->init_part);
  204|  3.07k|    }
  205|  4.36k|    else
  206|  4.36k|    {
  207|  4.36k|        part = f->alloc_fn (sizeof (struct _priv_exr_part_t));
  208|  4.36k|        if (!part) return f->standard_error (f, EXR_ERR_OUT_OF_MEMORY);
  ------------------
  |  Branch (208:13): [True: 0, False: 4.36k]
  ------------------
  209|       |
  210|  4.36k|        nptrs = f->alloc_fn (sizeof (exr_priv_part_t) * (size_t) ncount);
  211|  4.36k|        if (!nptrs)
  ------------------
  |  Branch (211:13): [True: 0, False: 4.36k]
  ------------------
  212|      0|        {
  213|      0|            f->free_fn (part);
  214|      0|            return f->standard_error (f, EXR_ERR_OUT_OF_MEMORY);
  215|      0|        }
  216|  4.36k|    }
  217|  7.43k|    memset (part, 0, sizeof (struct _priv_exr_part_t));
  218|       |
  219|       |    /* assign appropriately invalid values */
  220|  7.43k|    part->storage_mode         = EXR_STORAGE_LAST_TYPE;
  221|  7.43k|    part->data_window.max.x    = -1;
  222|  7.43k|    part->data_window.max.y    = -1;
  223|  7.43k|    part->display_window.max.x = -1;
  224|  7.43k|    part->display_window.max.y = -1;
  225|  7.43k|    part->chunk_count          = -1;
  226|  7.43k|    part->lines_per_chunk      = -1;
  227|       |
  228|  7.43k|    part->zip_compression_level = f->default_zip_level;
  229|  7.43k|    part->dwa_compression_level = f->default_dwa_quality;
  230|       |
  231|       |    /* put it into the part table */
  232|  13.5k|    for (int p = 0; p < f->num_parts; ++p)
  ------------------
  |  Branch (232:21): [True: 6.15k, False: 7.43k]
  ------------------
  233|  6.15k|    {
  234|  6.15k|        nptrs[p] = f->parts[p];
  235|  6.15k|    }
  236|  7.43k|    nptrs[f->num_parts] = part;
  237|       |
  238|  7.43k|    if (f->parts && f->parts != &(f->init_part)) { f->free_fn (f->parts); }
  ------------------
  |  Branch (238:9): [True: 4.36k, False: 3.07k]
  |  Branch (238:21): [True: 1.79k, False: 2.56k]
  ------------------
  239|  7.43k|    f->parts     = nptrs;
  240|  7.43k|    f->num_parts = ncount;
  241|  7.43k|    if (outpart) *outpart = part;
  ------------------
  |  Branch (241:9): [True: 7.43k, False: 0]
  ------------------
  242|       |
  243|  7.43k|    return EXR_ERR_SUCCESS;
  244|  7.43k|}
internal_exr_alloc_context:
  299|  3.07k|{
  300|  3.07k|    void*         memptr;
  301|  3.07k|    exr_result_t  rv;
  302|  3.07k|    exr_context_t ret;
  303|  3.07k|    int           gmaxw, gmaxh;
  304|  3.07k|    size_t        extra_data;
  305|       |
  306|  3.07k|    *out = NULL;
  307|  3.07k|    if (initializers->read_fn || initializers->write_fn)
  ------------------
  |  Branch (307:9): [True: 0, False: 3.07k]
  |  Branch (307:34): [True: 3.07k, False: 0]
  ------------------
  308|  3.07k|        extra_data = 0;
  309|      0|    else
  310|      0|        extra_data = default_size;
  311|       |
  312|  3.07k|    memptr = (initializers->alloc_fn) (
  313|  3.07k|        sizeof (struct _priv_exr_context_t) + extra_data);
  314|  3.07k|    if (memptr)
  ------------------
  |  Branch (314:9): [True: 3.07k, False: 0]
  ------------------
  315|  3.07k|    {
  316|  3.07k|        memset (memptr, 0, sizeof (struct _priv_exr_context_t));
  317|       |
  318|  3.07k|        ret       = memptr;
  319|  3.07k|        ret->mode = (uint8_t) mode;
  320|       |        /* stash this separately so when a user queries they don't see
  321|       |         * any of our internal hijinx */
  322|  3.07k|        ret->real_user_data = initializers->user_data;
  323|  3.07k|        if (initializers->read_fn || initializers->write_fn)
  ------------------
  |  Branch (323:13): [True: 0, False: 3.07k]
  |  Branch (323:38): [True: 3.07k, False: 0]
  ------------------
  324|  3.07k|            ret->user_data = initializers->user_data;
  325|      0|        else if (extra_data > 0)
  ------------------
  |  Branch (325:18): [True: 0, False: 0]
  ------------------
  326|      0|            ret->user_data =
  327|      0|                (((uint8_t*) memptr) + sizeof (struct _priv_exr_context_t));
  328|       |
  329|  3.07k|        ret->standard_error   = &dispatch_standard_error;
  330|  3.07k|        ret->report_error     = &dispatch_error;
  331|  3.07k|        ret->print_error      = &dispatch_print_error;
  332|  3.07k|        ret->error_handler_fn = initializers->error_handler_fn;
  333|  3.07k|        ret->alloc_fn         = initializers->alloc_fn;
  334|  3.07k|        ret->free_fn          = initializers->free_fn;
  335|       |
  336|  3.07k|        exr_get_default_maximum_image_size (&gmaxw, &gmaxh);
  337|  3.07k|        if (initializers->max_image_width <= 0)
  ------------------
  |  Branch (337:13): [True: 3.07k, False: 0]
  ------------------
  338|  3.07k|            ret->max_image_w = gmaxw;
  339|      0|        else
  340|      0|            ret->max_image_w = initializers->max_image_width;
  341|  3.07k|        if (ret->max_image_w > 0 && gmaxw > 0 && ret->max_image_w &&
  ------------------
  |  Branch (341:13): [True: 0, False: 3.07k]
  |  Branch (341:37): [True: 0, False: 0]
  |  Branch (341:50): [True: 0, False: 0]
  ------------------
  342|      0|            ret->max_image_w > gmaxw)
  ------------------
  |  Branch (342:13): [True: 0, False: 0]
  ------------------
  343|      0|            ret->max_image_w = gmaxw;
  344|       |
  345|  3.07k|        if (initializers->max_image_height <= 0)
  ------------------
  |  Branch (345:13): [True: 3.07k, False: 0]
  ------------------
  346|  3.07k|            ret->max_image_h = gmaxh;
  347|      0|        else
  348|      0|            ret->max_image_h = initializers->max_image_height;
  349|  3.07k|        if (ret->max_image_h > 0 && gmaxh > 0 && ret->max_image_h &&
  ------------------
  |  Branch (349:13): [True: 0, False: 3.07k]
  |  Branch (349:37): [True: 0, False: 0]
  |  Branch (349:50): [True: 0, False: 0]
  ------------------
  350|      0|            ret->max_image_h > gmaxh)
  ------------------
  |  Branch (350:13): [True: 0, False: 0]
  ------------------
  351|      0|            ret->max_image_h = gmaxh;
  352|       |
  353|  3.07k|        exr_get_default_maximum_tile_size (&gmaxw, &gmaxh);
  354|  3.07k|        if (initializers->max_tile_width <= 0)
  ------------------
  |  Branch (354:13): [True: 3.07k, False: 0]
  ------------------
  355|  3.07k|            ret->max_tile_w = gmaxw;
  356|      0|        else
  357|      0|            ret->max_tile_w = initializers->max_tile_width;
  358|  3.07k|        if (ret->max_tile_w > 0 && gmaxw > 0 && ret->max_tile_w &&
  ------------------
  |  Branch (358:13): [True: 0, False: 3.07k]
  |  Branch (358:36): [True: 0, False: 0]
  |  Branch (358:49): [True: 0, False: 0]
  ------------------
  359|      0|            ret->max_tile_w > gmaxw)
  ------------------
  |  Branch (359:13): [True: 0, False: 0]
  ------------------
  360|      0|            ret->max_tile_w = gmaxw;
  361|       |
  362|  3.07k|        if (initializers->max_tile_height <= 0)
  ------------------
  |  Branch (362:13): [True: 3.07k, False: 0]
  ------------------
  363|  3.07k|            ret->max_tile_h = gmaxh;
  364|      0|        else
  365|      0|            ret->max_tile_h = initializers->max_tile_height;
  366|  3.07k|        if (ret->max_tile_h > 0 && gmaxh > 0 && ret->max_tile_h &&
  ------------------
  |  Branch (366:13): [True: 0, False: 3.07k]
  |  Branch (366:36): [True: 0, False: 0]
  |  Branch (366:49): [True: 0, False: 0]
  ------------------
  367|      0|            ret->max_tile_h > gmaxh)
  ------------------
  |  Branch (367:13): [True: 0, False: 0]
  ------------------
  368|      0|            ret->max_tile_h = gmaxh;
  369|       |
  370|  3.07k|        exr_get_default_zip_compression_level (&ret->default_zip_level);
  371|  3.07k|        exr_get_default_dwa_compression_quality (&ret->default_dwa_quality);
  372|  3.07k|        if (initializers->zip_level >= 0)
  ------------------
  |  Branch (372:13): [True: 3.07k, False: 0]
  ------------------
  373|  3.07k|            ret->default_zip_level = initializers->zip_level;
  374|  3.07k|        if (initializers->dwa_quality >= 0.f)
  ------------------
  |  Branch (374:13): [True: 3.07k, False: 0]
  ------------------
  375|  3.07k|            ret->default_dwa_quality = initializers->dwa_quality;
  376|       |
  377|  3.07k|        if (initializers->flags & EXR_CONTEXT_FLAG_STRICT_HEADER)
  ------------------
  |  |  333|  3.07k|#define EXR_CONTEXT_FLAG_STRICT_HEADER (1 << 0)
  ------------------
  |  Branch (377:13): [True: 0, False: 3.07k]
  ------------------
  378|      0|            ret->strict_header = 1;
  379|  3.07k|        if (initializers->flags & EXR_CONTEXT_FLAG_SILENT_HEADER_PARSE)
  ------------------
  |  |  340|  3.07k|#define EXR_CONTEXT_FLAG_SILENT_HEADER_PARSE (1 << 1)
  ------------------
  |  Branch (379:13): [True: 0, False: 3.07k]
  ------------------
  380|      0|            ret->silent_header = 1;
  381|  3.07k|        ret->disable_chunk_reconstruct =
  382|  3.07k|            (initializers->flags &
  383|  3.07k|             EXR_CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION);
  ------------------
  |  |  348|  3.07k|#define EXR_CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION (1 << 2)
  ------------------
  384|  3.07k|        ret->legacy_header =
  385|  3.07k|            (initializers->flags & EXR_CONTEXT_FLAG_WRITE_LEGACY_HEADER);
  ------------------
  |  |  351|  3.07k|#define EXR_CONTEXT_FLAG_WRITE_LEGACY_HEADER (1 << 3)
  ------------------
  386|       |
  387|  3.07k|        ret->file_size       = -1;
  388|  3.07k|        ret->max_name_length = EXR_SHORTNAME_MAXLEN;
  ------------------
  |  |   28|  3.07k|#define EXR_SHORTNAME_MAXLEN 31
  ------------------
  389|       |
  390|  3.07k|        ret->destroy_fn = initializers->destroy_fn;
  391|  3.07k|        ret->read_fn    = initializers->read_fn;
  392|  3.07k|        ret->write_fn   = initializers->write_fn;
  393|       |
  394|  3.07k|#if ILMTHREAD_THREADING_ENABLED
  395|       |#    ifdef _WIN32
  396|       |        InitializeCriticalSection (&(ret->mutex));
  397|       |#    else
  398|  3.07k|        rv = pthread_mutex_init (&(ret->mutex), NULL);
  399|  3.07k|        if (rv != 0)
  ------------------
  |  Branch (399:13): [True: 0, False: 3.07k]
  ------------------
  400|      0|        {
  401|       |            /* fairly unlikely... */
  402|      0|            (initializers->free_fn) (memptr);
  403|      0|            *out = NULL;
  404|      0|            return EXR_ERR_OUT_OF_MEMORY;
  405|      0|        }
  406|  3.07k|#    endif
  407|  3.07k|#endif
  408|       |
  409|  3.07k|        *out = ret;
  410|  3.07k|        rv   = EXR_ERR_SUCCESS;
  411|       |
  412|       |        /* if we are reading the file, go ahead and set up the first
  413|       |         * part to make parsing logic easier */
  414|  3.07k|        if (mode != EXR_CONTEXT_WRITE)
  ------------------
  |  Branch (414:13): [True: 0, False: 3.07k]
  ------------------
  415|      0|        {
  416|      0|            exr_priv_part_t part;
  417|      0|            rv = internal_exr_add_part (ret, &part, NULL);
  418|      0|            if (rv != EXR_ERR_SUCCESS)
  ------------------
  |  Branch (418:17): [True: 0, False: 0]
  ------------------
  419|      0|            {
  420|       |                /* this should never happen since we reserve space for
  421|       |                 * one in the struct, but maybe we changed
  422|       |                 * something */
  423|      0|                (initializers->free_fn) (memptr);
  424|      0|                *out = NULL;
  425|      0|            }
  426|      0|        }
  427|  3.07k|    }
  428|      0|    else
  429|      0|    {
  430|      0|        (initializers->error_handler_fn) (
  431|      0|            NULL,
  432|      0|            EXR_ERR_OUT_OF_MEMORY,
  433|      0|            exr_get_default_error_message (EXR_ERR_OUT_OF_MEMORY));
  434|      0|        rv = EXR_ERR_OUT_OF_MEMORY;
  435|      0|    }
  436|       |
  437|  3.07k|    return rv;
  438|  3.07k|}
internal_exr_destroy_context:
  444|  3.07k|{
  445|  3.07k|    exr_memory_free_func_t dofree = ctxt->free_fn;
  446|       |
  447|  3.07k|    exr_attr_string_destroy (ctxt, &(ctxt->filename));
  448|  3.07k|    exr_attr_string_destroy (ctxt, &(ctxt->tmp_filename));
  449|  3.07k|    exr_attr_list_destroy (ctxt, &(ctxt->custom_handlers));
  450|  3.07k|    internal_exr_destroy_parts (ctxt);
  451|  3.07k|#if ILMTHREAD_THREADING_ENABLED
  452|       |#    ifdef _WIN32
  453|       |    DeleteCriticalSection (&(ctxt->mutex));
  454|       |#    else
  455|  3.07k|    pthread_mutex_destroy (&(ctxt->mutex));
  456|  3.07k|#    endif
  457|  3.07k|#endif
  458|       |
  459|  3.07k|    dofree (ctxt);
  460|  3.07k|}
internal_exr_update_default_handlers:
  466|  3.07k|{
  467|  3.07k|    if (!inits->error_handler_fn)
  ------------------
  |  Branch (467:9): [True: 3.07k, False: 0]
  ------------------
  468|  3.07k|        inits->error_handler_fn = &default_error_handler;
  469|       |
  470|  3.07k|    if (!inits->alloc_fn) inits->alloc_fn = &internal_exr_alloc;
  ------------------
  |  Branch (470:9): [True: 3.07k, False: 0]
  ------------------
  471|  3.07k|    if (!inits->free_fn) inits->free_fn = &internal_exr_free;
  ------------------
  |  Branch (471:9): [True: 3.07k, False: 0]
  ------------------
  472|  3.07k|}
internal_structs.c:internal_exr_destroy_part:
  147|  7.43k|{
  148|  7.43k|    exr_memory_free_func_t dofree = ctxt->free_fn;
  149|  7.43k|    uint64_t*              ctable;
  150|       |
  151|  7.43k|    exr_attr_list_destroy ((exr_context_t) ctxt, &(cur->attributes));
  152|       |
  153|       |    /* we stack x and y together so only have to free the first */
  154|  7.43k|    if (cur->tile_level_tile_count_x) dofree (cur->tile_level_tile_count_x);
  ------------------
  |  Branch (154:9): [True: 0, False: 7.43k]
  ------------------
  155|       |
  156|       |#if defined(_MSC_VER)
  157|       |    ctable = (uint64_t*) InterlockedOr64 (
  158|       |        (int64_t volatile*) &(cur->chunk_table), 0);
  159|       |    cur->chunk_table = 0;
  160|       |#else
  161|  7.43k|    ctable = (uint64_t*) atomic_load (&(cur->chunk_table));
  162|  7.43k|    atomic_store (&(cur->chunk_table), (uintptr_t) (0));
  163|  7.43k|#endif
  164|  7.43k|    if (ctable && ((uintptr_t) ctable) != UINTPTR_MAX) dofree (ctable);
  ------------------
  |  Branch (164:9): [True: 0, False: 7.43k]
  |  Branch (164:19): [True: 0, False: 0]
  ------------------
  165|       |
  166|       |    /* we avoid malloc on one part files, but need to check */
  167|  7.43k|    if (cur != &(ctxt->first_part)) { dofree (cur); }
  ------------------
  |  Branch (167:9): [True: 4.36k, False: 3.07k]
  ------------------
  168|  3.07k|    else { memset (cur, 0, sizeof (struct _priv_exr_part_t)); }
  169|  7.43k|}
internal_structs.c:dispatch_error:
   82|  4.83k|{
   83|  4.83k|    if (ctxt)
  ------------------
  |  Branch (83:9): [True: 4.83k, False: 0]
  ------------------
   84|  4.83k|    {
   85|  4.83k|        ctxt->error_handler_fn (ctxt, code, msg);
   86|  4.83k|        return code;
   87|  4.83k|    }
   88|       |
   89|      0|    default_error_handler (ctxt, code, msg);
   90|      0|    return code;
   91|  4.83k|}
internal_structs.c:dispatch_print_error:
  110|  3.82k|{
  111|  3.82k|    char    stackbuf[256];
  112|  3.82k|    char*   heapbuf = NULL;
  113|  3.82k|    int     nwrit   = 0;
  114|  3.82k|    va_list fmtargs;
  115|       |
  116|  3.82k|    va_start (fmtargs, msg);
  117|  3.82k|    {
  118|  3.82k|        va_list stkargs;
  119|       |
  120|  3.82k|        va_copy (stkargs, fmtargs);
  121|  3.82k|        nwrit = vsnprintf (stackbuf, 256, msg, stkargs);
  122|  3.82k|        va_end (stkargs);
  123|  3.82k|        if (nwrit >= 256)
  ------------------
  |  Branch (123:13): [True: 0, False: 3.82k]
  ------------------
  124|      0|        {
  125|      0|            heapbuf = ctxt->alloc_fn ((size_t) (nwrit + 1));
  126|      0|            if (heapbuf)
  ------------------
  |  Branch (126:17): [True: 0, False: 0]
  ------------------
  127|      0|            {
  128|      0|                (void) vsnprintf (heapbuf, (size_t) (nwrit + 1), msg, fmtargs);
  129|      0|                dispatch_error (ctxt, code, heapbuf);
  130|      0|                ctxt->free_fn (heapbuf);
  131|      0|            }
  132|      0|            else
  133|      0|                dispatch_error (
  134|      0|                    ctxt, code, "Unable to allocate temporary memory");
  135|      0|        }
  136|  3.82k|        else
  137|  3.82k|            dispatch_error (ctxt, code, stackbuf);
  138|  3.82k|    }
  139|       |    va_end (fmtargs);
  140|  3.82k|    return code;
  141|  3.82k|}
internal_structs.c:internal_exr_destroy_parts:
  175|  3.07k|{
  176|  10.5k|    for (int p = 0; p < ctxt->num_parts; ++p)
  ------------------
  |  Branch (176:21): [True: 7.43k, False: 3.07k]
  ------------------
  177|  7.43k|        internal_exr_destroy_part (ctxt, ctxt->parts[p]);
  178|       |
  179|  3.07k|    if (ctxt->parts != &(ctxt->init_part)) ctxt->free_fn (ctxt->parts);
  ------------------
  |  Branch (179:9): [True: 2.56k, False: 504]
  ------------------
  180|  3.07k|    ctxt->init_part = NULL;
  181|       |    ctxt->parts     = NULL;
  182|  3.07k|    ctxt->num_parts = 0;
  183|  3.07k|}
internal_structs.c:default_error_handler:
   30|  4.83k|{
   31|  4.83k|#if ILMTHREAD_THREADING_ENABLED
   32|       |#    ifdef _WIN32
   33|       |    static CRITICAL_SECTION sMutex;
   34|       |    volatile static long    initialized = 0;
   35|       |    if (InterlockedIncrement (&initialized) == 1)
   36|       |        InitializeCriticalSection (&sMutex);
   37|       |    initialized = 1; // avoids overflow on long running programs...
   38|       |#    else
   39|  4.83k|    static pthread_mutex_t sMutex = PTHREAD_MUTEX_INITIALIZER;
   40|  4.83k|#    endif
   41|  4.83k|#endif
   42|       |
   43|  4.83k|#if ILMTHREAD_THREADING_ENABLED
   44|       |#    ifdef _WIN32
   45|       |    EnterCriticalSection (&sMutex);
   46|       |#    else
   47|  4.83k|    pthread_mutex_lock (&sMutex);
   48|  4.83k|#    endif
   49|  4.83k|#endif
   50|  4.83k|    if (ctxt)
  ------------------
  |  Branch (50:9): [True: 4.83k, False: 0]
  ------------------
   51|  4.83k|    {
   52|  4.83k|        if (ctxt->filename.str)
  ------------------
  |  Branch (52:13): [True: 4.83k, False: 0]
  ------------------
   53|  4.83k|            fprintf (
   54|  4.83k|                stderr,
   55|  4.83k|                "%s: (%s) %s\n",
   56|  4.83k|                ctxt->filename.str,
   57|  4.83k|                exr_get_error_code_as_string (code),
   58|  4.83k|                msg);
   59|      0|        else
   60|      0|            fprintf (
   61|      0|                stderr,
   62|      0|                "Context 0x%p: (%s) %s\n",
   63|      0|                (const void*) ctxt,
   64|      0|                exr_get_error_code_as_string (code),
   65|      0|                msg);
   66|  4.83k|    }
   67|      0|    else
   68|      0|        fprintf (stderr, "<ERROR>: %s\n", msg);
   69|  4.83k|    fflush (stderr);
   70|       |
   71|  4.83k|#if ILMTHREAD_THREADING_ENABLED
   72|       |#    ifdef _WIN32
   73|       |    LeaveCriticalSection (&sMutex);
   74|       |#    else
   75|  4.83k|    pthread_mutex_unlock (&sMutex);
   76|  4.83k|#    endif
   77|  4.83k|#endif
   78|  4.83k|}

context.c:internal_exr_unlock:
  267|  3.07k|{
  268|  3.07k|#if ILMTHREAD_THREADING_ENABLED
  269|  3.07k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  3.07k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  270|       |#    ifdef _WIN32
  271|       |    LeaveCriticalSection (&nonc->mutex);
  272|       |#    else
  273|  3.07k|    pthread_mutex_unlock (&nonc->mutex);
  274|  3.07k|#    endif
  275|  3.07k|#endif
  276|  3.07k|}
context.c:internal_exr_lock:
  254|  3.07k|{
  255|  3.07k|#if ILMTHREAD_THREADING_ENABLED
  256|  3.07k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  3.07k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  257|       |#    ifdef _WIN32
  258|       |    EnterCriticalSection (&nonc->mutex);
  259|       |#    else
  260|  3.07k|    pthread_mutex_lock (&nonc->mutex);
  261|  3.07k|#    endif
  262|  3.07k|#endif
  263|  3.07k|}
part.c:internal_exr_lock:
  254|  7.43k|{
  255|  7.43k|#if ILMTHREAD_THREADING_ENABLED
  256|  7.43k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  7.43k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  257|       |#    ifdef _WIN32
  258|       |    EnterCriticalSection (&nonc->mutex);
  259|       |#    else
  260|  7.43k|    pthread_mutex_lock (&nonc->mutex);
  261|  7.43k|#    endif
  262|  7.43k|#endif
  263|  7.43k|}
part.c:internal_exr_unlock:
  267|  7.43k|{
  268|  7.43k|#if ILMTHREAD_THREADING_ENABLED
  269|  7.43k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  7.43k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  270|       |#    ifdef _WIN32
  271|       |    LeaveCriticalSection (&nonc->mutex);
  272|       |#    else
  273|  7.43k|    pthread_mutex_unlock (&nonc->mutex);
  274|  7.43k|#    endif
  275|  7.43k|#endif
  276|  7.43k|}
part_attr.c:internal_exr_lock:
  254|  63.3k|{
  255|  63.3k|#if ILMTHREAD_THREADING_ENABLED
  256|  63.3k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  63.3k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  257|       |#    ifdef _WIN32
  258|       |    EnterCriticalSection (&nonc->mutex);
  259|       |#    else
  260|  63.3k|    pthread_mutex_lock (&nonc->mutex);
  261|  63.3k|#    endif
  262|  63.3k|#endif
  263|  63.3k|}
part_attr.c:internal_exr_unlock:
  267|  63.3k|{
  268|  63.3k|#if ILMTHREAD_THREADING_ENABLED
  269|  63.3k|    exr_context_t nonc = EXR_CONST_CAST (exr_context_t, c);
  ------------------
  |  |  250|  63.3k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  270|       |#    ifdef _WIN32
  271|       |    LeaveCriticalSection (&nonc->mutex);
  272|       |#    else
  273|  63.3k|    pthread_mutex_unlock (&nonc->mutex);
  274|  63.3k|#    endif
  275|  63.3k|#endif
  276|  63.3k|}

internal_exr_alloc:
   34|   131k|{
   35|   131k|    if (_glob_alloc_func) return (*_glob_alloc_func) (bytes);
  ------------------
  |  Branch (35:9): [True: 0, False: 131k]
  ------------------
   36|       |#ifdef _WIN32
   37|       |    return HeapAlloc (GetProcessHeap (), 0, bytes);
   38|       |#else
   39|   131k|    return malloc (bytes);
   40|   131k|#endif
   41|   131k|}
internal_exr_free:
   67|   131k|{
   68|   131k|    if (!ptr) return;
  ------------------
  |  Branch (68:9): [True: 0, False: 131k]
  ------------------
   69|       |
   70|   131k|    if (_glob_free_func) { (*_glob_free_func) (ptr); }
  ------------------
  |  Branch (70:9): [True: 0, False: 131k]
  ------------------
   71|   131k|    else
   72|   131k|    {
   73|       |#ifdef _WIN32
   74|       |        HeapFree (GetProcessHeap (), 0, ptr);
   75|       |#else
   76|   131k|        free (ptr);
   77|   131k|#endif
   78|   131k|    }
   79|   131k|}

internal_exr_compute_tile_information:
 2344|  7.53k|{
 2345|  7.53k|    exr_result_t rv = EXR_ERR_SUCCESS;
 2346|  7.53k|    if (curpart->storage_mode == EXR_STORAGE_SCANLINE ||
  ------------------
  |  Branch (2346:9): [True: 4.01k, False: 3.52k]
  ------------------
 2347|  3.52k|        curpart->storage_mode == EXR_STORAGE_DEEP_SCANLINE ||
  ------------------
  |  Branch (2347:9): [True: 929, False: 2.59k]
  ------------------
 2348|  2.59k|        curpart->storage_mode == EXR_STORAGE_UNKNOWN)
  ------------------
  |  Branch (2348:9): [True: 0, False: 2.59k]
  ------------------
 2349|  4.94k|        return EXR_ERR_SUCCESS;
 2350|       |
 2351|  2.59k|    if (ctxt->mode == EXR_CONTEXT_TEMPORARY && !curpart->tiles)
  ------------------
  |  Branch (2351:9): [True: 0, False: 2.59k]
  |  Branch (2351:48): [True: 0, False: 0]
  ------------------
 2352|      0|        return EXR_ERR_SUCCESS;
 2353|       |
 2354|  2.59k|    if (rebuild && (!curpart->dataWindow || !curpart->tiles))
  ------------------
  |  Branch (2354:9): [True: 2.59k, False: 0]
  |  Branch (2354:21): [True: 0, False: 2.59k]
  |  Branch (2354:45): [True: 2.59k, False: 0]
  ------------------
 2355|  2.59k|        return EXR_ERR_SUCCESS;
 2356|       |
 2357|      0|    if (!curpart->tiles)
  ------------------
  |  Branch (2357:9): [True: 0, False: 0]
  ------------------
 2358|      0|        return ctxt->standard_error (ctxt, EXR_ERR_MISSING_REQ_ATTR);
 2359|       |
 2360|      0|    if (rebuild)
  ------------------
  |  Branch (2360:9): [True: 0, False: 0]
  ------------------
 2361|      0|    {
 2362|      0|        if (curpart->tile_level_tile_count_x)
  ------------------
  |  Branch (2362:13): [True: 0, False: 0]
  ------------------
 2363|      0|        {
 2364|      0|            ctxt->free_fn (curpart->tile_level_tile_count_x);
 2365|      0|            curpart->tile_level_tile_count_x = NULL;
 2366|      0|        }
 2367|      0|    }
 2368|       |
 2369|      0|    if (curpart->tile_level_tile_count_x == NULL)
  ------------------
  |  Branch (2369:9): [True: 0, False: 0]
  ------------------
 2370|      0|    {
 2371|      0|        const exr_attr_box2i_t     dw       = curpart->data_window;
 2372|      0|        const exr_attr_tiledesc_t* tiledesc = curpart->tiles->tiledesc;
 2373|      0|        int64_t                    w, h;
 2374|      0|        int32_t                    numX, numY;
 2375|      0|        int32_t*                   levcntX = NULL;
 2376|      0|        int32_t*                   levcntY = NULL;
 2377|      0|        int32_t*                   levszX  = NULL;
 2378|      0|        int32_t*                   levszY  = NULL;
 2379|       |
 2380|      0|        w = ((int64_t) dw.max.x) - ((int64_t) dw.min.x) + 1;
 2381|      0|        h = ((int64_t) dw.max.y) - ((int64_t) dw.min.y) + 1;
 2382|       |
 2383|      0|        if (tiledesc->x_size == 0 || tiledesc->y_size == 0)
  ------------------
  |  Branch (2383:13): [True: 0, False: 0]
  |  Branch (2383:38): [True: 0, False: 0]
  ------------------
 2384|      0|            return ctxt->standard_error (ctxt, EXR_ERR_INVALID_ATTR);
 2385|      0|        switch (EXR_GET_TILE_LEVEL_MODE ((*tiledesc)))
  ------------------
  |  |  252|      0|    ((exr_tile_level_mode_t) (((tiledesc).level_and_round) & 0xF))
  ------------------
 2386|      0|        {
 2387|      0|            case EXR_TILE_ONE_LEVEL: numX = numY = 1; break;
  ------------------
  |  Branch (2387:13): [True: 0, False: 0]
  ------------------
 2388|      0|            case EXR_TILE_MIPMAP_LEVELS:
  ------------------
  |  Branch (2388:13): [True: 0, False: 0]
  ------------------
 2389|      0|                if (EXR_GET_TILE_ROUND_MODE ((*tiledesc)) ==
  ------------------
  |  |  255|      0|    ((exr_tile_round_mode_t) ((((tiledesc).level_and_round) >> 4) & 0xF))
  ------------------
  |  Branch (2389:21): [True: 0, False: 0]
  ------------------
 2390|      0|                    EXR_TILE_ROUND_DOWN)
 2391|      0|                {
 2392|      0|                    numX = floor_log2 (w > h ? w : h) + 1;
  ------------------
  |  Branch (2392:40): [True: 0, False: 0]
  ------------------
 2393|      0|                    numY = numX;
 2394|      0|                }
 2395|      0|                else
 2396|      0|                {
 2397|      0|                    numX = ceil_log2 (w > h ? w : h) + 1;
  ------------------
  |  Branch (2397:39): [True: 0, False: 0]
  ------------------
 2398|      0|                    numY = numX;
 2399|      0|                }
 2400|      0|                break;
 2401|      0|            case EXR_TILE_RIPMAP_LEVELS:
  ------------------
  |  Branch (2401:13): [True: 0, False: 0]
  ------------------
 2402|      0|                if (EXR_GET_TILE_ROUND_MODE ((*tiledesc)) ==
  ------------------
  |  |  255|      0|    ((exr_tile_round_mode_t) ((((tiledesc).level_and_round) >> 4) & 0xF))
  ------------------
  |  Branch (2402:21): [True: 0, False: 0]
  ------------------
 2403|      0|                    EXR_TILE_ROUND_DOWN)
 2404|      0|                {
 2405|      0|                    numX = floor_log2 (w) + 1;
 2406|      0|                    numY = floor_log2 (h) + 1;
 2407|      0|                }
 2408|      0|                else
 2409|      0|                {
 2410|      0|                    numX = ceil_log2 (w) + 1;
 2411|      0|                    numY = ceil_log2 (h) + 1;
 2412|      0|                }
 2413|      0|                break;
 2414|      0|            case EXR_TILE_LAST_TYPE:
  ------------------
  |  Branch (2414:13): [True: 0, False: 0]
  ------------------
 2415|      0|            default: return ctxt->standard_error (ctxt, EXR_ERR_INVALID_ATTR);
  ------------------
  |  Branch (2415:13): [True: 0, False: 0]
  ------------------
 2416|      0|        }
 2417|       |
 2418|      0|        curpart->num_tile_levels_x = numX;
 2419|      0|        curpart->num_tile_levels_y = numY;
 2420|      0|        levcntX                    = (int32_t*) ctxt->alloc_fn (
 2421|      0|            2 * (size_t) (numX + numY) * sizeof (int32_t));
 2422|      0|        if (levcntX == NULL)
  ------------------
  |  Branch (2422:13): [True: 0, False: 0]
  ------------------
 2423|      0|            return ctxt->standard_error (ctxt, EXR_ERR_OUT_OF_MEMORY);
 2424|      0|        levszX  = levcntX + numX;
 2425|      0|        levcntY = levszX + numX;
 2426|      0|        levszY  = levcntY + numY;
 2427|       |
 2428|      0|        for (int32_t l = 0; l < numX; ++l)
  ------------------
  |  Branch (2428:29): [True: 0, False: 0]
  ------------------
 2429|      0|        {
 2430|      0|            int64_t sx = calc_level_size (
 2431|      0|                dw.min.x, dw.max.x, l, EXR_GET_TILE_ROUND_MODE ((*tiledesc)));
  ------------------
  |  |  255|      0|    ((exr_tile_round_mode_t) ((((tiledesc).level_and_round) >> 4) & 0xF))
  ------------------
 2432|      0|            if (sx < 0 || sx > (int64_t) INT32_MAX)
  ------------------
  |  Branch (2432:17): [True: 0, False: 0]
  |  Branch (2432:27): [True: 0, False: 0]
  ------------------
 2433|      0|                return ctxt->print_error (
 2434|      0|                    ctxt,
 2435|      0|                    EXR_ERR_INVALID_ATTR,
 2436|      0|                    "Invalid data window x dims (%d, %d) resulting in invalid tile level size (%" PRId64
 2437|      0|                    ") for level %d",
 2438|      0|                    dw.min.x,
 2439|      0|                    dw.max.x,
 2440|      0|                    sx,
 2441|      0|                    l);
 2442|      0|            levcntX[l] = (int32_t) (((uint64_t) sx + tiledesc->x_size - 1) /
 2443|      0|                                    tiledesc->x_size);
 2444|      0|            levszX[l]  = (int32_t) sx;
 2445|      0|        }
 2446|       |
 2447|      0|        for (int32_t l = 0; l < numY; ++l)
  ------------------
  |  Branch (2447:29): [True: 0, False: 0]
  ------------------
 2448|      0|        {
 2449|      0|            int64_t sy = calc_level_size (
 2450|      0|                dw.min.y, dw.max.y, l, EXR_GET_TILE_ROUND_MODE ((*tiledesc)));
  ------------------
  |  |  255|      0|    ((exr_tile_round_mode_t) ((((tiledesc).level_and_round) >> 4) & 0xF))
  ------------------
 2451|      0|            if (sy < 0 || sy > (int64_t) INT32_MAX)
  ------------------
  |  Branch (2451:17): [True: 0, False: 0]
  |  Branch (2451:27): [True: 0, False: 0]
  ------------------
 2452|      0|                return ctxt->print_error (
 2453|      0|                    ctxt,
 2454|      0|                    EXR_ERR_INVALID_ATTR,
 2455|      0|                    "Invalid data window y dims (%d, %d) resulting in invalid tile level size (%" PRId64
 2456|      0|                    ") for level %d",
 2457|      0|                    dw.min.y,
 2458|      0|                    dw.max.y,
 2459|      0|                    sy,
 2460|      0|                    l);
 2461|      0|            levcntY[l] = (int32_t) (((uint64_t) sy + tiledesc->y_size - 1) /
 2462|      0|                                    tiledesc->y_size);
 2463|      0|            levszY[l]  = (int32_t) sy;
 2464|      0|        }
 2465|       |
 2466|      0|        curpart->tile_level_tile_count_x = levcntX;
 2467|      0|        curpart->tile_level_tile_count_y = levcntY;
 2468|      0|        curpart->tile_level_tile_size_x  = levszX;
 2469|      0|        curpart->tile_level_tile_size_y  = levszY;
 2470|      0|    }
 2471|      0|    return rv;
 2472|      0|}

exr_add_part:
   61|  7.43k|{
   62|  7.43k|    exr_result_t    rv;
   63|  7.43k|    size_t          pnamelen;
   64|  7.43k|    int32_t         attrsz  = -1;
   65|  7.43k|    const char*     typestr = NULL;
   66|  7.43k|    exr_priv_part_t part    = NULL;
   67|       |
   68|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (68:9): [True: 0, False: 7.43k]
  ------------------
   69|  7.43k|    internal_exr_lock (ctxt);
   70|       |
   71|  7.43k|    if (ctxt->mode != EXR_CONTEXT_WRITE && ctxt->mode != EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (71:9): [True: 0, False: 7.43k]
  |  Branch (71:44): [True: 0, False: 0]
  ------------------
   72|      0|        return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
   73|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));
   74|       |
   75|  7.43k|    pnamelen = partname ? strlen (partname) : 0;
  ------------------
  |  Branch (75:16): [True: 7.43k, False: 0]
  ------------------
   76|  7.43k|    if (pnamelen >= INT32_MAX)
  ------------------
  |  Branch (76:9): [True: 0, False: 7.43k]
  ------------------
   77|      0|    {
   78|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
   79|      0|            ctxt,
   80|      0|            EXR_ERR_INVALID_ATTR,
   81|      0|            "Part name '%s': Invalid name length %" PRIu64,
   82|      0|            partname,
   83|      0|            (uint64_t) pnamelen));
   84|      0|    }
   85|       |
   86|  7.43k|    if (ctxt->num_parts > 0)
  ------------------
  |  Branch (86:9): [True: 4.36k, False: 3.07k]
  ------------------
   87|  4.36k|    {
   88|       |        // ensure multi part has at least some name?
   89|  4.36k|        if (!partname) partname = "";
  ------------------
  |  Branch (89:13): [True: 0, False: 4.36k]
  ------------------
   90|       |
   91|  10.5k|        for ( int pidx = 0; pidx < ctxt->num_parts; ++pidx )
  ------------------
  |  Branch (91:29): [True: 6.16k, False: 4.36k]
  ------------------
   92|  6.16k|        {
   93|  6.16k|            const exr_attribute_t* pname = ctxt->parts[pidx]->name;
   94|  6.16k|            if (!pname)
  ------------------
  |  Branch (94:17): [True: 0, False: 6.16k]
  ------------------
   95|      0|            {
   96|      0|                return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
   97|      0|                    ctxt->print_error (
   98|      0|                        ctxt,
   99|      0|                        EXR_ERR_INVALID_ARGUMENT,
  100|      0|                        "Part %d missing required attribute 'name' for multi-part file",
  101|      0|                        pidx));
  102|      0|            }
  103|  6.16k|            if (!strcmp (partname, pname->string->str))
  ------------------
  |  Branch (103:17): [True: 5, False: 6.16k]
  ------------------
  104|      5|            {
  105|      5|                return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      5|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  106|      5|                    ctxt->print_error (
  107|      5|                        ctxt,
  108|      5|                        EXR_ERR_INVALID_ARGUMENT,
  109|      5|                        "Each part should have a unique name, part %d and %d attempting to have same name '%s'",
  110|      5|                        pidx, ctxt->num_parts, partname));
  111|      5|            }
  112|  6.16k|        }
  113|  4.36k|    }
  114|       |
  115|  7.43k|    rv = internal_exr_add_part (ctxt, &part, new_index);
  116|  7.43k|    if (rv != EXR_ERR_SUCCESS) return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  |  Branch (116:9): [True: 0, False: 7.43k]
  ------------------
  117|       |
  118|  7.43k|    part->storage_mode = type;
  119|  7.43k|    switch (type)
  120|  7.43k|    {
  121|  3.96k|        case EXR_STORAGE_SCANLINE:
  ------------------
  |  Branch (121:9): [True: 3.96k, False: 3.46k]
  ------------------
  122|  3.96k|            typestr = "scanlineimage";
  123|  3.96k|            attrsz  = 13;
  124|  3.96k|            break;
  125|  1.25k|        case EXR_STORAGE_TILED:
  ------------------
  |  Branch (125:9): [True: 1.25k, False: 6.17k]
  ------------------
  126|  1.25k|            typestr = "tiledimage";
  127|  1.25k|            attrsz  = 10;
  128|  1.25k|            break;
  129|    902|        case EXR_STORAGE_DEEP_SCANLINE:
  ------------------
  |  Branch (129:9): [True: 902, False: 6.53k]
  ------------------
  130|    902|            typestr = "deepscanline";
  131|    902|            attrsz  = 12;
  132|    902|            break;
  133|  1.30k|        case EXR_STORAGE_DEEP_TILED:
  ------------------
  |  Branch (133:9): [True: 1.30k, False: 6.12k]
  ------------------
  134|  1.30k|            typestr = "deeptile";
  135|  1.30k|            attrsz  = 8;
  136|  1.30k|            break;
  137|      0|        case EXR_STORAGE_LAST_TYPE:
  ------------------
  |  Branch (137:9): [True: 0, False: 7.43k]
  ------------------
  138|      0|        default:
  ------------------
  |  Branch (138:9): [True: 0, False: 7.43k]
  ------------------
  139|      0|            internal_exr_revert_add_part (ctxt, &part, new_index);
  140|      0|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  141|  7.43k|                ctxt,
  142|  7.43k|                EXR_ERR_INVALID_ARGUMENT,
  143|  7.43k|                "Invalid storage type %d for new part",
  144|  7.43k|                (int) type));
  145|  7.43k|    }
  146|       |
  147|  7.43k|    rv = exr_attr_list_add_static_name (
  148|  7.43k|        ctxt,
  149|  7.43k|        &(part->attributes),
  150|  7.43k|        EXR_REQ_TYPE_STR,
  ------------------
  |  |   20|  7.43k|#define EXR_REQ_TYPE_STR "type"
  ------------------
  151|  7.43k|        EXR_ATTR_STRING,
  152|  7.43k|        0,
  153|  7.43k|        NULL,
  154|  7.43k|        &(part->type));
  155|       |
  156|  7.43k|    if (rv != EXR_ERR_SUCCESS)
  ------------------
  |  Branch (156:9): [True: 0, False: 7.43k]
  ------------------
  157|      0|    {
  158|      0|        internal_exr_revert_add_part (ctxt, &part, new_index);
  159|      0|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  160|      0|    }
  161|       |
  162|  7.43k|    rv = exr_attr_string_init_static_with_length (
  163|  7.43k|        ctxt, part->type->string, typestr, attrsz);
  164|       |
  165|  7.43k|    if (rv != EXR_ERR_SUCCESS)
  ------------------
  |  Branch (165:9): [True: 0, False: 7.43k]
  ------------------
  166|      0|    {
  167|      0|        internal_exr_revert_add_part (ctxt, &part, new_index);
  168|      0|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  169|      0|    }
  170|       |
  171|  7.43k|    if (partname)
  ------------------
  |  Branch (171:9): [True: 7.43k, False: 0]
  ------------------
  172|  7.43k|    {
  173|  7.43k|        rv = exr_attr_list_add_static_name (
  174|  7.43k|            ctxt,
  175|  7.43k|            &(part->attributes),
  176|  7.43k|            EXR_REQ_NAME_STR,
  ------------------
  |  |   19|  7.43k|#define EXR_REQ_NAME_STR "name"
  ------------------
  177|  7.43k|            EXR_ATTR_STRING,
  178|  7.43k|            0,
  179|  7.43k|            NULL,
  180|  7.43k|            &(part->name));
  181|       |
  182|  7.43k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (182:13): [True: 7.43k, False: 0]
  ------------------
  183|  7.43k|            rv = exr_attr_string_create_with_length (
  184|  7.43k|                ctxt, part->name->string, partname, (int32_t) pnamelen);
  185|  7.43k|    }
  186|       |
  187|  7.43k|    if (rv == EXR_ERR_SUCCESS &&
  ------------------
  |  Branch (187:9): [True: 7.43k, False: 0]
  ------------------
  188|  7.43k|        (type == EXR_STORAGE_DEEP_TILED || type == EXR_STORAGE_DEEP_SCANLINE))
  ------------------
  |  Branch (188:10): [True: 1.30k, False: 6.12k]
  |  Branch (188:44): [True: 902, False: 5.22k]
  ------------------
  189|  2.20k|    {
  190|  2.20k|        rv = exr_attr_list_add_static_name (
  191|  2.20k|            ctxt,
  192|  2.20k|            &(part->attributes),
  193|  2.20k|            EXR_REQ_VERSION_STR,
  ------------------
  |  |   21|  2.20k|#define EXR_REQ_VERSION_STR "version"
  ------------------
  194|  2.20k|            EXR_ATTR_INT,
  195|  2.20k|            0,
  196|  2.20k|            NULL,
  197|  2.20k|            &(part->version));
  198|  2.20k|        if (rv == EXR_ERR_SUCCESS) part->version->i = 1;
  ------------------
  |  Branch (198:13): [True: 2.20k, False: 0]
  ------------------
  199|  2.20k|        ctxt->has_nonimage_data = 1;
  200|  2.20k|    }
  201|       |
  202|  7.43k|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (202:9): [True: 7.43k, False: 0]
  ------------------
  203|  7.43k|    {
  204|  7.43k|        if (ctxt->num_parts > 1) ctxt->is_multipart = 1;
  ------------------
  |  Branch (204:13): [True: 4.36k, False: 3.07k]
  ------------------
  205|       |
  206|  7.43k|        if (!ctxt->has_nonimage_data && ctxt->num_parts == 1 &&
  ------------------
  |  Branch (206:13): [True: 3.54k, False: 3.88k]
  |  Branch (206:41): [True: 1.64k, False: 1.89k]
  ------------------
  207|  1.64k|            type == EXR_STORAGE_TILED)
  ------------------
  |  Branch (207:13): [True: 751, False: 895]
  ------------------
  208|    751|            ctxt->is_singlepart_tiled = 1;
  209|  6.68k|        else
  210|  6.68k|            ctxt->is_singlepart_tiled = 0;
  211|  7.43k|    }
  212|      0|    else
  213|      0|        internal_exr_revert_add_part (ctxt, &part, new_index);
  214|       |
  215|  7.43k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.43k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  216|  7.43k|}

exr_initialize_required_attr:
  185|  7.43k|{
  186|  7.43k|    exr_result_t rv;
  187|       |
  188|  7.43k|    rv = exr_set_compression (ctxt, part_index, ctype);
  189|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (189:9): [True: 0, False: 7.43k]
  ------------------
  190|  7.43k|    rv = exr_set_data_window (ctxt, part_index, dataWindow);
  191|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (191:9): [True: 0, False: 7.43k]
  ------------------
  192|  7.43k|    rv = exr_set_display_window (ctxt, part_index, displayWindow);
  193|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (193:9): [True: 0, False: 7.43k]
  ------------------
  194|  7.43k|    rv = exr_set_lineorder (ctxt, part_index, lineorder);
  195|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (195:9): [True: 0, False: 7.43k]
  ------------------
  196|  7.43k|    rv = exr_set_pixel_aspect_ratio (ctxt, part_index, pixelaspectratio);
  197|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (197:9): [True: 0, False: 7.43k]
  ------------------
  198|  7.43k|    rv = exr_set_screen_window_center (ctxt, part_index, screenWindowCenter);
  199|  7.43k|    if (rv != EXR_ERR_SUCCESS) return rv;
  ------------------
  |  Branch (199:9): [True: 0, False: 7.43k]
  ------------------
  200|       |
  201|  7.43k|    return exr_set_screen_window_width (ctxt, part_index, screenWindowWidth);
  202|  7.43k|}
exr_initialize_required_attr_simple:
  213|  7.43k|{
  214|  7.43k|    exr_attr_box2i_t dispWindow = {
  215|  7.43k|        .min = {.x = 0, .y = 0}, .max = {.x = (width - 1), .y = (height - 1)}};
  216|  7.43k|    exr_attr_v2f_t swc = {.x = 0.f, .y = 0.f};
  217|  7.43k|    return exr_initialize_required_attr (
  218|  7.43k|        ctxt,
  219|  7.43k|        part_index,
  220|  7.43k|        &dispWindow,
  221|  7.43k|        &dispWindow,
  222|  7.43k|        1.f,
  223|  7.43k|        &swc,
  224|  7.43k|        1.f,
  225|  7.43k|        EXR_LINEORDER_INCREASING_Y,
  226|  7.43k|        ctype);
  227|  7.43k|}
exr_set_compression:
  698|  7.43k|{
  699|  7.43k|    REQ_ATTR_FIND_CREATE (compression, EXR_ATTR_COMPRESSION);
  ------------------
  |  |  603|  7.43k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.43k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.43k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.43k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.43k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.43k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.43k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.43k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.43k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.43k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  607|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.43k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  610|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.43k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 0]
  |  |  ------------------
  |  |  613|  7.43k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.43k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 0]
  |  |  ------------------
  |  |  618|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.43k|            ctxt,                                                              \
  |  |  620|  7.43k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.43k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.43k|            part->name->type_name,                                             \
  |  |  623|  7.43k|            #name));                                                           \
  |  |  624|  7.43k|    attr = part->name
  ------------------
  700|  7.43k|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (700:9): [True: 7.43k, False: 0]
  ------------------
  701|  7.43k|    {
  702|  7.43k|        attr->uc        = (uint8_t) ctype;
  703|  7.43k|        part->comp_type = ctype;
  704|  7.43k|        part->lines_per_chunk =
  705|  7.43k|            ((int16_t) exr_compression_lines_per_chunk (part->comp_type));
  706|  7.43k|    }
  707|  7.43k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.43k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  708|  29.7k|}
exr_set_data_window:
  724|  7.53k|{
  725|  7.53k|    if (!dw)
  ------------------
  |  Branch (725:9): [True: 0, False: 7.53k]
  ------------------
  726|      0|        return ctxt->report_error (
  727|      0|            ctxt,
  728|      0|            EXR_ERR_INVALID_ARGUMENT,
  729|      0|            "Missing value for data window assignment");
  730|       |
  731|  7.53k|    {
  732|  7.53k|        REQ_ATTR_FIND_CREATE (dataWindow, EXR_ATTR_BOX2I);
  ------------------
  |  |  603|  7.53k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.53k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.53k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.53k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.53k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.53k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.53k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.53k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.53k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.53k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.53k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.53k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.53k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.53k]
  |  |  ------------------
  |  |  607|  7.53k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.53k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.53k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.53k]
  |  |  ------------------
  |  |  610|  7.53k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.53k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.53k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 104]
  |  |  ------------------
  |  |  613|  7.53k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.53k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 104]
  |  |  ------------------
  |  |  618|    104|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.53k|            ctxt,                                                              \
  |  |  620|  7.53k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.53k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.53k|            part->name->type_name,                                             \
  |  |  623|  7.53k|            #name));                                                           \
  |  |  624|  7.53k|    attr = part->name
  ------------------
  733|       |
  734|  7.53k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (734:13): [True: 7.53k, False: 0]
  ------------------
  735|  7.53k|        {
  736|  7.53k|            *(attr->box2i)    = *dw;
  737|  7.53k|            part->data_window = *dw;
  738|       |
  739|  7.53k|            rv = internal_exr_compute_tile_information (ctxt, part, 1);
  740|  7.53k|        }
  741|       |
  742|  7.53k|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.53k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  743|  30.1k|    }
  744|  30.1k|}
exr_set_display_window:
  760|  7.46k|{
  761|  7.46k|    if (!dw)
  ------------------
  |  Branch (761:9): [True: 0, False: 7.46k]
  ------------------
  762|      0|        return ctxt->report_error (
  763|      0|            ctxt,
  764|      0|            EXR_ERR_INVALID_ARGUMENT,
  765|      0|            "Missing value for data window assignment");
  766|       |
  767|  7.46k|    {
  768|  7.46k|        REQ_ATTR_FIND_CREATE (displayWindow, EXR_ATTR_BOX2I);
  ------------------
  |  |  603|  7.46k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.46k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.46k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.46k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.46k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.46k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.46k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.46k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.46k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.46k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.46k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.46k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.46k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.46k]
  |  |  ------------------
  |  |  607|  7.46k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.46k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.46k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.46k]
  |  |  ------------------
  |  |  610|  7.46k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.46k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.46k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 36]
  |  |  ------------------
  |  |  613|  7.46k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.46k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 36]
  |  |  ------------------
  |  |  618|     36|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.46k|            ctxt,                                                              \
  |  |  620|  7.46k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.46k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.46k|            part->name->type_name,                                             \
  |  |  623|  7.46k|            #name));                                                           \
  |  |  624|  7.46k|    attr = part->name
  ------------------
  769|  7.46k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (769:13): [True: 7.46k, False: 0]
  ------------------
  770|  7.46k|        {
  771|  7.46k|            *(attr->box2i)       = *dw;
  772|  7.46k|            part->display_window = *dw;
  773|  7.46k|        }
  774|       |
  775|  7.46k|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.46k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  776|  29.8k|    }
  777|  29.8k|}
exr_set_lineorder:
  792|  7.43k|{
  793|  7.43k|    if (lo >= EXR_LINEORDER_LAST_TYPE)
  ------------------
  |  Branch (793:9): [True: 0, False: 7.43k]
  ------------------
  794|      0|        return ctxt->print_error (
  795|      0|            ctxt,
  796|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,
  797|      0|            "'lineOrder' value for line order (%d) out of range (%d - %d)",
  798|      0|            (int) lo,
  799|      0|            0,
  800|      0|            (int) EXR_LINEORDER_LAST_TYPE);
  801|       |
  802|  7.43k|    {
  803|  7.43k|        REQ_ATTR_FIND_CREATE (lineOrder, EXR_ATTR_LINEORDER);
  ------------------
  |  |  603|  7.43k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.43k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.43k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.43k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.43k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.43k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.43k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.43k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.43k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.43k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  607|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.43k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  610|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.43k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 0]
  |  |  ------------------
  |  |  613|  7.43k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.43k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 0]
  |  |  ------------------
  |  |  618|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.43k|            ctxt,                                                              \
  |  |  620|  7.43k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.43k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.43k|            part->name->type_name,                                             \
  |  |  623|  7.43k|            #name));                                                           \
  |  |  624|  7.43k|    attr = part->name
  ------------------
  804|  7.43k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (804:13): [True: 7.43k, False: 0]
  ------------------
  805|  7.43k|        {
  806|  7.43k|            attr->uc        = (uint8_t) lo;
  807|  7.43k|            part->lineorder = lo;
  808|  7.43k|        }
  809|       |
  810|  7.43k|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.43k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  811|  29.7k|    }
  812|  29.7k|}
exr_set_pixel_aspect_ratio:
  827|  7.48k|{
  828|  7.48k|    REQ_ATTR_FIND_CREATE (pixelAspectRatio, EXR_ATTR_FLOAT);
  ------------------
  |  |  603|  7.48k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.48k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.48k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.48k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.48k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.48k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.48k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.48k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.48k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.48k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.48k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.48k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.48k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.48k]
  |  |  ------------------
  |  |  607|  7.48k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.48k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.48k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.48k]
  |  |  ------------------
  |  |  610|  7.48k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.48k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.48k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 51]
  |  |  ------------------
  |  |  613|  7.48k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.48k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 51]
  |  |  ------------------
  |  |  618|     51|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.48k|            ctxt,                                                              \
  |  |  620|  7.48k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.48k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.48k|            part->name->type_name,                                             \
  |  |  623|  7.48k|            #name));                                                           \
  |  |  624|  7.48k|    attr = part->name
  ------------------
  829|  7.48k|    if (rv == EXR_ERR_SUCCESS) attr->f = par;
  ------------------
  |  Branch (829:9): [True: 7.48k, False: 0]
  ------------------
  830|  7.48k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.48k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  831|  29.9k|}
exr_set_screen_window_center:
  847|  7.43k|{
  848|  37.1k|    REQ_ATTR_FIND_CREATE (screenWindowCenter, EXR_ATTR_V2F);
  ------------------
  |  |  603|  7.43k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.43k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.43k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.43k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.43k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.43k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.43k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.43k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.43k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.43k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  607|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.43k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  610|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.43k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 0]
  |  |  ------------------
  |  |  613|  7.43k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.43k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 0]
  |  |  ------------------
  |  |  618|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.43k|            ctxt,                                                              \
  |  |  620|  7.43k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.43k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.43k|            part->name->type_name,                                             \
  |  |  623|  7.43k|            #name));                                                           \
  |  |  624|  7.43k|    attr = part->name
  ------------------
  849|  37.1k|    if (rv != EXR_ERR_SUCCESS) return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  |  Branch (849:9): [True: 0, False: 7.43k]
  ------------------
  850|  7.43k|    if (!swc)
  ------------------
  |  Branch (850:9): [True: 0, False: 7.43k]
  ------------------
  851|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->report_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  852|  7.43k|            ctxt,
  853|  7.43k|            EXR_ERR_INVALID_ARGUMENT,
  854|  7.43k|            "Missing value for data window assignment"));
  855|       |
  856|  7.43k|    attr->v2f->x = swc->x;
  857|  7.43k|    attr->v2f->y = swc->y;
  858|  7.43k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.43k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  859|  7.43k|}
exr_set_screen_window_width:
  874|  7.43k|{
  875|  7.43k|    REQ_ATTR_FIND_CREATE (screenWindowWidth, EXR_ATTR_FLOAT);
  ------------------
  |  |  603|  7.43k|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|  7.43k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|  7.43k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|  7.43k|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  287|  7.43k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|  7.43k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 7.43k]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  289|  7.43k|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|  7.43k|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|  7.43k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  607|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|  7.43k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 7.43k]
  |  |  ------------------
  |  |  610|  7.43k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|  7.43k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|  7.43k|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 7.43k, False: 0]
  |  |  ------------------
  |  |  613|  7.43k|    {                                                                          \
  |  |  614|  7.43k|        rv = exr_attr_list_add (                                               \
  |  |  615|  7.43k|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|  7.43k|    }                                                                          \
  |  |  617|  7.43k|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 0]
  |  |  ------------------
  |  |  618|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|  7.43k|            ctxt,                                                              \
  |  |  620|  7.43k|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|  7.43k|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|  7.43k|            part->name->type_name,                                             \
  |  |  623|  7.43k|            #name));                                                           \
  |  |  624|  7.43k|    attr = part->name
  ------------------
  876|  7.43k|    if (rv == EXR_ERR_SUCCESS) attr->f = ssw;
  ------------------
  |  Branch (876:9): [True: 7.43k, False: 0]
  ------------------
  877|  7.43k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  7.43k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
  878|  29.7k|}
exr_set_name:
 1002|    570|{
 1003|    570|    size_t bytes;
 1004|  2.85k|    REQ_ATTR_FIND_CREATE (name, EXR_ATTR_STRING);
  ------------------
  |  |  603|    570|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|    570|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|    570|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|    570|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|    570|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 570]
  |  |  |  |  ------------------
  |  |  |  |  287|    570|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|    570|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 570]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 570]
  |  |  |  |  ------------------
  |  |  |  |  289|    570|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|    570|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|    570|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 570]
  |  |  ------------------
  |  |  607|    570|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|    570|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|    570|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 570]
  |  |  ------------------
  |  |  610|    570|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|    570|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|    570|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 0, False: 570]
  |  |  ------------------
  |  |  613|    570|    {                                                                          \
  |  |  614|      0|        rv = exr_attr_list_add (                                               \
  |  |  615|      0|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|      0|    }                                                                          \
  |  |  617|    570|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 570]
  |  |  ------------------
  |  |  618|    570|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|    570|            ctxt,                                                              \
  |  |  620|    570|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|    570|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|    570|            part->name->type_name,                                             \
  |  |  623|    570|            #name));                                                           \
  |  |  624|    570|    attr = part->name
  ------------------
 1005|       |
 1006|       |    /* old library allowed an empty string :(, but ensure not null */
 1007|  2.85k|    if (!val)
  ------------------
  |  Branch (1007:9): [True: 0, False: 570]
  ------------------
 1008|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->report_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1009|  2.85k|            ctxt,
 1010|  2.85k|            EXR_ERR_INVALID_ARGUMENT,
 1011|  2.85k|            "Invalid string passed trying to set 'name'"));
 1012|       |
 1013|    570|    bytes = strlen (val);
 1014|       |
 1015|    570|    if (bytes >= (size_t) INT32_MAX)
  ------------------
  |  Branch (1015:9): [True: 0, False: 570]
  ------------------
 1016|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1017|    570|            ctxt,
 1018|    570|            EXR_ERR_INVALID_ARGUMENT,
 1019|    570|            "String too large to store (%" PRIu64 " bytes) into 'name'",
 1020|    570|            (uint64_t) bytes));
 1021|       |
 1022|    570|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (1022:9): [True: 570, False: 0]
  ------------------
 1023|    570|    {
 1024|    570|        if (ctxt->num_parts > 1)
  ------------------
  |  Branch (1024:13): [True: 286, False: 284]
  ------------------
 1025|    286|        {
 1026|    842|            for ( int pidx = 0; pidx < ctxt->num_parts; ++pidx )
  ------------------
  |  Branch (1026:33): [True: 585, False: 257]
  ------------------
 1027|    585|            {
 1028|    585|                const exr_attribute_t* pname;
 1029|       |
 1030|    585|                if (pidx == part_index)
  ------------------
  |  Branch (1030:21): [True: 257, False: 328]
  ------------------
 1031|    257|                    continue;
 1032|    328|                pname = ctxt->parts[pidx]->name;
 1033|    328|                if (!pname)
  ------------------
  |  Branch (1033:21): [True: 0, False: 328]
  ------------------
 1034|      0|                {
 1035|      0|                    return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1036|      0|                        ctxt->print_error (
 1037|      0|                            ctxt,
 1038|      0|                            EXR_ERR_INVALID_ARGUMENT,
 1039|      0|                            "Part %d missing required attribute 'name' for multi-part file",
 1040|      0|                            pidx));
 1041|      0|                }
 1042|    328|                if (!strcmp (val, pname->string->str))
  ------------------
  |  Branch (1042:21): [True: 29, False: 299]
  ------------------
 1043|     29|                {
 1044|     29|                    return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|     29|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1045|     29|                        ctxt->print_error (
 1046|     29|                            ctxt,
 1047|     29|                            EXR_ERR_INVALID_ARGUMENT,
 1048|     29|                            "Each part should have a unique name, part %d and %d attempting to have same name '%s'",
 1049|     29|                            pidx, part_index, val));
 1050|     29|                }
 1051|    328|            }
 1052|    286|        }
 1053|       |
 1054|    541|        if (attr->string->length == (int32_t) bytes &&
  ------------------
  |  Branch (1054:13): [True: 54, False: 487]
  ------------------
 1055|     54|            attr->string->alloc_size > 0)
  ------------------
  |  Branch (1055:13): [True: 54, False: 0]
  ------------------
 1056|     54|        {
 1057|       |            /* we own the string... */
 1058|     54|            memcpy (EXR_CONST_CAST (void*, attr->string->str), val, bytes);
  ------------------
  |  |  250|     54|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
 1059|     54|        }
 1060|    487|        else if (ctxt->mode != EXR_CONTEXT_WRITE && ctxt->mode != EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (1060:18): [True: 0, False: 487]
  |  Branch (1060:53): [True: 0, False: 0]
  ------------------
 1061|      0|        {
 1062|      0|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1063|      0|                ctxt,
 1064|      0|                EXR_ERR_MODIFY_SIZE_CHANGE,
 1065|      0|                "Existing string 'name' has length %d, requested %d, unable to change",
 1066|      0|                attr->string->length,
 1067|      0|                (int32_t) bytes));
 1068|      0|        }
 1069|    487|        else
 1070|    487|        {
 1071|    487|            rv = exr_attr_string_set_with_length (
 1072|    487|                ctxt, attr->string, val, (int32_t) bytes);
 1073|    487|        }
 1074|    541|    }
 1075|       |
 1076|    541|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|    541|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1077|    570|}
exr_set_version:
 1091|    181|{
 1092|       |    /* version number for deep data, expect 1 */
 1093|    181|    if (val <= 0 || val > 1) return EXR_ERR_ARGUMENT_OUT_OF_RANGE;
  ------------------
  |  Branch (1093:9): [True: 83, False: 98]
  |  Branch (1093:21): [True: 51, False: 47]
  ------------------
 1094|       |
 1095|     47|    {
 1096|     47|        REQ_ATTR_FIND_CREATE (version, EXR_ATTR_INT);
  ------------------
  |  |  603|     47|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|     47|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|     47|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|     47|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|     47|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  287|     47|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|     47|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 47]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  289|     47|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|     47|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|     47|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 47]
  |  |  ------------------
  |  |  607|     47|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|     47|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|     47|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 47]
  |  |  ------------------
  |  |  610|     47|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|     47|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|     47|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 28, False: 19]
  |  |  ------------------
  |  |  613|     47|    {                                                                          \
  |  |  614|     28|        rv = exr_attr_list_add (                                               \
  |  |  615|     28|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|     28|    }                                                                          \
  |  |  617|     47|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 19]
  |  |  ------------------
  |  |  618|     19|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|     47|            ctxt,                                                              \
  |  |  620|     47|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|     47|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|     47|            part->name->type_name,                                             \
  |  |  623|     47|            #name));                                                           \
  |  |  624|     47|    attr = part->name
  ------------------
 1097|     47|        if (rv == EXR_ERR_SUCCESS) { attr->i = val; }
  ------------------
  |  Branch (1097:13): [True: 26, False: 21]
  ------------------
 1098|     47|        return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|     47|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1099|    188|    }
 1100|    188|}
exr_set_chunk_count:
 1106|     80|{
 1107|     80|    REQ_ATTR_FIND_CREATE (chunkCount, EXR_ATTR_INT);
  ------------------
  |  |  603|     80|    exr_attribute_t* attr = NULL;                                              \
  |  |  604|     80|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  605|     80|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  ------------------
  |  |  |  |  285|     80|    exr_priv_part_t part;                                                      \
  |  |  |  |  286|     80|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:9): [True: 0, False: 80]
  |  |  |  |  ------------------
  |  |  |  |  287|     80|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  288|     80|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (288:9): [True: 0, False: 80]
  |  |  |  |  |  Branch (288:19): [True: 0, False: 80]
  |  |  |  |  ------------------
  |  |  |  |  289|     80|    {                                                                          \
  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  297|     80|    part = ctxt->parts[pi]
  |  |  ------------------
  |  |  606|     80|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  ------------------
  |  |  |  Branch (606:9): [True: 0, False: 80]
  |  |  ------------------
  |  |  607|     80|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  608|     80|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  609|     80|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  ------------------
  |  |  |  Branch (609:9): [True: 0, False: 80]
  |  |  ------------------
  |  |  610|     80|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  611|     80|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  612|     80|    if (!part->name)                                                           \
  |  |  ------------------
  |  |  |  Branch (612:9): [True: 45, False: 35]
  |  |  ------------------
  |  |  613|     80|    {                                                                          \
  |  |  614|     45|        rv = exr_attr_list_add (                                               \
  |  |  615|     45|            ctxt, &(part->attributes), #name, t, 0, NULL, &(part->name));      \
  |  |  616|     45|    }                                                                          \
  |  |  617|     80|    else if (part->name->type != t)                                            \
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 35]
  |  |  ------------------
  |  |  618|     35|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  |  619|     80|            ctxt,                                                              \
  |  |  620|     80|            EXR_ERR_FILE_BAD_HEADER,                                           \
  |  |  621|     80|            "Invalid required attribute type '%s' for '%s'",                   \
  |  |  622|     80|            part->name->type_name,                                             \
  |  |  623|     80|            #name));                                                           \
  |  |  624|     80|    attr = part->name
  ------------------
 1108|     80|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (1108:9): [True: 58, False: 22]
  ------------------
 1109|     58|    {
 1110|     58|        attr->i           = val;
 1111|     58|        part->chunk_count = val;
 1112|     58|    }
 1113|     80|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|     80|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 1114|    320|}
exr_attr_set_box2i:
 1228|  1.60k|{
 1229|  1.60k|    if (name && 0 == strcmp (name, EXR_REQ_DATA_STR))
  ------------------
  |  |   11|  1.60k|#define EXR_REQ_DATA_STR "dataWindow"
  ------------------
  |  Branch (1229:9): [True: 1.60k, False: 0]
  |  Branch (1229:17): [True: 104, False: 1.50k]
  ------------------
 1230|    104|        return exr_set_data_window (ctxt, part_index, val);
 1231|  1.50k|    if (name && 0 == strcmp (name, EXR_REQ_DISP_STR))
  ------------------
  |  |   12|  1.50k|#define EXR_REQ_DISP_STR "displayWindow"
  ------------------
  |  Branch (1231:9): [True: 1.50k, False: 0]
  |  Branch (1231:17): [True: 36, False: 1.46k]
  ------------------
 1232|     36|        return exr_set_display_window (ctxt, part_index, val);
 1233|       |
 1234|  1.46k|    {
 1235|  1.46k|        ATTR_SET_IMPL_DEREF (EXR_ATTR_BOX2I, box2i);
  ------------------
  |  | 1199|  1.46k|    ATTR_FIND_CREATE (t, entry);                                               \
  |  |  ------------------
  |  |  |  | 1159|  1.46k|    exr_attribute_t* attr = NULL;                                              \
  |  |  |  | 1160|  1.46k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  |  | 1161|  1.46k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  285|  1.46k|    exr_priv_part_t part;                                                      \
  |  |  |  |  |  |  286|  1.46k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (286:9): [True: 0, False: 1.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  287|  1.46k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  |  |  288|  1.46k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (288:9): [True: 0, False: 1.46k]
  |  |  |  |  |  |  |  Branch (288:19): [True: 0, False: 1.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  289|  1.46k|    {                                                                          \
  |  |  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  |  |  297|  1.46k|    part = ctxt->parts[pi]
  |  |  |  |  ------------------
  |  |  |  | 1162|  1.46k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1162:9): [True: 0, False: 1.46k]
  |  |  |  |  ------------------
  |  |  |  | 1163|  1.46k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1164|  1.46k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  |  | 1165|  1.46k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1165:9): [True: 0, False: 1.46k]
  |  |  |  |  ------------------
  |  |  |  | 1166|  1.46k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1167|  1.46k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  |  | 1168|  1.46k|    rv = exr_attr_list_find_by_name (                                          \
  |  |  |  | 1169|  1.46k|        ctxt, (exr_attribute_list_t*) &(part->attributes), name, &attr);       \
  |  |  |  | 1170|  1.46k|    if (rv == EXR_ERR_NO_ATTR_BY_NAME)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1170:9): [True: 1.10k, False: 360]
  |  |  |  |  ------------------
  |  |  |  | 1171|  1.46k|    {                                                                          \
  |  |  |  | 1172|  1.10k|        if (ctxt->mode != EXR_CONTEXT_WRITE &&                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1172:13): [True: 0, False: 1.10k]
  |  |  |  |  ------------------
  |  |  |  | 1173|  1.10k|            ctxt->mode != EXR_CONTEXT_TEMPORARY)                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1173:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1174|  1.10k|            return EXR_UNLOCK_AND_RETURN (rv);                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1175|  1.10k|                                                                               \
  |  |  |  | 1176|  1.10k|        rv = exr_attr_list_add (                                               \
  |  |  |  | 1177|  1.10k|            ctxt, &(part->attributes), name, t, 0, NULL, &(attr));             \
  |  |  |  | 1178|  1.10k|    }                                                                          \
  |  |  |  | 1179|  1.46k|    else if (rv == EXR_ERR_SUCCESS)                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1179:14): [True: 224, False: 136]
  |  |  |  |  ------------------
  |  |  |  | 1180|    360|    {                                                                          \
  |  |  |  | 1181|    224|        if (attr->type != t)                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1181:13): [True: 74, False: 150]
  |  |  |  |  ------------------
  |  |  |  | 1182|    224|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|     74|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1183|    224|                ctxt,                                                          \
  |  |  |  | 1184|    224|                EXR_ERR_ATTR_TYPE_MISMATCH,                                    \
  |  |  |  | 1185|    224|                "'%s' requested type '" #entry                                 \
  |  |  |  | 1186|    224|                "', but stored attributes is type '%s'",                       \
  |  |  |  | 1187|    224|                name,                                                          \
  |  |  |  | 1188|    224|                attr->type_name));                                             \
  |  |  |  | 1189|    224|    }                                                                          \
  |  |  |  | 1190|    360|    else                                                                       \
  |  |  |  | 1191|    360|        return EXR_UNLOCK_AND_RETURN (rv)
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    136|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1200|  1.46k|    if (!val)                                                                  \
  |  |  ------------------
  |  |  |  Branch (1200:9): [True: 0, False: 1.25k]
  |  |  ------------------
  |  | 1201|  1.25k|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  | 1202|  1.25k|            ctxt,                                                              \
  |  | 1203|  1.25k|            EXR_ERR_INVALID_ARGUMENT,                                          \
  |  | 1204|  1.25k|            "No input value for setting '%s', type '%s'",                      \
  |  | 1205|  1.25k|            name,                                                              \
  |  | 1206|  1.25k|            #entry));                                                          \
  |  | 1207|  1.25k|    if (rv == EXR_ERR_SUCCESS) *(attr->entry) = *val;                          \
  |  |  ------------------
  |  |  |  Branch (1207:9): [True: 1.25k, False: 0]
  |  |  ------------------
  |  | 1208|  1.25k|    return EXR_UNLOCK_AND_RETURN (rv)
  |  |  ------------------
  |  |  |  |  278|  1.25k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  ------------------
 1236|  7.12k|    }
 1237|  7.12k|}
exr_attr_set_float:
 1566|  1.79k|{
 1567|  1.79k|    if (name && 0 == strcmp (name, EXR_REQ_PAR_STR))
  ------------------
  |  |   14|  1.79k|#define EXR_REQ_PAR_STR "pixelAspectRatio"
  ------------------
  |  Branch (1567:9): [True: 1.79k, False: 0]
  |  Branch (1567:17): [True: 51, False: 1.73k]
  ------------------
 1568|     51|        return exr_set_pixel_aspect_ratio (ctxt, part_index, val);
 1569|  1.73k|    if (name && 0 == strcmp (name, EXR_REQ_SCR_WW_STR))
  ------------------
  |  |   16|  1.73k|#define EXR_REQ_SCR_WW_STR "screenWindowWidth"
  ------------------
  |  Branch (1569:9): [True: 1.73k, False: 0]
  |  Branch (1569:17): [True: 0, False: 1.73k]
  ------------------
 1570|      0|        return exr_set_screen_window_width (ctxt, part_index, val);
 1571|       |
 1572|  1.73k|    {
 1573|  1.73k|        ATTR_SET_IMPL (EXR_ATTR_FLOAT, f);
  ------------------
  |  | 1194|  1.73k|    ATTR_FIND_CREATE (t, entry);                                               \
  |  |  ------------------
  |  |  |  | 1159|  1.73k|    exr_attribute_t* attr = NULL;                                              \
  |  |  |  | 1160|  1.73k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  |  | 1161|  1.73k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  285|  1.73k|    exr_priv_part_t part;                                                      \
  |  |  |  |  |  |  286|  1.73k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (286:9): [True: 0, False: 1.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  287|  1.73k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  |  |  288|  1.73k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (288:9): [True: 0, False: 1.73k]
  |  |  |  |  |  |  |  Branch (288:19): [True: 0, False: 1.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  289|  1.73k|    {                                                                          \
  |  |  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  |  |  297|  1.73k|    part = ctxt->parts[pi]
  |  |  |  |  ------------------
  |  |  |  | 1162|  1.73k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1162:9): [True: 0, False: 1.73k]
  |  |  |  |  ------------------
  |  |  |  | 1163|  1.73k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1164|  1.73k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  |  | 1165|  1.73k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1165:9): [True: 0, False: 1.73k]
  |  |  |  |  ------------------
  |  |  |  | 1166|  1.73k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1167|  1.73k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  |  | 1168|  1.73k|    rv = exr_attr_list_find_by_name (                                          \
  |  |  |  | 1169|  1.73k|        ctxt, (exr_attribute_list_t*) &(part->attributes), name, &attr);       \
  |  |  |  | 1170|  1.73k|    if (rv == EXR_ERR_NO_ATTR_BY_NAME)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1170:9): [True: 1.37k, False: 361]
  |  |  |  |  ------------------
  |  |  |  | 1171|  1.73k|    {                                                                          \
  |  |  |  | 1172|  1.37k|        if (ctxt->mode != EXR_CONTEXT_WRITE &&                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1172:13): [True: 0, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  | 1173|  1.37k|            ctxt->mode != EXR_CONTEXT_TEMPORARY)                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1173:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1174|  1.37k|            return EXR_UNLOCK_AND_RETURN (rv);                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1175|  1.37k|                                                                               \
  |  |  |  | 1176|  1.37k|        rv = exr_attr_list_add (                                               \
  |  |  |  | 1177|  1.37k|            ctxt, &(part->attributes), name, t, 0, NULL, &(attr));             \
  |  |  |  | 1178|  1.37k|    }                                                                          \
  |  |  |  | 1179|  1.73k|    else if (rv == EXR_ERR_SUCCESS)                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1179:14): [True: 201, False: 160]
  |  |  |  |  ------------------
  |  |  |  | 1180|    361|    {                                                                          \
  |  |  |  | 1181|    201|        if (attr->type != t)                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1181:13): [True: 127, False: 74]
  |  |  |  |  ------------------
  |  |  |  | 1182|    201|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    127|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1183|    201|                ctxt,                                                          \
  |  |  |  | 1184|    201|                EXR_ERR_ATTR_TYPE_MISMATCH,                                    \
  |  |  |  | 1185|    201|                "'%s' requested type '" #entry                                 \
  |  |  |  | 1186|    201|                "', but stored attributes is type '%s'",                       \
  |  |  |  | 1187|    201|                name,                                                          \
  |  |  |  | 1188|    201|                attr->type_name));                                             \
  |  |  |  | 1189|    201|    }                                                                          \
  |  |  |  | 1190|    361|    else                                                                       \
  |  |  |  | 1191|    361|        return EXR_UNLOCK_AND_RETURN (rv)
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    160|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1195|  1.73k|    if (rv == EXR_ERR_SUCCESS) attr->entry = val;                              \
  |  |  ------------------
  |  |  |  Branch (1195:9): [True: 1.45k, False: 0]
  |  |  ------------------
  |  | 1196|  1.45k|    return EXR_UNLOCK_AND_RETURN (rv)
  |  |  ------------------
  |  |  |  |  278|  1.45k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  ------------------
 1574|  6.95k|    }
 1575|  6.95k|}
exr_attr_set_int:
 1693|  2.07k|{
 1694|  2.07k|    if (name && !strcmp (name, EXR_REQ_VERSION_STR))
  ------------------
  |  |   21|  2.07k|#define EXR_REQ_VERSION_STR "version"
  ------------------
  |  Branch (1694:9): [True: 2.07k, False: 0]
  |  Branch (1694:17): [True: 181, False: 1.89k]
  ------------------
 1695|    181|        return exr_set_version (ctxt, part_index, val);
 1696|  1.89k|    if (name && !strcmp (name, EXR_REQ_CHUNK_COUNT_STR))
  ------------------
  |  |   22|  1.89k|#define EXR_REQ_CHUNK_COUNT_STR "chunkCount"
  ------------------
  |  Branch (1696:9): [True: 1.89k, False: 0]
  |  Branch (1696:17): [True: 80, False: 1.81k]
  ------------------
 1697|     80|        return exr_set_chunk_count (ctxt, part_index, val);
 1698|       |
 1699|  1.81k|    {
 1700|  1.81k|        ATTR_SET_IMPL (EXR_ATTR_INT, i);
  ------------------
  |  | 1194|  1.81k|    ATTR_FIND_CREATE (t, entry);                                               \
  |  |  ------------------
  |  |  |  | 1159|  1.81k|    exr_attribute_t* attr = NULL;                                              \
  |  |  |  | 1160|  1.81k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  |  | 1161|  1.81k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  285|  1.81k|    exr_priv_part_t part;                                                      \
  |  |  |  |  |  |  286|  1.81k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (286:9): [True: 0, False: 1.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  287|  1.81k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  |  |  288|  1.81k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (288:9): [True: 0, False: 1.81k]
  |  |  |  |  |  |  |  Branch (288:19): [True: 0, False: 1.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  289|  1.81k|    {                                                                          \
  |  |  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  |  |  297|  1.81k|    part = ctxt->parts[pi]
  |  |  |  |  ------------------
  |  |  |  | 1162|  1.81k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1162:9): [True: 0, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  | 1163|  1.81k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1164|  1.81k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  |  | 1165|  1.81k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1165:9): [True: 0, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  | 1166|  1.81k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1167|  1.81k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  |  | 1168|  1.81k|    rv = exr_attr_list_find_by_name (                                          \
  |  |  |  | 1169|  1.81k|        ctxt, (exr_attribute_list_t*) &(part->attributes), name, &attr);       \
  |  |  |  | 1170|  1.81k|    if (rv == EXR_ERR_NO_ATTR_BY_NAME)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1170:9): [True: 1.44k, False: 372]
  |  |  |  |  ------------------
  |  |  |  | 1171|  1.81k|    {                                                                          \
  |  |  |  | 1172|  1.44k|        if (ctxt->mode != EXR_CONTEXT_WRITE &&                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1172:13): [True: 0, False: 1.44k]
  |  |  |  |  ------------------
  |  |  |  | 1173|  1.44k|            ctxt->mode != EXR_CONTEXT_TEMPORARY)                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1173:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1174|  1.44k|            return EXR_UNLOCK_AND_RETURN (rv);                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1175|  1.44k|                                                                               \
  |  |  |  | 1176|  1.44k|        rv = exr_attr_list_add (                                               \
  |  |  |  | 1177|  1.44k|            ctxt, &(part->attributes), name, t, 0, NULL, &(attr));             \
  |  |  |  | 1178|  1.44k|    }                                                                          \
  |  |  |  | 1179|  1.81k|    else if (rv == EXR_ERR_SUCCESS)                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1179:14): [True: 198, False: 174]
  |  |  |  |  ------------------
  |  |  |  | 1180|    372|    {                                                                          \
  |  |  |  | 1181|    198|        if (attr->type != t)                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1181:13): [True: 146, False: 52]
  |  |  |  |  ------------------
  |  |  |  | 1182|    198|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    146|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1183|    198|                ctxt,                                                          \
  |  |  |  | 1184|    198|                EXR_ERR_ATTR_TYPE_MISMATCH,                                    \
  |  |  |  | 1185|    198|                "'%s' requested type '" #entry                                 \
  |  |  |  | 1186|    198|                "', but stored attributes is type '%s'",                       \
  |  |  |  | 1187|    198|                name,                                                          \
  |  |  |  | 1188|    198|                attr->type_name));                                             \
  |  |  |  | 1189|    198|    }                                                                          \
  |  |  |  | 1190|    372|    else                                                                       \
  |  |  |  | 1191|    372|        return EXR_UNLOCK_AND_RETURN (rv)
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    174|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1195|  1.81k|    if (rv == EXR_ERR_SUCCESS) attr->entry = val;                              \
  |  |  ------------------
  |  |  |  Branch (1195:9): [True: 1.49k, False: 0]
  |  |  ------------------
  |  | 1196|  1.49k|    return EXR_UNLOCK_AND_RETURN (rv)
  |  |  ------------------
  |  |  |  |  278|  1.49k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  ------------------
 1701|  7.25k|    }
 1702|  7.25k|}
exr_attr_set_string:
 1996|  4.27k|{
 1997|  4.27k|    size_t           bytes;
 1998|  4.27k|    exr_attribute_t* attr = NULL;
 1999|  4.27k|    exr_result_t     rv   = EXR_ERR_SUCCESS;
 2000|       |
 2001|  8.54k|    EXR_LOCK_AND_DEFINE_PART (part_index);
  ------------------
  |  |  285|  4.27k|    exr_priv_part_t part;                                                      \
  |  |  286|  4.27k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  ------------------
  |  |  |  Branch (286:9): [True: 0, False: 4.27k]
  |  |  ------------------
  |  |  287|  4.27k|    internal_exr_lock (ctxt);                                                  \
  |  |  288|  4.27k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  ------------------
  |  |  |  Branch (288:9): [True: 0, False: 4.27k]
  |  |  |  Branch (288:19): [True: 0, False: 4.27k]
  |  |  ------------------
  |  |  289|  4.27k|    {                                                                          \
  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  292|      0|            ctxt,                                                              \
  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  295|      0|            pi);                                                               \
  |  |  296|      0|    }                                                                          \
  |  |  297|  4.27k|    part = ctxt->parts[pi]
  ------------------
 2002|       |
 2003|  8.54k|    if (name && !strcmp (name, EXR_REQ_NAME_STR))
  ------------------
  |  |   19|  4.27k|#define EXR_REQ_NAME_STR "name"
  ------------------
  |  Branch (2003:9): [True: 4.27k, False: 0]
  |  Branch (2003:17): [True: 570, False: 3.70k]
  ------------------
 2004|    570|        return EXR_UNLOCK_AND_RETURN (exr_set_name (ctxt, part_index, val));
  ------------------
  |  |  278|    570|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2005|       |
 2006|  3.70k|    if (name && !strcmp (name, EXR_REQ_TYPE_STR))
  ------------------
  |  |   20|  3.70k|#define EXR_REQ_TYPE_STR "type"
  ------------------
  |  Branch (2006:9): [True: 3.70k, False: 0]
  |  Branch (2006:17): [True: 60, False: 3.64k]
  ------------------
 2007|     60|    {
 2008|     60|        if (ctxt->mode == EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (2008:13): [True: 0, False: 60]
  ------------------
 2009|      0|        {
 2010|      0|            if (!val)
  ------------------
  |  Branch (2010:17): [True: 0, False: 0]
  ------------------
 2011|      0|            {
 2012|      0|                return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2013|      0|                    ctxt->print_error (
 2014|      0|                        ctxt,
 2015|      0|                        EXR_ERR_INVALID_ARGUMENT,
 2016|      0|                        "Part type attribute must be set to valid value"));
 2017|      0|            }
 2018|      0|            if (!strcmp (val, "scanlineimage"))
  ------------------
  |  Branch (2018:17): [True: 0, False: 0]
  ------------------
 2019|      0|                part->storage_mode = EXR_STORAGE_SCANLINE;
 2020|      0|            else if (!strcmp (val, "tiledimage"))
  ------------------
  |  Branch (2020:22): [True: 0, False: 0]
  ------------------
 2021|      0|                part->storage_mode = EXR_STORAGE_TILED;
 2022|      0|            else if (!strcmp (val, "deepscanline"))
  ------------------
  |  Branch (2022:22): [True: 0, False: 0]
  ------------------
 2023|      0|                part->storage_mode = EXR_STORAGE_DEEP_SCANLINE;
 2024|      0|            else if (!strcmp (val, "deeptile"))
  ------------------
  |  Branch (2024:22): [True: 0, False: 0]
  ------------------
 2025|      0|                part->storage_mode = EXR_STORAGE_DEEP_TILED;
 2026|      0|            else
 2027|      0|                part->storage_mode = EXR_STORAGE_UNKNOWN;
 2028|      0|        }
 2029|     60|        else
 2030|     60|        {
 2031|     60|            return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|     60|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2032|     60|                ctxt->print_error (
 2033|     60|                    ctxt,
 2034|     60|                    EXR_ERR_INVALID_ARGUMENT,
 2035|     60|                    "Part type attribute must be implicitly only when adding a part"));
 2036|     60|        }
 2037|     60|    }
 2038|       |
 2039|  3.64k|    if (ctxt->mode == EXR_CONTEXT_READ)
  ------------------
  |  Branch (2039:9): [True: 0, False: 3.64k]
  ------------------
 2040|      0|        return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2041|  3.64k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));
 2042|  3.64k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)
  ------------------
  |  Branch (2042:9): [True: 0, False: 3.64k]
  ------------------
 2043|      0|        return EXR_UNLOCK_AND_RETURN (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2044|  3.64k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));
 2045|       |
 2046|  3.64k|    rv = exr_attr_list_find_by_name (
 2047|  3.64k|        ctxt, (exr_attribute_list_t*) &(part->attributes), name, &attr);
 2048|       |
 2049|  3.64k|    bytes = val ? strlen (val) : 0;
  ------------------
  |  Branch (2049:13): [True: 3.64k, False: 0]
  ------------------
 2050|       |
 2051|  3.64k|    if (bytes > (size_t) INT32_MAX)
  ------------------
  |  Branch (2051:9): [True: 0, False: 3.64k]
  ------------------
 2052|      0|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2053|  3.64k|            ctxt,
 2054|  3.64k|            EXR_ERR_INVALID_ARGUMENT,
 2055|  3.64k|            "String too large to store (%" PRIu64 " bytes) into '%s'",
 2056|  3.64k|            (uint64_t) bytes,
 2057|  3.64k|            name));
 2058|       |
 2059|  3.64k|    if (rv == EXR_ERR_NO_ATTR_BY_NAME)
  ------------------
  |  Branch (2059:9): [True: 2.82k, False: 815]
  ------------------
 2060|  2.82k|    {
 2061|  2.82k|        if (ctxt->mode != EXR_CONTEXT_WRITE && ctxt->mode != EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (2061:13): [True: 0, False: 2.82k]
  |  Branch (2061:48): [True: 0, False: 0]
  ------------------
 2062|      0|            return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2063|       |
 2064|  2.82k|        rv = exr_attr_list_add (
 2065|  2.82k|            ctxt, &(part->attributes), name, EXR_ATTR_STRING, 0, NULL, &(attr));
 2066|  2.82k|        if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (2066:13): [True: 2.82k, False: 0]
  ------------------
 2067|  2.82k|            rv = exr_attr_string_create_with_length (
 2068|  2.82k|                ctxt, attr->string, val, (int32_t) bytes);
 2069|  2.82k|    }
 2070|    815|    else if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (2070:14): [True: 468, False: 347]
  ------------------
 2071|    468|    {
 2072|    468|        if (attr->type != EXR_ATTR_STRING)
  ------------------
  |  Branch (2072:13): [True: 168, False: 300]
  ------------------
 2073|    168|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|    168|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2074|    468|                ctxt,
 2075|    468|                EXR_ERR_ATTR_TYPE_MISMATCH,
 2076|    468|                "'%s' requested type 'string', but attribute is type '%s'",
 2077|    468|                name,
 2078|    468|                attr->type_name));
 2079|    300|        if (attr->string->length == (int32_t) bytes &&
  ------------------
  |  Branch (2079:13): [True: 167, False: 133]
  ------------------
 2080|    167|            attr->string->alloc_size > 0)
  ------------------
  |  Branch (2080:13): [True: 167, False: 0]
  ------------------
 2081|    167|        {
 2082|    167|            if (val)
  ------------------
  |  Branch (2082:17): [True: 167, False: 0]
  ------------------
 2083|    167|                memcpy (EXR_CONST_CAST (void*, attr->string->str), val, bytes);
  ------------------
  |  |  250|    167|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
 2084|    167|        }
 2085|    133|        else if (ctxt->mode != EXR_CONTEXT_WRITE && ctxt->mode != EXR_CONTEXT_TEMPORARY)
  ------------------
  |  Branch (2085:18): [True: 0, False: 133]
  |  Branch (2085:53): [True: 0, False: 0]
  ------------------
 2086|      0|        {
 2087|      0|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (
  ------------------
  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2088|      0|                ctxt,
 2089|      0|                EXR_ERR_MODIFY_SIZE_CHANGE,
 2090|      0|                "Existing string '%s' has length %d, requested %d, unable to change",
 2091|      0|                name,
 2092|      0|                attr->string->length,
 2093|      0|                (int32_t) bytes));
 2094|      0|        }
 2095|    133|        else
 2096|    133|        {
 2097|    133|            rv = exr_attr_string_set_with_length (
 2098|    133|                ctxt, attr->string, val, (int32_t) bytes);
 2099|    133|        }
 2100|    300|    }
 2101|  3.47k|    return EXR_UNLOCK_AND_RETURN (rv);
  ------------------
  |  |  278|  3.47k|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  ------------------
 2102|  3.64k|}
exr_attr_set_v2i:
 2334|  1.11k|{
 2335|  1.11k|    ATTR_SET_IMPL_DEREF (EXR_ATTR_V2I, v2i);
  ------------------
  |  | 1199|  1.11k|    ATTR_FIND_CREATE (t, entry);                                               \
  |  |  ------------------
  |  |  |  | 1159|  1.11k|    exr_attribute_t* attr = NULL;                                              \
  |  |  |  | 1160|  1.11k|    exr_result_t     rv   = EXR_ERR_SUCCESS;                                   \
  |  |  |  | 1161|  1.11k|    EXR_LOCK_AND_DEFINE_PART (part_index);                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  285|  1.11k|    exr_priv_part_t part;                                                      \
  |  |  |  |  |  |  286|  1.11k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (286:9): [True: 0, False: 1.11k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  287|  1.11k|    internal_exr_lock (ctxt);                                                  \
  |  |  |  |  |  |  288|  1.11k|    if (pi < 0 || pi >= ctxt->num_parts)                                       \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (288:9): [True: 0, False: 1.11k]
  |  |  |  |  |  |  |  Branch (288:19): [True: 0, False: 1.11k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  289|  1.11k|    {                                                                          \
  |  |  |  |  |  |  290|      0|        internal_exr_unlock (ctxt);                                            \
  |  |  |  |  |  |  291|      0|        return ctxt->print_error (                                             \
  |  |  |  |  |  |  292|      0|            ctxt,                                                              \
  |  |  |  |  |  |  293|      0|            EXR_ERR_ARGUMENT_OUT_OF_RANGE,                                     \
  |  |  |  |  |  |  294|      0|            "Part index (%d) out of range",                                    \
  |  |  |  |  |  |  295|      0|            pi);                                                               \
  |  |  |  |  |  |  296|      0|    }                                                                          \
  |  |  |  |  |  |  297|  1.11k|    part = ctxt->parts[pi]
  |  |  |  |  ------------------
  |  |  |  | 1162|  1.11k|    if (ctxt->mode == EXR_CONTEXT_READ)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1162:9): [True: 0, False: 1.11k]
  |  |  |  |  ------------------
  |  |  |  | 1163|  1.11k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1164|  1.11k|            ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));              \
  |  |  |  | 1165|  1.11k|    if (ctxt->mode == EXR_CONTEXT_WRITING_DATA)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1165:9): [True: 0, False: 1.11k]
  |  |  |  |  ------------------
  |  |  |  | 1166|  1.11k|        return EXR_UNLOCK_AND_RETURN (                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1167|  1.11k|            ctxt->standard_error (ctxt, EXR_ERR_ALREADY_WROTE_ATTRS));         \
  |  |  |  | 1168|  1.11k|    rv = exr_attr_list_find_by_name (                                          \
  |  |  |  | 1169|  1.11k|        ctxt, (exr_attribute_list_t*) &(part->attributes), name, &attr);       \
  |  |  |  | 1170|  1.11k|    if (rv == EXR_ERR_NO_ATTR_BY_NAME)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1170:9): [True: 746, False: 372]
  |  |  |  |  ------------------
  |  |  |  | 1171|  1.11k|    {                                                                          \
  |  |  |  | 1172|    746|        if (ctxt->mode != EXR_CONTEXT_WRITE &&                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1172:13): [True: 0, False: 746]
  |  |  |  |  ------------------
  |  |  |  | 1173|    746|            ctxt->mode != EXR_CONTEXT_TEMPORARY)                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1173:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1174|    746|            return EXR_UNLOCK_AND_RETURN (rv);                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1175|    746|                                                                               \
  |  |  |  | 1176|    746|        rv = exr_attr_list_add (                                               \
  |  |  |  | 1177|    746|            ctxt, &(part->attributes), name, t, 0, NULL, &(attr));             \
  |  |  |  | 1178|    746|    }                                                                          \
  |  |  |  | 1179|  1.11k|    else if (rv == EXR_ERR_SUCCESS)                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1179:14): [True: 179, False: 193]
  |  |  |  |  ------------------
  |  |  |  | 1180|    372|    {                                                                          \
  |  |  |  | 1181|    179|        if (attr->type != t)                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1181:13): [True: 103, False: 76]
  |  |  |  |  ------------------
  |  |  |  | 1182|    179|            return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    103|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  |  | 1183|    179|                ctxt,                                                          \
  |  |  |  | 1184|    179|                EXR_ERR_ATTR_TYPE_MISMATCH,                                    \
  |  |  |  | 1185|    179|                "'%s' requested type '" #entry                                 \
  |  |  |  | 1186|    179|                "', but stored attributes is type '%s'",                       \
  |  |  |  | 1187|    179|                name,                                                          \
  |  |  |  | 1188|    179|                attr->type_name));                                             \
  |  |  |  | 1189|    179|    }                                                                          \
  |  |  |  | 1190|    372|    else                                                                       \
  |  |  |  | 1191|    372|        return EXR_UNLOCK_AND_RETURN (rv)
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    193|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1200|  1.11k|    if (!val)                                                                  \
  |  |  ------------------
  |  |  |  Branch (1200:9): [True: 0, False: 822]
  |  |  ------------------
  |  | 1201|    822|        return EXR_UNLOCK_AND_RETURN (ctxt->print_error (                      \
  |  |  ------------------
  |  |  |  |  278|      0|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  |  | 1202|    822|            ctxt,                                                              \
  |  | 1203|    822|            EXR_ERR_INVALID_ARGUMENT,                                          \
  |  | 1204|    822|            "No input value for setting '%s', type '%s'",                      \
  |  | 1205|    822|            name,                                                              \
  |  | 1206|    822|            #entry));                                                          \
  |  | 1207|    822|    if (rv == EXR_ERR_SUCCESS) *(attr->entry) = *val;                          \
  |  |  ------------------
  |  |  |  Branch (1207:9): [True: 822, False: 0]
  |  |  ------------------
  |  | 1208|    822|    return EXR_UNLOCK_AND_RETURN (rv)
  |  |  ------------------
  |  |  |  |  278|    822|#define EXR_UNLOCK_AND_RETURN(v) ((void) (internal_exr_unlock (ctxt)), v)
  |  |  ------------------
  ------------------
 2336|  5.29k|}

exr_attr_string_init:
   17|  13.7k|{
   18|  13.7k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (18:9): [True: 0, False: 13.7k]
  ------------------
   19|       |
   20|  13.7k|    if (len < 0)
  ------------------
  |  Branch (20:9): [True: 0, False: 13.7k]
  ------------------
   21|      0|        return ctxt->print_error (
   22|      0|            ctxt,
   23|      0|            EXR_ERR_INVALID_ARGUMENT,
   24|      0|            "Received request to allocate negative sized string (%d)",
   25|      0|            len);
   26|       |
   27|  13.7k|    if (!s)
  ------------------
  |  Branch (27:9): [True: 0, False: 13.7k]
  ------------------
   28|      0|        return ctxt->report_error (
   29|      0|            ctxt,
   30|      0|            EXR_ERR_INVALID_ARGUMENT,
   31|      0|            "Invalid reference to string object to initialize");
   32|       |
   33|  13.7k|    s->str = (char*) ctxt->alloc_fn ((size_t) (len + 1));
   34|  13.7k|    if (s->str == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 13.7k]
  ------------------
   35|      0|        return ctxt->standard_error (ctxt, EXR_ERR_OUT_OF_MEMORY);
   36|       |
   37|  13.7k|    s->length     = len;
   38|  13.7k|    s->alloc_size = len + 1;
   39|  13.7k|    return EXR_ERR_SUCCESS;
   40|  13.7k|}
exr_attr_string_init_static_with_length:
   47|  7.43k|{
   48|  7.43k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (48:9): [True: 0, False: 7.43k]
  ------------------
   49|       |
   50|  7.43k|    if (len < 0)
  ------------------
  |  Branch (50:9): [True: 0, False: 7.43k]
  ------------------
   51|      0|        return ctxt->print_error (
   52|      0|            ctxt,
   53|      0|            EXR_ERR_INVALID_ARGUMENT,
   54|      0|            "Received request to allocate negative sized string (%d)",
   55|      0|            len);
   56|       |
   57|  7.43k|    if (!v)
  ------------------
  |  Branch (57:9): [True: 0, False: 7.43k]
  ------------------
   58|      0|        return ctxt->report_error (
   59|      0|            ctxt,
   60|      0|            EXR_ERR_INVALID_ARGUMENT,
   61|      0|            "Invalid static string argument to initialize");
   62|       |
   63|  7.43k|    if (!s)
  ------------------
  |  Branch (63:9): [True: 0, False: 7.43k]
  ------------------
   64|      0|        return ctxt->report_error (
   65|      0|            ctxt,
   66|      0|            EXR_ERR_INVALID_ARGUMENT,
   67|      0|            "Invalid reference to string object to initialize");
   68|       |
   69|  7.43k|    s->length     = len;
   70|  7.43k|    s->alloc_size = 0;
   71|  7.43k|    s->str        = v;
   72|  7.43k|    return EXR_ERR_SUCCESS;
   73|  7.43k|}
exr_attr_string_create_with_length:
  105|  13.7k|{
  106|  13.7k|    exr_result_t rv;
  107|  13.7k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (107:9): [True: 0, False: 13.7k]
  ------------------
  108|       |
  109|  13.7k|    if (!s)
  ------------------
  |  Branch (109:9): [True: 0, False: 13.7k]
  ------------------
  110|      0|        return ctxt->report_error (
  111|      0|            ctxt,
  112|      0|            EXR_ERR_INVALID_ARGUMENT,
  113|      0|            "Invalid (NULL) arguments to string create with length");
  114|       |
  115|  13.7k|    rv = exr_attr_string_init (ctxt, s, len);
  116|  13.7k|    if (rv == EXR_ERR_SUCCESS)
  ------------------
  |  Branch (116:9): [True: 13.7k, False: 0]
  ------------------
  117|  13.7k|    {
  118|       |        /* we know we own the string memory */
  119|  13.7k|        char* outs = EXR_CONST_CAST (char*, s->str);
  ------------------
  |  |  250|  13.7k|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  120|       |        /* someone might pass in a string shorter than requested length (or longer) */
  121|  13.7k|        if (len > 0)
  ------------------
  |  Branch (121:13): [True: 13.5k, False: 232]
  ------------------
  122|  13.5k|        {
  123|       |#ifdef _MSC_VER
  124|       |#    pragma warning(push)
  125|       |#    pragma warning(disable : 4996)
  126|       |#elif defined(__clang__)
  127|       |// clang: do nothing
  128|       |#elif defined(__GNUC__)
  129|       |#    pragma GCC diagnostic push
  130|       |#    pragma GCC diagnostic ignored "-Wstringop-truncation"
  131|       |#endif
  132|  13.5k|            if (d)
  ------------------
  |  Branch (132:17): [True: 13.5k, False: 0]
  ------------------
  133|  13.5k|            {
  134|  13.5k|                size_t slen = strnlen( d, (size_t) len);
  135|  13.5k|                memcpy (outs, d, slen);
  136|  13.5k|                memset (outs + slen, '\0', ((size_t)len - slen) + 1);
  137|  13.5k|            }
  138|      0|            else
  139|      0|                memset (outs, 0, (size_t) len);
  140|       |#ifdef _MSC_VER
  141|       |#    pragma warning(pop)
  142|       |#elif defined(__clang__)
  143|       |// clang: do nothing
  144|       |#elif defined(__GNUC__)
  145|       |#    pragma GCC diagnostic pop
  146|       |#endif
  147|  13.5k|        }
  148|    232|        else outs[0] = '\0';
  149|  13.7k|    }
  150|  13.7k|    return rv;
  151|  13.7k|}
exr_attr_string_create:
  157|  3.07k|{
  158|  3.07k|    int32_t len     = 0;
  159|  3.07k|    if (d)
  ------------------
  |  Branch (159:9): [True: 3.07k, False: 0]
  ------------------
  160|  3.07k|    {
  161|  3.07k|        size_t  fulllen = strlen (d);
  162|  3.07k|        if (fulllen >= (size_t) INT32_MAX)
  ------------------
  |  Branch (162:13): [True: 0, False: 3.07k]
  ------------------
  163|      0|        {
  164|      0|            if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (164:17): [True: 0, False: 0]
  ------------------
  165|      0|            return ctxt->report_error (
  166|      0|                ctxt,
  167|      0|                EXR_ERR_INVALID_ARGUMENT,
  168|      0|                "Invalid string too long for attribute");
  169|      0|        }
  170|  3.07k|        len = (int32_t) fulllen;
  171|  3.07k|    }
  172|  3.07k|    return exr_attr_string_create_with_length (ctxt, s, d, len);
  173|  3.07k|}
exr_attr_string_set_with_length:
  180|    620|{
  181|    620|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (181:9): [True: 0, False: 620]
  ------------------
  182|       |
  183|    620|    if (!s)
  ------------------
  |  Branch (183:9): [True: 0, False: 620]
  ------------------
  184|      0|        return ctxt->report_error (
  185|      0|            ctxt,
  186|      0|            EXR_ERR_INVALID_ARGUMENT,
  187|      0|            "Invalid string argument to string set");
  188|       |
  189|    620|    if (len < 0)
  ------------------
  |  Branch (189:9): [True: 0, False: 620]
  ------------------
  190|      0|        return ctxt->print_error (
  191|      0|            ctxt,
  192|      0|            EXR_ERR_INVALID_ARGUMENT,
  193|      0|            "Received request to assign a negative sized string (%d)",
  194|      0|            len);
  195|       |
  196|    620|    if (s->alloc_size > len)
  ------------------
  |  Branch (196:9): [True: 202, False: 418]
  ------------------
  197|    202|    {
  198|       |        /* we own the memory */
  199|    202|        char* sstr;
  200|       |
  201|    202|        s->length = len;
  202|    202|        sstr      = EXR_CONST_CAST (char*, s->str);
  ------------------
  |  |  250|    202|#define EXR_CONST_CAST(t, v) ((t) (uintptr_t) v)
  ------------------
  203|    202|        if (len > 0)
  ------------------
  |  Branch (203:13): [True: 158, False: 44]
  ------------------
  204|    158|        {
  205|       |#ifdef _MSC_VER
  206|       |#    pragma warning(push)
  207|       |#    pragma warning(disable : 4996)
  208|       |#elif defined(__clang__)
  209|       |// clang: do nothing
  210|       |#elif defined(__GNUC__)
  211|       |#    pragma GCC diagnostic push
  212|       |#    pragma GCC diagnostic ignored "-Wstringop-truncation"
  213|       |#endif
  214|    158|            if (d)
  ------------------
  |  Branch (214:17): [True: 158, False: 0]
  ------------------
  215|    158|            {
  216|    158|                size_t slen = strnlen( d, (size_t) len);
  217|    158|                memcpy (sstr, d, slen);
  218|    158|                memset (sstr + slen, '\0', ((size_t)len - slen) + 1);
  219|    158|            }
  220|      0|            else
  221|      0|                memset (sstr, 0, (size_t) (len + 1));
  222|       |#ifdef _MSC_VER
  223|       |#    pragma warning(pop)
  224|       |#elif defined(__clang__)
  225|       |// clang: do nothing
  226|       |#elif defined(__GNUC__)
  227|       |#    pragma GCC diagnostic pop
  228|       |#endif
  229|    158|        }
  230|     44|        else sstr[0] = '\0';
  231|    202|        return EXR_ERR_SUCCESS;
  232|    202|    }
  233|    418|    exr_attr_string_destroy (ctxt, s);
  234|    418|    return exr_attr_string_create_with_length (ctxt, s, d, len);
  235|    620|}
exr_attr_string_destroy:
  264|  24.2k|{
  265|  24.2k|    if (!ctxt) return EXR_ERR_MISSING_CONTEXT_ARG;
  ------------------
  |  Branch (265:9): [True: 0, False: 24.2k]
  ------------------
  266|       |
  267|  24.2k|    if (s)
  ------------------
  |  Branch (267:9): [True: 24.2k, False: 0]
  ------------------
  268|  24.2k|    {
  269|  24.2k|        exr_attr_string_t nil = {0};
  270|  24.2k|        if (s->str && s->alloc_size > 0)
  ------------------
  |  Branch (270:13): [True: 21.1k, False: 3.07k]
  |  Branch (270:23): [True: 13.7k, False: 7.43k]
  ------------------
  271|  13.7k|            ctxt->free_fn ((char*) (uintptr_t) s->str);
  272|  24.2k|        *s = nil;
  273|  24.2k|    }
  274|  24.2k|    return EXR_ERR_SUCCESS;
  275|  24.2k|}

LLVMFuzzerTestOneInput:
   32|  3.07k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   33|       |    // FuzzedDataProvider is a utility integrated into clang via the
   34|       |    // compiler-rt project (see: https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/fuzzer/FuzzedDataProvider.h).
   35|       |    // It splits the fuzzer input (raw bytes) into various data types
   36|       |    // (integers, strings, etc.) to guide the fuzzer through different
   37|       |    // API calls and logic branches.
   38|  3.07k|    FuzzedDataProvider fdp(data, size);
   39|       |
   40|  3.07k|    exr_context_t f;
   41|  3.07k|    exr_context_initializer_t cinit;
   42|  3.07k|    memset(&cinit, 0, sizeof(exr_context_initializer_t));
   43|  3.07k|    cinit.size = sizeof(exr_context_initializer_t);
   44|       |
   45|       |    // Use a custom write function that just discards data, as we are
   46|       |    // testing the internal state management and header construction,
   47|       |    // not actual I/O performance.
   48|  3.07k|    cinit.write_fn = [](exr_const_context_t ctxt, void* userdata, const void* buffer, uint64_t sz, uint64_t offset, exr_stream_error_func_ptr_t error_cb) -> int64_t {
   49|  3.07k|        return (int64_t)sz;
   50|  3.07k|    };
   51|       |
   52|  3.07k|    if (exr_start_write(&f, "dummy.exr", EXR_WRITE_FILE_DIRECTLY, &cinit) != EXR_ERR_SUCCESS) {
  ------------------
  |  Branch (52:9): [True: 0, False: 3.07k]
  ------------------
   53|      0|        return 0;
   54|      0|    }
   55|       |
   56|       |    // Fuzz the number of parts (1 to 3)
   57|  3.07k|    int num_parts = fdp.ConsumeIntegralInRange<int>(1, 3);
   58|  10.5k|    for (int p = 0; p < num_parts; ++p) {
  ------------------
  |  Branch (58:21): [True: 7.43k, False: 3.07k]
  ------------------
   59|  7.43k|        char part_name[20];
   60|  7.43k|        snprintf(part_name, sizeof(part_name), "part%d", p);
   61|       |
   62|       |        // Pick a random storage type
   63|  7.43k|        exr_storage_t storage = (exr_storage_t)fdp.PickValueInArray({
   64|  7.43k|            EXR_STORAGE_SCANLINE,
   65|  7.43k|            EXR_STORAGE_TILED,
   66|  7.43k|            EXR_STORAGE_DEEP_SCANLINE,
   67|  7.43k|            EXR_STORAGE_DEEP_TILED
   68|  7.43k|        });
   69|       |
   70|  7.43k|        int part_idx;
   71|  7.43k|        if (exr_add_part(f, part_name, storage, &part_idx) != EXR_ERR_SUCCESS) {
  ------------------
  |  Branch (71:13): [True: 5, False: 7.43k]
  ------------------
   72|      5|            continue;
   73|      5|        }
   74|       |
   75|  7.43k|        exr_initialize_required_attr_simple(f, part_idx, 64, 64, EXR_COMPRESSION_NONE);
   76|       |
   77|       |        // Fuzz additional attributes (0 to 5)
   78|  7.43k|        int num_attrs = fdp.ConsumeIntegralInRange<int>(0, 5);
   79|  22.4k|        for (int a = 0; a < num_attrs; ++a) {
  ------------------
  |  Branch (79:25): [True: 14.9k, False: 7.43k]
  ------------------
   80|  14.9k|            std::string attr_name = fdp.ConsumeRandomLengthString(16);
   81|  14.9k|            if (attr_name.empty()) continue;
  ------------------
  |  Branch (81:17): [True: 4.13k, False: 10.8k]
  ------------------
   82|       |
   83|       |            // Pick a random attribute type to set and fill it with fuzzed data
   84|  10.8k|            int choice = fdp.ConsumeIntegralInRange<int>(0, 5);
   85|  10.8k|            switch (choice) {
  ------------------
  |  Branch (85:21): [True: 10.8k, False: 0]
  ------------------
   86|  2.07k|                case 0:
  ------------------
  |  Branch (86:17): [True: 2.07k, False: 8.78k]
  ------------------
   87|  2.07k|                    exr_attr_set_int(f, part_idx, attr_name.c_str(), fdp.ConsumeIntegral<int32_t>());
   88|  2.07k|                    break;
   89|  1.79k|                case 1:
  ------------------
  |  Branch (89:17): [True: 1.79k, False: 9.06k]
  ------------------
   90|  1.79k|                    exr_attr_set_float(f, part_idx, attr_name.c_str(), fdp.ConsumeFloatingPoint<float>());
   91|  1.79k|                    break;
   92|  1.83k|                case 2:
  ------------------
  |  Branch (92:17): [True: 1.83k, False: 9.02k]
  ------------------
   93|  1.83k|                {
   94|  1.83k|                    std::string s = fdp.ConsumeRandomLengthString(32);
   95|  1.83k|                    exr_attr_set_string(f, part_idx, attr_name.c_str(), s.c_str());
   96|  1.83k|                }
   97|  1.83k|                break;
   98|  1.11k|                case 3:
  ------------------
  |  Branch (98:17): [True: 1.11k, False: 9.74k]
  ------------------
   99|  1.11k|                {
  100|  1.11k|                    exr_attr_v2i_t v = {fdp.ConsumeIntegral<int32_t>(), fdp.ConsumeIntegral<int32_t>()};
  101|  1.11k|                    exr_attr_set_v2i(f, part_idx, attr_name.c_str(), &v);
  102|  1.11k|                }
  103|  1.11k|                break;
  104|  1.60k|                case 4:
  ------------------
  |  Branch (104:17): [True: 1.60k, False: 9.25k]
  ------------------
  105|  1.60k|                {
  106|  1.60k|                    exr_attr_box2i_t b = {{fdp.ConsumeIntegral<int32_t>(), fdp.ConsumeIntegral<int32_t>()},
  107|  1.60k|                                          {fdp.ConsumeIntegral<int32_t>(), fdp.ConsumeIntegral<int32_t>()}};
  108|  1.60k|                    exr_attr_set_box2i(f, part_idx, attr_name.c_str(), &b);
  109|  1.60k|                }
  110|  1.60k|                break;
  111|  2.43k|                case 5:
  ------------------
  |  Branch (111:17): [True: 2.43k, False: 8.42k]
  ------------------
  112|  2.43k|                {
  113|  2.43k|                    const char* choices[] = {"increasingY", "decreasingY", "randomY"};
  114|  2.43k|                    exr_attr_set_string(f, part_idx, attr_name.c_str(), fdp.PickValueInArray(choices));
  115|  2.43k|                }
  116|  2.43k|                break;
  117|  10.8k|            }
  118|  10.8k|        }
  119|  7.43k|    }
  120|       |
  121|       |    // This calls the internal header-writing and validation logic
  122|  3.07k|    exr_write_header(f);
  123|  3.07k|    exr_finish(&f);
  124|       |
  125|  3.07k|    return 0;
  126|  3.07k|}

