00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "libavutil/x86/asm.h"
00022 #include "libavutil/cpu.h"
00023 #include "libswresample/swresample_internal.h"
00024
00025 int swri_resample_int16_mmx2 (struct ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx);
00026 int swri_resample_int16_ssse3(struct ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx);
00027
00028 DECLARE_ALIGNED(16, const uint64_t, ff_resample_int16_rounder)[2] = { 0x0000000000004000ULL, 0x0000000000000000ULL};
00029
00030 #define COMMON_CORE_INT16_MMX2 \
00031 x86_reg len= -2*c->filter_length;\
00032 __asm__ volatile(\
00033 "movq "MANGLE(ff_resample_int16_rounder)", %%mm0 \n\t"\
00034 "1: \n\t"\
00035 "movq (%1, %0), %%mm1 \n\t"\
00036 "pmaddwd (%2, %0), %%mm1 \n\t"\
00037 "paddd %%mm1, %%mm0 \n\t"\
00038 "add $8, %0 \n\t"\
00039 " js 1b \n\t"\
00040 "pshufw $0x0E, %%mm0, %%mm1 \n\t"\
00041 "paddd %%mm1, %%mm0 \n\t"\
00042 "psrad $15, %%mm0 \n\t"\
00043 "packssdw %%mm0, %%mm0 \n\t"\
00044 "movd %%mm0, (%3) \n\t"\
00045 : "+r" (len)\
00046 : "r" (((uint8_t*)(src+sample_index))-len),\
00047 "r" (((uint8_t*)filter)-len),\
00048 "r" (dst+dst_index)\
00049 );
00050
00051 #define COMMON_CORE_INT16_SSSE3 \
00052 x86_reg len= -2*c->filter_length;\
00053 __asm__ volatile(\
00054 "movdqa "MANGLE(ff_resample_int16_rounder)", %%xmm0 \n\t"\
00055 "1: \n\t"\
00056 "movdqu (%1, %0), %%xmm1 \n\t"\
00057 "pmaddwd (%2, %0), %%xmm1 \n\t"\
00058 "paddd %%xmm1, %%xmm0 \n\t"\
00059 "add $16, %0 \n\t"\
00060 " js 1b \n\t"\
00061 "phaddd %%xmm0, %%xmm0 \n\t"\
00062 "phaddd %%xmm0, %%xmm0 \n\t"\
00063 "psrad $15, %%xmm0 \n\t"\
00064 "packssdw %%xmm0, %%xmm0 \n\t"\
00065 "movd %%xmm0, (%3) \n\t"\
00066 : "+r" (len)\
00067 : "r" (((uint8_t*)(src+sample_index))-len),\
00068 "r" (((uint8_t*)filter)-len),\
00069 "r" (dst+dst_index)\
00070 );