Mercurial > mplayer.hg
annotate liba52/resample.c @ 24900:9079c9745ff9
A/V sync: take audio filter buffers into account
Substract the delay caused by filter buffering when calculating
currently playing audio position. This matters for af_scaletempo which
buffers significant and varying amounts of data. For other current
filters the effect is normally insignificant.
Instead of the old time-based filter delay field (which was ignored)
this version stores the per-filter delay in units of bytes input read
without corresponding output. This allows the current scaletempo
behavior where other filters before and after it can see the same
nominal samplerate even though the real duration of the data varies;
in this case the other filters can not know the delay they're causing
in terms of real time.
author | uau |
---|---|
date | Thu, 01 Nov 2007 06:52:50 +0000 |
parents | d6219ce521e9 |
children | 170fc6d9dfa1 |
rev | line source |
---|---|
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
1 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
2 // a52_resample_init should find the requested converter (from type flags -> |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
3 // given number of channels) and set up some function pointers... |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
4 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
5 // a52_resample() should do the conversion. |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
6 |
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
7 #include <inttypes.h> |
3626 | 8 #include <stdio.h> |
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
9 #include "a52.h" |
3908 | 10 #include "mm_accel.h" |
3567 | 11 #include "../config.h" |
4247
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3909
diff
changeset
|
12 #include "mangle.h" |
3567 | 13 |
3626 | 14 int (* a52_resample) (float * _f, int16_t * s16)=NULL; |
15 | |
3909 | 16 #include "resample_c.c" |
17 | |
16173 | 18 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3909 | 19 #include "resample_mmx.c" |
3567 | 20 #endif |
3412
21d65a4ae3c9
resample.c added - float->int conversion and channel ordering
arpi
parents:
diff
changeset
|
21 |
11849
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
22 #ifdef HAVE_ALTIVEC |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
23 #include "resample_altivec.c" |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
24 #endif |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
25 |
3909 | 26 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){ |
27 void* tmp; | |
3626 | 28 |
16173 | 29 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3909 | 30 if(mm_accel&MM_ACCEL_X86_MMX){ |
31 tmp=a52_resample_MMX(flags,chans); | |
32 if(tmp){ | |
33 if(a52_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n"); | |
34 a52_resample=tmp; | |
35 return tmp; | |
36 } | |
37 } | |
38 #endif | |
11849
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
39 #ifdef HAVE_ALTIVEC |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
40 if(mm_accel&MM_ACCEL_PPC_ALTIVEC){ |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
41 tmp=a52_resample_altivec(flags,chans); |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
42 if(tmp){ |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
43 if(a52_resample==NULL) fprintf(stderr, "Using AltiVec optimized resampler\n"); |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
44 a52_resample=tmp; |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
45 return tmp; |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
46 } |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
47 } |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
48 #endif |
459ba3f14302
Altivec optimized stereo resampler by Romain Dolbeau (made it working under Linux myself)
alex
parents:
4247
diff
changeset
|
49 |
3909 | 50 tmp=a52_resample_C(flags,chans); |
51 if(tmp){ | |
52 if(a52_resample==NULL) fprintf(stderr, "No accelerated resampler found\n"); | |
53 a52_resample=tmp; | |
54 return tmp; | |
3626 | 55 } |
56 | |
3909 | 57 fprintf(stderr, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans); |
58 return NULL; | |
3626 | 59 } |