Andrew and I are examining the memory behavior of x264, and we&#39;ve noticed something that appears to be quite odd. It seems that x264_reference_update occasionally writes to frames that have a reference count of 0.<br><br>
We discovered this by inserting an assertion in encoder/encoder.c at about line 1094:<br><br>         return;<br>     }<br> <br>+    assert(h-&gt;fenc-&gt;i_reference_count &gt; 0);<br>+<br>     /* move lowres copy of the image to the ref frame */<br>
     for( i = 0; i &lt; 4; i++)<br>     {<br>         XCHG( uint8_t*, h-&gt;fdec-&gt;lowres[i], h-&gt;fenc-&gt;lowres[i] );<br>         XCHG( uint8_t*, h-&gt;fdec-&gt;buffer_lowres[i], h-&gt;fenc-&gt;buffer_lowres[i] );<br>
     }<br><br>This assertion fails for some workloads, including simsmall from the parsec benchmarks.<br><br>We are using the following command line parameters to cause the assertion to fail:<br><br>x264 --quiet --qp 20 --partitions b8x8,i4x4 --ref 5 --direct auto --b-pyramid --weightb --mixed-refs --no-fast-pskip --me umh --subme 7 --analyse b8x8,i4x4 --threads 2 -o eledream.264 eledream_640x360_8.y4m<br>
<br>Does this represent a bug?<br><br>