1
|
1 // Original by Strepto/Astral
|
|
2 // ported to gcc & bugfixed : A'rpi
|
|
3
|
|
4 #include <inttypes.h>
|
|
5 //#include "attributes.h"
|
|
6 #include "mmx.h"
|
|
7
|
|
8 void rgb15to16_mmx(char* s0,char* d0,int count){
|
|
9 static uint64_t mask_b = 0x001F001F001F001FLL; // 00000000 00011111 xxB
|
|
10 static uint64_t mask_rg = 0x7FE07FE07FE07FE0LL; // 01111111 11100000 RGx
|
|
11 register char* s=s0+count;
|
|
12 register char* d=d0+count;
|
|
13 register int offs=-count;
|
|
14 movq_m2r (mask_b, mm4);
|
|
15 movq_m2r (mask_rg, mm5);
|
|
16 while(offs<0){
|
|
17 movq_m2r (*(s+offs), mm0);
|
|
18 movq_r2r (mm0, mm1);
|
|
19
|
|
20 movq_m2r (*(s+8+offs), mm2);
|
|
21 movq_r2r (mm2, mm3);
|
|
22
|
|
23 pand_r2r (mm4, mm0);
|
|
24 pand_r2r (mm5, mm1);
|
|
25
|
|
26 psllq_i2r(1,mm1);
|
|
27 pand_r2r (mm4, mm2);
|
|
28
|
|
29 pand_r2r (mm5, mm3);
|
|
30 por_r2r (mm1, mm0);
|
|
31
|
|
32 psllq_i2r(1,mm3);
|
|
33 movq_r2m (mm0,*(d+offs));
|
|
34
|
|
35 por_r2r (mm3,mm2);
|
|
36 movq_r2m (mm2,*(d+8+offs));
|
|
37
|
|
38 offs+=16;
|
|
39 }
|
|
40 emms();
|
|
41 }
|
|
42
|