#include "fastmemcpy.h" #include "../mmx_defs.h" // mga_vid drawing functions static int mga_next_frame=0; static mga_vid_config_t mga_vid_config; static uint8_t *vid_data, *frames[4]; static int f; static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ int x,y; uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; switch(mga_vid_config.format){ case MGA_VID_FORMAT_YV12: case MGA_VID_FORMAT_IYUV: case MGA_VID_FORMAT_I420: vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch); break; case MGA_VID_FORMAT_YUY2: vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch); break; case MGA_VID_FORMAT_UYVY: vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch); break; } } //static void //write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num) static void draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y) { uint8_t *src; uint8_t *src2; uint8_t *dest; uint32_t bespitch,h,w; bespitch = (mga_vid_config.src_width + 31) & ~31; dest = vid_data + bespitch*y + x; src = image[0]; for(h=0; h < height; h++) { memcpy(dest, src, width); src += stride[0]; dest += bespitch; } width/=2;height/=2;x/=2;y/=2; dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x; src = image[1]; src2 = image[2]; for(h=0; h < height; h++) { #ifdef HAVE_MMX asm( "xorl %%eax, %%eax \n\t" "1: \n\t" PREFETCH" 64(%1, %%eax) \n\t" PREFETCH" 64(%2, %%eax) \n\t" "movq (%1, %%eax), %%mm0 \n\t" "movq 8(%1, %%eax), %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "movq (%2, %%eax), %%mm4 \n\t" "movq 8(%2, %%eax), %%mm5 \n\t" "punpcklbw %%mm4, %%mm0 \n\t" "punpckhbw %%mm4, %%mm1 \n\t" "punpcklbw %%mm5, %%mm2 \n\t" "punpckhbw %%mm5, %%mm3 \n\t" MOVNTQ" %%mm0, (%0, %%eax, 2) \n\t" MOVNTQ" %%mm1, 8(%0, %%eax, 2) \n\t" MOVNTQ" %%mm2, 16(%0, %%eax, 2) \n\t" MOVNTQ" %%mm3, 24(%0, %%eax, 2) \n\t" "addl $16, %%eax \n\t" "cmpl %3, %%eax \n\t" " jb 1b \n\t" ::"r"(dest), "r"(src), "r"(src2), "r" (width-15) : "memory", "%eax" ); for(w= (width&(~15)); w < width; w++) { dest[2*w+0] = src[w]; dest[2*w+1] = src2[w]; } #else for(w=0; w < width; w++) { dest[2*w+0] = src[w]; dest[2*w+1] = src2[w]; } #endif dest += bespitch; src += stride[1]; src2+= stride[2]; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif } static void draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) { uint8_t *src; uint8_t *dest; uint32_t bespitch,bespitch2; int i; bespitch = (mga_vid_config.src_width + 31) & ~31; bespitch2 = bespitch/2; dest = vid_data + bespitch * y + x; src = image[0]; for(i=0;i