annotate postproc/rgb2rgb.c @ 2567:ea6158be8103

video frame reading cleanup
author arpi
date Tue, 30 Oct 2001 20:36:20 +0000
parents 3d04a0991dce
children 794dec2fae64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
1 /*
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
2 *
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
3 * rgb2rgb.c, Software RGB to RGB convertor
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
4 * Written by Nick Kurshev.
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
5 */
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
6 #include <inttypes.h>
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
7 #include "../config.h"
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
8 #include "rgb2rgb.h"
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
9 #include "../mmx_defs.h"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
10
2535
b44113f46c96 cant compile on non x86 bugfix
michael
parents: 2517
diff changeset
11 #ifdef HAVE_MMX
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
12 static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL;
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
13 static const uint64_t mask24l __attribute__((aligned(8))) = 0x0000000000FFFFFFULL;
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
14 static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL;
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
15 static const uint64_t mask15b __attribute__((aligned(8))) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
16 static const uint64_t mask15rg __attribute__((aligned(8))) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */
2535
b44113f46c96 cant compile on non x86 bugfix
michael
parents: 2517
diff changeset
17 #endif
2513
nick
parents: 2512
diff changeset
18
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
19 void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
20 {
2508
94f9825a3736 Prev ver could work only on x86
nick
parents: 2506
diff changeset
21 uint8_t *dest = dst;
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
22 uint8_t *s = src;
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
23 uint8_t *end;
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
24 #ifdef HAVE_MMX
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
25 uint8_t *mm_end;
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
26 #endif
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
27 end = s + src_size;
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
28 #ifdef HAVE_MMX
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
29 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
2516
9ef4fa15b780 More elegant solution
nick
parents: 2514
diff changeset
30 mm_end = (uint8_t*)((((unsigned long)end)/(MMREG_SIZE*2))*(MMREG_SIZE*2));
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
31 __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory");
2516
9ef4fa15b780 More elegant solution
nick
parents: 2514
diff changeset
32 if(mm_end == end) mm_end -= MMREG_SIZE*2;
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
33 while(s < mm_end)
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
34 {
2511
6db23dd30242 mmx, mmx2, 3dnow optimized 24to32
nick
parents: 2510
diff changeset
35 __asm __volatile(
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
36 PREFETCH" 32%1\n\t"
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
37 "movd %1, %%mm0\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
38 "movd 3%1, %%mm1\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
39 "movd 6%1, %%mm2\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
40 "movd 9%1, %%mm3\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
41 "punpckldq %%mm1, %%mm0\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
42 "punpckldq %%mm3, %%mm2\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
43 "pand %%mm7, %%mm0\n\t"
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
44 "pand %%mm7, %%mm2\n\t"
2511
6db23dd30242 mmx, mmx2, 3dnow optimized 24to32
nick
parents: 2510
diff changeset
45 MOVNTQ" %%mm0, %0\n\t"
6db23dd30242 mmx, mmx2, 3dnow optimized 24to32
nick
parents: 2510
diff changeset
46 MOVNTQ" %%mm2, 8%0"
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
47 :"=m"(*dest)
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
48 :"m"(*s)
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
49 :"memory");
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
50 dest += 16;
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
51 s += 12;
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
52 }
2513
nick
parents: 2512
diff changeset
53 __asm __volatile(SFENCE:::"memory");
2511
6db23dd30242 mmx, mmx2, 3dnow optimized 24to32
nick
parents: 2510
diff changeset
54 __asm __volatile(EMMS:::"memory");
2510
42e1ae2c8f5f mmx optimized 24to32
nick
parents: 2508
diff changeset
55 #endif
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
56 while(s < end)
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
57 {
2508
94f9825a3736 Prev ver could work only on x86
nick
parents: 2506
diff changeset
58 *dest++ = *s++;
94f9825a3736 Prev ver could work only on x86
nick
parents: 2506
diff changeset
59 *dest++ = *s++;
94f9825a3736 Prev ver could work only on x86
nick
parents: 2506
diff changeset
60 *dest++ = *s++;
94f9825a3736 Prev ver could work only on x86
nick
parents: 2506
diff changeset
61 *dest++ = 0;
2504
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
62 }
13e1c5ab417a vo_vesa: rgb2rgb support
nick
parents:
diff changeset
63 }
2505
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
64
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
65 void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size)
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
66 {
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
67 uint8_t *dest = dst;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
68 uint8_t *s = src;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
69 uint8_t *end;
2517
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
70 #ifdef HAVE_MMX
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
71 uint8_t *mm_end;
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
72 #endif
2505
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
73 end = s + src_size;
2517
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
74 #ifdef HAVE_MMX
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
75 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
2517
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
76 mm_end = (uint8_t*)((((unsigned long)end)/(MMREG_SIZE*2))*(MMREG_SIZE*2));
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
77 __asm __volatile(
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
78 "movq %0, %%mm7\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
79 "movq %1, %%mm6"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
80 ::"m"(mask24l),"m"(mask24h):"memory");
2517
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
81 if(mm_end == end) mm_end -= MMREG_SIZE*2;
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
82 while(s < mm_end)
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
83 {
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
84 __asm __volatile(
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
85 PREFETCH" 32%1\n\t"
2517
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
86 "movq %1, %%mm0\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
87 "movq 8%1, %%mm1\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
88 "movq %%mm0, %%mm2\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
89 "movq %%mm1, %%mm3\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
90 "psrlq $8, %%mm2\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
91 "psrlq $8, %%mm3\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
92 "pand %%mm7, %%mm0\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
93 "pand %%mm7, %%mm1\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
94 "pand %%mm6, %%mm2\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
95 "pand %%mm6, %%mm3\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
96 "por %%mm2, %%mm0\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
97 "por %%mm3, %%mm1\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
98 MOVNTQ" %%mm0, %0\n\t"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
99 MOVNTQ" %%mm1, 6%0"
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
100 :"=m"(*dest)
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
101 :"m"(*s)
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
102 :"memory");
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
103 dest += 12;
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
104 s += 16;
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
105 }
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
106 __asm __volatile(SFENCE:::"memory");
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
107 __asm __volatile(EMMS:::"memory");
3d507ef1e3ed 32to24: MMX, MMX2, 3DNOW optimization
nick
parents: 2516
diff changeset
108 #endif
2505
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
109 while(s < end)
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
110 {
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
111 *dest++ = *s++;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
112 *dest++ = *s++;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
113 *dest++ = *s++;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
114 s++;
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
115 }
2aaa11d22f91 vo_vesa: more rgb2rgb support
nick
parents: 2504
diff changeset
116 }
2506
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
117
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
118 /*
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
119 Original by Strepto/Astral
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
120 ported to gcc & bugfixed : A'rpi
2564
3d04a0991dce cosmetic
nick
parents: 2538
diff changeset
121 MMX2, 3DNOW optimization by Nick Kurshev
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
122 */
2506
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
123 void rgb15to16(uint8_t *src,uint8_t *dst,uint32_t src_size)
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
124 {
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
125 #ifdef HAVE_MMX
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
126 register char* s=src+src_size;
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
127 register char* d=dst+src_size;
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
128 register int offs=-src_size;
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
129 __asm __volatile(PREFETCH" %0"::"m"(*(s+offs)):"memory");
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
130 __asm __volatile(
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
131 "movq %0, %%mm4\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
132 "movq %1, %%mm5"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
133 ::"m"(mask15b), "m"(mask15rg):"memory");
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
134 while(offs<0)
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
135 {
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
136 __asm __volatile(
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
137 PREFETCH" 32%1\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
138 "movq %1, %%mm0\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
139 "movq 8%1, %%mm2\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
140 "movq %%mm0, %%mm1\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
141 "movq %%mm2, %%mm3\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
142 "pand %%mm4, %%mm0\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
143 "pand %%mm5, %%mm1\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
144 "pand %%mm4, %%mm2\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
145 "pand %%mm5, %%mm3\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
146 "psllq $1, %%mm1\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
147 "psllq $1, %%mm3\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
148 "por %%mm1, %%mm0\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
149 "por %%mm3, %%mm2\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
150 MOVNTQ" %%mm0, %0\n\t"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
151 MOVNTQ" %%mm2, 8%0"
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
152 :"=m"(*(d+offs))
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
153 :"m"(*(s+offs))
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
154 :"memory");
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
155 offs+=16;
2506
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
156 }
2538
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
157 __asm __volatile(SFENCE:::"memory");
71320898b333 Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents: 2535
diff changeset
158 __asm __volatile(EMMS:::"memory");
2506
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
159 #else
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
160 uint16_t *s1=( uint16_t * )src;
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
161 uint16_t *d1=( uint16_t * )dst;
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
162 uint16_t *e=((uint8_t *)s1)+src_size;
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
163 while( s1<e ){
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
164 register int x=*( s1++ );
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
165 /* rrrrrggggggbbbbb
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
166 0rrrrrgggggbbbbb
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
167 0111 1111 1110 0000=0x7FE0
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
168 00000000000001 1111=0x001F */
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
169 *( d1++ )=( x&0x001F )|( ( x&0x7FE0 )<<1 );
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
170 }
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
171 #endif
501752469c39 vo_vesa: more rgb2rgb support
nick
parents: 2505
diff changeset
172 }