[MPlayer-dev-eng] MS-ADPCM/Stereo Works

Mike Melanson melanson at pcisys.net
Fri Dec 28 04:26:16 CET 2001


On Fri, 28 Dec 2001, Michael Niedermayer wrote:

> > 	Still, it's an interesting thought experiment, just to understand
> > SIMD instructions.
> perhaps it is even possible to do SIMD sith ANSI C here :)
> all variables seem to fit into at least 16 bit so it might be possible to 
> handle 2 at once (from 2 blocks or 2 channels ... they are indepedant?)
> and the blahblah[channel] thing isnt the fastest either (unneccesary array) 
> unrolling would speed it up perhaps if unrolling is possible at all here ... 
> cool, we r trying to optimize a adpcm decoder wich needs perhaps 1% of the 
> cpu time

	I was aiming for elegance and brief code when I wrote the ADPCM
decoders, as opposed to raw speed. The blahblah[channel] convention was
adopted in order to combine the mono and stereo decoders into a single
function. Now that I think about it, elegance and brevity of code tend to
clash with performance...:)

	Also, consider that a stream of ADPCM-coded data is a stream of
nibbles. Each nibble stands in for a 16-bit PCM sample. However, there is
no math performed directly on the nibble. They're always used as array
indices (which, I suppose, means that math is performed, but not the kind
that perhaps you had in mind).

	Another point to make is that in stereo ADPCM data, the codes are
already interleaved for us, LRLR... As soon as I get this format 0x62
decoder done, I'll be able to finish up the first rev of this ADPCM format
document, which may be of interest to you.

	As for the exercise of optimizing an ADPCM decoder with SIMD
instructions, it may seem silly, but I've learned never to deride any such
undertaking as futile since they can be great learning experiences. I've
never coded with SIMD instructions (studied them, though) and this may
prove to be a interesting beginner's exercise...if I go through with it
(big 'if'...:)

-- 
	-Mike Melanson




More information about the MPlayer-dev-eng mailing list