00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef MODULE_NAME_IS_i420_yuy2_mmx
00025
00026 #define MMX_CALL(MMX_INSTRUCTIONS) \
00027 do { \
00028 __asm__ __volatile__( \
00029 ".align 8 \n\t" \
00030 MMX_INSTRUCTIONS \
00031 : \
00032 : "r" (p_line1), "r" (p_line2), "r" (p_y1), "r" (p_y2), \
00033 "r" (p_u), "r" (p_v) ); \
00034 p_line1 += 16; p_line2 += 16; p_y1 += 8; p_y2 += 8; p_u += 4; p_v += 4; \
00035 } while(0); \
00036
00037 #define MMX_YUV420_YUYV " \n\
00038 movq (%2), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
00039 movd (%4), %%mm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
00040 movd (%5), %%mm2 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
00041 punpcklbw %%mm2, %%mm1 # v3 u3 v2 u2 v1 u1 v0 u0 \n\
00042 movq %%mm0, %%mm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\
00043 punpcklbw %%mm1, %%mm2 # v1 y3 u1 y2 v0 y1 u0 y0 \n\
00044 movq %%mm2, (%0) # Store low YUYV \n\
00045 punpckhbw %%mm1, %%mm0 # v3 y7 u3 y6 v2 y5 u2 y4 \n\
00046 movq %%mm0, 8(%0) # Store high YUYV \n\
00047 movq (%3), %%mm0 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00048 movq %%mm0, %%mm2 # Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00049 punpcklbw %%mm1, %%mm2 # v1 Y3 u1 Y2 v0 Y1 u0 Y0 \n\
00050 movq %%mm2, (%1) # Store low YUYV \n\
00051 punpckhbw %%mm1, %%mm0 # v3 Y7 u3 Y6 v2 Y5 u2 Y4 \n\
00052 movq %%mm0, 8(%1) # Store high YUYV \n\
00053 "
00054
00055 #define MMX_YUV420_YVYU " \n\
00056 movq (%2), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
00057 movd (%4), %%mm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
00058 movd (%5), %%mm1 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
00059 punpcklbw %%mm2, %%mm1 # u3 v3 u2 v2 u1 v1 u0 v0 \n\
00060 movq %%mm0, %%mm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\
00061 punpcklbw %%mm1, %%mm2 # u1 y3 v1 y2 u0 y1 v0 y0 \n\
00062 movq %%mm2, (%0) # Store low YUYV \n\
00063 punpckhbw %%mm1, %%mm0 # u3 y7 v3 y6 u2 y5 v2 y4 \n\
00064 movq %%mm0, 8(%0) # Store high YUYV \n\
00065 movq (%3), %%mm0 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00066 movq %%mm0, %%mm2 # Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00067 punpcklbw %%mm1, %%mm2 # u1 Y3 v1 Y2 u0 Y1 v0 Y0 \n\
00068 movq %%mm2, (%1) # Store low YUYV \n\
00069 punpckhbw %%mm1, %%mm0 # u3 Y7 v3 Y6 u2 Y5 v2 Y4 \n\
00070 movq %%mm0, 8(%1) # Store high YUYV \n\
00071 "
00072
00073 #define MMX_YUV420_UYVY " \n\
00074 movq (%2), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
00075 movq (%3), %%mm3 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00076 movd (%4), %%mm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
00077 movd (%5), %%mm1 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
00078 punpcklbw %%mm2, %%mm1 # u3 v3 u2 v2 u1 v1 u0 v0 \n\
00079 movq %%mm1, %%mm2 # u3 v3 u2 v2 u1 v1 u0 v0 \n\
00080 punpcklbw %%mm0, %%mm2 # y3 v1 y2 u1 y1 v0 y0 u0 \n\
00081 movq %%mm2, (%0) # Store low UYVY \n\
00082 movq %%mm1, %%mm2 # u3 v3 u2 v2 u1 v1 u0 v0 \n\
00083 punpckhbw %%mm0, %%mm2 # y3 v1 y2 u1 y1 v0 y0 u0 \n\
00084 movq %%mm2, 8(%0) # Store high UYVY \n\
00085 movq %%mm1, %%mm2 # u3 v3 u2 v2 u1 v1 u0 v0 \n\
00086 punpcklbw %%mm3, %%mm2 # Y3 v1 Y2 u1 Y1 v0 Y0 u0 \n\
00087 movq %%mm2, (%1) # Store low UYVY \n\
00088 punpckhbw %%mm3, %%mm1 # Y7 v3 Y6 u3 Y5 v2 Y4 u2 \n\
00089 movq %%mm1, 8(%1) # Store high UYVY \n\
00090 "
00091
00092
00093 #define MMX_YUV420_Y211 " \n\
00094 movq (%2), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
00095 movq (%3), %%mm1 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
00096 movd (%4), %%mm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
00097 movd (%5), %%mm3 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
00098 pand i_00ffw, %%mm0 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
00099 packuswb %%mm0, %%mm0 # pack Y y6 y4 y2 y0 y6 y4 y2 y0 \n\
00100 pand i_00ffw, %%mm2 # get U even 00 u6 00 u4 00 u2 00 u0 \n\
00101 packuswb %%mm2, %%mm2 # pack U 00 00 u2 u0 00 00 u2 u0 \n\
00102 pand i_00ffw, %%mm3 # get V even 00 v6 00 v4 00 v2 00 v0 \n\
00103 packuswb %%mm3, %%mm3 # pack V 00 00 v2 v0 00 00 v2 v0 \n\
00104 punpcklbw %%mm3, %%mm2 # 00 00 00 00 v2 u2 v0 u0 \n\
00105 psubsw i_80w, %%mm2 # U,V -= 128 \n\
00106 punpcklbw %%mm2, %%mm0 # v2 y6 u2 y4 v0 y2 u0 y0 \n\
00107 movq %%mm0, (%0) # Store YUYV \n\
00108 pand i_00ffw, %%mm1 # get Y even 00 Y6 00 Y4 00 Y2 00 Y0 \n\
00109 packuswb %%mm1, %%mm1 # pack Y Y6 Y4 Y2 Y0 Y6 Y4 Y2 Y0 \n\
00110 punpcklbw %%mm2, %%mm1 # v2 Y6 u2 Y4 v0 Y2 u0 Y0 \n\
00111 movq %%mm1, (%1) # Store YUYV \n\
00112 "
00113
00114 #else
00115
00116 #define C_YUV420_YVYU( ) \
00117 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00118 *(p_line1)++ = *(p_line2)++ = *(p_v)++; \
00119 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00120 *(p_line1)++ = *(p_line2)++ = *(p_u)++; \
00121
00122 #define C_YUV420_UYVY( ) \
00123 *(p_line1)++ = *(p_line2)++ = *(p_u)++; \
00124 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00125 *(p_line1)++ = *(p_line2)++ = *(p_v)++; \
00126 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00127
00128 #define C_YUV420_Y211( ) \
00129 *(p_line1)++ = *(p_y1); p_y1 += 2; \
00130 *(p_line2)++ = *(p_y2); p_y2 += 2; \
00131 *(p_line1)++ = *(p_line2)++ = *(p_u) - 0x80; p_u += 2; \
00132 *(p_line1)++ = *(p_y1); p_y1 += 2; \
00133 *(p_line2)++ = *(p_y2); p_y2 += 2; \
00134 *(p_line1)++ = *(p_line2)++ = *(p_v) - 0x80; p_v += 2; \
00135
00136 #endif
00137
00138
00139 #define C_YUV420_YUYV( ) \
00140 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00141 *(p_line1)++ = *(p_line2)++ = *(p_u)++; \
00142 *(p_line1)++ = *(p_y1)++; *(p_line2)++ = *(p_y2)++; \
00143 *(p_line1)++ = *(p_line2)++ = *(p_v)++; \
00144