internal void send_compressed_block(short[] ltree, short[] dtree) { int num = 0; if (this.last_lit != 0) { do { int num2 = this._distanceOffset + num * 2; int num3 = ((int)this.pending[num2] << 8 & 65280) | (int)(this.pending[num2 + 1] & byte.MaxValue); int num4 = (int)(this.pending[this._lengthOffset + num] & byte.MaxValue); num++; if (num3 == 0) { this.send_code(num4, ltree); } else { int num5 = (int)ZTree.LengthCode[num4]; this.send_code(num5 + InternalConstants.LITERALS + 1, ltree); int num6 = ZTree.ExtraLengthBits[num5]; if (num6 != 0) { num4 -= ZTree.LengthBase[num5]; this.send_bits(num4, num6); } num3--; num5 = ZTree.DistanceCode(num3); this.send_code(num5, dtree); num6 = ZTree.ExtraDistanceBits[num5]; if (num6 != 0) { num3 -= ZTree.DistanceBase[num5]; this.send_bits(num3, num6); } } }while (num < this.last_lit); } this.send_code(DeflateManager.END_BLOCK, ltree); this.last_eob_len = (int)ltree[DeflateManager.END_BLOCK * 2 + 1]; }
internal bool _tr_tally(int dist, int lc) { this.pending[this._distanceOffset + this.last_lit * 2] = (byte)((uint)dist >> 8); this.pending[this._distanceOffset + this.last_lit * 2 + 1] = (byte)dist; this.pending[this._lengthOffset + this.last_lit] = (byte)lc; this.last_lit++; if (dist == 0) { short[] array = this.dyn_ltree; int num = lc * 2; array[num] += 1; } else { this.matches++; dist--; short[] array2 = this.dyn_ltree; int num2 = ((int)ZTree.LengthCode[lc] + InternalConstants.LITERALS + 1) * 2; array2[num2] += 1; short[] array3 = this.dyn_dtree; int num3 = ZTree.DistanceCode(dist) * 2; array3[num3] += 1; } if ((this.last_lit & 8191) == 0 && this.compressionLevel > CompressionLevel.Level2) { int num4 = this.last_lit << 3; int num5 = this.strstart - this.block_start; for (int i = 0; i < InternalConstants.D_CODES; i++) { num4 = (int)((long)num4 + (long)this.dyn_dtree[i * 2] * (5L + (long)ZTree.ExtraDistanceBits[i])); } num4 >>= 3; if (this.matches < this.last_lit / 2 && num4 < num5 / 2) { return(true); } } return(this.last_lit == this.lit_bufsize - 1 || this.last_lit == this.lit_bufsize); }