<?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>Smart-Page.net &#187; reconstruct</title>
	<atom:link href="http://www.smart-page.net/blog/tag/reconstruct/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.smart-page.net/blog</link>
	<description>C++ / C# / Py / Actionscript ... &#039;My God. It&#039;s full of stars!&#039;</description>
	<lastBuildDate>Thu, 23 Jun 2011 00:14:09 +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>SmartAA &#8211; reconstruct anti aliasing with Pixel Bender</title>
		<link>http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/</link>
		<comments>http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 00:59:43 +0000</pubDate>
		<dc:creator>flashgordon</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[After Effects]]></category>
		<category><![CDATA[aliasing]]></category>
		<category><![CDATA[anti]]></category>
		<category><![CDATA[b-spline]]></category>
		<category><![CDATA[bicubic]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Mitchell-Netravali]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Pixel Bender]]></category>
		<category><![CDATA[reconstruct]]></category>

		<guid isPermaLink="false">http://www.smart-page.net/blog/?p=801</guid>
		<description><![CDATA[<a href="http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/" title="SmartAA &#8211; reconstruct anti aliasing with Pixel Bender"><img src="http://www.smart-page.net/blog/wp-content/uploads/yapb_cache/smartaa1.3nzh85x4xvebmsc00gc0o4440.h9fw4mcunmtegc04wgoo4wck.th.jpeg" width="200" height="150" alt="SmartAA &#8211; reconstruct anti aliasing with Pixel Bender" style="float:left;padding:0 10px 10px 0;" ></a>About three decades ago, pixels where as big as toasters &#8211; and mostly green. Today we have millions of them to deal with, and the terms anti-/aliasing are part of our daily live and every time an image is scaled, it gets interpolated to keep those bad &#8220;stairs&#8221; away from our eyes. But what if [...]]]></description>
			<content:encoded><![CDATA[<a href="http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/" title="SmartAA &#8211; reconstruct anti aliasing with Pixel Bender"><img src="http://www.smart-page.net/blog/wp-content/uploads/yapb_cache/smartaa1.3nzh85x4xvebmsc00gc0o4440.h9fw4mcunmtegc04wgoo4wck.th.jpeg" width="200" height="150" alt="SmartAA &#8211; reconstruct anti aliasing with Pixel Bender" style="float:left;padding:0 10px 10px 0;" ></a><p>About three decades ago, pixels where as big as toasters &#8211; and mostly green.</p>
<p>Today we have millions of them to deal with, and the terms anti-/aliasing are part of our daily live and every time an image is scaled, it gets interpolated to keep those bad &#8220;stairs&#8221; away from our eyes.</p>
<p>But what if the source image is aliased in the first place?</p>
<p><b>Checkout the <a href="http://www.smart-page.net/as3/sp_smartaa" target="_blank">demo of SmartAA!</a></b><br />
<br/><br />
<span id="more-801"></span><br />
While upsaling is the most common cause of <a href="http://en.wikipedia.org/wiki/Aliasing" target="_blank">aliasing</a>, there are images that are naturally aliased &#8211; for example images from a 3D render engine.</p>
<p>Of course there are many ways to <a href="http://en.wikipedia.org/wiki/Antialiasing" target="_blank">antialias</a> cg images when generating them &#8211; for example by rendering to a higher resolution than targeted and downscaling the result (FSAA)- or by rendering and merging four slightly offset variations.</p>
<p>While this is as computational intensive as it sounds, modern GPU´s can handle this task rather easily as they have their buffers and hardwired magic to do so, but still it’s not uncommon to come along aliased images in the world of computer graphics.</p>
<p>So is all this material &#8220;useless&#8221; or can an image that has never seen any antialiasing, or has been upscaled with the <a href="http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation" target="_blank">nearest neighbour</a> method, be reconstructed?</p>
<p>In fact all that modern imaging software does when rescaling an image is reconstructing its pixels to fit the new dimensions &#8211; most times with a <a href="http://en.wikipedia.org/wiki/Bicubic_interpolation" target="_blank">bicubic filter</a>.</p>
<p><img src="http://www.smart-page.net/blog/wp-content/uploads/2010/02/smartAA01.jpg" alt="" title="smartAA01" width="692" height="138" class="alignnone size-full wp-image-805" /></p>
<h3 style="margin-top:10px; margin-bottom:5px">SmartAA is a bicubic BC-spline reconstruction filter for PixelBender.</h3>
<p>Its 3&#215;3 kernel gathers all neighboring pixels of the one to reconstruct and weights them with the <a href="http://de.wikipedia.org/wiki/Mitchell-Netravali-Filter" target="_blank">Mitchell-Netravali</a>(german link) filter.</p>
<p>In essence, this means that each pixel is modified by the average color of its surrounding friends.<br />
While &#8220;average&#8221; being the wrong term here as the influence of each pixel is determined by the spline curve of the Mitchell-Netravali filter.</p>
<p>This eliminates those hard, &#8220;stair-like&#8221; artifacts of the aliasing by visually &#8220;softening&#8221; or unsharping the image.</p>
<p>However this is not simply a destructive blurring effect but a reconstructive analysis of the source &#8220;signal&#8221;.</p>
<p><br/><br />
There are many known filters that do this hard job &#8211; it´s not easy to reconstruct information that was partly lost (or never there in the first place).<br />
<img src="http://www.smart-page.net/blog/wp-content/uploads/2010/02/space.jpg" alt="" title="space" width="175" height="179" class="alignright size-full wp-image-811" /><br />
Thus all of them suffer of the same issues &#8211; the result always shows some artifacts.<br />
Mostly it’s a visible unsharping, <a href="http://en.wikipedia.org/wiki/Anisotropy" target="_blank">anisotropy </a>or the so-called &#8220;<a href="http://en.wikipedia.org/wiki/Ringing_artifacts" target="_blank">ringing</a>&#8220;.</p>
<p>In general bicubic reconstruction methods create the best results.</p>
<p>Among the various possible filter methods the windowed Sinc(<a href="http://en.wikipedia.org/wiki/Lanczos_resampling" target="_blank">Lanczos</a>)- and Mitchell-Netravali filter are chosen the most as their output is considered to be the best mix of the inevitable unsharping, anisotropy and ringing.</p>
<p>Just for the record: there are &#8220;better&#8221; solutions, the so called &#8220;adaptive&#8221; or &#8220;smart&#8221; filters that try separate methods on edges, fills and other structures.<br />
They are particularly useful when working with sequences of moving images (video) but again slow to compute.</p>
<p>SmartAA on the other hand is a quite simple implementation of the M.-N. filter and runs blazingly fast when run on the GPU &#8211; producing about 70 redraws per sec on a 1024*768 image.</p>
<p>Unfortunately it´s not nearly as fast on the CPU.<br />
If you have a rather slow machine, you will have seen the demo struggling to keep a 24fps framerate, so its just! that bit too slow to to antialias the pixelated output of a flash based C64 emulator.</p>
<p>That would have been cool&#8230; would love to see something like that.</p>
<p><br/><br />
I kept it flash compatible anyway &#8211; still there might be applications.</p>
<p>Its a matter of personal reception, but to me the M.-N. filter looks better on videos as the inbuild &#8220;smooth&#8221;-method.<br />
Anyway &#8211; flash video has been criticized enaugh for high cpu usage so lets not make things worse <img src='http://www.smart-page.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also: like any reconstruction filter it won´t work in any given scenario as there are some natural and some specific limitations.</p>
<p><img src="http://www.smart-page.net/blog/wp-content/uploads/2010/02/smartAA02.jpg" alt="" title="smartAA02" width="690" height="133" class="alignnone size-full wp-image-815" /></p>
<p><br/><br />
<img src="http://www.smart-page.net/blog/wp-content/uploads/2010/02/smartAA04.jpg" alt="" title="smartAA04" width="254" height="175" class="alignright size-full wp-image-823" /><br />
So what can SmartAA do and what not? Here is a feature/limitation list:</p>
<p><em>Features:</em></p>
<p>- Works with Photoshop, After Effects, Flash<br />
- Supports alpha channel<br />
- Is real-time</p>
<p><em>Limitations:</em></p>
<p>- Does no up/down scaling &#8211; just reconstruction of anti aliasing<br />
- Is scenario specific &#8211; for example text will often look strange<br />
- works only with artifacts in the same pixel space.</p>
<p><br/><br />
Let me elaborate on the last point:<br />
<img src="http://www.smart-page.net/blog/wp-content/uploads/2010/02/smartAA03.jpg" alt="" title="smartAA03" width="200" height="91" class="alignright size-full wp-image-817" /><br />
As SmartAA takes only neighbouring pixels into account it isn´t able to reconstruct aliasing effects that span over greater distances than 2 pixels.<br />
For example if an image exists of 4*4 pixel blocks of the same color, those blocks would get rounded on the edges but will still be visible as rounded blocks.</p>
<p>But it works ideal on sources like aliased output from a render engine, or images that have been upscaled x2 with the nearest neighbour method.<br />
<br/><br />
<strong>Conclusion:</strong></p>
<p>Aliasing should be fought before it ends up within an image as there are more sophisticated methods to keep it from emerging than to reconstruct it after the damage is done.</p>
<p>But sometimes it´s inevitable and if you are looking for a simple but effective way to get rid of that ugly blocks within an image or video &#8211; SmartAA will do the trick.<br />
<br/><br />
<strong>Download:</strong></p>
<p><a href="http://www.smart-page.net/as3/sp_smartaa/SmartAA.zip">Grab the Shader here</a> and use it with Photoshop (<a href="http://www.adobe.com/devnet/pixelbender/" target="_blank">Pixel Bender Plugin</a> needed), After Effects or Flash!<br />
<br/><br />
<strong>Hint:</strong></p>
<p>Try to add a sharpen filter or better an unsharpen mask to the result to counter the blur effect.<br />
Don´t forget to use the width/hight properties &#8211; SmartAA will work without but there will be artifacts on the upper- and lower right corner.</p>
<p><br/><br />
I hope this is helpful to anyone out there and would love to hear some comments or ideas.</p>
<p><br/><br />
Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

