Hello<div><br></div><div><br>I have compiled FFMPEG with x264 (v129) on Android and I am using the encoder to encode frames to a video file. I am using the following call to encode frames (as I decode them from another file):<div>
<br></div><div><div><p style="margin:0px;font-size:11px;font-family:Monaco"><i>out_size = avcodec_encode_video2(gVideoWriteCodecCtx, &writePkt, pCurrentFrame, &gotPacket);</i></p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p><p style="margin:0px;font-size:11px;font-family:Monaco"><span style="font-family:arial;font-size:small">The first few frames get buffered and on the 14th a call is made to lookahead_get_frames(). On slice type_decide, the following code is executed:</span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><br></p><p style="margin:0px;font-size:11px;font-family:Monaco"></p><p style="margin:0px"><i>frames[0] = h-><span style="color:#0326cc">lookahead</span>-><span style="color:#0326cc">last_nonb</span>;</i></p>

<p style="margin:0px"><i><span style="color:#793d93">memcpy</span>( &frames[1], h-><span style="color:#0326cc">lookahead</span>-><span style="color:#0326cc">next</span>.<span style="color:#0326cc">list</span>, (bframes+1) * <span style="color:#931a68">sizeof</span>(<span style="color:#006141">x264_frame_t</span>*) );</i></p>

<p style="margin:0px"><i><span style="color:#931a68">if</span>( IS_X264_TYPE_I( h-><span style="color:#0326cc">lookahead</span>-><span style="color:#0326cc">next</span>.<span style="color:#0326cc">list</span>[bframes]-><span style="color:#0326cc">i_type</span> ) )</i></p>

<p style="margin:0px"><i>    p0 = bframes + 1;</i></p>
<p style="margin:0px"><i><span style="color:#931a68">else</span> <span style="color:#4e9072">// P</span></i></p>
<p style="margin:0px"><i>    p0 = 0;</i></p><p style="margin:0px"><br></p><p style="margin:0px">Here, <i>h-><span style="color:rgb(3,38,204)">lookahead</span>-><span style="color:rgb(3,38,204)">last_nonb</span></i> is null. As a consequence, in x264_slicetype_frame_cost I get a SIGSEGV in x264_weights_analyse (ref is null)</p>
<p style="margin:0px"><br></p><p style="margin:0px"></p><p style="margin:0px"><i><span style="color:#931a68">static</span> <span style="color:#931a68">void</span> x264_weights_analyse( <span style="color:#006141">x264_t</span> *h, <span style="color:#006141">x264_frame_t</span> *fenc, <span style="color:#006141">x264_frame_t</span> *ref, <span style="color:#931a68">int</span> b_lookahead )</i></p>

<p style="margin:0px"><i>{</i></p>
<p style="margin:0px"><i>    <span style="color:#931a68">int</span> i_delta_index = fenc-><span style="color:#0326cc">i_frame</span> - ref-><span style="color:#0326cc">i_frame</span> - 1;</i></p><p></p><p></p></div>
<div><br></div><div>Shouldn't <i><span style="color:rgb(3,38,204)">last_nonb</span></i> have been set before this call? for example with <span style="font-family:Monaco;font-size:11px">x264_lookahead_update_last_nonb( h, h-></span><span style="font-family:Monaco;font-size:11px;color:rgb(3,38,204)">lookahead</span><span style="font-family:Monaco;font-size:11px">-></span><span style="font-family:Monaco;font-size:11px;color:rgb(3,38,204)">next</span><span style="font-family:Monaco;font-size:11px">.</span><span style="font-family:Monaco;font-size:11px;color:rgb(3,38,204)">list</span><span style="font-family:Monaco;font-size:11px">[0] ); </span>that is called in lookahead.c just after slicetype_decide?</div>
</div></div><div><br></div><div><div>Thanks</div><div>Nicolas</div></div>