<?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>Emeric&#039;s GSoC blog</title>
	<atom:link href="http://emericdev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://emericdev.wordpress.com</link>
	<description>Development of a hardware-accelerated VP8 video decoder</description>
	<lastBuildDate>Sat, 10 Dec 2011 19:06:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='emericdev.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/187ee15802faf31c7aec5c91479342ad?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Emeric&#039;s GSoC blog</title>
		<link>http://emericdev.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://emericdev.wordpress.com/osd.xml" title="Emeric&#039;s GSoC blog" />
	<atom:link rel='hub' href='http://emericdev.wordpress.com/?pushpress=hub'/>
		<item>
		<title>A comprehensive guide to parallel video decoding</title>
		<link>http://emericdev.wordpress.com/2011/08/26/a-comprehensive-guide-to-parallel-video-decoding/</link>
		<comments>http://emericdev.wordpress.com/2011/08/26/a-comprehensive-guide-to-parallel-video-decoding/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 18:27:28 +0000</pubDate>
		<dc:creator>Emeric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://emericdev.wordpress.com/?p=96</guid>
		<description><![CDATA[As promised, today we’ll talk about video decoding. We will review the most important operations that a decoder has to fulfill, and for each case see what kind of speed boost we can expect with a shader based video decoding. Because video decoding is a complex process and one blog post can hardly be thorough, I’ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=96&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">As promised, today we’ll talk about video decoding. We will review the most important operations that a decoder has to fulfill, and for each case see what kind of speed boost we can expect with a shader based video decoding. Because video decoding is a complex process and one blog post can hardly be thorough, I’ll provide related links for each chapter, if you wish to start your own research on a particular subject <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
</div>
<div style="text-align:justify;">Let’s begin with a quick overview of the most important operations of a VP8 video decoding process :</div>
<div><a href="http://emericdev.files.wordpress.com/2011/08/vp8_decode_pipeline.png"><img class="aligncenter size-full wp-image-97" title="vp8_decode_pipeline" src="http://emericdev.files.wordpress.com/2011/08/vp8_decode_pipeline.png?w=630&#038;h=338" alt="vp8_decode_pipeline" width="630" height="338" /></a></div>
<div>
<div>
<p id="internal-source-marker_0.2992284980136901" dir="ltr"><span id="more-96"></span></p>
<p dir="ltr">A little bit of background is needed before going further.</p>
</div>
<h1>1/ Colors coding</h1>
<p><a href="http://en.wikipedia.org/wiki/Rgb">http://en.wikipedia.org/wiki/Rgb</a><br />
<a href="http://en.wikipedia.org/wiki/Ycbcr">http://en.wikipedia.org/wiki/Ycbcr<br />
</a><a href="http://en.wikipedia.org/wiki/Chroma_subsampling">http://en.wikipedia.org/wiki/Chroma_subsampling</a></p>
</div>
<p style="text-align:left;"><a href="http://emericdev.files.wordpress.com/2011/08/couleurs_original.jpg"><img class="aligncenter size-medium wp-image-98" title="colors_original" src="http://emericdev.files.wordpress.com/2011/08/couleurs_original.jpg?w=300&#038;h=224" alt="colors_original" width="300" height="224" /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">Colors are usually represented in the 24 bits <strong>RGB</strong> scheme (8 bits for each of the 3 components). It is the “native format” for most of the screens and most importantly for the human eye.</p>
<div>
<p id="internal-source-marker_0.2992284980136901" dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/rvb.jpg"><img class="aligncenter size-full wp-image-99" title="RGB" src="http://emericdev.files.wordpress.com/2011/08/rvb.jpg?w=630&#038;h=156" alt="RGB" width="630" height="156" /></a></p>
<p style="text-align:justify;" dir="ltr">But when it comes to video compression, a different scheme is used. It’s called <strong>YCbCr</strong>, and you may know it as “YUV”. It is not a different colorspace than RGB but rather a different way to write it. The fact is that the human eye can see higher difference of luminosity than difference of colors. As for a RGB pixel, a YCbCr pixel has <strong>3 components</strong> : Y is the “<strong>luma</strong>” component, Cb and Cr the “<strong>chroma</strong>” blue and red. The whole components of the same type of a picture are call a <strong>plane</strong>. The trick is to store the two chroma components at quarter resolution and the luma component at full resolution. This is called “chroma sub-sampling”, and the VP8 codec only support “4:2:0” mode.</p>
<p style="text-align:justify;" dir="ltr">So with a 4:2:0 sub-sampling, we have an overall of 50% of the components removed, for a drop of quality almost imperceptible !</p>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/ycbcr.jpg"><img class="aligncenter size-full wp-image-100" title="YCbCr" src="http://emericdev.files.wordpress.com/2011/08/ycbcr.jpg?w=630&#038;h=156" alt="YCbCr" width="630" height="156" /></a></p>
<div>
<h1>2/ Block based coding</h1>
<p style="text-align:justify;" dir="ltr">Most of the computation that we are going to study don’t work on the whole picture, but instead the video encoders divide the picture in <strong>smaller block of data</strong>, easier and especially <strong>faster to process</strong>.</p>
<p style="text-align:justify;" dir="ltr">First we have the “<strong>macroblocks</strong>” which are 16&#215;16 pixels wide, used by the inter-prediction process. Then we have the “<strong>blocks</strong>” of 4&#215;4 pixels, used by the intra-prediction process. Each macroblock includes 16 4&#215;4 blocks of luma components, and 32 2&#215;2 blocks of chroma components (8 for chroma blue, 8 for chroma red).</p>
<p style="text-align:justify;" dir="ltr">In this post I’ll mostly talk of the treatments applied on the 4&#215;4 luma blocks in order to save time, not going too deep on the details.</p>
<p style="text-align:justify;" dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/block_based_coding.png"><img class="aligncenter size-full wp-image-105" title="block_based_coding" src="http://emericdev.files.wordpress.com/2011/08/block_based_coding.png?w=630&#038;h=208" alt="block_based_coding" width="630" height="208" /></a></p>
<div>
<h1 id="internal-source-marker_0.2992284980136901">3/ Entropy decoding</h1>
<p><a href="http://en.wikipedia.org/wiki/Entropy_encoding">http://en.wikipedia.org/wiki/Entropy_encoding</a><br />
<a href="http://en.wikipedia.org/wiki/Arithmetic_coding">http://en.wikipedia.org/wiki/Arithmetic_coding</a></p>
<p>The first process in “decoding order” is the entropy decoder. Lets paraphrase wikipedia :</p>
<div>
<blockquote>
<p style="text-align:justify;" dir="ltr">In information theory an entropy encoding is a <strong>lossless data compression scheme</strong> that is independent of the specific characteristics of the medium.</p>
<p style="text-align:justify;" dir="ltr">One of the main types of entropy coding creates and assigns a unique prefix-free code to each unique symbol that occurs in the input. These entropy encoders then <strong>compress data by replacing each fixed-length input symbol by the corresponding variable-length prefix-free output codeword</strong>. The length of each codeword is approximately proportional to the negative logarithm of the probability. Therefore, <strong>the most common symbols use the shortest codes</strong>.</p>
</blockquote>
</div>
<div style="text-align:justify;" dir="ltr">The VP8 codec uses an entropy coder called “Boolean Entropy Decoder”, a form of arithmetic coding, which uses only two symbols : 0 or 1. It is faster than typical arithmetic coding and allows purely integer implementation.</div>
<p style="text-align:justify;" dir="ltr">The only thing we need to known, is that entropy decoding is a very linear process and <strong>cannot be parallelized</strong>. The symbols are decompressed one by one (the bitstream is processed bit by bit in the case of arithmetic coding, i/o are bufferized however) and each symbol decoded updates the probability context of the decoder. Loose one bit, loose one frame.</p>
<p style="text-align:justify;" dir="ltr">Conclusion ? The entropy decoding stays in the CPU. What we need to do though is to decode the bitstream content for one frame in one pass, and not to start other processes as soon as enough data are available. That way we will have all the data to start other processes in parallel.</p>
<div>
<h1 id="internal-source-marker_0.2992284980136901" style="text-align:justify;">4/ Inverse transformation</h1>
<p><a href="http://en.wikipedia.org/wiki/Discrete_cosine_transform">http://en.wikipedia.org/wiki/Discrete_cosine_transform<br />
</a><a href="http://en.wikipedia.org/wiki/Walsh-Hadamard_transform">http://en.wikipedia.org/wiki/Walsh-Hadamard_transform</a></p>
<p style="text-align:justify;" dir="ltr">The DCT, initials for <strong>Discrete Cosine Transform</strong>, is the operation at the heart of today video compression formats. The DCT is a reversible and lossless operation, meaning that the encoder and the decoder do the exact same thing, and that it does not directly help data compression, but just reorganize the coefficients of a block by frequency order, with the high frequencies at the beginning of the block, and the low frequencies at the end.</p>
<p style="text-align:justify;" dir="ltr">Note that the first coefficient of the block is called the “DC” coefficient, and represents the average of all the values of the coefficients of the block. The other coefficients are called “AC”.</p>
<p style="text-align:center;" dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_luma.png"><img class="size-full wp-image-108 alignnone" title="4x4_block_luma" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_luma.png?w=630" alt="4x4_block_luma"   /></a><img class="size-full wp-image-107 alignnone" title="4x4_block_coeff" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_coeff.png?w=630" alt="4x4_block_coeff"   /><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct.png"><img class="alignnone size-full wp-image-109" title="4x4_block_dct" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct.png?w=630" alt="4x4_block_dct"   /></a><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct_zz.png"><img class="alignnone size-full wp-image-110" title="4x4_block_dct_zz" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct_zz.png?w=630" alt="4x4_block_dct_zz"   /><br />
</a>(original picture &#8211; original coefficients &#8211; transformed coefficients &#8211; “zigzag scan pattern”)</p>
<div>
<p dir="ltr">The VP8 codec uses a 2d DCT-II on AC coefficients of each 4&#215;4 block of luma pixel in frame.</p>
<p style="text-align:justify;" dir="ltr">The DC coefficients are then bundled by groups of 16 (so each DC coefficient of all 16 4&#215;4 blocks of a macroblock) and applied with a secondary WHT transform.</p>
<p style="text-align:justify;" dir="ltr">As the DCT and WHT transformations are basically matrix calculus, they does fit well inside shaders. Plus, the blocks of data to process are independent upon each other, which makes parallelization easy. The same DCT is applied to all of the blocks of the picture. But there is a major drawback that we will saw in chapter 6.</p>
</div>
<div>
<h1 id="internal-source-marker_0.2992284980136901">5/ Inverse quantization</h1>
<p><a href="http://en.wikipedia.org/wiki/Quantization_(image_processing)">http://en.wikipedia.org/wiki/Quantization_(image_processing)</a></p>
<p style="text-align:justify;" dir="ltr">The quantization stage reduces the amount of information by dividing each transformed blocks of coefficient (a 2d matrix) by a “quantization matrix” and then by a “quantization parameter (used to adjust the final quality of the block) to reduce the quantity of possible values that value could have. All near zero values are zeroed.</p>
<p dir="ltr">Because this makes the <strong>values fall into a narrower range</strong>, this allows entropy coding to express the values more compactly.</p>
</div>
<p style="text-align:center;" dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant.png"><img class="alignnone size-full wp-image-115" title="4x4_block_quant" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant.png?w=630" alt="4x4_block_quant"   /></a><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2.png"><img class="alignnone size-full wp-image-114" title="4x4_block_quant2" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2.png?w=630" alt="4x4_block_quant2"   /></a><a href="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2_zz.png"><img class="alignnone size-full wp-image-116" title="4x4_block_quant2_zz" src="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2_zz.png?w=630" alt="4x4_block_quant2_zz"   /><br />
</a>(transformed coefficients &#8211; transformed &amp; quantized coefficients- “zigzag scan pattern”)</p>
<div>
<p style="text-align:left;" dir="ltr">Here is a quick overview of the quantity of data in a block before and after transformation + quantization :</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/blockcoeff.png"><img class="alignnone size-full wp-image-117 aligncenter" title="blockcoeff" src="http://emericdev.files.wordpress.com/2011/08/blockcoeff.png?w=630&#038;h=187" alt="blockcoeff" width="630" height="187" /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">A simple way to gain a lot of speed using shaders is to process several 4&#215;4 blocks of data simultaneously as there is no dependency between blocks (in the limits of available shader units), and to process 4 data at a time inside each block.</p>
</div>
<div>
<h1 id="internal-source-marker_0.2992284980136901">6/ Intra-prediction</h1>
<p><a href="http://www.vcodex.com/files/h264_intrapred.pdf">www.vcodex.com/files/h264_intrapred.pdf</a></p>
<p style="text-align:justify;">Intra-predictions use spatial redundancy inside a frame to reduce the amount of data necessary to encode adjacent blocks. It is a major compression feature, able to greatly reduce the size of a single picture. VP8 has 10 available intra-prediction schemes, which consist in copying the edge of the adjacent block(s) through another block, as seen in the following picture :</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/intrapred4x4.png"><img class="alignnone size-full wp-image-119 aligncenter" title="intrapred4x4" src="http://emericdev.files.wordpress.com/2011/08/intrapred4x4.png?w=630&#038;h=605" alt="" width="630" height="605" /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">The major problem of the intra-prediction is that it reads the edges of adjacent reconstructed blocks. To reconstruct a block, the transformation, quantization and intra-prediction must have been performed on that block.</p>
<p style="text-align:justify;" dir="ltr">As the intra-prediction is in the middle of the operations needed to reconstruct a block, it mean that we cannot process these blocks in parallel, because each block can depend on the left, up-left, up-right block.</p>
<p style="text-align:justify;" dir="ltr">So basically each time we want to intra-predict a block we have to wait for the result of the previous intra-prediction process. It means that it <strong>suppresses the gain of doing parallel block transformation + quantization</strong>, because it would need to wait for the intra-prediction results to reconstruct the blocks anyway.</p>
<p dir="ltr"><strong>In a CPU implementation we do things like that :</strong></p>
<p dir="ltr">- for each macroblock of a picture<br />
* entropy decode a macroblock<br />
- for each 16 blocks of the macroblock<br />
* entropy decode a block<br />
* transformation<br />
* quantization<br />
* intra-prediction<br />
* block reconstruction</p>
<p style="text-align:justify;" dir="ltr">Once a set of data is loaded, it is better to perform all of the operations on that set while the data are still “hot” into the CPU cache, avoiding cache miss and expensive memory reads.</p>
<p dir="ltr"><strong>In a GPU implementation, we would try to do that :</strong></p>
<ul>
<li>entropy decode everything in a frame</li>
<li>upload data to the GPU memory</li>
<li>transform all the blocks (in parallel)</li>
<li>quantifiy all the blocks (in parallel)</li>
<li>intra-predict all the blocks</li>
<li>reconstruct all the blocks (in parallel)</li>
</ul>
<p dir="ltr">So what to do with the intra-prediction stage ?</p>
<p dir="ltr">When you start several intra-predictions processes at different places of the picture, ignoring the dependency between block is not an option. Do one mistake during the decoding, and that mistake will propagate itself :</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/foreman_cif_ibbbbbbbp_frame0_nok.png"><img class="aligncenter size-full wp-image-120" title="foreman_cif_IbBbBbBbP_frame0_nok" src="http://emericdev.files.wordpress.com/2011/08/foreman_cif_ibbbbbbbp_frame0_nok.png?w=630" alt="foreman_cif_IbBbBbBbP_frame0_nok"   /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">One another obstacle is that as each block uses a different intra-prediction scheme, we would need to setup shader programs for each scheme. Each of these shader programs must have a list of blocks it can handle, and they would have to wait for the availability of the reconstructed adjacent blocks of these inside the list to perform their task. But doing so (meaning doing linear processing using a parallel processor) could be counter productive performance wise.</p>
<p style="text-align:justify;" dir="ltr">The other solution would be to download transformed and quantified data (after parallel processing) to the main memory, do the intra-prediction in the CPU and re-upload the data for the reconstruction stage and further processing.</p>
<p style="text-align:justify;" dir="ltr">So far, my decision is to leave all the treatments before block reconstruction to the CPU, and concentrate on the parallelization of heavier treatments. The SIMD CPU optimizations (MMX, SSE&#8230;) will be reintroduced.</p>
<h1>7/ Inter-prediction (motion compensation)</h1>
<p><a href="http://en.wikipedia.org/wiki/Motion_compensation">http://en.wikipedia.org/wiki/Motion_compensation</a></p>
<p style="text-align:justify;" dir="ltr">The inter-prediction, or motion compensation, is a practical way to use the temporal redundancy between frames. As two frames which follow each other have a great chance to be very similar, each macroblock of the picture can be just copied into another picture instead of being recoded. If needed, the copied macroblock can be slightly moved and interpolated to match the destination picture. This process can be quite intensive, up to 70% of CPU time, depending on the amount of inter-predicted blocks in the frame of course.</p>
<p style="text-align:justify;" dir="ltr">The VP8 specification allows up to 3 frames to be used as reference.</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/motioncompensation.png"><img class="aligncenter size-full wp-image-122" title="motion compensation" src="http://emericdev.files.wordpress.com/2011/08/motioncompensation.png?w=630" alt="motion compensation"   /></a></p>
<div style="text-align:justify;">
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">If the reference frames are already loaded into the GPU memory, recomposing a frame by copying macroblocks between GPU textures is faster than doing the same thing across CPU memory.</p>
<p style="text-align:justify;" dir="ltr">One other advantage is that sometimes an interpolation filter must be applied to the block of texture copied, and texture filtering is one thing a GPU do fast, or at least faster than a CPU.</p>
<h1>8/ Loop filter</h1>
<p><a href="http://en.wikipedia.org/wiki/Deblocking_filter_(video)">http://en.wikipedia.org/wiki/Deblocking_filter_(video)</a></p>
<p>As we talked about on this post, most of the processing during video decoding are done on small blocks of data. One side effect is that differences can appear between blocks when they are compressed with slightly different parameters.</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/sky_blocking.png"><img class="aligncenter size-full wp-image-124" title="sky_blocking" src="http://emericdev.files.wordpress.com/2011/08/sky_blocking.png?w=630&#038;h=172" alt="sky_blocking" width="630" height="172" /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">To counter this “blocking effect”, a “loop filter”, or “deblocking filter” must be applied on the final picture. This filter is usually applied as a post processing filter for low bitrate videos.</p>
<p style="text-align:justify;" dir="ltr">In VP8 as in the H.264, the loop filter is a mandatory feature, allowing the encoder to lower the bitrate by 10%, regained in quality by applying the loop filter in both encoding and decoding paths. The only problem is that the loop filter is the most expensive operation of the VP8 decoding process, from 30% and up to 60% of the total decoding time, especially with high definition videos.</p>
<p style="text-align:justify;" dir="ltr">VP8 has two filter modes, a low complexity “simple filter” and a high complexity “normal filter” (used in almost every video). These two modes can be adjusted on a frame basis. The filter is somewhat adaptive, as some filtering parameter can be adjusted for each macroblock.</p>
<p style="text-align:justify;" dir="ltr">The goal is to smooth the rough edges between each block of the three planes (Y, Cb and Cr) for the normal filter, and only the Y planes for the simple filter. Depending if we are on a block or macroblock boundaries the process is not exactly the same, as 16&#215;16 macroblock can pack parameters specific to a group of 16 of 4&#215;4 blocks, there can be bigger differences at these macroblocks edges, so adjacent blocks edges within a macroblock may be concatenated and processed at once in their entirety.</p>
<p style="text-align:justify;" dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/macroblock_filtering.png"><img class="aligncenter size-medium wp-image-148" title="macroblock_filtering" src="http://emericdev.files.wordpress.com/2011/08/macroblock_filtering.png?w=300&#038;h=300" alt="macroblock_filtering" width="300" height="300" /></a></p>
</div>
<div><strong>Edges are filtered in that order :</strong></p>
<ol>
<li>left macroblock edge (16 pixels wide)</li>
<li>each left edge (4 pixels wide) for every 16 blocks inside the macroblock</li>
<li>top marcoblock edge (16 pixels wide)</li>
<li>each top edge (4 pixels wide) for every 16 blocks inside the macroblock</li>
</ol>
</div>
<div style="text-align:justify;">For each pixel position of an edge, two or three pixels adjacent to either side of the edge (at a right angle to the edge orientation) are examined and possibly modified if the difference between the values on either sides fall into a certain threshold.</div>
<div>
<p style="text-align:justify;" dir="ltr">The deblocking process reads and then writes to the same values. But the shader programs usually input and output to different textures. The idea would be to create a new texture to output only delta values for each pixel, and then to compose the &#8220;delta texture&#8221; to the &#8220;frame texture&#8221;.</p>
<p style="text-align:justify;" dir="ltr">This VP8 deblocking process is linear, each macroblock must be fully processed before staring the next one. In order to parallelize it, it should be safe to start several deblocking process at different macroblocks (chosen depending on their filter strength) at the expense of some particular edges left unfiltered.</p>
<h1>9/ Color space conversion</h1>
<p><a href="http://www.itu.int/rec/R-REC-BT.601-7-201103-I/en">http://www.itu.int/rec/R-REC-BT.601-7-201103-I/en</a></p>
<p style="text-align:justify;" dir="ltr">Color space conversion is the last process in “decoding order”. As we’ve seen in chapter 1, the video formats don’t store their pixels in RGB, but in subsampled YCbCr format.</p>
<p style="text-align:justify;" dir="ltr">To convert a pixel between the two color models, the VP8 uses the ITU recommendation 601, which defines among some other things how to convert an analog RGB signal to a digital YCbCr signal. From there an equation to convert digital YCbCr to digital RGB can be extrapolated :</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/rgb_full.png"><img class="aligncenter size-full wp-image-126" title="rgb_full" src="http://emericdev.files.wordpress.com/2011/08/rgb_full.png?w=630&#038;h=108" alt="rgb_full" width="630" height="108" /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" style="text-align:justify;" dir="ltr">Where R, G and B are the 3 components of a 24 bits RGB color space, and Y, Cb and Cr are the 3 components of a 24 bits YCbCr color space. The prime denotes a gamma-corrected component.</p>
<p style="text-align:justify;" dir="ltr">The YCbCr to RGB conversion can be intense on the CPU, for each pixel, 9 divisions, 13 multiplications, 11 additions/subtractions. With some rounding and factorisation we can find a faster implementation, with still 7 multiplications, 7 bitshift and 7 additions/subtractions :</p>
</div>
<p dir="ltr"><a href="http://emericdev.files.wordpress.com/2011/08/rgb_fast.png"><img class="aligncenter size-full wp-image-127" title="rgb_fast" src="http://emericdev.files.wordpress.com/2011/08/rgb_fast.png?w=630" alt="rgb_fast"   /></a></p>
<div>
<p id="internal-source-marker_0.2992284980136901" dir="ltr">Once again, to do that operation faster in a shader unit, convert 4 components at a time, and start simultaneously several conversion processes at different places of the frame.</p>
<h1>10/ Conclusion</h1>
<p style="text-align:justify;" dir="ltr">Video codecs are not conceived with performance in mind, as the primary goal is to save a lot of data for transmission. Video decoding is not really a “parallel job”. Some operations are by nature linear, and their handling by a GPU have to be carefully thought. The raw power of a GPU is only the addition of the raw power of its many computing units. When some operations cannot be parallelized, a GPU will end up being slower than a CPU for the same task.</p>
<p style="text-align:justify;" dir="ltr">The hard thing when it comes to GPU decoding is to properly identify which parts of the decoding can be parallelized and wich parts cannot. The key aspect is to do the maximum of operations inside the GPU memory, with shader programs working directly in that memory, and to try to have as little interaction as possible between CPU and GPU. Best case scenario, a shader outputs its results directly to another shader inputs. Uploading data to the GPU memory or scheduling shader programs introduces some latency which could became a net performance penalty in the decoding if done too frequently.</p>
<p style="text-align:justify;" dir="ltr">If you have any question regarding the content of this post, ask these in the comments and I’ll do my best to answer it.</p>
<h1>11/ Summer of Code conclusion</h1>
<p style="text-align:justify;" dir="ltr">As you may know the Google Summer of Code 2011 ends today.</p>
<p style="text-align:justify;" dir="ltr">I did not finish my project and only completed half of it. The “client side” of the VP8 VDPAU implementation is working and is currently being reviewed by the libvdpau maintainers. The mplayer/mplayer2 and ffmpeg/libav patches are also in shape and depending on the feedback on the libvdpau patch they will be sent upstream for review.</p>
<p style="text-align:justify;" dir="ltr">The Gallium3D decoder implementation inside Mesa is up and running, tested on r600g and softpipe drivers, but is only a slimmed down port of the libvpx decoder. Currently the only hardware accelerated part is the color space conversion stage, mainly because of the work of Younes Manton and Christian König on the G3DVL interface and the VDPAU state tracker.</p>
<p style="text-align:justify;" dir="ltr">My work here is not done, and the ideas expressed in this post have yet to be concretized. I still have some free time, and as I start working late on this project it’s only fair that I dedicate this time to move forward with the decoder implementation.</p>
<p style="text-align:justify;" dir="ltr">I&#8217;d like to thanks every one that has been involved in this project, starting with my mentor Jakob Bornecrantz who has been very patient with all my questions these past months, Younes Manton and Chrisitan Konïg who have been working on the current G3DVL interface and video decoders, Matt Dew for helping GSoC students since day one, and thanks to everyone else !</p>
<p style="text-align:justify;" dir="ltr">Special thanks to Chrisitan Konïg and AMD for providing hardware for the project !</p>
<p style="text-align:justify;" dir="ltr">Finally a big thanks to Google, to give students around the world an awesome learning opportunity with the Summer of Code program, and a great way of starting working inside a free software community.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emericdev.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emericdev.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=96&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emericdev.wordpress.com/2011/08/26/a-comprehensive-guide-to-parallel-video-decoding/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b99cb03ce9fbc9b85f028f41cb8fb74c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emericg</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/vp8_decode_pipeline.png" medium="image">
			<media:title type="html">vp8_decode_pipeline</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/couleurs_original.jpg?w=300" medium="image">
			<media:title type="html">colors_original</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/rvb.jpg" medium="image">
			<media:title type="html">RGB</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/ycbcr.jpg" medium="image">
			<media:title type="html">YCbCr</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/block_based_coding.png" medium="image">
			<media:title type="html">block_based_coding</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_luma.png" medium="image">
			<media:title type="html">4x4_block_luma</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_coeff.png" medium="image">
			<media:title type="html">4x4_block_coeff</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct.png" medium="image">
			<media:title type="html">4x4_block_dct</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_dct_zz.png" medium="image">
			<media:title type="html">4x4_block_dct_zz</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant.png" medium="image">
			<media:title type="html">4x4_block_quant</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2.png" medium="image">
			<media:title type="html">4x4_block_quant2</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/4x4_block_quant2_zz.png" medium="image">
			<media:title type="html">4x4_block_quant2_zz</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/blockcoeff.png" medium="image">
			<media:title type="html">blockcoeff</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/intrapred4x4.png" medium="image">
			<media:title type="html">intrapred4x4</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/foreman_cif_ibbbbbbbp_frame0_nok.png" medium="image">
			<media:title type="html">foreman_cif_IbBbBbBbP_frame0_nok</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/motioncompensation.png" medium="image">
			<media:title type="html">motion compensation</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/sky_blocking.png" medium="image">
			<media:title type="html">sky_blocking</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/macroblock_filtering.png?w=300" medium="image">
			<media:title type="html">macroblock_filtering</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/rgb_full.png" medium="image">
			<media:title type="html">rgb_full</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/rgb_fast.png" medium="image">
			<media:title type="html">rgb_fast</media:title>
		</media:content>
	</item>
		<item>
		<title>My GSoC project status</title>
		<link>http://emericdev.wordpress.com/2011/08/17/my-gsoc-project-status/</link>
		<comments>http://emericdev.wordpress.com/2011/08/17/my-gsoc-project-status/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 23:24:35 +0000</pubDate>
		<dc:creator>Emeric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://emericdev.wordpress.com/?p=79</guid>
		<description><![CDATA[Hi ! It’s been a long time that I didn&#8217;t blogged about my Google Summer of Code project, and I’m sorry about that. But today I have some good news ! I have successfully set up a VP8 decoder inside Mesa, built from Google’s libvpx. Let’s walk through the different parts of this new decoding [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=79&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Hi !<br />
It’s been a long time that I didn&#8217;t blogged about my Google Summer of Code project, and I’m sorry about that. But today I have some good news !<br />
I have successfully set up a VP8 decoder inside Mesa, built from Google’s <em>libvpx</em>. Let’s walk through the different parts of this new decoding stack.</p>
<p style="text-align:justify;">We need a VP8 video to begin with. As the current decoder is based on the <em>libvpx</em>, the official VP8 Codec SDK, all of the VP8 functionalities are supported and so, every <em>webm</em> file can be used. That’s an important point, and that’s one of the reason why I initially decided to start using an existing decoder first and not write a new one from scratch. Then I could progressively replace keys computations using shaders while having a solid base known to work in every situations.</p>
<h2 style="text-align:justify;"><strong>libvdpau</strong></h2>
<div>
<p id="internal-source-marker_0.18967416253872216" style="text-align:justify;" dir="ltr">To link together a video player and a video decoder through the VDPAU API, the first component used is the libvdpau. Formerly part of the NVIDIA video driver, it is now a standalone package allowing third party implementation of the API into video player or video decoder.<br />
This library has been patched to support the VP8 codec, and to handle a VdpPictureInfoVP8 structure. That structure is loaded by a VDPAU video player with information contained into each VP8 frame header and then passed to a VDPAU decoder alongside with the bitstream buffer.</p>
<div>
<h2 id="internal-source-marker_0.18967416253872216" style="text-align:justify;"><strong>mplayer/mplayer2 and ffmeg/libav</strong></h2>
<p style="text-align:justify;">Then, we need a media player. I have patched mplayer (and its recent fork mplayer2) together with ffmpeg (and its recent fork libav) to support VP8 decoding through VDPAU. The patches between mplayer and mplayer 2 are almost the same, but the actual VDPAU implementation is different with an advantage to mplayer 2. The ffmpeg/libav patches are identical.</p>
<div>
<p style="text-align:justify;" dir="ltr">To launch mplayer the following arguments must be used :</p>
<div>
<blockquote>
<p id="internal-source-marker_0.18967416253872216" dir="ltr">mplayer -vo vdpau -vc ffvp8vdpau myvideofile.webm</p>
</blockquote>
<div>
<ul>
<li><em>-vo vdpau</em> tells mplayer to initialize a VDPAU video output</li>
<li><em>-vc ffvp8vdpau</em> tells mplayer to use the <em>ffvp8vdpau</em> video codec, a slightly modified version of the native VP8 codec of ffmpeg/libav</li>
</ul>
<p dir="ltr">So basically, mplayer use the libvdpau to find an available decoder, initialize it, create a surface that is gonna be filled by the decoder, then after each decoded frame, draw the surface on screen.</p>
<p dir="ltr">As mplayer/mplayer2 relies on ffmpeg/libav to do the frame decoding itself, a hook has to be added into the frame decoding process, to bypass the regular decoder and send the datas to the VDPAU decoder.</p>
<h2><strong>Mesa</strong></h2>
<p style="text-align:justify;" dir="ltr">The “big part” of this GSoC is obviously the VP8 decoder implementation living inside Mesa. This piece of code is gonna be identified as a “device” by libvdpau. While most of the time a <em>device</em> is a hardware driver, the mesa decoder just register itself as an available video decoder. We know that this <em>device</em> is gonna be called by ffmpeg/libav for every frame to decode, with these arguments :</p>
<ol>
<li style="text-align:justify;">The content of the frame header (with various information like frame size, type, &#8230;)</li>
<li>The bitstream buffer, which contain the compressed data representing exactly one frame</li>
<li>Up to 3 “reference frames”, which are already decoded frames used for motion compensation</li>
</ol>
<p dir="ltr">With that, the decoder can do its job and decode frames. When a frame is ready to be drawn on screen, the decoder must load that frame into the surface provided by the VDPAU video output created by mplayer.</p>
<ul>
<li>The first step was to create a new decoder stub, based on the existing <em>g3dvl</em> interface (where all the Gallium3D video decoding work take place), and add it to the VDPAU state tracker, to advertise VP8 decoding capabilities.</li>
<li>The second step was to plug a working decoder into these new function stubs.</li>
</ul>
<p style="text-align:justify;" dir="ltr">I used the official libvpx (close to the 0.9.7 version) and stripped out several functionalities. The goal of course is to have a lightweigth standalone decoder. Example of removed code are the VP8 encoder, multi-threading (which was actually counter productive into the decoder part), the libvpx API, CPU run time detection, frame scaling functionality, a custom memory manager, etc&#8230;</p>
<p style="text-align:justify;" dir="ltr">And it worked !</p>
<p dir="ltr">This new decoder can be used by the patched mplayer, through the VDPAU Gallium3D state tracker, to decode VP8 video. Seeking, pausing, and everything works as intended.</p>
<h2><strong>Summary</strong></h2>
<div>Let’s see how our different components interacts :</div>
<div>
<p style="text-align:center;"><a href="http://emericdev.files.wordpress.com/2011/08/decoding-stack.png"><img class="size-full wp-image-81 aligncenter" title="decoding-stack" src="http://emericdev.files.wordpress.com/2011/08/decoding-stack.png?w=630&#038;h=460" alt="decoding-stack" width="630" height="460" /></a></p>
<p style="text-align:justify;">So far only mplayer can use the VP8 decoder inside Mesa, but other implementation can be provided for other popular media players like VLC and who knows, the flash media player ?! Similarly, the patched version of mplayer can only use the Mesa VP8 decoder, but only because there is no other VDPAU VP8 implementation in the wild right now.</p>
<div>
<h2 style="text-align:justify;"><strong>What’s left</strong></h2>
<p dir="ltr">The work on libvdpau and mplayer/ffmpeg is done and only need to be reviewed.</p>
<p style="text-align:justify;" dir="ltr">Right now the VP8 decoder is a pure C implementation running on the CPU (only color space conversion is done by the GPU, tested with r600g), and it is about 3 times slower than the regular libvpx (mostly because all CPU SIMD code as been removed). Ultimately different parts of the decoder are going to be rewritten to fit GPU decoding, and I don&#8217;t intend to port code from libvpx anymore.</p>
<p style="text-align:justify;" dir="ltr">Next week, a more technical post where we will see what decoding operations are the biggest CPU time eater, and what we are gonna do about it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p dir="ltr">If you have any question, go for it !</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emericdev.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emericdev.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=79&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emericdev.wordpress.com/2011/08/17/my-gsoc-project-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b99cb03ce9fbc9b85f028f41cb8fb74c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emericg</media:title>
		</media:content>

		<media:content url="http://emericdev.files.wordpress.com/2011/08/decoding-stack.png" medium="image">
			<media:title type="html">decoding-stack</media:title>
		</media:content>
	</item>
		<item>
		<title>A VP8 hardware decoding stack</title>
		<link>http://emericdev.wordpress.com/2011/07/10/a-vp8-hardware-decoding-stack/</link>
		<comments>http://emericdev.wordpress.com/2011/07/10/a-vp8-hardware-decoding-stack/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 12:58:53 +0000</pubDate>
		<dc:creator>Emeric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://emericdev.wordpress.com/?p=48</guid>
		<description><![CDATA[Hi ! Today let&#8217;s talk about the different components needed in order to provide a working VP8 hardware decoding stack. The goal of my Google Summer of Code project is to provide a generic way of decoding VP8 videos using hardware acceleration. This &#8220;hardware acceleration&#8221; is going to be provided by modern graphic cards and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=48&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Hi ! Today let&#8217;s talk about the different components needed in order to provide a working VP8 hardware decoding stack.</p>
<div style="text-align:justify;">
<p>The goal of my Google Summer of Code project is to provide a generic way of decoding VP8 videos using hardware acceleration. This &#8220;hardware acceleration&#8221; is going to be provided by modern graphic cards and there &#8220;streaming processors&#8221;, &#8220;shaders units&#8221;, &#8220;cuda cores&#8221; or whatever names they can takes depending on vendor&#8217;s marketing departments. Basically they are small processors built inside GPUs that can process a lot of data simultaneously.</p>
<p>When I say a &#8220;generic way to use hardware acceleration&#8221;, I mean that a lot of media players should be able to benefit from it, and a lot of graphic cards should be able to provide it.</p>
</div>
<p><strong>Decoding back-end</strong></p>
<div style="text-align:justify;">
<p>First, a hardware accelerated decoder has to be built. Because writing even a purely CPU based video decoder is a heavy task (in itself longer than the time allocated by the Google Summer of Code program), an existing decoder is going to be used first. Then, the heaviest computational tasks are going to be progressively rewritten to use shaders.</p>
<p>The <em>libvpx</em> library is going to be used and built inside the Mesa 3D Graphics Library. That should allow video cards drivers (r300g, r600g and nouveau are targeted) using Mesa to be shipped with VP8 hardware decoding support.<br />
<em>libvpx</em> is the VP8 reference implementation, supported by Google, and has a BSD style license, compatible with Mesa&#8217;s MIT license, wich make it a great candidate for inclusion.</p>
<p>In order to be used, the decoder located within Mesa must advertises its capabilities through a Gallium3D state tracker supporting the VDPAU API.</p>
</div>
<p><strong>API</strong></p>
<p style="text-align:justify;">So an API to make the link between the video decoder and a media player is needed. When a media player start decoding a video, it must check if your system is capable of hardware decoding, and if so, bypass its regular CPU based decoder to use the GPU based decoder. Several APIs can help doing that, let&#8217;s review some of them :</p>
<div>
<ul>
<li style="text-align:justify;">XvMC (<em>X-Video Motion Compensation</em>)</li>
</ul>
</div>
<p style="text-align:justify;">Build as a xorg extension, and based on the even older <em>X video extension</em>, XvMC allows media players to offload a limited number of operations (motion compensation/inter-frame prediction and iDCT/inverse transformation) to capable GPUs. XvMC design is quite old and has not been thought for recent video formats.<br />
Its primary target are MPEG 1/2 videos.</p>
<div>
<ul>
<li style="text-align:justify;">VA API (<em>Video Acceleration API)</em></li>
</ul>
</div>
<p style="text-align:justify;">Originally designed by Intel, VA API main motivation was to supersede XvMC with a new design and much extended capabilities. In addition of motion compensation and inverse transform, VA API can also handle deblocking filter, intra-frame prediction and bitstream processing. As XvMC, VA API just exposes to the GPUs only particular chunks of data and their associated treatments, so a lot of the video decoding logic stays inside regular CPU based decoder. Another particularity of VA API is to handle video encoding as well as video decoding.<br />
Its primary target are H.264, VC-1, MPEG-2 and MPEG-4 videos. VA API is currently implemented by the Intel Linux driver.</p>
<div>
<ul>
<li style="text-align:justify;">VDPAU (<em>Video Decode and Presentation API for Unix</em>)</li>
</ul>
</div>
<p style="text-align:justify;">VDPAU was designed by NVIDIA to offload video decoding and post-processing effects from the CPU. A media player has to start the decoding, but then passes large portions of the bitstream to VDPAU and gets back fully decoded frames. As almost all of the decoding process can be offloaded, VDPAU allows great flexibility in the implementation of a GPU based decoder.<br />
Its primary target are H.264, VC-1, MPEG-2 and MPEG-4 videos. The <em>libvdpau</em> library needs to be slightly patched in order to support VP8 decoding. VDPAU is currently implemented by the NVIDIA closed source driver available for Linux, FreeBSD and Solaris operating systems. VDPAU is well supported by media players, and this is why it has been chosen.</p>
<p>* XvMC <a title="X-Video Motion Compensation" href="http://en.wikipedia.org/wiki/XvMC#External_links">wikipedia</a> / <a title="X-Video Motion Compensation" href="http://www.xfree86.org/~mvojkovi/XvMC_API.txt">www.xfree86.org/~mvojkovi/XvMC_API.txt</a><br />
* VA API <a title="Video Acceleration API" href="http://en.wikipedia.org/wiki/VAAPI">wikipedia</a> / <a title="Video Acceleration API" href="http://www.freedesktop.org/wiki/Software/vaapi">www.freedesktop.org/wiki/Software/vaapi</a><br />
* VDPAU <a title="Video Decode and Presentation API for Unix" href="http://en.wikipedia.org/wiki/VDPAU">wikipedia</a> / <a title="Video Decode and Presentation API for Unix" href="http://http.download.nvidia.com/XFree86/vdpau/doxygen/html/">download.nvidia.com/XFree86/vdpau/doxygen/html</a></p>
<p><strong>Media player</strong></p>
<p style="text-align:justify;">Last but not least, you&#8217;ll need a media player. The media player loads a given video file, parses its container to gather some information about the file&#8217;s content (video length, definition, audio and video codec, etc) then launches the decoding process and finally draw the decoded pictures onto the screen.</p>
<p style="text-align:justify;">Today most of the media players available don&#8217;t do media decoding themselves, but instead uses libraries dedicated to these tasks. The primary used library is <em>ffmpeg</em> and its recent fork <em>libav</em>. We can also mention <em>GStreamer</em> and <em>xine-lib</em>. These libraries are available on a wide range of operating systems and architectures, and can decode pretty much every video or audio file formats available in the wild (and that is a lot).</p>
<p style="text-align:justify;">I made the choice to add VP8 VDPAU support inside ffmpeg/libav. They are well known libraries, already have support VDPAU for other video formats, and are used among others by the famous VLC media player and MPlayer.</p>
<p>* ffmpeg <a title="ffmpeg" href="http://www.ffmpeg.org/">www.ffmpeg.org</a><br />
* libav <a title="libav" href="http://libav.org/">libav.org</a><br />
* GStreamer <a title="GStreamer" href="http://gstreamer.freedesktop.org/">gstreamer.freedesktop.org</a><br />
* xine <a title="xine" href="http://www.xine-project.org/">www.xine-project.org</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emericdev.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emericdev.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=48&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emericdev.wordpress.com/2011/07/10/a-vp8-hardware-decoding-stack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b99cb03ce9fbc9b85f028f41cb8fb74c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emericg</media:title>
		</media:content>
	</item>
		<item>
		<title>Exams finished !</title>
		<link>http://emericdev.wordpress.com/2011/07/01/exams-finished/</link>
		<comments>http://emericdev.wordpress.com/2011/07/01/exams-finished/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 16:21:35 +0000</pubDate>
		<dc:creator>Emeric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://emericdev.wordpress.com/?p=1</guid>
		<description><![CDATA[Hi there ! I have just finished my exams, an so my academic year is now over. Time to start working full time on my Google Summer of Code project. The purpose of this blog is to keep you posted about my progress. I will write it in english, so I apologize in advance for any errors that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=1&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Hi there !</p>
<p>I have just finished my exams, an so my academic year is now over. Time to start working full time on my Google Summer of Code project. The purpose of this blog is to keep you posted about my progress. I will write it in english, so I apologize in advance for any errors that may slip into my sentences.</p>
<blockquote><p>The goal of this project is to write a Gallium3D state tracker capable of hardware accelerated VP8 video decoding through the VDPAU API. This would allow every graphic card with a Gallium3D driver (primary targets are r300g, r600g and Nouveau drivers) to be able to decode VP8 videos, and every VDPAU enabled multimedia software to play these videos.</p>
<p>Hardware acceleration will be built upon graphic card’s shaders units, able to take care of some heavy computations like motion compensation, intra-predictions, iDCT, deblocking filter.</p></blockquote>
<p>More <strong>information about the project</strong> can be found on <a title="About the project" href="https://emericdev.wordpress.com/about-the-project/">this page</a>, and a <strong>brief presentation</strong> of myself and <strong>contact information</strong> can be found on <a title="About me" href="https://emericdev.wordpress.com/about-me/">that page</a>.</p>
<p>Feel free to contact me at any time if you have any questions or comments about this work !</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emericdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emericdev.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emericdev.wordpress.com&#038;blog=24718394&#038;post=1&#038;subd=emericdev&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emericdev.wordpress.com/2011/07/01/exams-finished/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b99cb03ce9fbc9b85f028f41cb8fb74c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emericg</media:title>
		</media:content>
	</item>
	</channel>
</rss>
