00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmsgui/fb/mmsfbconv.h"
00034
00035 #ifdef __HAVE_PF_YUY2__
00036
00037 #include "mmstools/mmstools.h"
00038
00039 void mmsfb_fillrectangle_yuy2(MMSFBSurfacePlanes *dst_planes, int dst_height,
00040 int dx, int dy, int dw, int dh, MMSFBColor color) {
00041
00042 static bool firsttime = true;
00043 if (firsttime) {
00044 printf("DISKO: Using accelerated fill rectangle to YUY2.\n");
00045 firsttime = false;
00046 }
00047
00048
00049 unsigned int *dst = (unsigned int *)dst_planes->ptr;
00050 int dst_pitch = dst_planes->pitch;
00051
00052
00053
00054 if (dx & 0x01) {
00055 dx++;
00056 dw--;
00057 }
00058 dw/=2;
00059
00060
00061 int dst_pitch_pix = dst_pitch >> 2;
00062 dst+= dx + dy * dst_pitch_pix;
00063
00064 unsigned int *dst_end = dst + dst_pitch_pix * dh;
00065 #ifndef __HAVE_SSE__
00066 int dst_pitch_diff = dst_pitch_pix - dw;
00067 #endif
00068
00069
00070 unsigned int SRC_Y = MMSFB_CONV_RGB2Y(color.r, color.g, color.b);
00071 unsigned int SRC_U = MMSFB_CONV_RGB2U(color.r, color.g, color.b);
00072 unsigned int SRC_V = MMSFB_CONV_RGB2V(color.r, color.g, color.b);
00073 register unsigned int SRC;
00074 #if __BYTE_ORDER == __BIG_ENDIAN
00075
00076 SRC = (SRC_Y << 24)
00077 | (SRC_V << 16)
00078 | (SRC_Y << 8)
00079 | SRC_U;
00080 #else
00081
00082 SRC = (SRC_U << 24)
00083 | (SRC_Y << 16)
00084 | (SRC_V << 8)
00085 | SRC_Y;
00086 #endif
00087
00088
00089
00090 while (dst < dst_end) {
00091
00092 #ifdef __HAVE_SSE__
00093
00094
00095 short d0, d1, d2;
00096 __asm__ __volatile__ ( "\tcld\n\trep stosl" \
00097 : "=&D" (d0), "=&a" (d1), "=&c" (d2) \
00098 : "0" (dst), "1" (SRC), "2" (dw) \
00099 : "memory", "cc");
00100
00101
00102 dst+= dst_pitch_pix;
00103 #else
00104 unsigned int *line_end = dst + dw;
00105 while (dst < line_end) {
00106 *dst = SRC;
00107 dst++;
00108 }
00109
00110
00111 dst+= dst_pitch_diff;
00112 #endif
00113 }
00114 }
00115
00116 #endif