Archive for Performance

Flash App on iPhone is crap

I went today for Adobe Back from MAX conference here in London. It’s like a mashup of what they showed at Adobe MAX LA.

Well, here is the note I took, and I’m really disapointed about Flash app in iPhone…

Flash app on iPhone:

- It’s a “static” app. Only SWFs packed in the app can be loaded. No SWFs from outside can be loaded;
- You can load images, sound, text from outside;
- No H.264, RTMPT, PixelBender…;
- No access to Mic / Camera;
- No access to Native API like Maps;
- The packed file size is at least 2.7mb because they have to bundle all the functionalities because the compiler doesn’t know what is being used or not;

Flash Embed in HTML
- You can assign a priority to swfs during embed, so in a page with 2 banners and a main swf, can assign main swf a higher priority for performance;

Flash Catalyst
- easy integration of Photoshop/Illustrator design with Flash, using Catalyst.
- good for prototyping and IAs
- skinning components easy
- you can create a Flex Project directly from Catalyst, but the Flex Project can’t be loaded in Catalyst
- you can create just a Library Project so you can change components skins easily

Flash Pro CS5
- Text Framework integrated (http://labs.adobe.com/technologies/textlayout/)
- AS3 snippets for designers, creates simple interactive code as Keyboard / Mouse interaction
- Can save FLA or a uncompressed FLA format, that is a bunch of XML’s and assets inside a folder.
- The uncompressed file format is good to change the assets without opening the FLA file

Flash Builder
- You can easily create Flash Project and select a FLA file
- Better integration with back-end stuff, WebServices / AMF (CF, PHP, Java)
- Code generator for WebService / AMF
- Network monitor, to monitor webservices and AMF
- Easily create CMS, selecting the data origin, can be set to edit or only ready the data

Flash Distribution
- Monetization, using Adobe ID, sell Flash / AIR products
- Apps supports Ads
- Frameworks to make easier integrations with social network.

Vote in HexoSearch Vote

Comments (1)

LFPUG Presentation and Sources

As promissed, here is the presentation I made at LFPUG in PDF format.

http://www.hellokeita.in/presentations/LFPUG/20090827/MakingMusicFP10.pdf

And the source files zipped with the demos I showed.

http://www.hellokeita.in/presentations/LFPUG/20090827/examples.zip
The contents are:
Example01-SineWaveExample: Simple example generating a sine wave
Example02-KeyboardExample: Example of a piano keyboard
Example03-WaveformExample: Changing the waveform of a sound
Example04-TimePitchExample: Changing pitch and tempo of a mp3
Example05-HeliumBalloon: Real time pitch shifting using Java

Enjoy!

UPDATE
LFPUG website uploaded the video of my presentation
http://www.lfpug.com/flash-10-making-music/

Vote in HexoSearch Vote

Comments (1)

Fake Pitch Shifting

Pitch shifting is the method to change the frequency or the height of a sound.
And why it’s fake? Because, I’m really not using the correct algorithm, actually I just made one for demo purpose. If you listen carefully, you can hear some clippings when you change the slider position.

There is a difference between my previous post about pitch Controlling Pitch and Tempo.
The previous one I was using a dynamically generated sine wave and changing the pitch. It’s much easier because I already have the samples for each sound.


On this example I’m using an MP3 file (Daft Punk, please don’t sue me…If you want, I can change it) and changing the pitch on runtime.

Well it’s working, and as you can see no FPS loss.

Get Adobe Flash player

The source… well, I’m preparing for my LFPUG presentation so, I’ll try to explain about it there, and than release some kind of source.

There is a post from my friend Li http://www.lidev.com.ar/?p=237 where he is using more accurate algorithm to change the pitch. There’s not much loss on quality and no clips.

Vote in HexoSearch Vote

Comments (1)

BitmapData.lock benchmark

Well, I don’t know if anybody read the Thomas Pfeiffer aka Kiroukou (the Sandy3D creator and project leader) commented on my previous post.
Here’s what he said.

Indeed Sandy does a clone of the original texture, for few reasons:
- avoid an unfortunate dispose call.
- allowing to have a setTransparency method to dynamically change the transparency without changing the original bitmapdata of the user.

Concerning the lock() and unclock() are you sure it has a performance impact?
as far I know, this can’t provide any performance boost since the bitmapdata isn’t attached to the flash display list. When the object is out of stage, there’s no advantage to lock it.
But I’d be interessted to have your feedback about that, and your performance test.

About the BitmapData.clone(), he got his point.
It just don’t work for me because I’m using too many 3d Objects with different BitmapMaterial for each, so, the system memory gets too high.
But, about the setTransparency method, he is right.

About the lock and unlock methods, I runned a little benchmark test, because I got curious too how much performance boost you can get.
Here’s the two test I made. (Clicking on the flash area it will re-run the benchmark test)

Using the lock and unlock methods.

Not using the lock and unlock methods.

It’s a really simple test, just to make a benchmark test.
Actually, it’s not a situation that uses any 3d framework.

Creating a BitmapData.
Creating 1000 Bitmaps.
Applying 1000 times a BlurFilter over the BitmapData.

On my PC I get about 150ms faster with locking the BitmapData.

keita

Vote in HexoSearch Vote

Comments (3)

BitmapMaterial tips

I was making some experiments with Sandy3d and Papervision3d and I realized some tips to increase the performance.

Firstly, with Sandy3d 3.0, when you create a BitmapMaterial, the BitmapData that you used to create the Material, is cloned to create the BitmapMaterial.texture.
So, one think you can do is dispose the BitmapData that you used to create the Material after instantiating it and also, if you want to update your BitmapData use the BitmapMaterial.texture directly.

Something like this:
[code lang="actionscript"]
var bmpData:BitmapData = new BitmapData(100, 100, true, 0x00000000);
var bmpMaterial:BitmapMaterial = new BitmapMaterial(bmpData);

bmpData.dispose();

bmpMaterial.texture.fillRect(new Rectangle(10,10,30,30), 0xffff0000);
[/code]
This will not work with Papervision3d because it uses the same BitmapData instance (in my opinion, smarter).

Now for both, Sandy3d and Papervision3d.
As you make changes on your BitmapData, it’s updated on every poligon.
So, use the BitmapData.lock() and BitmapData.unlock() when you are redrawing your BitmapData texture.

[code lang="actionscript"]
var bmpData:BitmapData = new BitmapData(100, 100, false, 0x00000000);
var bmpMaterial:BitmapMaterial = new BitmapMaterial(bmpData);

redrawBitmap();

...

function redrawBitmap(){

bmpData.lock();

bmpData.fillRect(bmpData.rect, 0x00000000);
bmpData.fillRect(new Rectangle(10,10,30,30), 0xffff0000);

var blurFilter:BlurFilter = new BlurFilter(16, 16, 3);

bmpData.applyFilter(bmpData, bmpData.rect, new Point(0,0), blurFilter);

bmpData.unlock();

}
[/code]

Vote in HexoSearch Vote

Comments (2)

BitmapData.draw x Graphics.beginBitmapFill

Firstly… sorry for my poor English…

Working on Recyou.jp, I had to use many BitmapDatas, and so, I had to work out some way to make it lighter.
One thing I realized is that using Graphics.beginBitmapFill besides BitmapData.draw its much faster.

I made the benchmarks, drawing 10000 bitmapDatas, one using BitmapData.draw, and other using Graphics.beginBitmapFill.

First the benchmark with BitmapData.draw (Clicking on the flash it will re-run the benchmark):

The code is something like this:
[code lang="actionscript"]
var genericBmp:BitmapData = new BitmapData(100,100, false, 0x000000);
var bmp:BitmapData = new BitmapData(100,100, false, 0x000000);
for(var i = 0; i < 10000; i++){
bmp.draw(genericBmp);
}
[/code]

Now the benchmark with Graphics.beginBitmapFill (Clicking on the flash it will re-run the benchmark):

The code is something like this:
[code lang="actionscript"]
var genericBmp:BitmapData = new BitmapData(100,100, false, 0x000000);
var bmp:BitmapData = new BitmapData(100,100, false, 0x000000);
for(var i = 0; i < 10000; i++){
graphics.beginBitmapFill(genericBmp);
graphics.drawRect(0,0,100,100);
}
[/code]

So, if you are trying to create some bitmap pattens or attaching a Bitmap child and redrawing it’s BitmapData, try using the Graphics.beginBitmapFill.

Vote in HexoSearch Vote

Comments (6)

Launching my public subversion

http://code.hellokeita.in/public/

People, I’m launching my codes on public subversion repository.
It’s almost nothing there… but, how people claimed for the source (here), there is it.

Hope you enjoy it…

PS: If there’s any bug or anything I forgot, apologize me… I still don’t get much time to review my codes…

Vote in HexoSearch Vote

Comments (5)

Performance increase with BitmapData

I’m working on a project that everything eats performance, using FLV videos, animated smooth Bitmaps, Papervision3D and everything else…
So I started desperately find a way to increase the flash performance.

So, I realized that using BitmapDatas instead using many sprites and FLV videos helped really much.
I mean, instead adding a full screen FLV streaming video on your background, add a Bitmap child on your background that draws the FLV child.

I didn’t make any benchmarks, but, at least on this project it’s helping me speeding up my heavy processing flash.

Vote in HexoSearch Vote

Comments (2)