URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
297 |
jeremybenn |
typedef struct _RunlengthPacket
|
2 |
|
|
{
|
3 |
|
|
unsigned short
|
4 |
|
|
red,
|
5 |
|
|
green,
|
6 |
|
|
blue,
|
7 |
|
|
length;
|
8 |
|
|
unsigned short
|
9 |
|
|
index;
|
10 |
|
|
} RunlengthPacket;
|
11 |
|
|
typedef struct _Image
|
12 |
|
|
{
|
13 |
|
|
int
|
14 |
|
|
status,
|
15 |
|
|
temporary;
|
16 |
|
|
char
|
17 |
|
|
filename[1664 ];
|
18 |
|
|
long int
|
19 |
|
|
filesize;
|
20 |
|
|
int
|
21 |
|
|
pipe;
|
22 |
|
|
char
|
23 |
|
|
magick[1664 ],
|
24 |
|
|
*comments,
|
25 |
|
|
*label,
|
26 |
|
|
*text;
|
27 |
|
|
unsigned int
|
28 |
|
|
matte;
|
29 |
|
|
unsigned int
|
30 |
|
|
columns,
|
31 |
|
|
rows,
|
32 |
|
|
depth;
|
33 |
|
|
unsigned int
|
34 |
|
|
scene,
|
35 |
|
|
number_scenes;
|
36 |
|
|
char
|
37 |
|
|
*montage,
|
38 |
|
|
*directory;
|
39 |
|
|
unsigned int
|
40 |
|
|
colors;
|
41 |
|
|
double
|
42 |
|
|
gamma;
|
43 |
|
|
float
|
44 |
|
|
x_resolution,
|
45 |
|
|
y_resolution;
|
46 |
|
|
unsigned int
|
47 |
|
|
mean_error_per_pixel;
|
48 |
|
|
double
|
49 |
|
|
normalized_mean_error,
|
50 |
|
|
normalized_maximum_error;
|
51 |
|
|
unsigned long
|
52 |
|
|
total_colors;
|
53 |
|
|
char
|
54 |
|
|
*signature;
|
55 |
|
|
unsigned int
|
56 |
|
|
packets,
|
57 |
|
|
runlength,
|
58 |
|
|
packet_size;
|
59 |
|
|
unsigned char
|
60 |
|
|
*packed_pixels;
|
61 |
|
|
long int
|
62 |
|
|
magick_time;
|
63 |
|
|
char
|
64 |
|
|
magick_filename[1664 ];
|
65 |
|
|
unsigned int
|
66 |
|
|
magick_columns,
|
67 |
|
|
magick_rows;
|
68 |
|
|
char
|
69 |
|
|
*geometry,
|
70 |
|
|
*page;
|
71 |
|
|
unsigned int
|
72 |
|
|
dispose,
|
73 |
|
|
delay,
|
74 |
|
|
iterations;
|
75 |
|
|
unsigned int
|
76 |
|
|
orphan;
|
77 |
|
|
struct _Image
|
78 |
|
|
*previous,
|
79 |
|
|
*list,
|
80 |
|
|
*next;
|
81 |
|
|
} Image;
|
82 |
|
|
Image *MinifyImage(Image *image)
|
83 |
|
|
{
|
84 |
|
|
Image
|
85 |
|
|
*minified_image;
|
86 |
|
|
register RunlengthPacket
|
87 |
|
|
*q,
|
88 |
|
|
*s,
|
89 |
|
|
*s0,
|
90 |
|
|
*s1,
|
91 |
|
|
*s2,
|
92 |
|
|
*s3;
|
93 |
|
|
register unsigned int
|
94 |
|
|
x;
|
95 |
|
|
unsigned int
|
96 |
|
|
blue,
|
97 |
|
|
green,
|
98 |
|
|
red;
|
99 |
|
|
unsigned long
|
100 |
|
|
total_matte,
|
101 |
|
|
total_blue,
|
102 |
|
|
total_green,
|
103 |
|
|
total_red;
|
104 |
|
|
unsigned short
|
105 |
|
|
index;
|
106 |
|
|
for (x=0; x < (image->columns-1); x+=2)
|
107 |
|
|
{
|
108 |
|
|
total_red=0;
|
109 |
|
|
total_green=0;
|
110 |
|
|
total_blue=0;
|
111 |
|
|
total_matte=0;
|
112 |
|
|
s=s0;
|
113 |
|
|
total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ;
|
114 |
|
|
s=s1;
|
115 |
|
|
total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ;
|
116 |
|
|
s=s2;
|
117 |
|
|
total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ;
|
118 |
|
|
s=s3;
|
119 |
|
|
total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ;
|
120 |
|
|
red=(unsigned short) ((total_red+63) >> 7);
|
121 |
|
|
green=(unsigned short) ((total_green+63) >> 7);
|
122 |
|
|
blue=(unsigned short) ((total_blue+63) >> 7);
|
123 |
|
|
index=(unsigned short) ((total_matte+63) >> 7);
|
124 |
|
|
if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
|
125 |
|
|
(index == q->index) && ((int) q->length < 65535L ))
|
126 |
|
|
q->length++;
|
127 |
|
|
}
|
128 |
|
|
return(minified_image);
|
129 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.