comparison libvo/mga_common.c @ 5405:c7455d4079ae

using interleaveBytes() for G200 draw_slice
author arpi
date Sat, 30 Mar 2002 17:40:22 +0000
parents 7296c4262457
children 7a8e6b6418f5
comparison
equal deleted inserted replaced
5404:534580bc88a8 5405:c7455d4079ae
1 1
2 #include "fastmemcpy.h" 2 #include "fastmemcpy.h"
3 #include "../mmx_defs.h" 3 #include "../mmx_defs.h"
4 #include "../mp_image.h" 4 #include "../mp_image.h"
5 #include "../postproc/rgb2rgb.h"
5 6
6 // mga_vid drawing functions 7 // mga_vid drawing functions
7 8
8 static int mga_next_frame=0; 9 static int mga_next_frame=0;
9 10
83 mem2agpcpy_pic(dest, image[0], width, height, bespitch, stride[0]); 84 mem2agpcpy_pic(dest, image[0], width, height, bespitch, stride[0]);
84 85
85 width/=2;height/=2;x/=2;y/=2; 86 width/=2;height/=2;x/=2;y/=2;
86 87
87 dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x; 88 dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x;
88 src = image[1]; 89
89 src2 = image[2]; 90 interleaveBytes(image[1],image[2],dest,
90 91 mga_vid_config.src_width, height,
91 for(h=0; h < height; h++) 92 stride[1], stride[2], bespitch);
92 {
93 #ifdef HAVE_MMX
94 asm(
95 "xorl %%eax, %%eax \n\t"
96 "1: \n\t"
97 PREFETCH" 64(%1, %%eax) \n\t"
98 PREFETCH" 64(%2, %%eax) \n\t"
99 "movq (%1, %%eax), %%mm0 \n\t"
100 "movq 8(%1, %%eax), %%mm2 \n\t"
101 "movq %%mm0, %%mm1 \n\t"
102 "movq %%mm2, %%mm3 \n\t"
103 "movq (%2, %%eax), %%mm4 \n\t"
104 "movq 8(%2, %%eax), %%mm5 \n\t"
105 "punpcklbw %%mm4, %%mm0 \n\t"
106 "punpckhbw %%mm4, %%mm1 \n\t"
107 "punpcklbw %%mm5, %%mm2 \n\t"
108 "punpckhbw %%mm5, %%mm3 \n\t"
109 MOVNTQ" %%mm0, (%0, %%eax, 2) \n\t"
110 MOVNTQ" %%mm1, 8(%0, %%eax, 2) \n\t"
111 MOVNTQ" %%mm2, 16(%0, %%eax, 2) \n\t"
112 MOVNTQ" %%mm3, 24(%0, %%eax, 2) \n\t"
113 "addl $16, %%eax \n\t"
114 "cmpl %3, %%eax \n\t"
115 " jb 1b \n\t"
116 ::"r"(dest), "r"(src), "r"(src2), "r" (width-15)
117 : "memory", "%eax"
118 );
119 for(w= (width&(~15)); w < width; w++)
120 {
121 dest[2*w+0] = src[w];
122 dest[2*w+1] = src2[w];
123 }
124 #else
125 for(w=0; w < width; w++)
126 {
127 dest[2*w+0] = src[w];
128 dest[2*w+1] = src2[w];
129 }
130 #endif
131 dest += bespitch;
132 src += stride[1];
133 src2+= stride[2];
134 }
135 #ifdef HAVE_MMX
136 asm(
137 EMMS" \n\t"
138 SFENCE" \n\t"
139 ::: "memory"
140 );
141 #endif
142 } 93 }
143 94
144 static void 95 static void
145 draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) 96 draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y)
146 { 97 {