<?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>strayorange &#187; x264</title>
	<atom:link href="http://www.strayorange.com/blog/tag/x264/feed" rel="self" type="application/rss+xml" />
	<link>http://www.strayorange.com/blog</link>
	<description>The most passionate and reliable Lorem Ipsum providers in the world</description>
	<lastBuildDate>Sun, 29 Jan 2012 22:28:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Testing x264 b-frames heuristic</title>
		<link>http://www.strayorange.com/blog/155-testing-x264-b-frames-heuristic</link>
		<comments>http://www.strayorange.com/blog/155-testing-x264-b-frames-heuristic#comments</comments>
		<pubDate>Mon, 06 Jul 2009 15:58:07 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[x264]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=155</guid>
		<description><![CDATA[Last week I wrote about my x264 patch that would enable B-frames heuristic decisions in x264. Today I finally managed to do some proper testing using the Big Buck Bunny PNG image sequence from xiph.org, and found out that for reasonable settings (b-frames 8, b-heuristic 4) we have an overall 4% speed gain and for [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Last week I wrote about my x264 patch that would enable B-frames heuristic decisions in x264.</p>
<p style="text-align: left;">Today I finally managed to do some proper testing using the Big Buck Bunny PNG image sequence from xiph.org, and found out that for reasonable settings (b-frames 8, b-heuristic 4) we have an overall 4% speed gain and for more extreme settings (b-frames 16, b-heuristic 4) we gain 17% overall.</p>
<p style="text-align: left;">The base command line used in this test is &#8211;b-adapt 2 &#8211;b-pyramid -r 4 &#8211;crf 26 -A all &#8211;direct auto -w -m 9 &#8211;psy-rd &#8211;mixed-refs -8 -t 2 &#8211;threads 3 &#8211;thread-input.</p>
<p style="text-align: left;">In the following pretty graph™ I plotted the frames-per-second for various settings (b-frames/b-heuristic):</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-156" title="Spped results for different x264 encodes" src="http://www.strayorange.com/blog/wp-content/uploads/2009/07/Immagine-512x335.png" alt="Spped results for different x264 encodes" width="512" height="335" /></p>
<p style="text-align: left;">The following are the raw results taken from the x264 logs:</p>
<table style="border-collapse: collapse; width: 437pt; text-align: center;" border="0" cellspacing="0" cellpadding="0" width="582">
<col style="width: 48pt;" span="3" width="64"></col>
<col style="width: 59pt;" width="79"></col>
<col style="width: 48pt;" span="2" width="64"></col>
<col style="width: 68pt;" width="90"></col>
<col style="width: 70pt;" width="93"></col>
<tbody>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt; width: 96pt;" colspan="2" width="128" height="20">settings</td>
<td style="width: 48pt;" width="64"></td>
<td style="width: 59pt;" width="79"></td>
<td style="width: 164pt;" colspan="3" width="218">PSNR</td>
<td style="width: 70pt;" width="93">SSIM</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">b-frames</td>
<td>b-heuristic</td>
<td>fps</td>
<td>kb/s</td>
<td>Y</td>
<td>avg</td>
<td>global</td>
<td></td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">4</td>
<td>0</td>
<td>12,62</td>
<td>336,03</td>
<td>39,644</td>
<td>40,377</td>
<td>38,614</td>
<td>0,9686156</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">4</td>
<td>2</td>
<td>12,67</td>
<td>336,95</td>
<td>39,650</td>
<td>40,383</td>
<td>38,617</td>
<td>0,9686125</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">8</td>
<td>0</td>
<td>11,16</td>
<td>333,68</td>
<td>39,604</td>
<td>40,330</td>
<td>38,583</td>
<td>0,9683932</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">8</td>
<td>2</td>
<td>12,07</td>
<td>335,57</td>
<td>39,631</td>
<td>40,356</td>
<td>38,598</td>
<td>0,9685096</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">8</td>
<td>4</td>
<td>11,64</td>
<td>334,02</td>
<td>39,613</td>
<td>40,338</td>
<td>38,588</td>
<td>0,9684230</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">16</td>
<td>0</td>
<td>8,43</td>
<td>331,42</td>
<td>39,588</td>
<td>40,313</td>
<td>38,566</td>
<td>0,9682979</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">16</td>
<td>2</td>
<td>10,17</td>
<td>334,85</td>
<td>39,619</td>
<td>40,341</td>
<td>38,590</td>
<td>0,9684408</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">16</td>
<td>4</td>
<td>9,93</td>
<td>333,50</td>
<td>39,607</td>
<td>40,330</td>
<td>38,585</td>
<td>0,9683999</td>
</tr>
<tr style="height: 15pt;" height="20">
<td style="height: 15pt;" height="20">16</td>
<td>8</td>
<td>9,31</td>
<td>333,11</td>
<td>39,598</td>
<td>40,322</td>
<td>38,579</td>
<td>0,9683561</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/155-testing-x264-b-frames-heuristic/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>x264 adaptive max b-frames patch</title>
		<link>http://www.strayorange.com/blog/150-x264-adaptive-max-b-frames-patch</link>
		<comments>http://www.strayorange.com/blog/150-x264-adaptive-max-b-frames-patch#comments</comments>
		<pubDate>Sun, 28 Jun 2009 15:00:23 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[x264]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=150</guid>
		<description><![CDATA[I just put together a patch (it&#8217;s more of an ugly hack but whatever) that makes &#8211;b-adapt 2 somewhat faster. Basically what it does is to adapt the number of b-frames to look for based upon the length of the previous consecutive b-frames span. It is way easier just to read the patch to find [...]]]></description>
			<content:encoded><![CDATA[<p>I just put together a patch (it&#8217;s more of an ugly hack but whatever) that makes &#8211;b-adapt 2 somewhat faster.</p>
<p>Basically what it does is to adapt the number of b-frames to look for based upon the length of the previous consecutive b-frames span. It is way easier just to read the patch to find out how it works; this is the relevant part:</p>
<blockquote>
<pre>+    /* adaptive max b-frames */
+    if( h-&gt;sh.i_type == SLICE_TYPE_P )
+    {
+        int i_gop_bframes = h-&gt;fdec-&gt;i_frame - h-&gt;fref0[0]-&gt;i_frame - 1;
+        const int i_bframes_overhead = 4;
+        if ( i_gop_bframes + i_bframes_overhead &gt; h-&gt;frames.i_adapt_bframes )
+            h-&gt;frames.i_adapt_bframes = i_gop_bframes + i_bframes_overhead;
+        else
+            h-&gt;frames.i_adapt_bframes--;
+        h-&gt;frames.i_adapt_bframes = x264_clip3( h-&gt;frames.i_adapt_bframes, 0, h-&gt;param.i_bframe );
+    }</pre>
</blockquote>
<p>i_gop_bframes is the length of the previous span of consecutive b-frames and i_bframes_overhead is an arbitrary constant (possibly to be parametrized).</p>
<p>h-&gt;frames.i_adapt_bframes is initialized (and reset at every scencut) to h-&gt;param.i_bframe (i.e. the number of b-frames specified on the command line).</p>
<p>The same adaptive method can be easily added also to &#8211;b-adapt 0 and 1, but I guess that it wouldn&#8217;t give the same speedup.</p>
<p>Right now I&#8217;m running a few tests and I will post further results briefly, but the first tests showed a speedup ranging from 5 to 30% (being heavily dependent of the content of the video) for -b 16 (I know that this is the best-case scenario as well as I know the tendancy of doom9ers to max out their settings ).</p>
<p>Just a few more warnings: I tested it only on a Ubuntu32 VM and I have not paid much attention to concurrency issues (there should be none, and I experienced no crashes or other misbehaviour &#8211; but I&#8217;ll wait for a review from the x264 devs about this). I tried to be as clear as possible in the patch, but I guess that at least a few variable names and comments will have to be edited&#8230; I couldn&#8217;t come out with better ones, though.</p>
<p>That&#8217;s all. Feel free to comment and give (possibly) constructive advice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/150-x264-adaptive-max-b-frames-patch/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

