1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
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);
}
}
*/
|