The basic coding unit in JPEG is a 8x8 block. For each 8x8 block, it goes through DCT, quantization, and runlength coding. Given a gray scale image, it is divided into non-overlapping 8x8 blocks. Each block is processed as above. When the input image is RGB, each color component (R, G, and B) can be compressed directly as a gray scale image. Alternatively, the RGB values of each pixel can be changed to the YcbCr values, and the Cb and Cr images can be further downsampled by a factor of 2 in both horizontal and vertical directions. Then the Y, Cb and Cr images can be coded independently, each as a gray scale image. In the interleaved mode, a minimum coding unit (MCU) consists of 4 Y blocks, 1 Cb block and 1 Cr block. The 3 components are processed simultaneously, by coding 1 MCU at a time.