Archive for August, 2007

What the FUI?

FUITalking about FUI. What is FUI? It is a framework for fast device GUI creation. This means it does not imply a fancy ComboBox or stuff like that. Sliders, Knobs, Triggers and LEDs is what FUI is about. Originally André Michelle had the idea to create a tile-based and skinable system which uses a simple editor that outputs you a file. You load the file, connect the parameters with your visible elements and that’s it.

Now we are getting closer to a final version and this is why I want to show a little preview. It looks currently not very attractive but that is what the skins are good for. So to get the idea imagine you have a filter. This filter has a parameter like gain. This parameter goes from 0 to 0.5. The Parameter framework André already built allows you to do anything you want in a clean and easy way using new Parameter( new MappingNumberLinear( 0, 0.5 ). Now to change this parameter you can connect it to a FUI element like fui.connect( 'gainSlider', gainParameter ). The user will see a slider he can drag around, you saved a lot of work and can concentrate on the fun part (…the filter!).

The example is built using the following code:
[as][SWF(width='288',height='384',backgroundColor='0xeeeeee',frameRate='255')]
public class FuiTest extends Sprite
{
private const param0: Parameter = new Parameter( new MappingNumberLinear( .25, .75 ), .5 );
private const param1: Parameter = new Parameter( new MappingBoolean(), false );
private const inter0: InterpolationLinear = new InterpolationLinear( new MappingNumberLinear() );

private var point: ControlPoint;

public function FuiTest()
{
param0.addChangedCallbacks( onParameterChanged );

inter0.addControlPoint( new ControlPoint( 0, 0 ) );
inter0.addControlPoint( point = new ControlPoint( .5, .5 ) );
inter0.addControlPoint( new ControlPoint( 1, 1 ) );

var fui: Fui = Fui.build( ByteArray( new FURNACE ) );

fui.connect( ’slider0′, param0 );
fui.connect( ’slider1′, param1 );
fui.connect( ’slider2′, param0 );
fui.connect( ’slider3′, param0 );

fui.connect( ‘knob0′, param0 );
fui.connect( ‘knob1′, param1 );

fui.connect( ‘label0′, new Formatter( ‘P0: %04.2f, P1: % 4i’, param0, param1 ) );
fui.connect( ‘label1′, ‘Just a label’ );

fui.connect( ’switch0′, param1 );
fui.connect( ‘trigger0′, param1 );

fui.connect( ‘interp0′, inter0 );
fui.connect( ‘interp1′, inter0 );

fui.x = 64;
fui.y = 64;

addChild( fui );
}

private function onParameterChanged( p: Parameter, old:*, newV:* ): void
{
point.x = p.getValue();
}
}[/as]

It is easy, clean and will save you (and us) hours of boring stuff. The framework is designed in a way that a skin can do whatever the developer wants. Currently we are missing some of the last components and then of course an editor written in AS3 using AIR.

Update: I just added Group support. This way you can connect a Parameter that is using MappingValues with a set of SwitchButton objects for instance. You can connect any set of values this way with any set of components. It looks like this:

[as]private const param2: Parameter = new Parameter( new MappingValues( [ 'FUI', 'GROUPS', 'EXAMPLE' ] ), ‘FUI’ );
//…
fui.connect( ‘label1′, new Formatter( ‘P2: %s’, param2 ) );

var group: Group = new Group( fui );
group.addComponent( ‘group0′, ‘FUI’ );
group.addComponent( ‘group1′, ‘GROUPS’ );
group.addComponent( ‘group2′, ‘EXAMPLE’ );

group.connect( param2 );[/as]

popforge sprintf

The upcomming FUI framework needs strong string formatters to bind parameters on labels for instance. Using the sprintf syntax is easy and very powerful in that case. Just imagine you can format and bind your parametes with labels in one easy step like fui.connect( 'label', new Formatter( 'Volume: %.2f\nBPM: % 4i', volume, bpm ) );. Fantástico!

By the way. There is already a great ActionScript 3 version of sprintf out there developed by Manish Jethani. Our version follows the specs a little bit closer (e.g. not displaying 0 for 0-precision integers), supports more specifiers (eEgG) , the asterisk for width/precision and we have type length plus nice error reporting (if you are not familiar with the syntax).

So that as a side-node — FUI is getting closer.

Analyzing bitmaps bigger than 512×512

Remember I promised to release some paper on performance optimizations for the Flash Player? Well currently there is just to much to do in order to get it done. But I do not want to hide this from you any longer.

Analyzing big BitmapData objects is a pain. For a nice contrast correction, world luminance or any other histogram based filter you need to know about all the pixels (if you want to make it accurate).

On my way from Germany to France a month ago I was thinking about this problem and I found something that is strangely enough faster to read a whole picture — but only for big pictures. For smaller ones fortunately it does not matter that much since the time you have to spend on reading them is around 30ms.

So basically I read through a BitmapData like this:
[code]var x: int;
var y: int;

for (;x < width; ++x)
for (y = 0; y < height; ++y)
color = bmp.getPixel( x, y );[/code]

I guess it is very common to do that. Now this goes row by row (or column by column) through your BitmapData. Now just for fun I was testing what happens if you cycle through your BitmapData without ever resetting x and y. And voilá it is faster. On a 2048x2048 BitmapData it is 336ms vs 739ms. That is a nice performance increase. But funny enough it is slower for smaller bitmaps.

Here are the results (cycling vs. for-loop):

Iterations Cycle[ms] Simple for[ms]
128×128 2.7 2.7
128×128 11.1 10.3
512×512 29.7 28.3
1024×1024 95.4 106.3
2048×2048 355.8 738.6

And here is the code for the faster version:
[code]var y: int;
var x: int;
var m: Boolean = true;

while (true)
{
color = bitmapData.getPixel(m ? x++ : –x, y);

if (x == width || x == 0)
{
if (y++ == height)
break;
m = !m;
}
}[/code]

How To Be Sejooced

Watch it.

Furnace format

There was a quiet additon to the popforge repository. It is our own file format to put your library in a single file. Basically it is just like a zip file. The format is built buy a header, item headers and items. This way it is very easy to navigate through the file and also allows easy streaming access.

At the end it is just a container format that is simple to use. There is a prototype AIR GUI to create the files and then you need one line to transform the file into a simple furnace library which gives you access to all your files again.

I appended the file specifications to the FurnaceFormat.as file for now. Any suggestions are welcome. Checksums are one thing we definitly want to include in the next version.

jooce - public beta sneak (tech) preview

jooce.com - power to the people

As you may know I have been involved in a start-up called jooce. For the last couple of months we were in a private beta for family and friends. Now we open up the curtains a little bit more. Public beta should start next monday. Now the reason why I write this is because I am so excited about our technology. If you look at a system like ours you easily say “I can do that in a day”. I did the same mistake. Before I started working on this sort of beast.

jooce is not an online desktop. Technically speaking it is a platform that allows you to communicate using our IM client and share files instant using an online storage. The whole client is based on AS3 plus the backend — a combination of Java and C++. Since we have an eclectic cocktail of knowledge at jooce I am proud to talk about some features that we came up with.

Media player with seeking using a “big disk”. One of the main features is the media player. The jooce media player allows you to seek through files just like you know it from the Flash Media Server. Since we are a poor start-up we went with the cheaper solution. red5 as the weapon of choice has been optimized and extended to stream files over the network. If we have the time we surely will contribute this to the project. It is so great seeing files being streamd over the network using our internal protocol.

Multiple caching solutions are a second piece that makes such an application actually what it is. All client side operations are done immediately and you only have to synchronize with the server. Unless of course data is requested from the server like opening a folder for the first time. And also pictures are cached as single instances. Basically if I go to your “joocetop” and drag a wallpaper that I like to copy it over to my stuff I will have the same version as you have and it stays cached until one of us actually modifies the data of the file.

Another thing are APIs in the jooce system. All of the components are self-made. Our datagrid can handle more then a 1000 items and for me it scrolls as smooth as it would have only 100. There is a 3D engine involved in switching desktops wich runs fullscreen for me at a 90fps — take in mind all the other stuff that is going on during that process while hopping from one desktop to another. We also use our own event system to get rid of a lot of overhead regarding the memory. It is a mixture of the DOM event model and WinAPI.

So there is a lot of other stuff I could talk about. Like our Webupload supporting YourMinis embeds. We also have a simple physics engine in the system for springs and other funky stuff. But what was it actually that I wanted to say..? Ah, yes. I love my job!

ImageProcessing will go open source

With the release of popforge there was another announcement as well. The Google Code page says that a future project is the ImageProcessing library.

Probably the current version — wich I am not happy with actually — will go there and a better version will come soon supporting asynchronus filter execution for instance. I will not give any date for now but expect a release in the next couple of weeks.




Close
E-mail It