ActionScript 3 Vorbis Encoder

Vorbis Encoding TimesAs André already mentioned we have finally got an Ogg Vorbis Encoder in ActionScript 3. André wrote a lot about the benefits already.

Now what I really like about the encoder is the way we could minimize the encoding time by ~50%! I know two implementations of Ogg Vorbnis. One is written in C and another one in Java. What we did first was just getting it to work and it looked pretty much like the C/Java version. Then we started optimizing the code by comparing the encoding results always to reference files. I am quiet happy because on my machine we reduced the encoding time from 32sec to 16.5sec with simple optimizations and tricks.

Where to go from here? Of course we think the best we can do is to open-source the encoder. But there are a couple of other things in my mind. I started modifing Tamarin and added two functions to the Math class. Those convert a Number to its binary IEEE32 single-precision representation and vice versa. With those two functions we could get huge speed improvements for performance hungry tasks like this one. I hope Adobe will not forget about this as well — there seems to be general problem currently trying to support the simple Flash user on the one hand and the “Flash explorer” on the other hand.

I know you may ask what this feature could be good for, but doing floating point math using bitwise operations is a killer when it comes to performance. We are currently not allowed to do this and there is no reason for that.

12 Comments

  1. Stefan
    Posted Jul 24, 2008 at 4:13 pm | Permalink

    contratulations, dude! this is by far one of the coolest things I´ve heard of since…I don´t know, threading? :) to be honest I didn´t think it was possible for the flash client so hey, it might be time for me to check out as3 to and not stubbornly wave the java flag :)

  2. Macaca
    Posted Jul 24, 2008 at 8:46 pm | Permalink

    I wonder how long it will take before someone (like you or Andre) will totally abuse those new Hydra shaders in FP10, and create something entirely different from it (like you did for that incredible SoundTool).

    If you could encode your input data in a bitmapData, then offload it to the GPU for some insane processing with some wicked shader, and then read the resulting pixels back you might be able to do some crazy stuff.

  3. Posted Jul 25, 2008 at 11:36 am | Permalink

    Macaca: I wrote already some code to do very interesting things with Hydra. I hope that I will be allowed to post about this soon. It is all about recompilation at runtime.

  4. Posted Jul 26, 2008 at 10:58 pm | Permalink

    I vote too for Number bytes conversions, for (fast) 32 and 64 IEEE formats. They are pretty useful in NekoVM already.

  5. Posted Jul 28, 2008 at 12:20 pm | Permalink

    Yes, I want to have this! I tested already with Tamarin and speed improvements are huge …


    int MathClass::floatToIntBits(double x)
    {
    float f = (float)x;
    int i = *(int*)&f;
    return i;
    }

    double MathClass::intBitsToFloat(int x)
    {
    float f = *(float*)&x;
    return (double)f;
    }

  6. Posted Jul 28, 2008 at 12:42 pm | Permalink

    If you want to vote: https://bugs.adobe.com/jira/browse/FP-487

  7. oli
    Posted Aug 8, 2008 at 3:56 pm | Permalink

    is there also a vorbis decoder?

  8. Posted Aug 8, 2008 at 6:29 pm | Permalink

    There is one existing afaik. SpliceMusic was decoding vorbis samples at runtime.

  9. Posted Sep 13, 2008 at 4:48 am | Permalink

    I wonder how long it will take before someone (like you or Andre) will totally abuse those new Hydra shaders in FP10, and create something entirely different from it (like you did for that incredible SoundTool).

  10. Martin
    Posted Jan 10, 2009 at 11:59 pm | Permalink

    Has the encoder been open sourced yet?

  11. Posted Nov 19, 2009 at 8:02 pm | Permalink

    Hi Welcome to our new girls site

  12. daslicht
    Posted Jun 17, 2010 at 10:12 pm | Permalink

    Hi,
    is the encoder somewhere available now ? Even a SWC would be nice :)

2 Trackbacks

  1. [...] Imageprocessing Library « ActionScript 3 Vorbis Encoder [...]

  2. By Websites tagged "vorbis" on Postsaver on Sep 10, 2008 at 2:17 am

    [...] – ActionScript 3 Vorbis Encoder saved by frozenfire22008-08-24 – Native Ogg Vorbis and Theora support added for Firefox 3.1 saved [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*