internal bool _tr_tally(int dist, int lc) { this.pending[this.d_buf + (this.last_lit * 2)] = (byte)SharedUtils.URShift(dist, 8); this.pending[(this.d_buf + (this.last_lit * 2)) + 1] = (byte)dist; this.pending[this.l_buf + this.last_lit] = (byte)lc; this.last_lit++; if (dist == 0) { this.dyn_ltree[lc * 2] = (short)(this.dyn_ltree[lc * 2] + 1); } else { this.matches++; dist--; this.dyn_ltree[((Tree._length_code[lc] + 0x100) + 1) * 2] = (short)(this.dyn_ltree[((Tree._length_code[lc] + 0x100) + 1) * 2] + 1); this.dyn_dtree[Tree.d_code(dist) * 2] = (short)(this.dyn_dtree[Tree.d_code(dist) * 2] + 1); } if (((this.last_lit & 0x1fff) == 0) && (this.compressionLevel > CompressionLevel.Level2)) { int number = this.last_lit * 8; int num2 = this.strstart - this.block_start; for (int i = 0; i < 30; i++) { number += (int)(this.dyn_dtree[i * 2] * (5L + Tree.extra_dbits[i])); } number = SharedUtils.URShift(number, 3); if ((this.matches < (this.last_lit / 2)) && (number < (num2 / 2))) { return(true); } } return((this.last_lit == (this.lit_bufsize - 1)) || (this.last_lit == this.lit_bufsize)); }
internal void send_compressed_block(short[] ltree, short[] dtree) { int num3 = 0; if (this.last_lit != 0) { do { int dist = ((this.pending[this.d_buf + (num3 * 2)] << 8) & 0xff00) | (this.pending[(this.d_buf + (num3 * 2)) + 1] & 0xff); int c = this.pending[this.l_buf + num3] & 0xff; num3++; if (dist == 0) { this.send_code(c, ltree); } else { int index = Tree._length_code[c]; this.send_code((index + 0x100) + 1, ltree); int length = Tree.extra_lbits[index]; if (length != 0) { c -= Tree.base_length[index]; this.send_bits(c, length); } dist--; index = Tree.d_code(dist); this.send_code(index, dtree); length = Tree.extra_dbits[index]; if (length != 0) { dist -= Tree.base_dist[index]; this.send_bits(dist, length); } } }while (num3 < this.last_lit); } this.send_code(0x100, ltree); this.last_eob_len = ltree[0x201]; }