private build_tree ( |
||
s | ||
Résultat | void |
internal int build_bl_tree() { scan_tree(dyn_ltree, treeLiterals.max_code); scan_tree(dyn_dtree, treeDistances.max_code); treeBitLengths.build_tree(this); int num = InternalConstants.BL_CODES - 1; while (num >= 3 && bl_tree[Tree.bl_order[num] * 2 + 1] == 0) { num--; } opt_len += 3 * (num + 1) + 5 + 5 + 4; return(num); }
internal int build_bl_tree() { scan_tree(dyn_ltree, treeLiterals.max_code); scan_tree(dyn_dtree, treeDistances.max_code); treeBitLengths.build_tree(this); int max_blindex = InternalConstants.BL_CODES - 1; while (max_blindex >= 3 && bl_tree[Tree.bl_order[max_blindex] * 2 + 1] == 0) { max_blindex--; } opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; return(max_blindex); }
internal void _tr_flush_block(int buf, int stored_len, bool eof) { int num = 0; int num2; int num3; if (compressionLevel > CompressionLevel.None) { if (data_type == Z_UNKNOWN) { set_data_type(); } treeLiterals.build_tree(this); treeDistances.build_tree(this); num = build_bl_tree(); num2 = opt_len + 3 + 7 >> 3; num3 = static_len + 3 + 7 >> 3; if (num3 <= num2) { num2 = num3; } } else { num2 = (num3 = stored_len + 5); } if (stored_len + 4 <= num2 && buf != -1) { _tr_stored_block(buf, stored_len, eof); } else if (num3 == num2) { send_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3); send_compressed_block(StaticTree.lengthAndLiteralsTreeCodes, StaticTree.distTreeCodes); } else { send_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3); send_all_trees(treeLiterals.max_code + 1, treeDistances.max_code + 1, num + 1); send_compressed_block(dyn_ltree, dyn_dtree); } _InitializeBlocks(); if (eof) { bi_windup(); } }