* @param decode           decode vector.
     * @param bitsPerComponent bits per component .
     */
    private static void alterRasterYCCK2CMYK(WritableRaster wr,
                                             Vector<Integer> decode,
                                             int bitsPerComponent) {

        float[] origValues;
        double[] pixels = new double[4];
        double Y, Cb, Cr, K;
        double lastY = -1, lastCb = -1, lastCr = -1, lastK = -1;
        double c = 0, m = 0, y2 = 0, k = 0;

        int width = wr.getWidth();
        int height = wr.getHeight();
        int maxValue = ((int) Math.pow(2, bitsPerComponent)) - 1;

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                // apply decode param.
                origValues = getNormalizedComponents(
                        (byte[]) wr.getDataElements(x, y, null),
                        decode,
                        maxValue);

                Y = origValues[0] * 255;
                Cb = origValues[1] * 255;
                Cr = origValues[2] * 255;
                K = origValues[3] * 255;

                if (!(lastY == y && lastCb == Cb && lastCr == Cr && lastK == K)) {

                    // intel codecs, http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch6/ch6_color_models.html
                    // Intel IPP conversion for JPEG codec.
                    c = 255 - (Y + (1.402 * Cr) - 179.456);
                    m = 255 - (Y - (0.34414 * Cb) - (0.71413636 * Cr) + 135.45984);
                    y2 = 255 - (Y + (1.7718 * Cb) - 226.816);
                    k = K;

                    c = clip(0, 255, c);
                    m = clip(0, 255, m);
                    y2 = clip(0, 255, y2);
                }

                lastY = Y;
                lastCb = Cb;
                lastCr = Cr;
                lastK = K;

                pixels[0] = c;
                pixels[1] = m;
                pixels[2] = y2;
                pixels[3] = k;

                wr.setPixel(x, y, pixels);
            }
        }
    }