[Vorbis-dev] My Flash 10 attempt
Tor-Einar Jarnbjo
tor-einar at jarnbjo.name
Tue Oct 7 02:17:07 PDT 2008
Hi everybody,
after hearing about the new Sound functionality in Flash 10, Arek's
performance gain using the new Vector type instead of Array and not at
least actually seeing the performance boost he achieved compared to my
old Vorbis decoder, I found a few hours yesterday to migrate my old code.
First of all: the new PCM playback API for Flash is rather restricted
and only allows 44.1 ksps, stereo. Implementing a generic Vorbis player
for Flash would still require a software resampler between the decoder
and the playback engine, but I guess most streams are encoded with those
parameters anyway. Good news is at least that the new API seem to be
much less critical to timing issues compared to the hack I used in the
previous player, so it should be much easier now to operate the player
together with a user interface.
Second: replacing Array with Vector simplified the code to some extent,
but I am not able to measure any particular performance gain. I am not
sure, but it looks almost to me as if the haXe compiler is producing
much more efficient Flash bytecode compared to the Adobe AS compiler. I
haven't bothered verifying this, but I've profiled my code and there is
no "hotspot" where I'm doing something obviously wrong. Time divides
between the components in almost the same manner as with my Java
decoder, e.g. roughly 40% of the time is spent in the iMDCT code, 35-40%
decoding floors and residues and most of the remainer is probably the
Huffman code.
New attempt (requiring Flash 10 beta player):
http://flash.j-ogg.de/10/
Old player:
http://flash-j-ogg.de/
Can someone verify that the new player actually causes slightly more CPU
load than the old player, or is it just my eyes fooling me?
Tor
More information about the Vorbis-dev
mailing list