static private gen_codes ( short tree, int max_code, short bl_count ) : void | ||
tree | short | |
max_code | int | |
bl_count | short | |
return | void |
// Token: 0x060006F4 RID: 1780 RVA: 0x00032FE4 File Offset: 0x000311E4 internal void build_tree(DeflateManager s) { short[] array = this.dyn_tree; short[] treeCodes = this.staticTree.treeCodes; int elems = this.staticTree.elems; int num = -1; s.heap_len = 0; s.heap_max = Tree.HEAP_SIZE; for (int i = 0; i < elems; i++) { if (array[i * 2] != 0) { num = (s.heap[++s.heap_len] = i); s.depth[i] = 0; } else { array[i * 2 + 1] = 0; } } int num2; while (s.heap_len < 2) { num2 = (s.heap[++s.heap_len] = ((num < 2) ? (++num) : 0)); array[num2 * 2] = 1; s.depth[num2] = 0; s.opt_len--; if (treeCodes != null) { s.static_len -= (int)treeCodes[num2 * 2 + 1]; } } this.max_code = num; for (int i = s.heap_len / 2; i >= 1; i--) { s.pqdownheap(array, i); } num2 = elems; do { int i = s.heap[1]; s.heap[1] = s.heap[s.heap_len--]; s.pqdownheap(array, 1); int num3 = s.heap[1]; s.heap[--s.heap_max] = i; s.heap[--s.heap_max] = num3; array[num2 * 2] = array[i * 2] + array[num3 * 2]; s.depth[num2] = (sbyte)(Math.Max((byte)s.depth[i], (byte)s.depth[num3]) + 1); array[i * 2 + 1] = (array[num3 * 2 + 1] = (short)num2); s.heap[1] = num2++; s.pqdownheap(array, 1); }while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1]; this.gen_bitlen(s); Tree.gen_codes(array, num, s.bl_count); }
internal void build_tree(DeflateManager s) { short[] tree = this.dyn_tree; short[] numArray1 = this.staticTree.treeCodes; int num1 = this.staticTree.elems; int max_code = -1; s.heap_len = 0; s.heap_max = Tree.HEAP_SIZE; for (int index = 0; index < num1; ++index) { if ((int)tree[index * 2] != 0) { s.heap[++s.heap_len] = max_code = index; s.depth[index] = (sbyte)0; } else { tree[index * 2 + 1] = (short)0; } } while (s.heap_len < 2) { int[] numArray2 = s.heap; int index1 = ++s.heap_len; int num2; if (max_code >= 2) { num2 = 0; } else { max_code = num2 = max_code + 1; } int num3 = num2; numArray2[index1] = num2; int index2 = num3; tree[index2 * 2] = (short)1; s.depth[index2] = (sbyte)0; --s.opt_len; if (numArray1 != null) { s.static_len -= (int)numArray1[index2 * 2 + 1]; } } this.max_code = max_code; for (int k = s.heap_len / 2; k >= 1; --k) { s.pqdownheap(tree, k); } int index3 = num1; do { int index1 = s.heap[1]; s.heap[1] = s.heap[s.heap_len--]; s.pqdownheap(tree, 1); int index2 = s.heap[1]; s.heap[--s.heap_max] = index1; s.heap[--s.heap_max] = index2; tree[index3 * 2] = (short)((int)tree[index1 * 2] + (int)tree[index2 * 2]); s.depth[index3] = (sbyte)((int)Math.Max((byte)s.depth[index1], (byte)s.depth[index2]) + 1); tree[index1 * 2 + 1] = tree[index2 * 2 + 1] = (short)index3; s.heap[1] = index3++; s.pqdownheap(tree, 1); }while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1]; this.gen_bitlen(s); Tree.gen_codes(tree, max_code, s.bl_count); }