dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) / 65536); dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) / 65536); dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) / 65536);
dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16);
void convertMultiRGBToYCbCr(ImageData image) {	int srcWidth = image.width;	int srcHeight = image.height;	int bSize = srcWidth * srcHeight;	byte[] dataYComp = new byte[bSize];	byte[] dataCbComp = new byte[bSize];	byte[] dataCrComp = new byte[bSize];	PaletteData palette = image.palette;	int[] buffer = new int[srcWidth];	if (palette.isDirect) {		int redMask = palette.redMask;		int greenMask = palette.greenMask;		int blueMask = palette.blueMask;		int redShift = palette.redShift;		int greenShift = palette.greenShift;		int blueShift = palette.blueShift;		for (int yPos = 0; yPos < srcHeight; yPos++) {			image.getPixels(0, yPos, srcWidth, buffer, 0);			int dstRowIndex = yPos * srcWidth;			for (int xPos = 0; xPos < srcWidth; xPos++) {				int pixel = buffer[xPos];				int dstDataIndex = dstRowIndex + xPos;				int r = pixel & redMask;				r = (redShift < 0) ? r >>> -redShift : r << redShift;				int g = pixel & greenMask;				g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;				int b = pixel & blueMask;				b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;								dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) / 65536);				dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) / 65536);				dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) / 65536);			}		}	} else {		for (int yPos = 0; yPos < srcHeight; yPos++) {			image.getPixels(0, yPos, srcWidth, buffer, 0);			int dstRowIndex = yPos * srcWidth;			for (int xPos = 0; xPos < srcWidth; xPos++) {				int pixel = buffer[xPos];				int dstDataIndex = dstRowIndex + xPos;				RGB rgb = palette.getRGB(pixel);				int r = rgb.red;				int g = rgb.green;				int b = rgb.blue;				dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) / 65536);				dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) / 65536);				dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) / 65536);			}		}	}	compress(image, dataYComp, dataCbComp, dataCrComp);}