OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [gfx/] [mw/] [v2_0/] [src/] [drivers/] [SubRepl.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
 
2
// these 4 inlines are here to get the code clearer (it was unreadable due do the parenthesis)
3
static inline T8p sd(T8p d1, int s1, T8p d2, int s2)
4
// sd stands for shift data
5
{ return((d1<<s1)|(d2>>s2)); }
6
 
7
static inline T8p sdm(T8p d1, int s1, T8p d2, int s2, T8p m)
8
// sdm stands for shift data mask
9
{ return(((d1<<s1)|(d2>>s2))&m); }
10
 
11
static inline T8p sdml(T8p d, int s, T8p m)
12
// sdml stands for shift data left mask
13
{ return(m&(d<<s)); }
14
 
15
static inline T8p sdmr(T8p d, int s, T8p m)
16
// sdmr stands for shift data right mask
17
{ return(m&(d>>s)); }
18
 
19
// for all the functions bellow
20
// the shift state is after in the function name.
21
// w? stands for the number of full words-1 to copy.
22
// as all these functions are based on the same principles,
23
// the comments are located in the most complex of them: Blt_Shift_Positif
24
 
25
// s and d are the source and destination pointers.
26
// ss and ds are the skip source and skip destination values (ie: the number to add to source and
27
// destination pointer at the end of each line to go to the next line).
28
// S, M1 and M2 are the shift, start and end masks.
29
// w is the number of full words to write per line
30
// h is the number of line to work on.
31
 
32
static inline void Blt_Shift_Positif_w0(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
33
{
34
  M1= M2&~M1;
35
  do
36
  {
37
    *d= (*d&~M1) | sdml(*s, S, M1);
38
    d+= ds; s+= ss;
39
  } while (--h!=0);
40
  return;
41
}
42
 
43
static inline void Blt_Shift_Positif_w1(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
44
{
45
  int S2= 32-S;
46
  M1= ~M1;
47
  do
48
  {
49
    T8p d1= *s++;
50
    *d++= (*d&~M1)|sdml(d1, S, M1);
51
    *d= (*d&~M2)| sdm(*s, S, d1, S2, M2);
52
    d+= ds; s+= ss;
53
  } while (--h!=0);
54
  return;
55
}
56
 
57
static inline void Blt_Shift_Positif_w2(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
58
{
59
  int S2= 32- S;
60
  M1= ~M1;
61
  do
62
  {
63
    T8p d2, d1= *s++; *d++= (*d&~M1)|sdml(d1, S, M1);
64
    d2= *s++; *d++= sd(d2, S, d1, S2);
65
    *d= (*d&~M2)|sdm(*s, S, d2, S2, M2);
66
    d+= ds; s+= ss;
67
  } while (--h!=0);
68
  return;
69
}
70
 
71
static inline void Blt_Shift_Positif(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
72
{
73
  int S2= 32- S;
74
  M1= ~M1;
75
  // for each line to copy (there is at least one)
76
  do
77
  {
78
    int i;
79
    // get the first set of pixels from the source
80
    T8p d1= *s++;
81
    // combine the shifted source pixels with the destination pixels (use of mask1)
82
    *d++= (*d&~M1)|sdml(d1, S, M1);
83
    // for every other set of pixel
84
    i= w;
85
    // directly write the shifted set of pixels to the dest (see how 2 set of pixels are shifted and combined together like a sliding window)
86
    do { T8p d2= *s++; *d++= sd(d2, S, d1, S2); d1= d2; } while (--i!=0);
87
    // combine the final shifted source pixels with the destination pixels (use of mask2)
88
    *d= (*d&~M2)|sdm(*s, S, d1, S2, M2);
89
    // skip what is left of the curent lines in sources and dest.
90
    d+= ds; s+= ss;
91
  } while (--h!=0);
92
  return;
93
}
94
 
95
static inline void Blt_Shift_Null_w0(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
96
{
97
  M1|= ~M2;
98
  do
99
  {
100
    *d= (*d&M1) | (*s&~M1);
101
    d+= ds; s+= ss;
102
  } while (--h!=0);
103
}
104
 
105
static inline void Blt_Shift_Null_w1(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
106
{
107
  do
108
  {
109
    *d++= (*d&M1)|(*s++&~M1);
110
    *d= (*d&~M2)|(*s&M2);
111
    d+= ds; s+= ss;
112
  } while (--h!=0);
113
  return;
114
}
115
 
116
static inline void Blt_Shift_Null_w2(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
117
{
118
  do
119
  {
120
    *d++= (*d&M1)|(*s++&~M1);
121
    *d++= *s++;
122
    *d= (*d&~M2)|(*s&M2);
123
    d+= ds; s+= ss;
124
  } while (--h!=0);
125
  return;
126
}
127
 
128
static inline void Blt_Shift_Null_w3(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
129
{
130
  do
131
  {
132
    *d++= (*d&M1)|(*s++&~M1);
133
    *d++= *s++;
134
    *d++= *s++;
135
    *d= (*d&~M2)|(*s&M2);
136
    d+= ds; s+= ss;
137
  } while (--h!=0);
138
  return;
139
}
140
 
141
static inline void Blt_Shift_Null(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
142
{
143
  do
144
  {
145
    int i;
146
    *d++= (*d&M1)|(*s++&~M1);
147
    switch (w&7)
148
    {
149
      case 7: *d++= *s++; case 6: *d++= *s++; case 5: *d++= *s++; case 4: *d++= *s++;
150
      case 3: *d++= *s++; case 2: *d++= *s++; case 1: *d++= *s++; case 0: default:;
151
    }
152
    for (i= w>>3; i!=0; i--)
153
    {
154
      *d++= *s++; *d++= *s++; *d++= *s++; *d++= *s++;
155
      *d++= *s++; *d++= *s++; *d++= *s++; *d++= *s++;
156
    }
157
    *d= (*d&~M2)|(*s&M2);
158
    d+= ds; s+= ss;
159
  } while (--h!=0);
160
  return;
161
}
162
 
163
static inline void Blt_Shift_Negatif_w0(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
164
{
165
  int S2= 32+ S;
166
  S= -S;
167
  M1= M2&~M1;
168
  do
169
  {
170
    *d= (*d&~M1) | sdm(*(s+1), S2, *s, S, M1);
171
    d+= ds; s+= ss;
172
  } while (--h!=0);
173
  return;
174
}
175
 
176
static inline void Blt_Shift_Negatif_w1(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
177
{
178
  int S2= 32+ S;
179
  M1= ~M1;
180
  S= -S;
181
  do
182
  {
183
    T8p d1= *s++; T8p d2= *s;
184
    *d++= (*d&~M1)|sdm(d2, S2, d1, S, M1);
185
    *d= (*d&~M2)|sdm(*(s+1), S2, *s, S, M2);
186
    d+= ds; s+= ss;
187
  } while (--h!=0);
188
  return;
189
}
190
 
191
static inline void Blt_Shift_Negatif_w2(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
192
{
193
  int S2= 32+S;
194
  M1= ~M1;
195
  ss--;
196
  S= -S;
197
  do
198
  {
199
    T8p d1= *s++; T8p d2= *s++;
200
    *d++= (*d&~M1)|sdm(d2, S2, d1, S, M1);
201
    d1= *s++; *d++= sd(d1, S2, d2, S);
202
    *d= (*d&~M2)|sdm(*s, S2, d1, S, M2);
203
    d+= ds; s+= ss;
204
  } while (--h!=0);
205
  return;
206
}
207
 
208
static inline void Blt_Shift_Negatif(P8p s, P8p d, int ss, int ds, int S, T8p M1, T8p M2, int w, int h)
209
{
210
  int S2= 32+S;
211
  M1= ~M1;
212
  ss--;
213
  S= -S;
214
  do
215
  {
216
    int i;
217
    T8p d1= *s++; T8p d2= *s++;
218
    *d++= (*d&~M1)|sdm(d2, S2, d1, S, M1);
219
    i= w;
220
    do { d1= d2; d2= *s++; *d++= sd(d2, S2, d1, S); } while (--i!=0);
221
    *d= (*d&~M2)|sdm(*s, S2, d2, S, M2);
222
    d+= ds; s+= ss;
223
  } while (--h!=0);
224
  return;
225
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.