<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>AwkwardGames - Quote: &#34;AwkwardGames ftw!&#34; &#187; CrystalSpace</title>
	<atom:link href="http://awkwardgames.wordpress.com/category/crystalspace/feed/" rel="self" type="application/rss+xml" />
	<link>http://awkwardgames.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 30 May 2012 16:20:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='awkwardgames.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/93619d6e4bc41303265852cc67872beb?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>AwkwardGames - Quote: &#34;AwkwardGames ftw!&#34; &#187; CrystalSpace</title>
		<link>http://awkwardgames.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://awkwardgames.wordpress.com/osd.xml" title="AwkwardGames - Quote: &#34;AwkwardGames ftw!&#34;" />
	<atom:link rel='hub' href='http://awkwardgames.wordpress.com/?pushpress=hub'/>
		<item>
		<title>More Google Summer of Code!</title>
		<link>http://awkwardgames.wordpress.com/2011/08/28/more-google-summer-of-code/</link>
		<comments>http://awkwardgames.wordpress.com/2011/08/28/more-google-summer-of-code/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 09:34:11 +0000</pubDate>
		<dc:creator>tayron</dc:creator>
				<category><![CDATA[awkward]]></category>
		<category><![CDATA[CrystalSpace]]></category>
		<category><![CDATA[Alin]]></category>
		<category><![CDATA[Baciu]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[crystal]]></category>
		<category><![CDATA[crystalspace]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[gamedev]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[of]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[rgb]]></category>
		<category><![CDATA[space]]></category>
		<category><![CDATA[summer]]></category>
		<category><![CDATA[theora]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[yuv]]></category>

		<guid isPermaLink="false">http://awkwardgames.wordpress.com/?p=369</guid>
		<description><![CDATA[Well,  GSoC came to an end and I thought I&#8217;d post an update. As a quick refresher, my project involved adding video decode support to the open source engine CrystalSpace. Everything turned out ok, so I&#8217;m gonna talk a bit about it. I added video decode support through Theora, and open source video compression format. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=awkwardgames.wordpress.com&#038;blog=6119103&#038;post=369&#038;subd=awkwardgames&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well,  GSoC came to an end and I thought I&#8217;d post an update. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As a quick refresher, my project involved adding video decode support to the open source engine <a href="http://www.crystalspace3d.org/" target="_blank">CrystalSpace</a>. Everything turned out ok, so I&#8217;m gonna talk a bit about it.</p>
<p>I added video decode support through <a href="http://theora.org/">Theora</a>, and open source video compression format. The basic idea behind my implementation was to have the main thread to render the scene, and another thread to decode video frames and convert data from the  YCbCr colorspace to RGB. Then, in the main thread, data would be written to one of the buffers, and the buffers would be swapped. I used double buffering.</p>
<p>If I had to give a few tips on video decoding, here&#8217;s what I&#8217;d say:</p>
<p><span style="text-decoration:underline;"><strong>1. Threads</strong></span></p>
<p>If you can, avoid them. Threads introduce concurrency and code that ran perfectly before, will probably run slower and you won&#8217;t know why. If you can get just the right amount of processing transferred over to another thread, you&#8217;ll get a speed boost, but you&#8217;ll have to experiment quite a bit. In my project, I used threads, because you can&#8217;t just use up the main thread (which renders and updates the scene) to do your dirty work. It worked well in the end, but it was a bit of a pain in the ass. Here&#8217;s a nice article on <a href="http://www.gamedev.net/blog/355/entry-2250530-threads-are-cancer/">threads</a>.</p>
<p><strong><span style="text-decoration:underline;">2. Conversion</span></strong></p>
<p>Depending on the colorspace supported by the surface you render the video frames to, you will have to do conversion. I did it on the CPU using Look-up Tables, and it worked well, but just for the 4:2:0 pixel format. 4:2:2 and 4:4:4 were too slow to be useable. My advice, if you&#8217;re doing conversion on the CPU, is to use MMX. I ran some tests on MMX during my project<strong></strong>, and it turned out about 2 times faster. Implementing conversion in MMX using LUTs isn&#8217;t really a hard thing, but you&#8217;ll have to watch out for different compilers. asm tags are usually different for each one. Unfortunately, I din&#8217;t have time to move conversion to MMX. In any case, here&#8217;s a <a href="http://dl.dropbox.com/u/1393021/cs/yuvrgb.pdf">paper </a>about optimizing YUV-&gt;RGB conversion. Alternatively, you can do conversion on the GPU, using a shader. Again, I didn&#8217;t have time to implement this, but here&#8217;s a <a href="http://www.fourcc.org/fccyvrgb.php">reference</a>.</p>
<p><strong><span style="text-decoration:underline;">3. OpenGL</span></strong></p>
<p>The main problem I ran into during this project<strong></strong> is that openGL doesn&#8217;t support multi threading (as far as I know, oGL 3 and up do support it). This is a big problem. You can&#8217;t access an openGL context from outside the thread it was created in. This is annoying because, if you&#8217;re processing an openGL resource on another thread, you need to place a callback in the main thread to apply the changes, which slows you down. Admittedly, the slow down isn&#8217;t that big, but you&#8217;ll see a huge difference between single threaded implementations and multi threaded ones. For example, w/o multi threading, converting th 4:4:4 pixel format (the one used for 720p vids) was pretty fast. As soon as I moved conversion to another thread, due to the synchronization induced by this, it was now too slow to be practical.</p>
<p>&nbsp;</p>
<p>In any case, the project turned out OK, and I&#8217;m happy with it. Learned a lot of things this summer. It was a really nice experience. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This also means I can get back to game dev <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Gonna post a prototype as soon as I have one <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Peace</p>
<br />Filed under: <a href='http://awkwardgames.wordpress.com/category/awkward/'>awkward</a>, <a href='http://awkwardgames.wordpress.com/category/crystalspace/'>CrystalSpace</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/awkwardgames.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/awkwardgames.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/awkwardgames.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=awkwardgames.wordpress.com&#038;blog=6119103&#038;post=369&#038;subd=awkwardgames&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://awkwardgames.wordpress.com/2011/08/28/more-google-summer-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ddd6a16d681739da70f40c2a042b0d3?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">tayron</media:title>
		</media:content>
	</item>
		<item>
		<title>I&#8217;m in Google Summer of Code!</title>
		<link>http://awkwardgames.wordpress.com/2011/05/12/im-in-google-summer-of-code/</link>
		<comments>http://awkwardgames.wordpress.com/2011/05/12/im-in-google-summer-of-code/#comments</comments>
		<pubDate>Thu, 12 May 2011 15:41:53 +0000</pubDate>
		<dc:creator>tayron</dc:creator>
				<category><![CDATA[awkward]]></category>
		<category><![CDATA[CrystalSpace]]></category>

		<guid isPermaLink="false">http://awkwardgames.wordpress.com/?p=364</guid>
		<description><![CDATA[Well, I&#8217;ve been following GSoC for a while now and I finally decided to join. I found a nice graphics engine called CrystalSpace which needed video decode support. So that&#8217;s what I&#8217;m gonna do. Wish me luck! Filed under: awkward, CrystalSpace<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=awkwardgames.wordpress.com&#038;blog=6119103&#038;post=364&#038;subd=awkwardgames&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;ve been following <a href="http://code.google.com/soc/" target="_blank">GSoC </a>for a while now and I finally decided to join. I found a nice graphics engine called <a href="http://www.crystalspace3d.org/" target="_blank">CrystalSpace</a> which needed video decode support. So that&#8217;s what I&#8217;m gonna do.</p>
<p>Wish me luck! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br />Filed under: <a href='http://awkwardgames.wordpress.com/category/awkward/'>awkward</a>, <a href='http://awkwardgames.wordpress.com/category/crystalspace/'>CrystalSpace</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/awkwardgames.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/awkwardgames.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/awkwardgames.wordpress.com/364/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=awkwardgames.wordpress.com&#038;blog=6119103&#038;post=364&#038;subd=awkwardgames&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://awkwardgames.wordpress.com/2011/05/12/im-in-google-summer-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ddd6a16d681739da70f40c2a042b0d3?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">tayron</media:title>
		</media:content>
	</item>
	</channel>
</rss>
