Webp image and Opus audio formats support

I have created a project in order to enable webp decoding. http://lib.haxe.org/p/nme-webp https://github.com/soywiz/haxe-nme-webp API 0.0.2 is pretty simple: [quote]webp.Webp.getDecoderVersion():String [quote]webp.Webp.getEncoderVersion():String …

Viewing 1 to 9 (9 Total)
Webp image and Opus audio formats support

soywiz

soywiz
Total Posts: 11
Joined: August 29, 2012

I have created a project in order to enable webp decoding.

http://lib.haxe.org/p/nme-webp
http://github.com/soywiz/haxe-nme-webp...

API 0.0.2 is pretty simple:

webp.Webp.getDecoderVersion():String
[quote]webp.Webp.getEncoderVersion():String
webp.Webp.getImageInfo(data:Bytes):WebpInfo
webp.Webp.decodeAsBitmapData(data:Bytes):BitmapData
webp.Webp.encodeBitmapData(bitmapData:BitmapData, lossless:Bool = false, quality_factor:Float = 86):Bytes

Example:
var webpData = File.getBytes('C:/dev/webp/test2.webp');
var data = webp.Decoder.decodeAsBitmapData(webpData);
addChild(new Bitmap(data));

It allows to decode webp data into a BitmapData object.
It is binded with webp 0.2.0 which have lossy, lossless compression and alpha support. And compresses better than JPEG and PNG so it is ideal for mobile projects.
http://developers.google.com/speed/webp/...
http://code.google.com/p/webp/

I have successfully compiled for in windows and now I'm trying to compile it for other platforms. Any help testing would be highly appreciated.

---

I have created other project to handle the opus audio codec which performs pretty good (much better than ogg and mp3, specially for speech files; that codec is an evolution of the speex codec but also works fine for music audio files).

http://www.speex.org/
http://opus-codec.org/
http://lib.haxe.org/p/nme-opus
http://github.com/soywiz/haxe-nme-opus......

Usage:

var sound:Sound = Opus.decode(File.getBytes('C:/projects/test.opus'));
sound.play();

Tags:
Posted on October 19, 2012 at 9:30 AM

Franky

Franky
Total Posts: 87
Joined: February 26, 2012

Re: Webp support

Awesome, I am off to install it with haxelib.
Thank you for your work, can always use smaller file sizes.
I am going to try and compile it to run on Android.

Posted on October 19, 2012 at 4:23 PM

soywiz

soywiz
Total Posts: 11
Joined: August 29, 2012

Re: Webp support

Great!

Posted on October 19, 2012 at 9:50 PM

Franky

Franky
Total Posts: 87
Joined: February 26, 2012

Re: Webp support

It's like xmas in here... simply incredible dev-o-rama streak you got going. Much respect.
Something like OPUS support will come in very handy, though I wasn't expecting to have it in Haxe just like that.
It was on the short list with stuff like video play support outside of the flash target and opencl/gpgpu type gpu parallel computing access, it was on the list of stuff... one less now grin.
This is simply incredible. And you just probably provided enough must-do-experimenting to fill up the weekend...
Thank you.

Posted on October 19, 2012 at 11:28 PM

soywiz

soywiz
Total Posts: 11
Joined: August 29, 2012

Re: Webp image and Opus audio formats support

I'm glad you like it!

I'm still thinking how to improve those APIs.

Probably in webp just a way to encode image would be enough.
And for Opus maybe and encoder too, but specially a function to generate a streamed Sound, currently it decodes the whole sound and that's not appropiate for music files.

If you were able to compile it to other platforms, or you use it and have some feedback about it, that would help a lot.

Posted on October 20, 2012 at 5:30 AM

Franky

Franky
Total Posts: 87
Joined: February 26, 2012

Re: Webp image and Opus audio formats support

Encoders for both would be huge, for sure.

Will report back soon, long shift grin.

Posted on October 20, 2012 at 5:41 AM

singmajesty

singmajesty
Total Posts: 2141
Joined: August 25, 2011

Re: Webp image and Opus audio formats support

Will this work with Assets.getBytes?

File.getBytes doesn't work on all platforms unless the assets are not included with your application smiling

Posted on October 20, 2012 at 7:56 AM

soywiz

soywiz
Total Posts: 11
Joined: August 29, 2012

Re: Webp image and Opus audio formats support

Yeah, it works with Assets.getBytes smiling It just requires a Bytes object.

Though it will work just with CPP targets right now.

But there is a project to use it in javascript and flash:
http://webpjs.appspot.com/

So maybe in a future release it will support JS and Flash too smiling (even when the flash decoder is a bit slow, it works)

Posted on October 20, 2012 at 8:00 AM

soywiz

soywiz
Total Posts: 11
Joined: August 29, 2012

Re: Webp image and Opus audio formats support

I have created other library to handle Webm movies:
http://www.haxenme.org/index.php?cID=8225...

BTW: I changed the webp API to use ByteArray instead of Bytes.

Posted on November 12, 2012 at 11:00 AM