void compress(int init_bits, OutputStream outs) throws IOException {
		int fcode;
		int i /* = 0 */;
		int c;
		int ent;
		int disp;
		int hsize_reg;
		int hshift;
		g_init_bits = init_bits;
		clear_flg = false;
		n_bits = g_init_bits;
		maxcode = MAXCODE(n_bits);
		ClearCode = 1 << (init_bits - 1);
		EOFCode = ClearCode + 1;
		free_ent = ClearCode + 2;

		char_init();
		ent = nextPixel();
		hshift = 0;
		for (fcode = hsize; fcode < 65536; fcode *= 2)
			++hshift;
		hshift = 8 - hshift;
		hsize_reg = hsize;
		cl_hash(hsize_reg);
		output(ClearCode, outs);
		outer_loop:
		while ((c = nextPixel()) != EOF) {
			fcode = (c << maxbits) + ent;
			i = (c << hshift) ^ ent;
			if (htab[i] == fcode) {
				ent = codetab[i];
				continue;
			} else if (htab[i] >= 0) {
				disp = hsize_reg - i;
				if (i == 0)
					disp = 1;
				do {
					if ((i -= disp) < 0)
						i += hsize_reg;

					if (htab[i] == fcode) {
						ent = codetab[i];
						continue outer_loop;
					}
				} while (htab[i] >= 0);
			}
			output(ent, outs);
			ent = c;
			if (free_ent < maxmaxcode) {
				codetab[i] = free_ent++;
				htab[i] = fcode;
			} else
				cl_block(outs);
		}
		output(ent, outs);
		output(EOFCode, outs);
	}