Witam
Próbuję zrobic konwersję obrazu z RGB do YCbCr jednak nie jestem pewien czy dobrze ją wykonuje w sensie programowania java. Ze strony algorytmu wszystko wydaje się dobrze.

for(int i=0;i<this.height;i++)
            for(int j=0;j<this.width;j++){
                    r = this.r_we[i][j];//tablica skladowych red 0..255
                    g = this.g_we[i][j];//tak jak wyzej
                    b = this.b_we[i][j];//tak jak wyzej
                    this.Y[i][j] = (int) (16 + (65.738 * r + 129.057 * g + 25.0640 * b) / 256);
                    this.Cr[i][j] = (int)(128 + (-37.945 * r - 74.494 * g + 112.439 * b)/256);
                    this.Cb[i][j] = (int)(128 + (112.439 * r - 94.154 * g - 18.2850 * b)/256);
            }
try{
            for(int i=0;i<this.height;i++)
                for(int j=0;j<this.width;j++){
                    //tu nie jestem pewnien czy robię dobrze więc proszę o wasze sugestię i opinie
                    int rr = this.Y[i][j];
                    int gg = this.Cb[i][j];
                    int bb = this.Cr[i][j];
                    int pxl = bb | gg << 8 | rr << 16 | 0xff << 24;
                    this.img.setRGB(j, i, pxl);// ??? czy to jest ok ?
                    //this.img. // obiekt BufferedImage jako BufferedImage.TYPE_INT_RGB
                }
        }

z góry thx</cpp>