[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[116] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-21 14:58:45
|
Revision: 116 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=116&view=rev Author: nickols_k Date: 2010-01-21 14:58:37 +0000 (Thu, 21 Jan 2010) Log Message: ----------- minor accelerate audio-filters + bugfixes Modified Paths: -------------- TOOLS/Makefile TOOLS/asmopt.c TOOLS/asmopt_template.h TOOLS/asmoptf.c TOOLS/asmoptf_template.h mplayerxp/configure mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_export.c mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/dsp.c mplayerxp/postproc/dsp.h mplayerxp/postproc/dsp_accel.h mplayerxp/pvector/pvector.h mplayerxp/pvector/pvector_f32_x86.h mplayerxp/pvector/pvector_inc.h Modified: TOOLS/Makefile =================================================================== --- TOOLS/Makefile 2010-01-20 18:48:33 UTC (rev 115) +++ TOOLS/Makefile 2010-01-21 14:58:37 UTC (rev 116) @@ -16,7 +16,7 @@ ../mplayerxp/osdep/libosdep.a ../mplayerxp/mp_msg.o ../mplayerxp/nls/libnls.a ../mplayerxp/cpudetect.o COMMON_LIBS = $(MP_LIBS) $(EXTRALIBS) -lm -CFLAGS = $(OPTFLAGS) -I ../mplayerxp -I../mplayerxp/libmpdemux -I../mplayerxp/libvo $(EXTRA_INC) +CFLAGS = $(OPTFLAGS) -I./ -I../mplayerxp -I../mplayerxp/libmpdemux -I../mplayerxp/libvo $(EXTRA_INC) all: $(OBJS) Modified: TOOLS/asmopt.c =================================================================== --- TOOLS/asmopt.c 2010-01-20 18:48:33 UTC (rev 115) +++ TOOLS/asmopt.c 2010-01-21 14:58:37 UTC (rev 116) @@ -20,49 +20,10 @@ #include "../mplayerxp/mp_config.h" #include "../mplayerxp/cpudetect.h" -#undef OPTIMIZE_AVX -#undef OPTIMIZE_SSE4 -#undef OPTIMIZE_SSSE3 -#undef OPTIMIZE_SSE3 -#undef OPTIMIZE_SSE2 -#undef OPTIMIZE_SSE -#undef OPTIMIZE_MMX2 -#undef OPTIMIZE_MMX -#define RENAME(a) a ## _C -#include "asmopt_template.h" +#define PVECTOR_TESTING +#define PVECTOR_ACCEL_H "asmopt_template.h" +#include "../mplayerxp/pvector/pvector_inc.h" - -#ifdef __MMX__ -#define OPTIMIZE_MMX -#undef RENAME -#define RENAME(a) a ## _MMX -#include "asmopt_template.h" -#endif -#ifdef __SSE__ -#define OPTIMIZE_MMX2 -#undef RENAME -#define RENAME(a) a ## _MMX2 -#include "asmopt_template.h" -#endif -#ifdef __SSE2__ -#define OPTIMIZE_SSE2 -#undef RENAME -#define RENAME(a) a ## _SSE2 -#include "asmopt_template.h" -#endif -#ifdef __SSE3__ -#define OPTIMIZE_SSE3 -#undef RENAME -#define RENAME(a) a ## _SSE3 -#include "asmopt_template.h" -#endif -#ifdef __SSE4_1__ -#define OPTIMIZE_SSE4 -#undef RENAME -#define RENAME(a) a ## _SSE4 -#include "asmopt_template.h" -#endif - #define ARR_SIZE (1024*64*2)*10 unsigned verbose=1; extern CpuCaps gCpuCaps; @@ -136,7 +97,7 @@ gCpuCaps.has3DNow, gCpuCaps.has3DNowExt, gCpuCaps.hasSSE, gCpuCaps.hasSSE2); - test_simd("asmopt.gen" ,"GENERIC:",convert_C); + test_simd("asmopt.gen" ,"GENERIC:",convert_c); // ordered per speed fasterst first #ifdef __SSE3__ if(gCpuCaps.hasSSE3) test_simd("asmopt.sse3","SSE3 :",convert_SSE3); @@ -144,8 +105,8 @@ #ifdef __SSE2__ if(gCpuCaps.hasSSE2) test_simd("asmopt.sse2","SSE2 :",convert_SSE2); #endif -#ifdef __MMX2__ - if(gCpuCaps.hasMMX2) test_simd("asmopt.mmx2","MMX2 :",convert_MMX2); +#ifdef __SSE__ + if(gCpuCaps.hasMMX2) test_simd("asmopt.mmx2","MMX2 :",convert_SSE); #endif #ifdef __MMX__ if(gCpuCaps.hasMMX) test_simd("asmopt.mmx", "MMX :",convert_MMX); Modified: TOOLS/asmopt_template.h =================================================================== --- TOOLS/asmopt_template.h 2010-01-20 18:48:33 UTC (rev 115) +++ TOOLS/asmopt_template.h 2010-01-21 14:58:37 UTC (rev 116) @@ -10,35 +10,39 @@ MMX2 : cpu clocks=5874563 = 2659us...[OK] MMX : cpu clocks=6092012 = 2757us...[OK] */ -void RENAME(convert)(unsigned char *dstbase,unsigned char *src,unsigned char *srca,unsigned int asize) +void PVECTOR_RENAME(convert)(unsigned char *dstbase,unsigned char *src,unsigned char *srca,unsigned int asize) { #ifdef HAVE_INT_PVECTOR - __ivec vzero = _ivec_setzero(); + __ivec izero = _ivec_setzero(); #endif - unsigned x,w; - x = 0; - w = asize; + uint8_t *out_data = dstbase; + uint8_t *in_data = src; + + unsigned i,len; + i = 0; + len = asize; #ifdef HAVE_INT_PVECTOR - if(w>=__IVEC_SIZE) - for(;x<w;x+=__IVEC_SIZE){ - __ivec vmsk,vdest,vsrc,vsrca,vt[4]; - vdest = _ivec_loadu(&dstbase[x]); - vsrc = _ivec_loada(&src[x]); - vsrca = _ivec_loada(&srca[x]); - vmsk = _ivec_not(_ivec_cmpeq_s8(vsrca,vzero)); - vt[0] = _ivec_u16_from_lou8(vdest); - vt[1] = _ivec_u16_from_hiu8(vdest); - vt[2] = _ivec_u16_from_lou8(vsrca); - vt[3] = _ivec_u16_from_hiu8(vsrca); - vt[0] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[0],vt[2]),8); - vt[1] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[1],vt[3]),8); - vt[0] = _ivec_add_s8(_ivec_u8_from_u16(vt[0],vt[1]),vsrc); - _ivec_storeu(&dstbase[x],_ivec_blend_u8(vdest,vt[0],vmsk)); - } + for(;i<len;i++) { + ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8; + if((((long)out_data)&(__IVEC_SIZE-1))==0) break; + } + if((len-i)>=__IVEC_SIZE) + for(;i<len;i+=__IVEC_SIZE){ + __ivec ind,itmp[2]; + ind = _ivec_loadu(&((uint8_t *)in_data)[i]); +#if 0 /* slower but portable on non-x86 CPUs version */ + itmp[0]= _ivec_sll_s16_imm(_ivec_u16_from_lou8(ind),8); + itmp[1]= _ivec_sll_s16_imm(_ivec_u16_from_hiu8(ind),8); +#else + itmp[0]= _ivec_interleave_lo_u8(izero,ind); + itmp[1]= _ivec_interleave_hi_u8(izero,ind); #endif - for(;x<(unsigned)w;x++){ - if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; - } + _ivec_storea(&((uint16_t*)out_data)[i],itmp[0]); + _ivec_storea(&((uint16_t*)out_data)[i+__IVEC_SIZE/2],itmp[1]); + } +#endif + for(;i<len;i++) + ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8; #ifdef HAVE_INT_PVECTOR _ivec_empty(); _ivec_sfence(); Modified: TOOLS/asmoptf.c =================================================================== --- TOOLS/asmoptf.c 2010-01-20 18:48:33 UTC (rev 115) +++ TOOLS/asmoptf.c 2010-01-21 14:58:37 UTC (rev 116) @@ -14,6 +14,8 @@ #include <inttypes.h> #include <unistd.h> #include <fcntl.h> +#define __USE_ISOC99 +#include <math.h> #include <sys/mman.h> #include <sys/time.h> #include <limits.h> @@ -21,54 +23,10 @@ #include "../mplayerxp/mp_config.h" #include "../mplayerxp/cpudetect.h" -#undef F32_OPTIMIZE_AVX -#undef F32_OPTIMIZE_SSE4 -#undef F32_OPTIMIZE_SSSE3 -#undef F32_OPTIMIZE_SSE3 -#undef F32_OPTIMIZE_SSE2 -#undef F32_OPTIMIZE_SSE -#undef F32_OPTIMIZE_3DNOW -#define RENAME(a) a ## _C -#include "asmoptf_template.h" +#define PVECTOR_TESTING +#define PVECTOR_ACCEL_H "asmoptf_template.h" +#include "../mplayerxp/pvector/pvector_inc.h" - -#ifdef __3dNOW__ -#define F32_OPTIMIZE_3DNOW -#undef RENAME -#define RENAME(a) a ## _3DNOW -#include "asmoptf_template.h" -#endif -#ifdef __SSE__ -#define F32_OPTIMIZE_SSE -#undef RENAME -#define RENAME(a) a ## _SSE -#include "asmoptf_template.h" -#endif -#ifdef __SSE2__ -#define F32_OPTIMIZE_SSE2 -#undef RENAME -#define RENAME(a) a ## _SSE2 -#include "asmoptf_template.h" -#endif -#ifdef __SSE3__ -#define F32_OPTIMIZE_SSE3 -#undef RENAME -#define RENAME(a) a ## _SSE3 -#include "asmoptf_template.h" -#endif -#ifdef __SSE4_1__ -#define F32_OPTIMIZE_SSE4 -#undef RENAME -#define RENAME(a) a ## _SSE4 -#include "asmoptf_template.h" -#endif -#ifdef __AVX__ -#define F32_OPTIMIZE_AVX -#undef RENAME -#define RENAME(a) a ## _AVX -#include "asmoptf_template.h" -#endif - #define ARR_SIZE (1024*64*2)*10 unsigned verbose=1; extern CpuCaps gCpuCaps; @@ -76,8 +34,8 @@ /* Fixme: put here any complexness of source array filling */ #define INIT_ARRAYS(x) \ {\ - for(i=0; i<x; i++) srca[i] = i; \ - for(i=0; i<x; i++) src[i] = i+64; \ + for(i=0; i<x; i++) srca[i] = i*0.0001; \ + for(i=0; i<x; i++) src[i] = (i+64)*0.0001; \ memset(dsta,0,sizeof(ARR_SIZE*sizeof(float))); \ } @@ -143,7 +101,7 @@ gCpuCaps.has3DNow, gCpuCaps.has3DNowExt, gCpuCaps.hasSSE, gCpuCaps.hasSSE2); - test_simd("asmoptf.gen" ,"GENERIC:",convert_C); + test_simd("asmoptf.gen" ,"GENERIC:",convert_c); // ordered per speed fasterst first #ifdef __AVX__ if(gCpuCaps.hasAVX) test_simd("asmoptf.avx","AVX :",convert_AVX); Modified: TOOLS/asmoptf_template.h =================================================================== --- TOOLS/asmoptf_template.h 2010-01-20 18:48:33 UTC (rev 115) +++ TOOLS/asmoptf_template.h 2010-01-21 14:58:37 UTC (rev 116) @@ -10,34 +10,86 @@ MMX2 : cpu clocks=5874563 = 2659us...[OK] MMX : cpu clocks=6092012 = 2757us...[OK] */ -void RENAME(convert)(uint8_t *dstbase,const uint8_t *src,const uint8_t *srca,unsigned int asize) +#ifndef SATURATE +#define SATURATE(x,_min,_max) {if((x)<(_min)) (x)=(_min); else if((x)>(_max)) (x)=(_max);} +#endif + +static void __FASTCALL__ PVECTOR_RENAME(float2int32)(float* in, int32_t* out, unsigned len, int final) { + register unsigned i; + float ftmp; +#ifdef HAVE_F32_PVECTOR + __f32vec int_max; +#endif + i=0; +#ifdef HAVE_F32_PVECTOR + int_max = _f32vec_broadcast(INT_MAX-1); + for(;i<len;i++) { + ftmp=((float*)in)[i]; + SATURATE(ftmp,-1.0,+1.0); + ((int32_t*)out)[i]=(int32_t)lrintf((INT_MAX-1)*ftmp); + if((((long)out)&(__F32VEC_SIZE-1))==0) break; + } + _ivec_empty(); + if((len-i)>=__F32VEC_SIZE) + for(;i<len;i+=__F32VEC_SIZE/sizeof(float)) { + __f32vec tmp; + tmp = _f32vec_mul(int_max,_f32vec_loadu(&((float*)in)[i])); + if(final) + _f32vec_to_s32_stream(&((int32_t*)out)[i],tmp); + else + _f32vec_to_s32a(&((int32_t*)out)[i],tmp); + } + _ivec_sfence(); + _ivec_empty(); +#endif + for(;i<len;i++) { + ftmp=((float*)in)[i]; + SATURATE(ftmp,-1.0,+1.0); + ((int32_t*)out)[i]=(int32_t)lrintf((INT_MAX-1)*ftmp); + } +} + +void PVECTOR_RENAME(convert)(uint8_t *dstbase,const uint8_t *src,const uint8_t *srca,unsigned int asize) +{ unsigned i,len; const uint8_t *in; - uint8_t *out; + float ftmp; + int32_t __attribute__((aligned(__IVEC_SIZE))) i32_tmp[asize]; #ifdef HAVE_F32_PVECTOR - __f32vec rev_imax = _f32vec_broadcast(1.0/INT_MAX); + __f32vec int_max = _f32vec_broadcast(SHRT_MAX); #endif - in = src; + uint8_t *out; + in = srca; out = dstbase; i=0; len=asize; #ifdef HAVE_F32_PVECTOR for(;i<len;i++) { - ((float*)out)[i]=(1.0/INT_MAX)*((float)((int32_t*)in)[i]); + ftmp=((float*)in)[i]; + SATURATE(ftmp,-1.0,+1.0); + ((int16_t*)out)[i]=(int16_t)lrintf(SHRT_MAX*ftmp); if((((long)out)&(__F32VEC_SIZE-1))==0) break; } - _f32vec_empty(); - if((len-i)>=__F32VEC_SIZE) - for(;i<len;i+=__F32VEC_SIZE/sizeof(float)) { - __f32vec tmp; - tmp = _f32vec_mul(rev_imax,_f32vec_from_s32u(&((int32_t*)in)[i])); - _f32vec_storea(&((float*)out)[i],tmp); + _ivec_empty(); + if((len-i)>=__F32VEC_SIZE) { + PVECTOR_RENAME(float2int32)(in,i32_tmp,len-i,0); + for(;i<len;i+=__IVEC_SIZE*2/sizeof(int32_t)) { + __ivec tmp[2]; + tmp[0] = _ivec_loada(&((int32_t*)i32_tmp)[i])); + tmp[1] = _ivec_loada(&((int32_t*)i32_tmp)[i+__F32VEC_SIZE])); + _f32vec_to_s32a(itmp[0],ftmp[0]); + _f32vec_to_s32a(itmp[1],ftmp[1]); + tmp=_ivec_s16_from_s32(_ivec_loada(itmp[1]),_ivec_loada(itmp[0])); + _ivec_storea(&((int16_t*)out)[i],tmp); } - _f32vec_sfence(); - _f32vec_empty(); + } + _ivec_sfence(); + _ivec_empty(); #endif for(;i<len;i++) { - ((float*)out)[i]=(1.0/INT_MAX)*((float)((int32_t*)in)[i]); + ftmp=((float*)in)[i]; + SATURATE(ftmp,-1.0,+1.0); + ((int16_t*)out)[i]=(int16_t)lrintf(SHRT_MAX*ftmp); } } Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/configure 2010-01-21 14:58:37 UTC (rev 116) @@ -360,7 +360,7 @@ _arch=$host_arch x86_32 && _arch="x86_32" x86_64 && _arch="x86_64" -ffmpeg_args="--arch=$arch $ffmpeg_args" +ffmpeg_args="--arch=$_arch $ffmpeg_args" fi test "$debug" != "0" && ffmpeg_args="$ffmpeg_args --enable-debug=$debug" enabled $profile && ffmpeg_args="$ffmpeg_args --enable-profile" Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/dec_ahead.c 2010-01-21 14:58:37 UTC (rev 116) @@ -209,9 +209,7 @@ } if(in_size<0) { - LOCK_VDECA(); - shva[dec_ahead_locked_frame].eof=1; - UNLOCK_VDECA(); + __MP_SYNCHRONIZE(vdeca_mutex,shva[dec_ahead_locked_frame].eof=1); xp_eof=1; if(has_xp_audio && enable_xp<XP_VAFull) { while(!xp_audio_eof && !dec_ahead_in_lseek && !pthread_end_of_work) { @@ -562,9 +560,7 @@ if(pthread_id && pthread_is_living && has_xp_video) { pthread_end_of_work=1; - LOCK_VIDEO_DECODE(); - pthread_cond_signal(&video_decode_cond); - UNLOCK_VIDEO_DECODE(); + __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); while(pthread_is_living && !force) usleep(0); pthread_is_living=0; pthread_attr_destroy(&our_attr); @@ -577,9 +573,7 @@ a_pthread_end_of_work=1; xp_audio_eof=1; if(a_pthread_is_living) { - LOCK_AUDIO_DECODE(); - pthread_cond_signal(&audio_decode_cond); - UNLOCK_AUDIO_DECODE(); + __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); } while(a_pthread_is_living && !force) usleep(0); a_pthread_is_living=0; @@ -711,9 +705,7 @@ if (is_reset_vcache) UNLOCK_VDECODING(); /* Release lock from vo_x11 */ if(pthread_is_living) { - LOCK_VIDEO_DECODE(); - pthread_cond_signal(&video_decode_cond); - UNLOCK_VIDEO_DECODE(); + __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); while(dec_ahead_in_lseek==PreSeek) usleep(1); } @@ -737,9 +729,7 @@ xp_thread_decode_audio(); if(pthread_is_living) { - LOCK_VIDEO_DECODE(); - pthread_cond_signal(&video_decode_cond); - UNLOCK_VIDEO_DECODE(); + __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); while(dec_ahead_in_lseek==Seek) usleep(1); while(abs_dec_ahead_locked_frame == abs_dec_ahead_active_frame && !xp_eof) @@ -748,17 +738,11 @@ dec_ahead_in_lseek = NoSeek; - if(a_pthread_is_living) { - LOCK_AUDIO_DECODE(); - pthread_cond_signal(&audio_decode_cond); - UNLOCK_AUDIO_DECODE(); - } + if(a_pthread_is_living) + __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); - if(pthread_audio_is_living) { - LOCK_AUDIO_PLAY(); - pthread_cond_signal(&audio_play_cond); - UNLOCK_AUDIO_PLAY(); - } + if(pthread_audio_is_living) + __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } /* Audio stuff */ Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/dec_ahead.h 2010-01-21 14:58:37 UTC (rev 116) @@ -45,22 +45,30 @@ #endif #define LOCK_VDEC_ACTIVE() { MSG_D(DA_PREFIX"LOCK_VDEC_ACTIVE\n"); pthread_mutex_lock(&vdec_active_mutex); } #define UNLOCK_VDEC_ACTIVE() { MSG_D(DA_PREFIX"UNLOCK_VDEC_ACTIVE\n"); pthread_mutex_unlock(&vdec_active_mutex); } + #define LOCK_VDEC_LOCKED() { MSG_D(DA_PREFIX"LOCK_VDEC_LOCKED\n"); pthread_mutex_lock(&vdec_locked_mutex); } #define UNLOCK_VDEC_LOCKED() { MSG_D(DA_PREFIX"UNLOCK_VDEC_LOCKED\n"); pthread_mutex_unlock(&vdec_locked_mutex); } + #define LOCK_VDECODING() { MSG_D(DA_PREFIX"LOCK_VDECODING\n"); pthread_mutex_lock(&vdecoding_mutex); } #define UNLOCK_VDECODING() { MSG_D(DA_PREFIX"UNLOCK_VDECODING\n"); pthread_mutex_unlock(&vdecoding_mutex); } + #define LOCK_VREADING() { MSG_D(DA_PREFIX"LOCK_VREADING\n"); pthread_mutex_lock(&vreading_mutex); } #define UNLOCK_VREADING() { MSG_D(DA_PREFIX"UNLOCK_VREADING\n"); pthread_mutex_unlock(&vreading_mutex); } + #define LOCK_VDECA() { MSG_D(DA_PREFIX"LOCK_VDECA\n"); pthread_mutex_lock(&vdeca_mutex); } #define UNLOCK_VDECA() { MSG_D(DA_PREFIX"UNLOCK_VDECA\n"); pthread_mutex_unlock(&vdeca_mutex); } + #define LOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"LOCK_AUDIO_PLAY\n"); pthread_mutex_lock(&audio_play_mutex); } #define UNLOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_PLAY\n"); pthread_mutex_unlock(&audio_play_mutex); } + #define LOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"LOCK_AUDIO_DECODE\n"); pthread_mutex_lock(&audio_decode_mutex); } #define UNLOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_DECODE\n"); pthread_mutex_unlock(&audio_decode_mutex); } + #define LOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"LOCK_VIDEO_DECODE\n"); pthread_mutex_lock(&video_decode_mutex); } #define UNLOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_VIDEO_DECODE\n"); pthread_mutex_unlock(&video_decode_mutex); } -#define __MP_ATOMIC(OP) { pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } +#define __MP_ATOMIC(OP) { static pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } +#define __MP_SYNCHRONIZE(mtx,OP) { pthread_mutex_lock(&mtx); OP; pthread_mutex_unlock(&mtx); } typedef struct sh_video_attr { Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/libmpcodecs/ad_mp3.c 2010-01-21 14:58:37 UTC (rev 116) @@ -331,7 +331,7 @@ ,fi.flags&MPG123_ORIGINAL?"Yes":"No" ,fi.flags&MPG123_CRC?"Yes":"No" ,fi.flags&MPG123_PRIVATE?"Yes":"No" - ,fi.emphasis,mpg123_current_decoder(sh->context)); + ,fi.emphasis,mpg123_current_decoder(priv->mh)); } return 1; } @@ -354,10 +354,10 @@ int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen,float *pts) { mp3_priv_t *priv=sh->context; - unsigned char *indata=NULL,*outdata; + unsigned char *indata=NULL,*outdata=NULL; int err=MPG123_OK,indata_size=0; off_t offset,cpos; - size_t done=0,total=0; + size_t done=0; minlen=1; /* decode one frame per call to be compatible with old logic: *************************** @@ -377,7 +377,6 @@ cpos = mpg123_tell(priv->mh); *pts = priv->pts+((float)(cpos-priv->pos)/sh->i_bps); err=mpg123_decode_frame(priv->mh,&offset,&outdata,&done); - total+=done; if(!((err==MPG123_OK)||(err==MPG123_NEED_MORE))) { MSG_ERR("mpg123_read = %s done = %u minlen = %u\n",mpg123_plain_strerror(err),done,minlen); } Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/libmpdemux/demuxer_r.c 2010-01-21 14:58:37 UTC (rev 116) @@ -9,6 +9,7 @@ #include "demuxer_r.h" #include "../osdep/timer.h" #include "../mplayer.h" +#include "../dec_ahead.h" pthread_mutex_t demuxer_mutex=PTHREAD_MUTEX_INITIALIZER; @@ -170,26 +171,20 @@ int demuxer_switch_audio_r(demuxer_t *d, int id) { int retval; - LOCK_DEMUXER(); - retval=demuxer_switch_audio(d,id); - UNLOCK_DEMUXER(); + __MP_SYNCHRONIZE(demuxer_mutex,retval=demuxer_switch_audio(d,id)); return retval; } int demuxer_switch_video_r(demuxer_t *d, int id) { int retval; - LOCK_DEMUXER(); - retval=demuxer_switch_video(d,id); - UNLOCK_DEMUXER(); + __MP_SYNCHRONIZE(demuxer_mutex,retval=demuxer_switch_video(d,id)); return retval; } int demuxer_switch_subtitle_r(demuxer_t *d, int id) { int retval; - LOCK_DEMUXER(); - retval=demuxer_switch_subtitle(d,id); - UNLOCK_DEMUXER(); + __MP_SYNCHRONIZE(demuxer_mutex,retval=demuxer_switch_subtitle(d,id)); return retval; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/mplayer.c 2010-01-21 14:58:37 UTC (rev 116) @@ -768,9 +768,7 @@ volatile int dec_ahead_active_frame; for(;;) { - LOCK_VDEC_ACTIVE(); - vo_get_active_frame(&dec_ahead_active_frame); - UNLOCK_VDEC_ACTIVE(); + __MP_SYNCHRONIZE(vdec_active_mutex,vo_get_active_frame(&dec_ahead_active_frame)); LOCK_VDECA(); if(shva[dec_ahead_active_frame].eof) break; usleep(0); @@ -1524,9 +1522,7 @@ int delay_corrected=1; int final_frame=0; int num_frames_decoded = 0; - LOCK_VDEC_ACTIVE(); - vo_get_active_frame(&dec_ahead_active_frame); - UNLOCK_VDEC_ACTIVE(); + __MP_SYNCHRONIZE(vdec_active_mutex,vo_get_active_frame(&dec_ahead_active_frame)); LOCK_VDECA(); final_frame = shva[dec_ahead_active_frame].eof; sh_video->num_frames = shva[dec_ahead_active_frame].num_frames; @@ -1722,9 +1718,7 @@ bench_dropped_frames ++; } } - LOCK_VDEC_ACTIVE(); - abs_dec_ahead_active_frame++; - UNLOCK_VDEC_ACTIVE(); + __MP_SYNCHRONIZE(vdec_active_mutex,abs_dec_ahead_active_frame++); pinfo[xp_id].current_module=NULL; /*================ A-V TIMESTAMP CORRECTION: =========================*/ @@ -1763,12 +1757,8 @@ if(x> max_pts_correction) x= max_pts_correction; if(default_max_pts_correction>=0) max_pts_correction=default_max_pts_correction; - else - { - LOCK_VDECA(); - max_pts_correction=shva[dec_ahead_active_frame].duration*0.10; // +-10% of time - UNLOCK_VDECA(); - } + else // +-10% of time + __MP_SYNCHRONIZE(vdeca_mutex,max_pts_correction=shva[dec_ahead_active_frame].duration*0.10); if(enable_xp>=XP_VAPlay) pthread_mutex_lock(&audio_timer_mutex); sh_audio->timer+=x; @@ -2869,9 +2859,7 @@ volatile unsigned ada_blitted_frame; do { usleep(0); - LOCK_VDEC_LOCKED(); - ada_blitted_frame = abs_dec_ahead_blitted_frame; - UNLOCK_VDEC_LOCKED(); + __MP_SYNCHRONIZE(vdec_locked_mutex,ada_blitted_frame = abs_dec_ahead_blitted_frame); }while(ada_blitted_frame < xp_num_frames/2 && !xp_eof); } if(run_xp_players()!=0) exit_player("Can't run xp players!\n"); @@ -3018,9 +3006,7 @@ ao_resume(); // resume audio if( enable_xp >= XP_VAPlay ) { dec_ahead_in_pause=0; - LOCK_AUDIO_PLAY(); - pthread_cond_signal(&audio_play_cond); - UNLOCK_AUDIO_PLAY(); + __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } } if (vo_inited && sh_video) Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af.c 2010-01-21 14:58:37 UTC (rev 116) @@ -523,7 +523,7 @@ // Iterate through all filters do{ MSG_DBG2("filtering %s\n",af->info->name); - data=af->play(af,data); + data=af->play(af,data,af->next?0:1); af=af->next; }while(af && data); return data; Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af.h 2010-01-21 14:58:37 UTC (rev 116) @@ -50,7 +50,7 @@ const af_info_t* info; int (* __FASTCALL__ control)(struct af_instance_s* af, int cmd, void* arg); void (* __FASTCALL__ uninit)(struct af_instance_s* af); - af_data_t* (* __FASTCALL__ play)(struct af_instance_s* af, af_data_t* data); + af_data_t* (* __FASTCALL__ play)(struct af_instance_s* af, af_data_t* data,int final); void* setup; // setup data for this specific instance and filter af_data_t* data; // configuration for outgoing data stream struct af_instance_s* next; Modified: mplayerxp/postproc/af_ao2.c =================================================================== --- mplayerxp/postproc/af_ao2.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_ao2.c 2010-01-21 14:58:37 UTC (rev 116) @@ -148,7 +148,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { // Do something necessary to get rid of annoying warning during compile if(!af) Modified: mplayerxp/postproc/af_center.c =================================================================== --- mplayerxp/postproc/af_center.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_center.c 2010-01-21 14:58:37 UTC (rev 116) @@ -70,7 +70,7 @@ } // Filter data through filter -static af_data_t* play(struct af_instance_s* af, af_data_t* data) +static af_data_t* play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_center_t* s = af->setup; // Setup for this instance Modified: mplayerxp/postproc/af_channels.c =================================================================== --- mplayerxp/postproc/af_channels.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_channels.c 2010-01-21 14:58:37 UTC (rev 116) @@ -244,7 +244,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_data_t* l = af->data; // Local data Modified: mplayerxp/postproc/af_comp.c =================================================================== --- mplayerxp/postproc/af_comp.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_comp.c 2010-01-21 14:58:37 UTC (rev 116) @@ -106,7 +106,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_comp_t* s = (af_comp_t*)af->setup; // Setup for this instance Modified: mplayerxp/postproc/af_crystality.c =================================================================== --- mplayerxp/postproc/af_crystality.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_crystality.c 2010-01-21 14:58:37 UTC (rev 116) @@ -516,7 +516,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; /* Current working data */ echo3d(af->setup,(float*)c->audio, c->len); Modified: mplayerxp/postproc/af_delay.c =================================================================== --- mplayerxp/postproc/af_delay.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_delay.c 2010-01-21 14:58:37 UTC (rev 116) @@ -107,7 +107,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_delay_t* s = af->setup; // Setup for this instance Modified: mplayerxp/postproc/af_dummy.c =================================================================== --- mplayerxp/postproc/af_dummy.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_dummy.c 2010-01-21 14:58:37 UTC (rev 116) @@ -27,7 +27,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { // Do something necessary to get rid of annoying warning during compile if(!af) Modified: mplayerxp/postproc/af_dyn.c =================================================================== --- mplayerxp/postproc/af_dyn.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_dyn.c 2010-01-21 14:58:37 UTC (rev 116) @@ -60,7 +60,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { register unsigned i = 0; float *in = (float*)data->audio; // Audio data Modified: mplayerxp/postproc/af_echo3d.c =================================================================== --- mplayerxp/postproc/af_echo3d.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_echo3d.c 2010-01-21 14:58:37 UTC (rev 116) @@ -192,7 +192,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; /* Current working data */ Modified: mplayerxp/postproc/af_equalizer.c =================================================================== --- mplayerxp/postproc/af_equalizer.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_equalizer.c 2010-01-21 14:58:37 UTC (rev 116) @@ -168,7 +168,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_equalizer_t* s = (af_equalizer_t*)af->setup; // Setup Modified: mplayerxp/postproc/af_export.c =================================================================== --- mplayerxp/postproc/af_export.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_export.c 2010-01-21 14:58:37 UTC (rev 116) @@ -194,7 +194,7 @@ af audio filter instance data audio data */ -static af_data_t* __FASTCALL__ play( struct af_instance_s* af, af_data_t* data ) +static af_data_t* __FASTCALL__ play( struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_export_t* s = af->setup; // Setup for this instance @@ -225,10 +225,10 @@ // Export buffer to mmaped area if(flag){ // update buffer in mapped area - memcpy(s->mmap_area + SIZE_HEADER, s->buf[0], sz * c->bps * nch); + stream_copy(s->mmap_area + SIZE_HEADER, s->buf[0], sz * c->bps * nch); s->count++; // increment counter (to sync) - memcpy(s->mmap_area + SIZE_HEADER - sizeof(s->count), - &(s->count), sizeof(s->count)); + stream_copy(s->mmap_area + SIZE_HEADER - sizeof(s->count), + &(s->count), sizeof(s->count)); } // We don't modify data, just export it Modified: mplayerxp/postproc/af_extrastereo.c =================================================================== --- mplayerxp/postproc/af_extrastereo.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_extrastereo.c 2010-01-21 14:58:37 UTC (rev 116) @@ -75,7 +75,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_extrastereo_t *s = af->setup; register int i = 0; Modified: mplayerxp/postproc/af_ffenc.c =================================================================== --- mplayerxp/postproc/af_ffenc.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_ffenc.c 2010-01-21 14:58:37 UTC (rev 116) @@ -154,7 +154,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { unsigned tlen,ilen,olen,delta; af_ffenc_t *s=af->setup; Modified: mplayerxp/postproc/af_format.c =================================================================== --- mplayerxp/postproc/af_format.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_format.c 2010-01-21 14:58:37 UTC (rev 116) @@ -38,11 +38,11 @@ }af_format_t; // Switch endianess -static void endian(void* in, void* out, int len, int bps); +static void endian(void* in, void* out, int len, int bps,int final); // From singed to unsigned -static void si2us(void* in, void* out, int len, int bps); +static void si2us(void* in, void* out, int len, int bps,int final); // From unsinged to signed -static void us2si(void* in, void* out, int len, int bps); +static void us2si(void* in, void* out, int len, int bps,int final); static const struct fmt_alias_s { @@ -378,7 +378,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* l = af->data; // Local data af_data_t* c = data; // Current working data @@ -389,7 +389,7 @@ // Change to cpu native endian format if((c->format&AF_FORMAT_END_MASK)!=AF_FORMAT_NE) - endian(c->audio,c->audio,len,c->bps); + endian(c->audio,c->audio,len,c->bps,final); // Conversion table switch(c->format & ~AF_FORMAT_END_MASK){ @@ -398,14 +398,14 @@ if(AF_FORMAT_A_LAW == (l->format&AF_FORMAT_SPECIAL_MASK)) to_ulaw(l->audio, l->audio, len, 1, AF_FORMAT_SI); if((l->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) - si2us(l->audio,l->audio,len,l->bps); + si2us(l->audio,l->audio,len,l->bps,final); break; case(AF_FORMAT_A_LAW): from_alaw(c->audio, l->audio, len, l->bps, l->format&AF_FORMAT_POINT_MASK); if(AF_FORMAT_A_LAW == (l->format&AF_FORMAT_SPECIAL_MASK)) to_alaw(l->audio, l->audio, len, 1, AF_FORMAT_SI); if((l->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) - si2us(l->audio,l->audio,len,l->bps); + si2us(l->audio,l->audio,len,l->bps,final); break; case(AF_FORMAT_F): switch(l->format&AF_FORMAT_SPECIAL_MASK){ @@ -416,9 +416,12 @@ to_alaw(c->audio, l->audio, len, c->bps, c->format&AF_FORMAT_POINT_MASK); break; default: - float2int(c->audio, l->audio, len, l->bps); - if((l->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) - si2us(l->audio,l->audio,len,l->bps); + if((l->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) { + float2int(c->audio, l->audio, len, l->bps,0); + si2us(l->audio,l->audio,len,l->bps,final); + } + else + float2int(c->audio, l->audio, len, l->bps,final); break; } break; @@ -428,9 +431,9 @@ // Change signed/unsigned if((c->format&AF_FORMAT_SIGN_MASK) != (l->format&AF_FORMAT_SIGN_MASK)){ if((c->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) - us2si(c->audio,c->audio,len,c->bps); + us2si(c->audio,c->audio,len,c->bps,final); else - si2us(c->audio,c->audio,len,c->bps); + si2us(c->audio,c->audio,len,c->bps,final); } // Convert to special formats switch(l->format&(AF_FORMAT_SPECIAL_MASK|AF_FORMAT_POINT_MASK)){ @@ -441,12 +444,12 @@ to_alaw(c->audio, l->audio, len, c->bps, c->format&AF_FORMAT_POINT_MASK); break; case(AF_FORMAT_F): - int2float(c->audio, l->audio, len, c->bps); + int2float(c->audio, l->audio, len, c->bps,final); break; default: // Change the number of bits if(c->bps != l->bps) - change_bps(c->audio,l->audio,len,c->bps,l->bps); + change_bps(c->audio,l->audio,len,c->bps,l->bps,final); else l->audio=c->audio; break; @@ -456,7 +459,7 @@ // Switch from cpu native endian to the correct endianess if((l->format&AF_FORMAT_END_MASK)!=AF_FORMAT_NE) - endian(l->audio,l->audio,len,l->bps); + endian(l->audio,l->audio,len,l->bps,final); // Set output data c->audio = l->audio; @@ -515,7 +518,7 @@ } // Function implementations used by play -static void endian(void* in, void* out, int len, int bps) +static void endian(void* in, void* out, int len, int bps,int final) { register int i; switch(bps){ @@ -545,7 +548,7 @@ } } -static void si2us(void* in, void* out, int len, int bps) +static void si2us(void* in, void* out, int len, int bps,int final) { register int i; switch(bps){ @@ -568,7 +571,7 @@ } } -static void us2si(void* in, void* out, int len, int bps) +static void us2si(void* in, void* out, int len, int bps,int final) { register int i; switch(bps){ Modified: mplayerxp/postproc/af_gate.c =================================================================== --- mplayerxp/postproc/af_gate.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_gate.c 2010-01-21 14:58:37 UTC (rev 116) @@ -102,7 +102,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_gate_t* s = (af_gate_t*)af->setup; // Setup for this instance Modified: mplayerxp/postproc/af_hrtf.c =================================================================== --- mplayerxp/postproc/af_hrtf.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_hrtf.c 2010-01-21 14:58:37 UTC (rev 116) @@ -383,7 +383,7 @@ 2. A bass compensation is introduced to ensure that 0-200 Hz are not damped (without any real 3D acoustical image, however). */ -static af_data_t* __FASTCALL__ play(struct af_instance_s *af, af_data_t *data) +static af_data_t* __FASTCALL__ play(struct af_instance_s *af, af_data_t *data,int final) { af_hrtf_t *s = af->setup; real_t *in = data->audio; // Input audio data Modified: mplayerxp/postproc/af_karaoke.c =================================================================== --- mplayerxp/postproc/af_karaoke.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_karaoke.c 2010-01-21 14:58:37 UTC (rev 116) @@ -37,7 +37,7 @@ } // Filter data through filter -static af_data_t* play(struct af_instance_s* af, af_data_t* data) +static af_data_t* play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data float* a = c->audio; // Audio data Modified: mplayerxp/postproc/af_lp.c =================================================================== --- mplayerxp/postproc/af_lp.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_lp.c 2010-01-21 14:58:37 UTC (rev 116) @@ -58,7 +58,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { // Do something necessary to get rid of annoying warning during compile if(!af) Modified: mplayerxp/postproc/af_pan.c =================================================================== --- mplayerxp/postproc/af_pan.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_pan.c 2010-01-21 14:58:37 UTC (rev 116) @@ -123,7 +123,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_data_t* l = af->data; // Local data Modified: mplayerxp/postproc/af_raw.c =================================================================== --- mplayerxp/postproc/af_raw.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_raw.c 2010-01-21 14:58:37 UTC (rev 116) @@ -142,7 +142,7 @@ af audio filter instance data audio data */ -static af_data_t* __FASTCALL__ play( struct af_instance_s* af, af_data_t* data ) +static af_data_t* __FASTCALL__ play( struct af_instance_s* af, af_data_t* data,int final) { af_raw_t* s = af->setup; // Setup for this instance if(s->fd) fwrite(data->audio,data->len,1,s->fd); Modified: mplayerxp/postproc/af_resample.c =================================================================== --- mplayerxp/postproc/af_resample.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_resample.c 2010-01-21 14:58:37 UTC (rev 116) @@ -348,7 +348,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { int len = 0; // Length of output data af_data_t* c = data; // Current working data Modified: mplayerxp/postproc/af_scaletempo.c =================================================================== --- mplayerxp/postproc/af_scaletempo.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_scaletempo.c 2010-01-21 14:58:37 UTC (rev 116) @@ -165,7 +165,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_scaletempo_t* s = af->setup; int offset_in; @@ -202,6 +202,11 @@ bytes_off = s->best_overlap_offset(s); s->output_overlap(s, pout, bytes_off); } + if(final) + stream_copy(pout + s->bytes_overlap, + s->buf_queue + bytes_off + s->bytes_overlap, + s->bytes_standing); + else memcpy(pout + s->bytes_overlap, s->buf_queue + bytes_off + s->bytes_overlap, s->bytes_standing); Modified: mplayerxp/postproc/af_sinesuppress.c =================================================================== --- mplayerxp/postproc/af_sinesuppress.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_sinesuppress.c 2010-01-21 14:58:37 UTC (rev 116) @@ -31,9 +31,9 @@ double pos; }af_sinesuppress_t; -static af_data_t* play_s16(struct af_instance_s* af, af_data_t* data); +static af_data_t* play_s16(struct af_instance_s* af, af_data_t* data,int final); #if 0 -static af_data_t* play_float(struct af_instance_s* af, af_data_t* data); +static af_data_t* play_float(struct af_instance_s* af, af_data_t* data,int final); #endif // Initialization and runtime control @@ -90,7 +90,7 @@ } // Filter data through filter -static af_data_t* play_s16(struct af_instance_s* af, af_data_t* data) +static af_data_t* play_s16(struct af_instance_s* af, af_data_t* data,int final) { af_sinesuppress_t *s = af->setup; register int i = 0; @@ -121,7 +121,7 @@ } #if 0 -static af_data_t* play_float(struct af_instance_s* af, af_data_t* data) +static af_data_t* play_float(struct af_instance_s* af, af_data_t* data,int final) { af_sinesuppress_t *s = af->setup; register int i = 0; Modified: mplayerxp/postproc/af_sub.c =================================================================== --- mplayerxp/postproc/af_sub.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_sub.c 2010-01-21 14:58:37 UTC (rev 116) @@ -136,7 +136,7 @@ #endif // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_sub_t* s = af->setup; // Setup for this instance Modified: mplayerxp/postproc/af_surround.c =================================================================== --- mplayerxp/postproc/af_surround.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_surround.c 2010-01-21 14:58:37 UTC (rev 116) @@ -168,7 +168,7 @@ //static int amp_L = 0, amp_R = 0, amp_C = 0, amp_S = 0; // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data){ +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final){ af_surround_t* s = (af_surround_t*)af->setup; float* m = steering_matrix[0]; float* in = data->audio; // Input audio data Modified: mplayerxp/postproc/af_volnorm.c =================================================================== --- mplayerxp/postproc/af_volnorm.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_volnorm.c 2010-01-21 14:58:37 UTC (rev 116) @@ -116,7 +116,7 @@ free(af->setup); } -static void __FASTCALL__ method1_int16(af_volnorm_t *s, af_data_t *c) +static void __FASTCALL__ method1_int16(af_volnorm_t *s, af_data_t *c,int final) { register int i = 0; int16_t *data = (int16_t*)c->audio; // Audio data @@ -158,7 +158,7 @@ s->lastavg = (1.0 - SMOOTH_LASTAVG) * s->lastavg + SMOOTH_LASTAVG * newavg; } -static void __FASTCALL__ method1_float(af_volnorm_t *s, af_data_t *c) +static void __FASTCALL__ method1_float(af_volnorm_t *s, af_data_t *c,int final) { register int i = 0; float *data = (float*)c->audio; // Audio data @@ -195,7 +195,7 @@ s->lastavg = (1.0 - SMOOTH_LASTAVG) * s->lastavg + SMOOTH_LASTAVG * newavg; } -static void __FASTCALL__ method2_int16(af_volnorm_t *s, af_data_t *c) +static void __FASTCALL__ method2_int16(af_volnorm_t *s, af_data_t *c,int final) { register int i = 0; int16_t *data = (int16_t*)c->audio; // Audio data @@ -245,7 +245,7 @@ s->idx = (s->idx + 1) % NSAMPLES; } -static void __FASTCALL__ method2_float(af_volnorm_t *s, af_data_t *c) +static void __FASTCALL__ method2_float(af_volnorm_t *s, af_data_t *c,int final) { register int i = 0; float *data = (float*)c->audio; // Audio data @@ -292,23 +292,23 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_volnorm_t *s = af->setup; if(af->data->format == (AF_FORMAT_SI | AF_FORMAT_NE)) { if (s->method) - method2_int16(s, data); + method2_int16(s, data,final); else - method1_int16(s, data); + method1_int16(s, data,final); } else if(af->data->format == (AF_FORMAT_F | AF_FORMAT_NE)) { if (s->method) - method2_float(s, data); + method2_float(s, data,final); else - method1_float(s, data); + method1_float(s, data,final); } return data; } Modified: mplayerxp/postproc/af_volume.c =================================================================== --- mplayerxp/postproc/af_volume.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/af_volume.c 2010-01-21 14:58:37 UTC (rev 116) @@ -135,7 +135,7 @@ } // Filter data through filter -static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data) +static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data af_volume_t* s = (af_volume_t*)af->setup; // Setup for this instance Modified: mplayerxp/postproc/dsp.c =================================================================== --- mplayerxp/postproc/dsp.c 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/dsp.c 2010-01-21 14:58:37 UTC (rev 116) @@ -664,7 +664,7 @@ bp->prev = bp->pprev = 0.0; } -static void __FASTCALL__ init_change_bps(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps) +static void __FASTCALL__ init_change_bps(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps,int final) { #ifdef __SSE4_1__ if(gCpuCaps.hasSSE41) change_bps = change_bps_SSE4; @@ -689,11 +689,11 @@ #endif #endif /* __x86_64__ */ change_bps = change_bps_c; - (*change_bps)(in,out,len,inbps,outbps); + (*change_bps)(in,out,len,inbps,outbps,final); } -void (* __FASTCALL__ change_bps)(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps)=init_change_bps; +void (* __FASTCALL__ change_bps)(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps,int final)=init_change_bps; -static void __FASTCALL__ init_float2int(void* in, void* out, int len, int bps) +static void __FASTCALL__ init_float2int(void* in, void* out, int len, int bps,int final) { #ifdef __AVX__ if(gCpuCaps.hasAVX) float2int = float2int_AVX; @@ -726,11 +726,11 @@ #endif #endif /*__x86_64__*/ float2int = float2int_c; - (*float2int)(in,out,len,bps); + (*float2int)(in,out,len,bps,final); } -void (* __FASTCALL__ float2int)(void* in, void* out, int len, int bps)=init_float2int; +void (* __FASTCALL__ float2int)(void* in, void* out, int len, int bps,int final)=init_float2int; -static void __FASTCALL__ init_int2float(void* in, void* out, int len, int bps) +static void __FASTCALL__ init_int2float(void* in, void* out, int len, int bps,int final) { #ifdef __AVX__ if(gCpuCaps.hasAVX) int2float = int2float_AVX; @@ -763,9 +763,9 @@ #endif #endif /*__x86_64__*/ int2float = int2float_c; - (*int2float)(in,out,len,bps); + (*int2float)(in,out,len,bps,final); } -void (* __FASTCALL__ int2float)(void* in, void* out, int len, int bps)=init_int2float; +void (* __FASTCALL__ int2float)(void* in, void* out, int len, int bps,int final)=init_int2float; static int32_t __FASTCALL__ FIR_i16_init(int16_t *x,int16_t *w) Modified: mplayerxp/postproc/dsp.h =================================================================== --- mplayerxp/postproc/dsp.h 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/dsp.h 2010-01-21 14:58:37 UTC (rev 116) @@ -143,9 +143,9 @@ } /* some mmx_optimized stuff */ -extern void (* __FASTCALL__ change_bps)(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps); -extern void (* __FASTCALL__ float2int)(void* in, void* out, int len, int bps); -extern void (* __FASTCALL__ int2float)(void* in, void* out, int len, int bps); +extern void (* __FASTCALL__ change_bps)(const void* in, void* out, unsigned len, unsigned inbps, unsigned outbps,int final); +extern void (* __FASTCALL__ float2int)(void* in, void* out, int len, int bps,int final); +extern void (* __FASTCALL__ int2float)(void* in, void* out, int len, int bps,int final); extern int32_t (* __FASTCALL__ FIR_i16)(int16_t *x,int16_t *w); extern float (* __FASTCALL__ FIR_f32)(float *x,float *w); Modified: mplayerxp/postproc/dsp_accel.h =================================================================== --- mplayerxp/postproc/dsp_accel.h 2010-01-20 18:48:33 UTC (rev 115) +++ mplayerxp/postproc/dsp_accel.h 2010-01-21 14:58:37 UTC (rev 116) @@ -1,66 +1,163 @@ /* DSP acceleration routines */ #include "pvector/pvector.h" -#ifdef HAVE_INT_PVECTOR -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load)(const void *__P) -{ - return *(const __m64 *)__P; -} -#undef _m_load -#define _m_load PVECTOR_RENAME(_m_load) -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load_half)(const void *__P) +static void __FASTCALL__ PVECTOR_RENAME(int8_to_int16)(const int8_t* in_data, int16_t* out_data, unsigned len, int final) { - return _mm_cvtsi32_si64 (*(const int *)__P); +#ifdef HAVE_INT_PVECTOR + __ivec izero = _ivec_setzero(); +#endif + unsigned i; + i = 0; +#ifdef HAVE_INT_PVECTOR + for(;i<len;i++) { + ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8; + if((((long)out_data)&(__IVEC_SIZE-1))==0) break; + } + if((len-i)>=__IVEC_SIZE) + for(;i<len;i+=__IVEC_SIZE){ + __ivec ind,itmp[2]; + ind = _ivec_loadu(&((uint8_t *)in_data)[i]); +#if 0 /* slower but portable on non-x86 CPUs version */ + itmp[0]= _ivec_sll_s16_imm(_ivec_u16_from_lou8(ind),8); + itmp[1]= _ivec_sll_s16_imm(_ivec_u16_from_hiu8(ind),8); +#else + itmp[0]= _ivec_interleave_lo_u8(izero,ind); + itmp[1]= _ivec_interleave_hi_u8(izero,ind); +#endif + if(final) { + _ivec_stream(&((uint16_t*)out_data)[i],itmp[0]); + _ivec_stream(&((uint16_t*)out_data)[i+__IVEC_SIZE/2],itmp[1]); + } else { + _ivec_storea(&((uint16_t*)out_data)[i],itmp[0]); + _ivec_storea(&((uint16_t*)out_data)[i+__IVEC_SIZE/2],itmp[1]); + } + } +#endif + for(;i<len;i++) + ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8; +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + _ivec_sfence(); +#endif } -#undef _m_load_half -#define _m_load_half PVECTOR_RENAME(_m_load_half) -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store)(void *__P, __m64 src) +static void __FASTCALL__ PVECTOR_RENAME(int16_to_int8)(const int16_t* in_data, int8_t* out_data, unsigned len, int final) { - *(__m64 *)__P = src; + unsigned i; + i = 0; +#ifdef HAVE_INT_PVECTOR + for(;i<len;i++) { + ((uint8_t*)out_data)[i]=(uint8_t)((((uint16_t*)in_data)[i])>>8); + if((((long)out_data)&(__IVEC_SIZE-1))==0) break; + } + if((len-i)>=__IVEC_SIZE) + for(;i<len;i+=__IVEC_SIZE){ + __ivec outd,itmp[2]; + itmp[0] = _ivec_sra_s16_imm(_ivec_loadu(&((uint16_t*)in_data)[i]),8); + itmp[1] = _ivec_sra_s16_imm(_ivec_loadu(&((uint16_t*)in_data)[i+__IVEC_SIZE/2]),8); + outd = _ivec_s8_from_s16(itmp[0],itmp[1]); + if(final) + _ivec_stream(&((uint8_t*)out_data)[i],outd); + else + _ivec_storea(&((uint8_t*)out_data)[i],outd); + } +#endif + for(;i<len;i++) + ((uint8_t*)out_data)[i]=(uint8_t)((((uint16_t*)in_data)[i])>>8); +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + _ivec_sfence(); +#endif } -#undef _m_store -#define _m_store PVECTOR_RENAME(_m_store) -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store_half)(void *__P, __m64 src) +static void __FASTCALL__ PVECTOR_RENAME(int16_to_int32)(const int16_t* in_data, int32_t* out_data, unsigned len, int final) { - *(int *)__P = _mm_cvtsi64_si32(src); -} -#undef _m_store_half -#define _m_store_half PVECTOR_RENAME(_m_store_half) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_movntq)(void *__P, __m64 src) -{ -#ifdef HAVE_MMX2 - _mm_stream_pi(__P,src); +#ifdef HAVE_INT_PVECTOR + __ivec izero = _ivec_setzero(); + unsigned len_mm,j; +#endif + unsigned i; + i=0; +#ifdef HAVE_INT_PVECTOR + j=0; + len_mm=len&(~(__IVEC_SIZE-1)); + for(;i<len;i++,j+=2){ + ((uint32_t*)out_data)[i]=((uint32_t)((uint16_t*)in_data)[i])<<16; + if((((long)out_data)&(__IVEC_SIZE-1))==0) break; + } + if((len_mm-i)>=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) + { + __ivec ind,tmp[2]; + ind = _ivec_loadu(&((uint8_t *)in_data)[j]); +#if 0 /* slower but portable on non-x86 CPUs version */ + tmp[0]= _ivec_sll_s32_imm(_ivec_u32_from_lou16(ind),16); + tmp[1]= _ivec_sll_s32_imm(_ivec_u32_from_hiu16(ind),16); #else - _m_store(__P,src); + tmp[0]= _ivec_interleave_lo_u16(izero,ind); + tmp[1]= _ivec_interleave_hi_u16(izero,ind); #endif -} -#undef _m_movntq -#define _m_movntq PVECTOR_RENAME(_m_movntq) + if(final) { + _ivec_stream(&((uint8_t *)out_data)[j*2],tmp[0]); + _ivec_stream(&((uint8_t *)out_data)[j*2+__IVEC_SIZE],tmp[1]); + } else { + _ivec_storea(&((uint8_t *)out_data)[j*2],tmp[0]); + _ivec_storea(&((uint8_t *)out_data)[j*2+__IVEC_SIZE],tmp[1]); + } + } #endif + for(;i<len;i++) + ((uint32_t*)out_data)[i]=((uint32_t)((uint16_t*)in_data)[i])<<16; +#ifdef HAVE_INT_PVECTOR + _ivec_sfence(); + _ivec_empty(); +#endif +} -static void __FASTCALL__ PVECTOR_RENAME(change_bps)(const void* in_data, void* out_data, unsigned len, unsigned inbps, unsigned outbps) +static void __FASTCALL__ PVECTOR_RENAME(int32_to_int16)(const int32_t* in_data, int16_t* out_data, unsigned len, int final) { #ifdef HAVE_INT_PVECTOR - __ivec izero = _ivec_setzero(); - unsigned len_mm,j; + unsigned len_mm,j; #endif + unsigned i; + i=0; +#ifdef HAVE_INT_PVECTOR + j=0; + len_mm=len&(~(__IVEC_SIZE-1)); + for(;i<len;i++,j+=2){ + ((uint16_t*)out_data)[i]=(uint16_t)((((uint32_t*)in_data)[i])>>16); + if((((long)out_data)&(__IVEC_SIZE-1))==0) break; + } + if((len-i)>=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) + { + __ivec ind[2],tmp; + ind[0]= _ivec_sra_s32_imm(_ivec_loadu(&((uint8_t *)in_data)[j*2]),16); + ind[1]= _ivec_sra_s32_imm(_ivec_loadu(&((uint8_t *)in_data)[j*2+__IVEC_SIZE]),16); + tmp = _ivec_s16_from_s32(ind[0],ind[1]); + if(final) + _ivec_stream(&((uint8_t *)out_data)[j],tmp); + else + _ivec_storea(&((uint8_t *)out_data)[j],tmp); + } +#endif + for(;i<len;i++) + ((uint16_t*)out_data)[i]=(uint16_t)((((uint32_t*)in_data)[i])>>16); +#ifdef HAVE_INT_PVECTOR + _ivec_sfence(); + _ivec_empty(); +#endif +} + +static void __FASTCALL__ PVECTOR_RENAME(change_bps)(const void* in_data, void* out_data, unsigned len, unsigned inbps, unsigned outbps,int final) +{ unsigned i; // Change the number of bits switch(inbps){ case 1: switch(outbps){ case 2: - i=0; - for(;i<len;i++) - ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8; + PVECTOR_RENAME(int8_to_int16)(in_data,out_data,len,final); break; case 3: for(i=0;i<len;i++) @@ -78,9 +175,7 @@ case 2: switch(outbps){ case 1: - i=0; - for(;i<len;i++) - ((uint8_t*)out_data)[i]=(uint8_t)((((uint16_t*)in_data)[i])>>8); + PVECTOR_RENAME(int16_to_int8)(in_data,out_data,len,final); break; case 3: for(i=0;i<len;i++) @@ -89,32 +184,7 @@ ((uint8_t*)out_data)[3*i+2]=(((uint8_t*)in_data)[2*i+1]); break; case 4: - i=0; -#ifdef HAVE_INT_PVECTOR - j=0; - len_mm=len&(~(__IVEC_SIZE-1)); - for(;i<len;i++,j+=2){ - ((uint32_t*)out_data)[i]=((uint32_t)((uint16_t*)in_data)[i])<<16; - if((((long)out_data)&(__IVEC_SIZE-1))==0) break; - } - if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) - { - __ivec ind,tmp[2]; - ind = _ivec_loadu(&((uint8_t *)in_data)[j]); -#if 0 /* slower but portable on non-x86 CPUs version */ - tmp[0]= _ivec_sll_s32_imm(_ivec_u32_from_lou16(ind),16); - tmp[1]= _ivec_sll_s32_imm(_ivec_u32_from_hiu16(ind),16); -#else - tmp[0]= _ivec_interleave_lo_u16(izero,ind); - tmp[1]= _ivec_interleave_hi_u16(izero,ind); -#endif - _ivec_storea(&((uint8_t *)out_data)[j*2],tmp[0]); - _ivec_storea(&((uint8_t *)out_data)[j*2+__IVEC_SIZE],tmp[1]); - } -#endif - for(;i<len;i++) - ((uint32_t*)out_data)[i]=((uint32_t)((uint16_t*)in_data)[i])<<16; + PVECTOR_RENAME(int16_to_int32)(in_data,out_data,len,final); break; } break; @@ -150,26 +220,7 @@ ((uint8_t*)out_data)[i]=(uint8_t)((((uint32_t*)in_data)[i])>>24); break; case 2: - i=0; -#ifdef HAVE_INT_PVECTOR - j=0; - len_mm=len&(~(__IVEC_SIZE-1)); - for(;i<len;i++,j+=2){ - ((uint16_t*)out_data)[i]=(uint16_t)((((uint32_t*)in_data)[i])>>16); - if((((long)out_data)&(__IVEC_SIZE-1))==0) break; - } - if((len-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) - { - __ivec ind[2],tmp; - ind[0]= _ivec_sra_s32_imm(_ivec_loadu(&((uint8_t *)in_data)[j*2]),16); - ind[1]= _ivec_sra_s32_imm(_ivec_loadu(&((uint8_t *)in_data)[j*2+__IVEC_SIZE]),16); - tmp = _ivec_s16_from_s32(ind[0],ind[1]); - _ivec_storea(&((uint8_t *)out_data)[j],tmp); - } -#endif - for(;i<len;i++) - ((uint16_t*)out_data)[i]=(uint16_t)((((uint32_t*)in_data)[i])>>16); + PVECTOR_RENAME(int32_to_int16)(in_data,out_data,len,final); break; case 3: for(i=0;i<len;i++) @@ -180,12 +231,53 @@ } break; } +} + #ifdef HAVE_INT_PVECTOR - _ivec_sfence(); - _ivec_empty(); -#endif +static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(_m_load)(const void *__P) +{ + return *(const __m64 *)__P; } +#undef _m_load +#define _m_load PVECTOR_RENAME(_m_load) +static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(_m_load_half)(const void *__P) +{ + return _mm_cvtsi32_si64 (*(const int *)__P); +} +#undef _m_load_half +#define _m_load_half PVECTOR_RENAME(_m_load_half) + +static __inline void __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(_m_store)(void *__P, __m64... [truncated message content] |