[MPlayer-dev-eng] [PATCH] libbs2b audio filter

Andrew Savchenko bircoph at gmail.com
Thu Mar 5 17:08:04 CET 2009


Hi,

On Thursday 05 March 2009 16:31, Reimar Döffinger wrote:
[...]
> > Necessity of using void* pointers and pointer to function
> > ensues from aiming to avoid six different play functions for
> > different types of audio data
>
> Using void * does not mean you have to do arithmetic on them,
> you can e.g. make i uint8_t *.

OK, I admit I misunderstood the standard.

> > or even worse alternative: switch statement
> > inside single play function.
>
> Now you have a switch inside the config...

If I want to use different functions depending on data type, I will 
have switch somewhere. The idea was that it is better to have it 
in config than in play.

> There may well be reasons to do it this way, but if you just
> _assume_ it is faster or simpler like this, you may well assume
> wrong. Indirect function calls can be slower on some
> architectures, as well as adds with a runtime values instead of
> a constant,

But play itself is called indirectly. I agree, static function 
calls will be faster, but this will result in significant code 
duplication. If the latter is acceptable, I'll do this, but I 
doubt it is.

> though I don't think it gets any more inefficient 
> than one function call per sample, such an inner loop obviously
> belongs into the library, particularly since that
> one-sample-a-time approach makes SIMD-optimization near
> impossible.

I'll contact author of the library, imo it is possible to make 
buffered i/o. BTW the library itself is very small, so essential 
code may be inserted directly into the filter, obviously this will 
be faster, but I do not want to duplicate code (and actually fork) 
without sugnificat reason to.

> Anyway just using uint8_t * instead of void * should 
> work well enough.

Thanks for the clue. New patch version is attached.

-- 
Best regards,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libbs2b-filter.patch
Type: text/x-diff
Size: 7895 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090305/267e9834/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090305/267e9834/attachment.pgp>


More information about the MPlayer-dev-eng mailing list