<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.joa-ebert.com - Blog of Joa Ebert &#187; as3</title>
	<atom:link href="http://blog.joa-ebert.com/category/flash/as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joa-ebert.com</link>
	<description>Actionscript3, Flash, Scala, Java, C#, C++, Algorithms &#38; Imageprocessing</description>
	<lastBuildDate>Fri, 11 Nov 2011 11:13:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Software Transactional Memory and Audiotool</title>
		<link>http://blog.joa-ebert.com/2011/02/25/stm-and-audiotool/</link>
		<comments>http://blog.joa-ebert.com/2011/02/25/stm-and-audiotool/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 22:18:17 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[knowledge]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[audiotool]]></category>
		<category><![CDATA[stm]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=755</guid>
		<description><![CDATA[I have tweeted a while ago about the fact that Audiotool does heavily rely on a so called software transactional memory. In this blog post I want to discuss the implementation of our STM and why it is useful. Wikipedia defines STM as: In computer science, software transactional memory (STM) is a concurrency control mechanism [...]]]></description>
			<content:encoded><![CDATA[<p>I have tweeted a while ago about the fact that <a href="http://www.audiotool.com/" target="_blank" title="Audiotool">Audiotool</a> does heavily rely on a so called <a href="http://en.wikipedia.org/wiki/Software_transactional_memory" title="STM">software transactional memory</a>. In this blog post I want to discuss the implementation of our STM and why it is useful.</p>
<p>Wikipedia defines STM as:</p>
<blockquote><p>In computer science, software transactional memory (STM) is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing.</p></blockquote>
<p>First of all when reading this you might think that an STM is not necessary since ActionScript does not support true concurrency and also the <a href="http://bugs.adobe.com/jira/browse/ASL-23" target="_blank">shared-nothing worker proposal</a> will not allow you concurrent memory access. While this holds true you may not forget that concurrency becomes an issue when you have just access to a single core but on multiple machines.</p>
<p>A lesser known fact about Audiotool is also that we have a built-in system for real time collaboration since its beginning. Due to conceptional issues and other prioritized features we were never able to roll it out as a full feature but the technology base is there.</p>
<p>When it comes to multiplayer gaming and network latency you will always have to figure out a system which allows you to share a certain state across multiple machines. In some games the state is synchronized across a certain server. An example is an FPS like Quake3. The Audiotool is unlike Quake3 not a FPS and different conditions have to be met. And this is the reason why I have choosen to implement an STM with very optimistic concurrency control.</p>
<p>The basic idea of my system is to use atomic transactions with commit and revert operations. Those are handled by a transaction manager which performs the basic tasks of an STM. That means: execute all transactions until an error occurs, roll back and try again. Each transaction in the Audiotool contains a guard. The guard defines whether or not one should still execute the transaction.</p>
<p><img src="/wp-content/images/stm_flow.gif" width="193" height="344" border="0" style="float: left; margin-right: 8px;"/>Here is an example of why a guard is important and how all this stuff works. You have two Audiotool instances running that share the same state. We call them <em>A</em> and <em>B</em>. <em>A</em> and <em>B</em> are connected via P2P no an arbitrary network. This means exchanging messages introduces latency and we cannot guarantee that <em>A</em> is at the same state of <em>B</em>.</p>
<p>So what happens? t<sub>0</sub> is committed by <em>A</em>, serialized and sent to <em>B</em> who is committing the same transaction. The same applies to t<sub>1</sub>. t<sub>2</sub> is initiated by <em>B</em>, serialized and sent to <em>A</em>. Everything works fine until <em>B</em> commits t<sub>4</sub>. While t<sub>4</sub> is being transferred to <em>A</em>, <em>A</em> created t<sub>5</sub> and committed it. This means <em>A</em> never saw t<sub>4</sub> when it committed t<sub>5</sub> and <em>B</em> would continue with t<sub>6</sub> ignoring t<sub>5</sub>. <em>A</em> will actually receive t<sub>4</sub> after he commited t<sub>5</sub> so the system will revert t<sub>5</sub>, commit t<sub>4</sub>, commit t<sub>5</sub> if the guard does not prevent it, and both continue at t<sub>6</sub>.</p>
<p>To explain the guard: Imagine the t<sub>5</sub> transaction includes modifications on a device in the Audiotool that is deleted by t<sub>4</sub>. In that case t<sub>5</sub> will never be executed.</p>
<p>So what does this imply? You can guess that each modification of the Audiotool state is in fact handled by a transaction and we carefully have to pick the guards. E.g. if an editor is referenced by a transaction it is part of the guard. However this introduces a second issue: references. Sharing references of objects across a network is a tricky task. I am using &#8220;boxes&#8221; to solve this issue. A box can hold a value and it is guaranteed that it will hold the same value at the same state across the network. A box can be serialized and will be shared between commit and revert states. This means if t<sub>n</sub> creates an object which is referenced by t<sub>n+1</sub> both will use the same box. This also means that I can safely revert t<sub>n+1</sub> and then t<sub>n</sub> and commit them without having to worry that both still reference the same object. And this even works across the network. And in fact we can now also identify whether or not one transaction would conflict with a different one which is a very important condition for the actual implementation.</p>
<p>Right now you might have figured out that a transaction in the Audiotool has the following properties:</p>
<ul>
<li>It is serializable so it can be transferred across the network.</li>
<li>All object references must be stored via &#8220;boxes&#8221;.</li>
<li>A guard is used to determine whether or not to commit a transaction.</li>
<li>Transactions can be committed and reverted.</li>
</ul>
<p>A lot of stuff one has to reason about. But although we do not support live collaboration at the moment we are using the STM. Why? The reason is quite simple. The STM gives us history for free. Since everything is serializable via a very lightweight protocol we can take the last 500 transactions for instance and store them as a compressed ByteArray in memory instead of each as a single object with all its references.</p>
<p>Another very nice option is testing. A serializable history means that one simply has to press a super secret shortcut to dump the whole history and send it to the responsible developer who can reason about every single step that happened which ultimately led to the error. In development mode I usually commit, revert and commit each transaction. Then I also serialize and deserialize them and do the whole thing again.</p>
<p>Since transactions are known by the system we can also write a fuzzer that executes lots of crazy stuff. Sort of Android&#8217;s monkey mode. And ultimately I personally hope that we will get to the point where we will enable live collaboration in the Audiotool of course.</p>
<p>The last feature I implemented is the automatic transformation of arbitrary transactions to a compound transaction. You can guess what this feature actually means for the user :). In fact it is very complex and I implemented it with the STM using only a couple lines of code (of course that is just half the story &#8230;).</p>
<p>If you are interested in writing your own multi user application I think this is a very nice approach since collisions do not happen very often from my experience and the optimistic concurrency in a P2P environment achieves great results in terms of overall latency and feeling. The <a href="http://www.waveprotocol.org/" target="_blank">Google Wave protocol</a> and their <a href="http://www.waveprotocol.org/whitepapers/operational-transform" target="_blank">operational transform</a> is also an interesting read.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2011/02/25/stm-and-audiotool/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=755&amp;md5=f361069b28000698af6f6b5a80c8c2f6" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2011/02/25/stm-and-audiotool/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=755&amp;md5=f361069b28000698af6f6b5a80c8c2f6" type="text/html" />
	</item>
		<item>
		<title>Introducing JITB</title>
		<link>http://blog.joa-ebert.com/2010/08/19/introducing-jitb/</link>
		<comments>http://blog.joa-ebert.com/2010/08/19/introducing-jitb/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 02:07:41 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[fitc]]></category>
		<category><![CDATA[flashplayer]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jitb]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[san francisco]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=636</guid>
		<description><![CDATA[My talk at FITC San Francisco is over and I want to share some of the anouncements from today with you. At the end of my talk I was showing JITB. What you see in the YouTube video I posted a while ago is a Java program executing a SWF. For FITC I added some [...]]]></description>
			<content:encoded><![CDATA[<div align="center"><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/EMm893PRDJM?fs=1&amp;hl=de_DE"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/EMm893PRDJM?fs=1&amp;hl=de_DE" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div>
<p>My talk at FITC San Francisco is over and I want to share some of the anouncements from today with you. At the end of my talk I was showing <a href="http://www.youtube.com/watch?v=-IXvf17GWVI" target="_blank" title="JITB">JITB</a>.</p>
<p>What you see in the YouTube video I posted a while ago is a Java program executing a SWF. For FITC I added some more code and an OpenGL based Display List renderer. In other words: I wrote a Flash Player.</p>
<p>However I should rephrase that statement and say I am attempting to build a Flash Player. The current state is available in the <a href="http://code.google.com/r/joaebert-sf2010-sprint/source/list" target="_blank" title="sf2010-sprint clone">sf2010-sprint</a> clone of Apparat. I will merge the changes into the main Apparat branch when I am back home in Germany.</p>
<p>JITB is currently able to translate a subset of ActionScript code at runtime into Java bytecode and runs nearly at the same speed as native Java. This is a really huge improvement compared to standard ActionScript performance. A lot of smart people worked on the JVM and made it really fast. Apparat will allow you to leverage all this hard work in the future. I am also shooting for Java interoperability at some level so that you can call Java classes from within ActionScript. Hopefully you will be able to use JITB on your desktop machine, on a server or on an Android phone. Basically everywhere Java runs.</p>
<p>There are still a lot of things missing. The whole Flash API needs to be implemented. And the Display List rendering needs a proper OpenGL implementation. However I thought this might be some cool stuff to share with you in its early stages.<br />
My hope is that more people start contributing to the project. Maybe some OpenGL guru wants to take care of the Display List rendering or someone else likes to help implement the Flash API in Java.</p>
<p>I also showed a Raytracer by Nico Zimmermann during my presentation and promised to put the URL on my blog so here it is. His company is called Britzpetermann and the address is <a href="http://www.britzpetermann.com/" target="_blank" title="Britzpetermann">http://www.britzpetermann.com/</a>.</p>
<p><b>Update:</b> Please do not think that this implementation is 30x faster than the Flash Player developed by Adobe. One(!) microbenchmark is never a number you should count on. I would like to make clear that I never said this.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2010/08/19/introducing-jitb/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=636&amp;md5=e3cd48304d4dfb8fee13de1b216671c2" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/08/19/introducing-jitb/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=636&amp;md5=e3cd48304d4dfb8fee13de1b216671c2" type="text/html" />
	</item>
		<item>
		<title>AS3V For Ant Released</title>
		<link>http://blog.joa-ebert.com/2009/06/26/as3v-for-ant-released/</link>
		<comments>http://blog.joa-ebert.com/2009/06/26/as3v-for-ant-released/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 16:43:48 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[as3v]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[fdt]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=388</guid>
		<description><![CDATA[Since I started the development of some other library I completly put AS3V aside because the Eclipse integration with FDT is currently not possible. But since AS3V is working already I decided to release a version really quick that allows you to use AS3V as an Ant Task or simply from command line. I know [...]]]></description>
			<content:encoded><![CDATA[<p>Since I started the development of <a href="http://blog.joa-ebert.com/2009/06/23/a-simple-method-and-taas/" target="_self">some other library</a> I completly put AS3V aside because the Eclipse integration with FDT is currently not possible. But since AS3V is working already I decided to release a version really quick that allows you to use AS3V as an Ant Task or simply from command line.</p>
<p>I know it would be better to have it as an Eclipse Plug-in with nice little markers etc. but for that I need some more extension points in FDT. I do not know about FlexBuilder but it would be probably the same.</p>
<p>The file includes an example build and some test cases that show you how AS3V can detect common errors and mistakes. There is currently not that much documentation available for the rules and parameters you can specify. Putting a list online with all rules and nice descriptions is of course something I would like to do but currently the time for that is missing. I hope everything is self-explaining if you have a look at the readme and example files.</p>
<ul>
<li><a href="http://as3v.joa-ebert.com/as3v.zip" title="AS3V">Download AS3V</a></li>
</ul>
<p><b>Update:</b> The AS3V package has been updated with one bug fix and some modifications so that AS3V will produce a more interesting log output if it fails for some reason. Using AS3V with Eclipse works only if you specify <code>fork="true"</code> like in the Flex SDK example from the build file that comes with the zip.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2009/06/26/as3v-for-ant-released/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=388&amp;md5=abdf8d652bd46d662b3f59a8465e85bf" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/06/26/as3v-for-ant-released/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=388&amp;md5=abdf8d652bd46d662b3f59a8465e85bf" type="text/html" />
	</item>
		<item>
		<title>ActionScript Wiki</title>
		<link>http://blog.joa-ebert.com/2009/03/24/actionscript-wiki/</link>
		<comments>http://blog.joa-ebert.com/2009/03/24/actionscript-wiki/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 22:52:45 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=296</guid>
		<description><![CDATA[I started an ActionScript Wiki at http://wiki.joa-ebert.com/ with most of the articles from my old optimizations paper and some new stuff. See it as a knowledge base for ActionScript optimization techniques, data structures and code snippets. I would appreciate any feedback and suggestions for articles in those or other categories. ActionScript Wiki]]></description>
			<content:encoded><![CDATA[<p>I started an ActionScript Wiki at <a href="http://wiki.joa-ebert.com/" target="_blank">http://wiki.joa-ebert.com/</a> with most of the articles from my old <a href="http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/" target="_self">optimizations paper</a> and some new stuff.</p>
<p>See it as a knowledge base for ActionScript optimization techniques, data structures and code snippets. I would appreciate any feedback and suggestions for articles in those or other categories.</p>
<ul>
<li><a href="http://wiki.joa-ebert.com/" target="_blank">ActionScript Wiki</a></li>
</ul>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2009/03/24/actionscript-wiki/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=296&amp;md5=62e7d2e5d0faa908c7ac516de5d7e73f" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/03/24/actionscript-wiki/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=296&amp;md5=62e7d2e5d0faa908c7ac516de5d7e73f" type="text/html" />
	</item>
		<item>
		<title>Graphs and a floating world</title>
		<link>http://blog.joa-ebert.com/2009/02/16/graphs-and-a-floating-world/</link>
		<comments>http://blog.joa-ebert.com/2009/02/16/graphs-and-a-floating-world/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 12:26:48 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[audiotool]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hobnox]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[layout engine]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=284</guid>
		<description><![CDATA[When you are implementing a pathfinding algorithm you have usually some sort of defined map available. This is in most cases a tile map or a graph of nodes. If you have no nodes and no tiles you have two options: build a graph of nodes or put your smooth environment into a raster with [...]]]></description>
			<content:encoded><![CDATA[<p>When you are implementing a pathfinding algorithm you have usually some sort of defined map available. This is in most cases a tile map or a graph of nodes. If you have no nodes and no tiles you have two options: build a graph of nodes or put your smooth environment into a raster with a defined detail. Option two is usually faster but we have choosen number one for asthetic pleasure in the AudioTool. And we showed that building such a graph at runtime in Flash is something you can do if you  implement clever optimizations.</p>
<p>You will always have problems without some kind of raster. Sometimes more, sometimes less. Usually you have to build your own context of how things are connected and how they behave in your environment. We were discussing a lot about the audio engine and the core structure behind. The most important part of the audio engine is probably the ability to build a linear chain of plugins which process signals that arrive in your speakers at the end of that chain. When we started this part we had a lot of optimizations in mind. Plugins that do not generate any audible output should not go into that chain etc. The code became quite complex and results in a lot of special case scenarios. Imagine a scope which is a pure visual element that shows the incomming waveform. This is a plugin which should not be kicked out of any chain but generates no audible output.</p>
<p>You can imagine that we used a graph for that kind of task. To be more specific: a directed cyclic graph since there is a direction of the flow and we are allowing feedbacks for audio signals. After some time of discussion I started researching for a better way of solving our signal chain. Because I beleive that a problem can be solved the easiest way on a pure mathematical basis I started with a plain graph &#8212; but this time a real graph. After some time I could produce the same output as our old solver but with less lines of code and we got rid of all the special cases.</p>
<p><img src="http://blog.joa-ebert.com/wp-content/images/graphLayout.png" alt="Automatic Graph Layout" width="140" height="140" style="float: right; padding-left: 3px"/>Now having a real graph is fun and I was not surprised that lots of people invested their brainpower in graph algorithms. For the desktop in the AudioTool I always wanted to implement some kind of automatic layout algorithm. My first idea was to build a spring between two editors connected by a cable. I thought that this could be too complex but after spending the last days with graphs this became a possible solution and there are already algorithms which do the same thing: build springs for connections and let the system solve itself. I did some tests in a sandbox already but hopefully I can implement this in the AudioTool before FITC Amsterdam. The graph you see in the picture is a result of the graph layout engine.</p>
<p>But working with graphs opened my eyes even more. I am currently the poor bugger that has to implement a layout engine. Implementing a layout engine is by the way the most ungrateful task I could think of. <img src="http://blog.joa-ebert.com/wp-content/images/layoutFramework.png" width="250" height="169" style="float: left; padding-right: 3px;" alt="Layout Framework"/> Anyways, what if you think about the dependencies in your layout engine as a graph structure? You have usually three cases when calculating a size: relative known size to &#8220;some kind of available size&#8221;, absolute known size, absolute unknown size. Those cases can be reduced to their most simple form on a piece of paper and a graph structure evolves. You can get rid of observers and listeners in such a system if a connection in the graph has the meaning of invoking the layout engine again on a subset of nodes. Those subsets could be optimized even more if you figure out the strongly connected components in the graph. I have to admit that I did not implement this system yet but it makes a lot of sense in theory currently&#8230; something which makes working on a layout engine interesting again ;)</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2009/02/16/graphs-and-a-floating-world/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=284&amp;md5=8857249c95ba65c7ffd44d87d776ebb2" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/02/16/graphs-and-a-floating-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=284&amp;md5=8857249c95ba65c7ffd44d87d776ebb2" type="text/html" />
	</item>
		<item>
		<title>Flash And Image Processing</title>
		<link>http://blog.joa-ebert.com/2009/01/23/flash-and-imageprocessing/</link>
		<comments>http://blog.joa-ebert.com/2009/01/23/flash-and-imageprocessing/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 13:01:49 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[hydra]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[imageprocessing]]></category>
		<category><![CDATA[pixelbender]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=275</guid>
		<description><![CDATA[During the last weeks I have thought about a completly new version of the image processing library. I have done lots of scribbling about what kind of features I want to have and which would be really cool. But there is still a big problem when it comes to dealing with image data in Flash. [...]]]></description>
			<content:encoded><![CDATA[<p>During the last weeks I have thought about a completly new version of the image processing library. I have done lots of scribbling about what kind of features I want to have and which would be really cool. </p>
<p>But there is still a big problem when it comes to dealing with image data in Flash. I have currently different strategies with their pro&#8217;s and con&#8217;s but I can not decide for myself which one makes the most sense.</p>
<ol>
<li>
<h4>BitmapData</h4>
<p>When you are using only one BitmapData to represent an image you have of course access to all the native methods. Life will be a lot easier. But there are certain key issues with the BitmapData. The precision for each channel is limited to 8bit and the main problem is that you will always have to deal with pre-multiplied alpha.  If I want to have a high-quality image processing library this is unacceptable.
</li>
<li>
<h4>Vector.&lt;uint&gt;</h4>
<p>A vector filled with unsigned integers makes sense because this is what you get from a BitmapData and what you can use to set the contents of a BitmapData but working all the times with one integer value and having to do the bit-hassle is really annoying.<br />
The main problem with a Vector of unsigned integers is simply that PixelBender does only accept a Vector of Number values with the length of <code>width * height * 4</code>. So everytime you want to use PixelBender you would have to convert your vector. And also remember that you have only a precision of 8bit per channel. Instead of using a Vector.&lt;uint&gt; I could also use a BitmapData &#8212; the only thing I gain from the vector is that I do not have to deal with pre-multiplied alpha.
</li>
<li>
<h4>Vector.&lt;Number&gt;</h4>
<p>A vector of normalized Number values makes a lot of sense. You are able to use PixelBender with this kind of Vector without having to convert anything. The only problem occurrs when you want to convert your vector into a BitmapData &#8212; but this problem can be solved pretty easy with a PixelBender identity shader. This is also what I used to convert a BitmapData into a vector of Number values since <code>BitmapData.getVector</code> returns only a vector of unsigned integers.</p>
<p>Now all of this does not sound that bad. But there are a lot of problems actually. First of all every time you want to get/set a pixel you have to access four fields of a vector which is way slower than accessing only one field. And the main problem I have is the poor PixelBender support. First of all every time I start a ShaderJob with a vector of fixed length as the target I get an exception that the <code>ShaderJob.start()</code> wants to change the length of my vector. What the fuck? If my Vector has a fixed length of <code>width * height * 4</code> I do not see why the ShaderJob should change this at all.</p>
<p>Another problem is PixelBender itself. In order to rebuild a method like <code>BitmapData.fillRect()</code> you have to visit every channel for every pixel if the rectangle is the full image size. Using ActionScript for this task is out of the question because it will be way to slow. So I thought I write a fillRect-Shader. No problem. The shader works very well in the PixelBender Toolkit but I get only garbage in the Flash Player. Now I am really uncertain if I should continue with this approach since even simple tasks fail. If my target is a BitmapData it works very well by the way. So if I want to fill a rectangle with PixelBender and I have only a Vector.&lt;Number&gt; I have to create a BitmapData with equal size to use it as the target with the ShaderJob and then use an identity shader to convert the BitmapData back into a Vector.&lt;Number&gt;. And once we are using a BitmapData we have again lost the precision and we have pre-multiplied alpha. This would not be a problem if PixelBender would work with Vector.&lt;Number&gt; as good as with a BitmapData.</p>
</li>
<li>
<h4>Vector.&lt;RGBA&gt; and single-linked list</h4>
<p>Having a Vector.&lt;RGBA&gt; in combination with a single linked list is by far the best what you can get in terms of speed. We use this in our audio engine as well. You need to access every field only once and you can iterate over the single-linked list very fast. There are only two major issues. In order to use PixelBender you have to convert this structure which has the length <code>width * height</code> into a Vector.&lt;Number&gt; of the length <code>width * height * 4</code> and you will have the same problems as described above. If you want to have a BitmapData representation you will have to convert the Vector manually to a BitmapData which will also cost you a lot.
</li>
</ol>
<p>My main problem is that I do not like any of those possible approaches. In the old ImageProcessing library I used a BitmapData for each channel but I would not do that again. The main problem is that Adobe has released a very buggy version of the PixelBender run-time in Flash. I would criticize also that we have so many different formats for pixel data which do not fit together. Sometimes you need a Vector.&lt;uint&gt;, sometimes you need a Vector.&lt;Number&gt; &#8212; sometimes the endian is flipped (Adobe Alchemy) and working with the BitmapData only  &#8212; which sounds reasonable &#8212; is a pain because you will never get around pre-multiplied alpha. I would love to have a primitive RGBA data type for image processing which I could feed into PixelBender (color4) and which I could get and set to a BitmapData as a Vector.&lt;RGBA&gt;. If those RGBA elements would be also a single-linked list &#8212; even better.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2009/01/23/flash-and-imageprocessing/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=275&amp;md5=703397f65d0685686af382574e96dfac" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/01/23/flash-and-imageprocessing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=275&amp;md5=703397f65d0685686af382574e96dfac" type="text/html" />
	</item>
		<item>
		<title>Alchemy, ActionScript and the ASC</title>
		<link>http://blog.joa-ebert.com/2008/12/01/alchemy-actionscript-asc/</link>
		<comments>http://blog.joa-ebert.com/2008/12/01/alchemy-actionscript-asc/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 12:57:12 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[alchemy]]></category>
		<category><![CDATA[asc]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[nicolas cannasse]]></category>
		<category><![CDATA[pixelbender]]></category>
		<category><![CDATA[ralph hauwert]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=265</guid>
		<description><![CDATA[Ralph Hauwert put a very interesting blog post up no his blog about Adobe Alchemy. Basically he was reading my mind with this post. I want to a step further now. But please keep in mind that I am definitly not a compiler expert or have deep knowledge of the Flash Player. Everything I write [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.unitzeroone.com/" target="_blank">Ralph Hauwert</a> put a very interesting <a href="http://www.unitzeroone.com/blog/2008/11/28/adobe-alchemy-is-it-actionscript-heresy/" target="_blank">blog post</a> up no his blog about <a href="http://labs.adobe.com/technologies/alchemy/" target="_blank">Adobe Alchemy</a>. Basically he was reading my mind with this post.</p>
<p>I want to a step further now. But please keep in mind that I am definitly not a compiler expert or have deep knowledge of the Flash Player. Everything I write about is in my opinion common sense and comes from a long time of reverse engineering and autodidactic learning.</p>
<p><span id="more-265"></span></p>
<h3>Alchemy</h3>
<p>First of all I have to say that Alchemy is a great research project and I have full respect for Scott Peterson and his work. He did an awesome job and I am more than happy that Alchemy has now been released on labs because people begin to question now the Flash Player, ActionScript and the ASC (ActionScript Compiler).<br />
So why is Alchemy faster than using plain ActionScript &#8212; or is that true at all? I do not want to disappoint anyone here but writing C/C++ code instead of ActionScript is not the right way. Alchemy will never be faster than your plain handoptimized ActionScript and it still has to prove for me that it is actually faster. All my comparisons between Alchemy and ActionScript showed that using ActionScript is in most cases faster.<br />
But it makes sense to use Alchemy. An audio encoder for instance runs for a long time on its own without having to exchange data. Currently it is very slow to transfer data between Alchemy and ActionScript on every frame. This does not mean Alchemy is bad, but it will not work for your <a href="http://www.assembla.com/spaces/floorplanner-alchemy/documents/dZ88ruUByr3Anoab7jnrAJ/download/invsqrt.c" target="_blank">fast inverse square root</a> algorithm.<br />
So why can Alchemy be faster at all? There are a couple of reasons for that.</p>
<ol>
<li>C/C++ can be compiled and optimized much better than ActionScript</li>
<li>The language offers you features you would dream about as an ActionScript programmer (operator overloading, method inlining, templates, etc.)</li>
<li>The <a href="http://www.llvm.org/" target="_blank">LLVM</a> does a really good job on optimizing its intermediate language</li>
<li>Alchemy comes with some <a href="http://ncannasse.fr/blog/virtual_memory_api" target="_blank">new opcodes</a> for the Flash Player that allow very fast ByteArray operations</li>
<li>Alchemy uses a modified ASC that supports inlining of Flash Player bytecodes.</li>
</ol>
<p>So just to make one thing cristal clear: If the new opcodes would not exist, Alchemy would produce very poor results in terms of execution speed. But albeit that I have to disappoint you about the execution speed of Alchemy in general. Nicolas Cannasse wrote an <a href="http://www.ncannasse.fr/blog/adobe_alchemy" target="_blank">interesting blog post</a> about this issue and I completely agree. ActionScript does not support a lot of features which C/C++ offers &#8212; pointers for instance. All those features have to be wrapped and this means a significant speed loss.<br />
But I do not want to start an Alchemy bashing here. I still think it is a really great technology and the main use case is not fast code execution. But it brings me to my next points: The ActionScript language and the ASC.</p>
<h3>ActionScript</h3>
<p>ActionScript has been designed several years ago and Adobe had always the incentive to be ECMA compilant. Being standards compilant reduces a certain level of innovation and recuded the power of the Flash Player in the last years. Right now, ActionScript 3 is <a href="http://whydoeseverythingsuck.com/2008/08/ru-roh-adobe-screwed-by-ecmascript.html" target="_blank">not an ECMA compilant language</a>. And I am not saying this because ECMA Script 4 has been dropped. ActionScript 3 added additional &#8220;features&#8221; even before that happened.<br />
For a long time ActionScript 3 has been very close in terms of its ECMA compilance but I think it is now time for innovation. The ActionScript 3 language does not fulfill most of the professional needs.<br />
Have you ever looked at <a href="http://www.haxe.org/" target="_blank">haXe</a>? I hope you did. haXe is definitly not perfect but I want give you a small excerpt of haXe language features which will make your mouth water:</p>
<ul>
<li>You are able to use <a href="http://www.haxe.org/ref/type_params" target="_blank">type parameters</a></li>
<li>You are able to use <a href="http://www.haxe.org/ref/type_advanced" target="_blank">function types</a> like <code>Event -> Void</code> for an event listener instead of <code>Function</code></li>
<li>Enums instead of the <code>public static const</code> convulsion</li>
</ul>
<p>Why am I talking about haXe at all? Java has most of those features implemented as well and several other languages too. But haXe can output a SWF so we can compare it to ActionScript. haXe is in a lot of ways superior to ActionScript and I did not talk about the compiler yet.<br />
The quintessence is that ActionScript is not a feature rich language compared to mature ones. And even a single French genius can develop something better than a multi-million dollar company. What the hell is going on here?<br />
The main problem of ActionScript is that you lose most of your types along the way and therefore the compiler can not produce a good output. E.g. everytime you put some object into an Array in ActionScript its type is lost unless you cast of course when reading again &#8212; and I hope you do that. This is a really big problem. This is the reason why Alchemy can produce &#8220;better ActionScript&#8221; than you. Not because you are stupid but because you do not have the tools in ActionScript to do that. And this is a shame for Adobe. So many great developers could produce such a great output but they are not allowed to.</p>
<h3>ActionScript Compiler</h3>
<p>One of the main problem in the whole Flash universe is the ActionScript compiler. This is a little bit harder to explain because it is a little bit more abstract. Some problems exist because of the ActionScript language nature. But some problems exist because of the compiler itself. Let me explain this with an example:<br />
<code><br />
package {<br />
	public final class Example extends flash.display.Sprite {<br />
		public function Example() {<br />
			var a: int = 1+2;<br />
			var b: int = a;<br />
			var c: int = b+1;<br />
		}<br />
	}<br />
}<br />
</code><br />
This code will produce exactly this output for the constructor:<br />
<code><br />
get_local0<br />
pushscope<br />
get_local0<br />
constructsuper 0<br />
<b>pushbyte 1<br />
pushbyte 2<br />
add<br />
convert_i<br />
set_local1<br />
get_local1<br />
convert_i<br />
set_local2<br />
get_local2<br />
pushbyte 1<br />
add<br />
convert_i<br />
set_local3</b><br />
returnvoid<br />
</code><br />
The interesting part has been marked bold. Let me explain what is going on here:</p>
<ol>
<li>Put value 1 on the stack</li>
<li>Put value 2 on the stack</li>
<li>Add the two values which are on the stack together using floating point calculus</li>
<li>Convert this floating point value to an integer</li>
<li>Set this value to local register one which is <code>a</code></li>
<li>Put the value of local register one on the stack</li>
<li>Convert this floating point value to an integer</li>
<li>Set the value to local register two which is <code>b</code></li>
<li>Put the value of local register two on the stack</li>
<li>Put value 1 on the stack</li>
<li>Add the two values which are on the stack together using floating point calculus</li>
<li>Convert this floating point value to an integer</li>
<li>Set this value to local register three which is <code>c</code></li>
</ol>
<p>Basically this is an example for the worst output a compiler could produce. First of all <code>b</code> is not needed at all in our code. We hold just the value <code>a</code> in <code>b</code>. <code>a</code> holds a constant value <code>3</code>. Why do we have to add this stuff together at runtime everytime if it is constant? For <code>c</code> we add the constant value <code>1</code> to the constant value <code>3</code> which has been stored in <code>a</code>. The compiler should know at this point three things: a is constant, b is not needed, c is constant. The compiler could just set <code>c</code> to the integer value of <code>4</code>. This is also what I would expect for a <b>S</b>mall<b>W</b>eb<b>F</b>ormat.<br />
But to make it even more interesting: <code>c</code> is not used at all. So why does the constructor contain any bytecode at all besides calling the super constructor? And to make it a little bit more absurd: Try doing the same in <a href="http://labs.adobe.com/technologies/pixelbender/" target="_blank">PixelBender</a> and use <a href="http://www.kaourantin.net/2008/09/pixel-bender-pbj-files.html" target="_blank">Tinic&#8217;s disassembler</a>. You will see that you will not find any of your local variables in the PixelBender bytecode &#8212; which is correct. And the answer why the PixelBender compiler is smarter than the ASC is quite easy: Adobe uses the LLVM for PixelBender as well. Remember the LLVM is what Alchemy is using. This means basically that PixelBender has a better compiler than we have for ActionScript. This is sad and insane but true.<br />
With the haXe compiler you will get nearly the same output as the ASC with certain differences. All the variables are integer values and therefore haXe uses integer calculus. And the last addition does not involve <code>b</code> at all. haXe will not ignore that <code>a</code>, <code>b</code> and <code>c</code> are not used at all. But as I said: haXe is definitly not perfect &#8212; but it is by far better.</p>
<p>I have asked for certain features a lot in the past and implemented them for myself. I asked Adobe to support the __asm keyword even before Alchemy and they refused it. Of course I am a little bit disappointed about that because now they use it for Alchemy and they see it makes sense. Basically having a __asm keyword allows you to get around the nonsense which the ASC produces at least for performance critical loops. This is why I started writing AS3C but it is basically a stupid idea to try optimizing on a byte code level but it integrated very well into my daily workflow.<br />
The Flash Player could work much faster if we could access certain things with ActionScript. The lookup of a class can be stored in a local variable for instance which gives a significat speed boost. haXe already allows you to do that via <code>var m = Math</code>. Why do we have to wait for such things so long?</p>
<h3>Thoughts</h3>
<p>Now after writing about Alchemy, ActionScript and the ASC I think that you get the idea. What we need is a compiler that works. And once the new Alchemy opcodes are supported in the ASC it will be much more fun to write your lightning fast ActionScript code instead of converting C libraries. We need a mature language which allows us to work in professional large-scale environments and which allows the compiler to produce a good output.<br />
Libraries which are a community-darling could become even better, easier to use and faster in execution speed which would result in better user experiences.<br />
I would like to see a faster and more innovative development of ActionScript and the ASC. But then there are the politics and all the bussiness stuff so we will have to wait probably for ages until we get what we need. Right now we can use alternatives such as haXe. And the good thing is that other companies do not sleep as well. I would love to write C# instead of ActionScript but Silverlight just sucks. Maybe someone could write a C#-&gt;LLVM-&gt;ActionScript-&gt;SWF compiler toolkit?</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/12/01/alchemy-actionscript-asc/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=265&amp;md5=9019e237dbeb07615eababc987e06e73" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/12/01/alchemy-actionscript-asc/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=265&amp;md5=9019e237dbeb07615eababc987e06e73" type="text/html" />
	</item>
		<item>
		<title>PixelBender Outline View</title>
		<link>http://blog.joa-ebert.com/2008/10/08/pixelbender-outline-view/</link>
		<comments>http://blog.joa-ebert.com/2008/10/08/pixelbender-outline-view/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 16:36:42 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[hydra]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[fdt]]></category>
		<category><![CDATA[pixelbender]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=245</guid>
		<description><![CDATA[PixelBender Outline is a simple view for Eclipse. It allows you to browse through compiled PixelBender kernel files (pbj). Usually it is quite annoying when working with PixelBender. You always have to debug the shader if you did not write it yourself to know about parameters and stuff. The PixelBender Outline view allows you to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.joa-ebert.com/wp-content/images/pixelBenderOutline.jpg" target="_blank" rel="lightbox[245]"><img src="http://blog.joa-ebert.com/wp-content/images/pixelBenderOutline.gif" alt="PixelBender Outline" border="0" style="float: right; padding-left: 6px"/></a>PixelBender Outline is a simple view for Eclipse. It allows you to browse through compiled PixelBender kernel files (pbj). Usually it is quite annoying when working with PixelBender. You always have to debug the shader if you did not write it yourself to know about parameters and stuff. The PixelBender Outline view allows you to navigate through that information in a comfortable way.</p>
<p><b>PixelBender Outline is working with FDT only</b>. Just grab the JAR file and place it into your Eclipse plugins folder (&#8230;/Eclipse/plugins/) to install it. After restarting Eclipse you can open the view using Window-&gt;Show View-&gt;Other-&gt;PixelBender-&gt;PixelBender Outline.</p>
<p>The outline is updated everytime you select a *.pbj file in the Flash Explorer.</p>
<ul>
<li><a href="http://www.joa-ebert.com/files/jar/com.joa_ebert.eclipse.pbjexplorer_1.0.0.jar" target="_blank">Download</a></li>
</ul>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/10/08/pixelbender-outline-view/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=245&amp;md5=eece2f20ac783db32dd22d10b03e4de9" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/10/08/pixelbender-outline-view/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=245&amp;md5=eece2f20ac783db32dd22d10b03e4de9" type="text/html" />
	</item>
		<item>
		<title>AS3V</title>
		<link>http://blog.joa-ebert.com/2008/10/06/as3v/</link>
		<comments>http://blog.joa-ebert.com/2008/10/06/as3v/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 11:33:12 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[as3v]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=243</guid>
		<description><![CDATA[At the end of my FOTB session I wanted to show you my latest tool called AS3V. Time was short and there was a small glitch so I could not show it. But now I can explain what AS3V really is without having to rush. AS3V is basically a tool that can check for syntactical [...]]]></description>
			<content:encoded><![CDATA[<p>At the end of my FOTB session I wanted to show you my latest tool called <a href="http://as3v.googlecode.com" target="_blank" title="AS3V">AS3V</a>. Time was short and there was a small glitch so I could not show it. But now I can explain what AS3V really is without having to rush.</p>
<p>AS3V is basically a tool that can check for syntactical correctness. It will do with your code what a compiler does but it keeps formatting metadata. That way it can generate an XML skeleton of your code and apply rules on the XML.</p>
<p>You can have a look at the first output AS3V produces <a href="view-source:http://www.joa-ebert.com/files/xml/as3v_00.xml" target="_blank" title="AS3V output">here</a>. The original source code is included in the comment at the top.</p>
<p>As you can see it will be possible to force coding standards for instance and to warn if code could be optimized. I hope that it will be possible to have a first version of a stable parser soon. ANTLR is still giving me a lot of trouble but it is the first time for me working with such a tool as well.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/10/06/as3v/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=243&amp;md5=bd6efecdcce657654b35c8881145bd91" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/10/06/as3v/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=243&amp;md5=bd6efecdcce657654b35c8881145bd91" type="text/html" />
	</item>
		<item>
		<title>AudioTool&#8217;s Private Parts Slides</title>
		<link>http://blog.joa-ebert.com/2008/10/01/audiotools-private-parts-slides/</link>
		<comments>http://blog.joa-ebert.com/2008/10/01/audiotools-private-parts-slides/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 10:10:00 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[knowledge]]></category>
		<category><![CDATA[audiotool]]></category>
		<category><![CDATA[fotb]]></category>
		<category><![CDATA[hobnox]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=235</guid>
		<description><![CDATA[Here are the slides from my Flash On The Beach 2008 session &#8220;AudioTool&#8217;s Private Parts&#8221;. 2mb without a prelaoder. You will need Flash Player 10 to pass through to version detection or you can save the SWF directly to disk and watch it with Flash Player 9. http://www.joa-ebert.com/swfs/lectures/fotb08 http://www.joa-ebert.com/files/swf/lectures/fotb08.swf]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from my <i>Flash On The Beach 2008</i> session &#8220;AudioTool&#8217;s Private Parts&#8221;. 2mb without a prelaoder. You will need Flash Player 10 to pass through to version detection or you can save the SWF directly to disk and watch it with Flash Player 9.</p>
<ul>
<li><a href="http://www.joa-ebert.com/swfs/lectures/fotb08" target="_blank">http://www.joa-ebert.com/swfs/lectures/fotb08</a></li>
<li><a href="http://www.joa-ebert.com/files/swf/lectures/fotb08.swf" target="_blank">http://www.joa-ebert.com/files/swf/lectures/fotb08.swf</a></li>
</ul>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/10/01/audiotools-private-parts-slides/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=235&amp;md5=84c47ab151a4767c7d7c0e3790449f3b" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/10/01/audiotools-private-parts-slides/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=235&amp;md5=84c47ab151a4767c7d7c0e3790449f3b" type="text/html" />
	</item>
		<item>
		<title>Tween engine comparison</title>
		<link>http://blog.joa-ebert.com/2008/09/08/tween-engine-comparison/</link>
		<comments>http://blog.joa-ebert.com/2008/09/08/tween-engine-comparison/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 18:33:04 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[fot]]></category>
		<category><![CDATA[fotb]]></category>
		<category><![CDATA[gtween]]></category>
		<category><![CDATA[hobnox]]></category>
		<category><![CDATA[tweenlite]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=230</guid>
		<description><![CDATA[I wrote a while ago about our tween engine at Hobnox but I did not post any performance demos. Here are the results for 1000 DisplayObjects with manipulation on their scaleX, scaleY, alpha, x, y and rotation properties. It is also very important that you take a look at the memory behaviour. A click starts [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a while ago about <a href="http://blog.joa-ebert.com/2008/05/07/tweening-and-object-pools/" target="_blank">our tween engine</a> at <a href="http://www.hobnox.com/" target="_blank">Hobnox</a> but I did not post any performance demos.</p>
<p>Here are the results for 1000 DisplayObjects with manipulation on their scaleX, scaleY, alpha, x, y and rotation properties.  It is also very important that you take a look at the memory behaviour. A click starts the tweening.</p>
<ul>
<li><a href="http://www.joa-ebert.com/swfs/tween/Hobnox" target="_blank">Hobnox</a></li>
<li><a href="http://www.joa-ebert.com/swfs/tween/GTween" target="_blank">GTween</a></li>
<li><a href="http://www.joa-ebert.com/swfs/tween/TweenLite" target="_blank">TweenLite</a></li>
</ul>
<p>As you can see it makes a lot of sense to stay type-safe and to manage the memory you are using on your own.<br />
I will talk about those concepts in my next session <i>AudioTool&#8217;s Private Parts</i> in <a href="http://www.flashonthebeach.com/" target="_blank">Brighton</a> and <a href="http://www.flashontap.com/" target="_blank">Boston</a>. Since optimization on a code level is trivial the main performance boost is achieved by re-thinking algorithms, structures and concepts. I guess one of the most interesting topics will be the optimization of our cable solver which was running <code>O(n^2)</code> (really!), then <code>O(n(n+1)/2)</code> and could be minimized to a rare <code>O(n(n-4)/2)</code> worst-case.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/09/08/tween-engine-comparison/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=230&amp;md5=b0f3c74aaa5acbc1563d384c1e7e6e90" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/09/08/tween-engine-comparison/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=230&amp;md5=b0f3c74aaa5acbc1563d384c1e7e6e90" type="text/html" />
	</item>
		<item>
		<title>PixelBender Runtime Compilation</title>
		<link>http://blog.joa-ebert.com/2008/09/08/pixelbender-runtime-compilation/</link>
		<comments>http://blog.joa-ebert.com/2008/09/08/pixelbender-runtime-compilation/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 08:34:28 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[dynamic loop unrolling]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[pixelbender]]></category>
		<category><![CDATA[runtime compilation]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=227</guid>
		<description><![CDATA[Tinic posted today his PixelBender assembler and disassembler. This makes me happy, because now I can post an experiment I could not show for a while. If you know PixelBender, than you know that you can not create loops. What you could do is unroll all constant loops with a fixed length. If you know [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kaourantin.net/2008/09/pixel-bender-pbj-files.html" target="_blank">Tinic</a> posted today his PixelBender assembler and disassembler. This makes me happy, because now I can post an experiment I could not show for a while.</p>
<p>If you know PixelBender, than you know that you can not create loops. What you could do is unroll all constant loops with a fixed length. If you know simple convolution filters like a blur, you know that you need an xy-loop and you know it should not be possible with PixelBender at all. Let me prove you wrong and have a look at <a href="http://je2050.joa-ebert.com/pb/" target="_blank">dynamic loop unrolling with PixelBender</a> (be careful with high values!). </p>
<p>I built a library to assemble and disassemble PixelBender kernels at runtime. I wrapped it also in a high level API so basically you can create a new Kernel by doing <code>var kernel: Kernel = new Kernel();</code>. Then when you need your shader as a ByteArray you simple call <code>kernel.compile()</code>. There are still some glitches here and there but I hope that I can release the source code pretty soon.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/09/08/pixelbender-runtime-compilation/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=227&amp;md5=82cfc4e268fef0c211cf0d123078e795" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/09/08/pixelbender-runtime-compilation/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=227&amp;md5=82cfc4e268fef0c211cf0d123078e795" type="text/html" />
	</item>
		<item>
		<title>Compiling dependent SWF files</title>
		<link>http://blog.joa-ebert.com/2008/09/05/compiling-dependent-swf-files/</link>
		<comments>http://blog.joa-ebert.com/2008/09/05/compiling-dependent-swf-files/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 15:44:48 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[audiotool]]></category>
		<category><![CDATA[compc]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mxmlc]]></category>
		<category><![CDATA[swc]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=225</guid>
		<description><![CDATA[Last night I spent about 9 hours writing a build script for the AudioTool allowing us to compile each plugin into its own SWF container. I think it is the first time a Flash project is taking more than 5 minutes for me to compile completly. I figured out that it is definitly not easy [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.joa-ebert.com/wp-content/images/audiotool_antbuild.jpg" border="0" alt="AudioTool Ant build" style="float: left; padding-right: 3px"/>Last night I spent about 9 hours writing a build script for the AudioTool allowing us to compile each plugin into its own SWF container. I think it is the first time a Flash project is taking more than 5 minutes for me to compile completly.</p>
<p>I figured out that it is definitly not easy to handle the mxmlc or compc in a way we needed it to be. The point is that we have for each plugin three modules A, B, C and a library D. A depends on D. B depends on A and D. C depends on A, B and D. Now to make it even more complex we have A, B, C and D in one project so that developing in this environment stays still simple. The solution to compile all modules in a way we need them to be was first generating unique entry points for the SWF files because we do not want to work with SWC libraries (or the SWF inside the SWC package). After having the unique entry points we compile D (and its dependencies as well) without including the source of A, B or C. Afterwards we can compile A. But B is dependent on A so we have to compile a SWF for A and then a SWC for A so B can link to A as an external library. C is also analog to this but needs B as a library as well. In the end it was 5am and I was happy to have the complete build working which generates a lot of SWF files and SWC libraries.</p>
<p>Since it is very hard to configure Ant for this (I was using XSL in the beginning for automated code generation) I started developing my own Ant tasks. I have to say that it is really simple and saved us hours of work. We have now one single XML file containing the dependencies and the Ant task will do the rest (code generation, compile tasks, etc.).</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/09/05/compiling-dependent-swf-files/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=225&amp;md5=ffa694ebe702e173087c14f3be327d27" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/09/05/compiling-dependent-swf-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=225&amp;md5=ffa694ebe702e173087c14f3be327d27" type="text/html" />
	</item>
		<item>
		<title>FDT supports Vector syntax now</title>
		<link>http://blog.joa-ebert.com/2008/08/11/fdt-supports-vector-syntax-now/</link>
		<comments>http://blog.joa-ebert.com/2008/08/11/fdt-supports-vector-syntax-now/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 12:58:25 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[fdt]]></category>
		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=211</guid>
		<description><![CDATA[This FDT update makes me so happy that I have to post about it. The Powerflasher FDT developers implemented the new Vector.&#60;T&#62; syntax. Hooray &#8212; we can make full use of the Vector class! FDT is implementing it also in a nice way. So for instance if you have a Vector.&#60;int&#62; named vec and you [...]]]></description>
			<content:encoded><![CDATA[<p>This <a href="http://fdt.powerflasher.com/" target="_blank">FDT</a> update makes me so happy that I have to post about it. The Powerflasher FDT developers implemented the new <code>Vector.&lt;T&gt;</code> syntax. Hooray &#8212; we can make full use of the Vector class!</p>
<p>FDT is implementing it also in a nice way. So for instance if you have a <code>Vector.&lt;int&gt;</code> named <code>vec</code> and you write <code>var sprite: Sprite = vec[0]</code> this will result in an error because FDT knows that your Vector was typed <code>int</code>.</p>
<p>There are still some <a href="http://fdt.powerflasher.com/forum/viewtopic.php?f=24&#038;t=2403&#038;sid=" target="_blank">glitches</a> here and there but I hope this will be fixed soon as well. </p>
<p>By the way I am using the <a href="http://fdt.powerflasher.com/forum/viewtopic.php?f=21&#038;t=1896&#038;sid=" target="_blank">beta site</a> to update my FDT &#8212; so if you want to have Vector support too you should use the beta update site.</p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/08/11/fdt-supports-vector-syntax-now/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=211&amp;md5=3e54456c75cca5bfc79a004d1b614555" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/08/11/fdt-supports-vector-syntax-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=211&amp;md5=3e54456c75cca5bfc79a004d1b614555" type="text/html" />
	</item>
		<item>
		<title>AS3C &#8212; take a look inside</title>
		<link>http://blog.joa-ebert.com/2008/08/11/as3c-take-a-look-inside/</link>
		<comments>http://blog.joa-ebert.com/2008/08/11/as3c-take-a-look-inside/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 09:09:35 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[c++ and others]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[as3c]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=209</guid>
		<description><![CDATA[I have started working on AS3C at the end of last year. After a quick prototype the development stagnated and I added just several fixes and tests to the code. Basically I started AS3C as a complete C# newcommer and because of that the code is very ugly. Due to the fact that I do [...]]]></description>
			<content:encoded><![CDATA[<p>I have started working on <a href="http://as3c.googlecode.com/" target="_blank">AS3C</a> at the end of last year. After a quick prototype the development stagnated and I added just several fixes and tests to the code. Basically I started AS3C as a complete C# newcommer and because of that the code is very ugly.</p>
<p>Due to the fact that I do not have much free time to continue developing AS3C I think it is the right time to release the source-code on the one hand and to let people experiment with it on the other hand.</p>
<p>You can either download the sources and build AS3C manually (you will need <a href="http://www.componentace.com/zlib_.NET.htm" target="_blank">zlib.net</a>) or download a binary from <code>trunk/bin/</code>.</p>
<p>When using AS3C you will need the ActionScript from the SVN. Remember that you write real ActionScript code which gets translated by AS3C. There is also one undocumented and very experimental feature existing. If you run <code>as3c.exe -optimize main.swf</code> you could get some speed improvements if you have heavy loops using the Math class. But it could also destroy the SWF so do not forget to make a backup :o)</p>
<ul>
<li><a href="http://as3c.googlecode.com/" target="_blank">AS3C on GoogleCode</a></li>
</ul>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/08/11/as3c-take-a-look-inside/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=209&amp;md5=4076e62b3121449f1ab304680979310a" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/08/11/as3c-take-a-look-inside/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=209&amp;md5=4076e62b3121449f1ab304680979310a" type="text/html" />
	</item>
		<item>
		<title>ActionScript 3 Quine</title>
		<link>http://blog.joa-ebert.com/2008/08/04/actionscript-3-quine/</link>
		<comments>http://blog.joa-ebert.com/2008/08/04/actionscript-3-quine/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 13:43:58 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[quine]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=201</guid>
		<description><![CDATA[A quine is a programm emitting its own source-code. I guess this is the most simple variant one could produce. package { import flash.display.Sprite; /** * @author Joa Ebert */ public class Main extends Sprite { public function Main() { var i: int; var c: Function = String.fromCharCode; var q: Array = [ 'package', '{', [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://en.wikipedia.org/wiki/Quine_(computing)" target="_blank">quine</a> is a programm emitting its own source-code. I guess this is the most simple variant one could produce.</p>
<p><span id="more-201"></span></p>
<p><code></p>
<pre>
package
{
	import flash.display.Sprite;

	/**
	 * @author Joa Ebert
	 */
	public class Main extends Sprite
	{
		public function Main()
		{
			var i: int;
			var c: Function = String.fromCharCode;
			var q: Array = [
				'package',
				'{',
				'\timport flash.display.Sprite',
				'',
				'\t/**',
				'\t * @author Joa Ebert',
				'\t */',
				'\tpublic class Main extends Sprite',
				'\t{',
				'\t\tpublic function Main()',
				'\t\t{',
				'\t\t\tvar i: int;',
				'\t\t\tvar c: Function = String.fromCharCode;',
				'\t\t\tvar q: Array = [',
				'\t\t\t];',
				'\t\t\tfor(;i<14;++i)trace(q[i]);',
				'\t\t\tfor(i=0;i<21;++i)trace(c(9)+c(9)+c(9)+c(9)+c(39)+String(q[i]).replace(new RegExp(c(92)+"x09","g"),c(92)+"t")+c(39)+",");',
				'\t\t\tfor(i=14;i<21;++i)trace(q[i]);',
				'\t\t}',
				'\t}',
				'}',
			];
			for(;i<14;++i)trace(q[i]);
			for(i=0;i<21;++i)trace(c(9)+c(9)+c(9)+c(9)+c(39)+String(q[i]).replace(new RegExp(c(92)+"x09","g"),c(92)+"t")+c(39)+",");
			for(i=14;i<21;++i)trace(q[i]);
		}
	}
}
</pre>
<p></code></p>
<div class="none"><div class="g-plusone" data-href="http://blog.joa-ebert.com/2008/08/04/actionscript-3-quine/" size="standard" count="true"></div></div> <p><a href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=201&amp;md5=f29273033fbbf22d3a469c7bee6407e3" title="Flattr" target="_blank"><img src="http://blog.joa-ebert.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2008/08/04/actionscript-3-quine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://blog.joa-ebert.com/?flattrss_redirect&amp;id=201&amp;md5=f29273033fbbf22d3a469c7bee6407e3" type="text/html" />
	</item>
	</channel>
</rss>

