BitMiracle.LibTiff.Classic.TiffRgbaImage.putcontig8bitYCbCr12tile C# (CSharp) Method

putcontig8bitYCbCr12tile() private static method

8-bit packed YCbCr samples w/ 1,2 subsampling => RGB
private static putcontig8bitYCbCr12tile ( TiffRgbaImage img, int raster, int rasterOffset, int rasterShift, int x, int y, int width, int height, byte buffer, int offset, int bufferShift ) : void
img TiffRgbaImage
raster int
rasterOffset int
rasterShift int
x int
y int
width int
height int
buffer byte
offset int
bufferShift int
return void
        private static void putcontig8bitYCbCr12tile(
            TiffRgbaImage img, int[] raster, int rasterOffset, int rasterShift,
            int x, int y, int width, int height, byte[] buffer, int offset, int bufferShift)
        {
            bufferShift = (bufferShift / 2) * 4;
            int rasterOffset2 = rasterOffset + width + rasterShift;

            while (height >= 2)
            {
                x = width;
                do
                {
                    int Cb = buffer[offset + 2];
                    int Cr = buffer[offset + 3];
                    img.YCbCrtoRGB(out raster[rasterOffset + 0], buffer[offset + 0], Cb, Cr);
                    img.YCbCrtoRGB(out raster[rasterOffset2 + 0], buffer[offset + 1], Cb, Cr);
                    rasterOffset++;
                    rasterOffset2++;
                    offset += 4;
                } while (--x != 0);

                rasterOffset += rasterShift * 2 + width;
                rasterOffset2 += rasterShift * 2 + width;
                offset += bufferShift;
                height -= 2;
            }

            if (height == 1)
            {
                x = width;
                do
                {
                    int Cb = buffer[offset + 2];
                    int Cr = buffer[offset + 3];
                    img.YCbCrtoRGB(out raster[rasterOffset + 0], buffer[offset + 0], Cb, Cr);
                    rasterOffset++;
                    offset += 4;
                } while (--x != 0);
            }
        }