Now that we have finished the back end of image compression, the simple coding that we do with Hoffman coding, in the example that I presented, let's go to the front end of image compression. Basically what we're going to describe in this video is this part. So let's just start with this component. What we have is an image, and the fur think that at J big dash or a law see transfer compression does is divides the image into blocks. Each one of these blocks has n by n pixels, and we're going to talk, we're going to give examples of what's the value of N, but just to give you an idea, a JPEG uses eight by eight. So, basically, jpeg codes almost independently every eight by eight block of the image. These are non-overlapping block, so here are eight, then eight, then eight, then eight. Okay. And we go all the way. And there are techniques what to do if your image width is not a multiple of eight and so on. So, don't worry about that for the moment. Those are just technical details. So we take an N by N block, and we are going to encode each one of those N by N, eight by eight blocks. And as I say that are encoded almost independently. Now, this is what you do with one image, but this is if you only have a black and white image. What happens if I have an RGB image? So jpeg is what's called color blind. Jpeg doesn't know how to deal with color. The standard itself, but there's some assumptions that are made. Originally what you could do is you just take the red. Remember every channel is a two-dimensional array of pixels. So the red looks like this. You divide the red in eight by eight blocks and you code the red. You do the same with the green, you do the same with the blue, and that's perfectly legitimate. Now, normally there's, basically a lot of correlation between the channels. So what basically jpeg does, instead of calling RGB, it goes in to what's called Y. Cb, CR. I'm going to tell you in a second how to do that. But these are, instead of three channels RGB, you have three channels which are Y, CB, and CR. This is a luminance channel, which is basically what you will see if you have a black and white TV or a black and white monitor. You will get a color image, but you will only see, basically, the black and white component, the luminous component, of it. And these are the colors. Okay. And this is a very simple transform. This is actually done by a three by three, matrix. So you basically are going to have your y. Cb, CR, as a column. You have a three by three matrix here, three by three, and you have your RGB values. So the y is a linear combination of the rgb, the cbr is a linear combination. The CB a linear combination, and the CR another, and this matrix is invertible, so once you decode a YCBCR, you multiply by the inverse of this matrix and you get back the RGB. So the very first thing that jpeg does, it takes your color image, mulitplies it by a matrix, so basically every pixel. Let's say 100, 1650, 200. You multiply by the coefficients here. This is a constant matrix, that is given is very well known. It appears all over, if you just, Google YCBCR, you're going to get the values of this matrix. So it goes over every single pixel of the image and transforms it from red, green, blue arrays into YCbCr arrays. Once again, 2-dimensional arrays where every pixel, now instead being an RGB is a YCbCr. So it has those, and then it's going to encode each one of these arrays independently. So let's look at Y. It will go into Y. And it will divide it in eight by eight blocks. Okay, and that's all what's going to do. And then it's going to take each one of these eight by eight blocks, and it's going to encode them. As I say, almost independently, but for the sake of this presentation, we're going to consider them independently. So it's going to encode a lot of eight by eight small images. And how it's going to do that, It's going to do that with a discrete cosine transform, a transform. Then a quantization, and then what, a symbol encoding. As we have seen so many times with the diagram of jpeg. So now, we have an eight by eight block. And all that we need to think about now is that we have a small eight by eight image.