comparison libvo/mga_common.c @ 2625:a8145a712f25

mmx opt ,untested, i have no mga
author michael
date Fri, 02 Nov 2001 03:17:33 +0000
parents 248972c26eee
children 48bfd1d278d1
comparison
equal deleted inserted replaced
2624:64844fccf623 2625:a8145a712f25
1 1
2 #include "fastmemcpy.h" 2 #include "fastmemcpy.h"
3 #include "../mmx_defs.h"
3 4
4 // mga_vid drawing functions 5 // mga_vid drawing functions
5 6
6 static int mga_next_frame=0; 7 static int mga_next_frame=0;
7 8
55 dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x; 56 dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x;
56 src = image[1]; 57 src = image[1];
57 src2 = image[2]; 58 src2 = image[2];
58 for(h=0; h < height; h++) 59 for(h=0; h < height; h++)
59 { 60 {
61 #ifdef HAVE_MMX
62 asm(
63 "xorl %%eax, %%eax \n\t"
64 "1: \n\t"
65 PREFETCH" 64(%1, %%eax) \n\t"
66 PREFETCH" 64(%2, %%eax) \n\t"
67 "movq (%1, %%eax), %%mm0 \n\t"
68 "movq 8(%1, %%eax), %%mm2 \n\t"
69 "movq %%mm0, %%mm1 \n\t"
70 "movq %%mm2, %%mm3 \n\t"
71 "movq (%2, %%eax), %%mm4 \n\t"
72 "movq 8(%2, %%eax), %%mm5 \n\t"
73 "punpcklbw %%mm4, %%mm0 \n\t"
74 "punpckhbw %%mm4, %%mm1 \n\t"
75 "punpcklbw %%mm5, %%mm2 \n\t"
76 "punpckhbw %%mm5, %%mm3 \n\t"
77 MOVNTQ" %%mm0, (%0, %%eax, 2) \n\t"
78 MOVNTQ" %%mm1, 8(%0, %%eax, 2) \n\t"
79 MOVNTQ" %%mm2, 16(%0, %%eax, 2) \n\t"
80 MOVNTQ" %%mm3, 24(%0, %%eax, 2) \n\t"
81 "addl $16, %%eax \n\t"
82 "cmpl %3, %%eax \n\t"
83 " jb 1b \n\t"
84 ::"r"(dest), "r"(src), "r"(src2), "r" (width-15)
85 : "memory", "%eax"
86 );
87 for(w= (width&(~15)); w < width; w++)
88 {
89 dest[2*w+0] = src[w];
90 dest[2*w+1] = src2[w];
91 }
92 #else
60 for(w=0; w < width; w++) 93 for(w=0; w < width; w++)
61 { 94 {
62 dest[2*w+0] = src[w]; 95 dest[2*w+0] = src[w];
63 dest[2*w+1] = src2[w]; 96 dest[2*w+1] = src2[w];
64 } 97 }
98 #endif
65 dest += bespitch; 99 dest += bespitch;
66 src += stride[1]; 100 src += stride[1];
67 src2+= stride[2]; 101 src2+= stride[2];
68 } 102 }
103 #ifdef HAVE_MMX
104 asm(
105 EMMS" \n\t"
106 SFENCE" \n\t"
107 ::: "memory"
108 );
109 #endif
69 } 110 }
70 111
71 static void 112 static void
72 draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) 113 draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y)
73 { 114 {