Libav
|
00001 00024 #include "libavutil/x86_cpu.h" 00025 #include "libavcodec/dsputil.h" 00026 #include "dsputil_mmx.h" 00027 #include "vp6dsp_sse2.h" 00028 00029 #define DIAG4_SSE2(in1,in2,in3,in4) \ 00030 "movq "#in1"(%0), %%xmm0 \n\t" \ 00031 "movq "#in2"(%0), %%xmm1 \n\t" \ 00032 "punpcklbw %%xmm7, %%xmm0 \n\t" \ 00033 "punpcklbw %%xmm7, %%xmm1 \n\t" \ 00034 "pmullw %%xmm4, %%xmm0 \n\t" /* src[x-8 ] * biweight [0] */ \ 00035 "pmullw %%xmm5, %%xmm1 \n\t" /* src[x ] * biweight [1] */ \ 00036 "paddw %%xmm1, %%xmm0 \n\t" \ 00037 "movq "#in3"(%0), %%xmm1 \n\t" \ 00038 "movq "#in4"(%0), %%xmm2 \n\t" \ 00039 "punpcklbw %%xmm7, %%xmm1 \n\t" \ 00040 "punpcklbw %%xmm7, %%xmm2 \n\t" \ 00041 "pmullw %%xmm6, %%xmm1 \n\t" /* src[x+8 ] * biweight [2] */ \ 00042 "pmullw %%xmm3, %%xmm2 \n\t" /* src[x+16] * biweight [3] */ \ 00043 "paddw %%xmm2, %%xmm1 \n\t" \ 00044 "paddsw %%xmm1, %%xmm0 \n\t" \ 00045 "paddsw "MANGLE(ff_pw_64)", %%xmm0 \n\t" /* Add 64 */ \ 00046 "psraw $7, %%xmm0 \n\t" \ 00047 "packuswb %%xmm0, %%xmm0 \n\t" \ 00048 "movq %%xmm0, (%1) \n\t" \ 00049 00050 void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride, 00051 const int16_t *h_weights,const int16_t *v_weights) 00052 { 00053 uint8_t tmp[8*11], *t = tmp; 00054 src -= stride; 00055 00056 __asm__ volatile( 00057 "pxor %%xmm7, %%xmm7 \n\t" 00058 "movq %4, %%xmm3 \n\t" 00059 "pshuflw $0, %%xmm3, %%xmm4 \n\t" 00060 "punpcklqdq %%xmm4, %%xmm4 \n\t" 00061 "pshuflw $85, %%xmm3, %%xmm5 \n\t" 00062 "punpcklqdq %%xmm5, %%xmm5 \n\t" 00063 "pshuflw $170, %%xmm3, %%xmm6 \n\t" 00064 "punpcklqdq %%xmm6, %%xmm6 \n\t" 00065 "pshuflw $255, %%xmm3, %%xmm3 \n\t" 00066 "punpcklqdq %%xmm3, %%xmm3 \n\t" 00067 "1: \n\t" 00068 DIAG4_SSE2(-1,0,1,2) 00069 "add $8, %1 \n\t" 00070 "add %2, %0 \n\t" 00071 "decl %3 \n\t" 00072 "jnz 1b \n\t" 00073 : "+r"(src), "+r"(t) 00074 : "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights) 00075 : "memory"); 00076 00077 t = tmp + 8; 00078 00079 __asm__ volatile( 00080 "movq %4, %%xmm3 \n\t" 00081 "pshuflw $0, %%xmm3, %%xmm4 \n\t" 00082 "punpcklqdq %%xmm4, %%xmm4 \n\t" 00083 "pshuflw $85, %%xmm3, %%xmm5 \n\t" 00084 "punpcklqdq %%xmm5, %%xmm5 \n\t" 00085 "pshuflw $170, %%xmm3, %%xmm6 \n\t" 00086 "punpcklqdq %%xmm6, %%xmm6 \n\t" 00087 "pshuflw $255, %%xmm3, %%xmm3 \n\t" 00088 "punpcklqdq %%xmm3, %%xmm3 \n\t" 00089 "1: \n\t" 00090 DIAG4_SSE2(-8,0,8,16) 00091 "add $8, %0 \n\t" 00092 "add %2, %1 \n\t" 00093 "decl %3 \n\t" 00094 "jnz 1b \n\t" 00095 : "+r"(t), "+r"(dst) 00096 : "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights) 00097 : "memory"); 00098 }