1 /***************************************
4 * ( $Revision$ $Date$ )
7 * http://optimum.citeweb.net/index.html
9 ****************************************/
12 # * conversions functions between graphic modes
14 # * (trifouilli extrait de l'optilib en version pre-beta)
23 .global SOpti_cvrt_RGB_888_RGB_565
24 .global SOpti_cvrt_BGR_888_RGB_565
28 .global SOpti_cvrt_ABGR_8888_RGB_565
29 .global SOpti_cvrt_bRGBA_8888_RGB_565
30 .global SOpti_cvrt_mRGBA_8888_RGB_565
31 .global SOpti_cvrt_lABGR_8888_RGB_565
33 .global SOpti_cvrt_ARGB_8888_RGB_565
34 .global SOpti_cvrt_bBGRA_8888_RGB_565
35 .global SOpti_cvrt_mBGRA_8888_RGB_565
36 .global SOpti_cvrt_lARGB_8888_RGB_565
38 .global SOpti_cvrt_RGB_565_ARGB_8888
39 .global SOpti_cvrt_RGB_565_bBGRA_8888
40 .global SOpti_cvrt_RGB_565_mBGRA_8888
41 .global SOpti_cvrt_RGB_565_lARGB_8888
43 .global SOpti_cvrt_PAL_8_RGB_565
44 .global SOpti_cvrt_PAL_8_RGBA_8888
46 .type SOpti_cvrt_RGB_888_RGB_565,@function
47 .type SOpti_cvrt_BGR_888_RGB_565,@function
49 .type SOpti_cvrt_ABGR_8888_RGB_565,@function
50 .type SOpti_cvrt_bRGBA_8888_RGB_565,@function
51 .type SOpti_cvrt_mRGBA_8888_RGB_565,@function
52 .type SOpti_cvrt_lABGR_8888_RGB_565,@function
54 .type SOpti_cvrt_ARGB_8888_RGB_565,@function
55 .type SOpti_cvrt_bBGRA_8888_RGB_565,@function
56 .type SOpti_cvrt_mBGRA_8888_RGB_565,@function
57 .type SOpti_cvrt_lARGB_8888_RGB_565,@function
59 .type SOpti_cvrt_RGB_565_ARGB_8888,@function
60 .type SOpti_cvrt_RGB_565_bBGRA_8888,@function
61 .type SOpti_cvrt_RGB_565_mBGRA_8888,@function
62 .type SOpti_cvrt_RGB_565_lARGB_8888,@function
64 .type SOpti_cvrt_PAL_8_RGB_565,@function
65 .type SOpti_cvrt_PAL_8_RGBA_888,@function
67 SOpti_cvrt_RGB_888_RGB_565:
76 movl 8(%ebp),%esi // load src and dst ptr,
78 movl 16(%ebp),%ecx // and number of pixels
81 subl $2,%edi // will be re-added in the loop (for pairability)
83 .align 16, 0x90 // align loop start for efficiency; fill with nops(90)
114 SOpti_cvrt_BGR_888_RGB_565:
123 movl 8(%ebp),%esi // load src and dst ptr,
125 movl 16(%ebp),%ecx // and number of pixels
128 subl $2,%edi // will be re-added in the loop (for pairability)
130 .align 16, 0x90 // align loop start for efficiency; fill with nops(90)
162 SOpti_cvrt_ABGR_8888_RGB_565:
163 SOpti_cvrt_bRGBA_8888_RGB_565:
164 SOpti_cvrt_mRGBA_8888_RGB_565:
165 SOpti_cvrt_lABGR_8888_RGB_565:
171 movl 8(%ebp),%esi //#
\0load src and dst ptr,
173 movl 16(%ebp),%ecx //# and number of pixels
176 subl $2,%edi // will be re-added in the loop (for pairability)
178 .align 16, 0x90 // align loop start for efficiency;fill with nops(90)
184 andl $0x00ffff00,%eax// keep only BG
186 shll $8,%eax // ABGR => BGR0 ( BG00 in fact)
187 andb $0xf8,%dl // zeroe 3 low bits of R
189 bswapl %eax // Rearange BGR0 into 0RGB (00GB)
192 shrb $2,%ah // shift G (8bits ->6bits)
193 addl $2,%edi // next dest. pixel
195 shrl $3,%eax // shift B (8bits -> 5bits) and put GB on position
197 orb %dl,%ah // mix R with GB
211 SOpti_cvrt_ARGB_8888_RGB_565:
212 SOpti_cvrt_bBGRA_8888_RGB_565:
213 SOpti_cvrt_mBGRA_8888_RGB_565:
214 SOpti_cvrt_lARGB_8888_RGB_565:
221 movl 8(%ebp),%esi // load src and dst ptr,
223 movl 16(%ebp),%ecx // and number of pixels
226 subl $2,%edi // will be re-added in the loop (for pairability)
228 .align 16, 0x90 // align loop start for efficiency; fill with nops(90)
234 andl $0x0000ffff,%eax// keep only GB
236 shrl $16,%edx // R into dl
238 shrb $2,%ah // shift G (8bits ->6bits)
239 addl $2,%edi // next dest. pixel
241 shrl $3,%eax // shift B (8bits -> 5bits) and put GB on position
242 andb $0xf8,%dl // zeroe 3 low bits of R
244 orb %dl,%ah // mix R with GB
263 SOpti_cvrt_RGB_565_ARGB_8888:
264 SOpti_cvrt_RGB_565_bBGRA_8888:
265 SOpti_cvrt_RGB_565_mBGRA_8888:
266 SOpti_cvrt_RGB_565_lARGB_8888:
273 movl 8(%ebp),%esi // load src and dst ptr,
275 movl 16(%ebp),%ecx // and number of pixels
279 movw (%esi,%ecx,2),%ax
282 shll $3,%eax // shift B and ~G
283 andl $0xf800,%ebx // isolate R
285 shll $8,%ebx // set R in position
286 andl $0xffff,%eax // clear upper word for future R
288 shlb $2,%ah // shift G
290 orl %eax,%ebx // mix 0R GB
292 movl %ebx,(%edi,%ecx,4)
308 SOpti_cvrt_PAL_8_RGB_565:
315 movl 8(%ebp),%esi # load src and dst ptr,
317 movl 16(%ebp),%ecx # number of pixels
318 movl 20(%ebp),%ebx # palette
320 addl %ecx,%esi # partir de la fin pour partir du debut (hem)
324 shrl $2,%ecx # 4 pixels par tour
328 movl (%esi,%ecx,4),%edx
334 movw (%ebx,%eax,2),%si
338 andl $0xffff0000,%edx
340 movw (%ebx,%eax,2),%si
344 movl %esi,(%edi,%ecx,8) ###
349 movw (%ebx,%eax,2),%ax
355 movw (%ebx,%edx,2),%ax
358 movl %eax,4(%edi,%ecx,8)
372 SOpti_cvrt_PAL_8_RGBA_8888:
379 movl 8(%ebp),%esi # load src and dst ptr,
381 movl 16(%ebp),%ecx # number of pixels
382 movl 20(%ebp),%ebx # palette
384 addl %ecx,%esi # partir de la fin pour partir du debut (hem)
396 movl (%ebx,%edx,4),%eax
399 movl %eax,(%edi,%ecx,4)