private void filterPixels(DirectGif89Frame dgf) throws IOException {
		if (ciLookup == null)
			throw new IOException("RGB frames require palette autodetection");

		int[]  argb_pixels = (int[]) dgf.getPixelSource();
		byte[] ci_pixels = dgf.getPixelSink();
		int    npixels = argb_pixels.length;
		for (int i = 0; i < npixels; ++i) {
			int argb = argb_pixels[i];

			/* handle transparency */
			if ((argb >>> 24) < 0x80)        /* transparent pixel? */
				if (transparentIndex == -1)    /* first transparent color encountered? */
					transparentIndex = ciCount;  /* record its index */
				else if (argb != theColors[transparentIndex]) {
					/* different pixel value? */
					/* collapse all transparent pixels into one color index */
					ci_pixels[i] = (byte) transparentIndex;
					continue;  /* CONTINUE - index already in table */
				}

			/* try to look up the index in our "reverse" color table */
			int color_index = ciLookup.getPaletteIndex(argb & 0xffffff);

			if (color_index == -1) {
				/* if it isn't in there yet */
				if (ciCount == 256)
					throw new IOException("can't encode as GIF (> 256 colors)");

				/* store color in our accumulating palette */
				theColors[ciCount] = argb;

				/* store index in reverse color table   */
				ciLookup.put(argb & 0xffffff, ciCount);

				/* send color index to our output array */
				ci_pixels[i] = (byte) ciCount;

				/* increment count of distinct color indices */
				++ciCount;
			}
			else  /* we've already snagged color into our palette */
				ci_pixels[i] = (byte) color_index;  /* just send filtered pixel    */
		}
	}