void BMPto8x8AndYCbCr(int Start_x, int Start_y, int ImageSize_x, int ImageSize_y, int offset, unsigned char *Image, int *blok8x8) { unsigned char i,color; int x,y,Start_point; Start_point = offset + (ImageSize_x*(ImageSize_y-1)+Start_x-(Start_y*ImageSize_x)); for(i=0;i<64;i++) { if((Start_y+(i/8)) < ImageSize_y) { if((Start_x+(i%8)) < ImageSize_x) blok8x8[i] = Image[Start_point+(i%8)-(i/8)*(ImageSize_x)]; } else i = 64; } } void YCbCrAnd8x8toBMP(int Start_x, int Start_y, int ImageSize_x, int ImageSize_y, int offset,unsigned char *Image, unsigned char *blok8x8) { unsigned char i; int x,y,Start_point; Start_point = offset + (ImageSize_x*(ImageSize_y-1)+Start_x-(Start_y*ImageSize_x)); for(i=0;i<64;i++) { if((Start_y+(i/8)) < ImageSize_y) { if((Start_x+(i%8)) < ImageSize_x) Image[Start_point+(i%8)-(i/8)*(ImageSize_x)] = blok8x8[i]; } else i = 64; } } /***************************** The code without the RGB - > YUV ****************************** void BMPto8x8(int Start_x, int Start_y, int ImageSize_x, int ImageSize_y, int offset, unsigned char depth ,unsigned char *Image, unsigned char *blok8x8) { unsigned char i; int x,y,Start_point; depth = depth/8; Start_point = offset + (ImageSize_x*(ImageSize_y-1)+Start_x-(Start_y*ImageSize_x)); for(i=0;i<(64);i+=depth) { if((i%8)==0) printf("\n"); if((Start_y+(i/(8))) < ImageSize_y) { if((Start_x+((i%(8))/depth)) < ImageSize_x) { if(depth == 3) { blok8x8[i+2] = Image[Start_point+(i%(8)) -(i/(8))*(ImageSize_x)]; //R blok8x8[i+1] = Image[Start_point+(i%(8))+1-(i/(8))*(ImageSize_x)]; //G blok8x8[i+0] = Image[Start_point+(i%(8))+2-(i/(8))*(ImageSize_x)]; //B printf("%02x%02x%02x|",blok8x8[i+0],blok8x8[i+1],blok8x8[i+2]); } if(depth == 1) { blok8x8[i+0] = Image[Start_point+(i%(8))-(i/(8))*(ImageSize_x)]; printf("%02x ",blok8x8[i]); } } } else i = (64); } } void B8x8toBMP(int Start_x, int Start_y, int ImageSize_x, int ImageSize_y, int offset, unsigned char depth ,unsigned char *Image, unsigned char *blok8x8) { unsigned char i; int x,y,Start_point; depth = depth/8; Start_point = offset + (ImageSize_x*(ImageSize_y-1)+Start_x-(Start_y*ImageSize_x)); for(i=0;i<(64);i+=depth) { if((i%8)==0) printf("\n"); if((Start_y+(i/(8))) < ImageSize_y) { if((Start_x+((i%(8))/depth)) < ImageSize_x) { if(depth == 3) { Image[Start_point+(i%(8)) -(i/(8))*(ImageSize_x)] = blok8x8[i+2]; //R Image[Start_point+(i%(8))+1-(i/(8))*(ImageSize_x)] = blok8x8[i+1]; //G Image[Start_point+(i%(8))+2-(i/(8))*(ImageSize_x)] = blok8x8[i+0]; //B printf("%02x%02x%02x|",blok8x8[i+0],blok8x8[i+1],blok8x8[i+2]); } if(depth == 1) { Image[Start_point+(i%(8))-(i/(8))*(ImageSize_x)] = blok8x8[i+0]; printf("%02x ",blok8x8[i]); } } } else i = (64); } } */