<div dir="ltr">It is probably related to how turbo boost works. You need to tune your OS for CPU latency (governor performance on Debian/Ubuntu), it has to do with the delay changing between low power states and performance states. When you sleep continuously, you cannot reach peak CPU clock speed. When you don't use the sleep, you are using peak clock speed all the time.<div><br></div><div>Cheers,</div><div><br></div><div>Omar. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El sáb., 1 jun. 2019 a las 19:33, Paul Sanderson (<<a href="mailto:nannapie@hotmail.co.uk">nannapie@hotmail.co.uk</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div dir="auto">
I think Carl’s point is interesting. It could be something funky with sleep which if I remember right is a Linux/ Debian based call. Maybe try a different method of making your program hang and see if the problem persists. 
<div><br>
</div>
<div>All my best,</div>
<div><br>
</div>
<div>Paul <br>
<br>
<div id="gmail-m_1335320627791674332AppleMailSignature" dir="ltr">Sent from the top a castle using a moderately sized European swallow </div>
<div dir="ltr"><br>
On 1 Jun 2019, at 16:17, Lukas Bommes <<a href="mailto:lukas.bommes@gmx.de" target="_blank">lukas.bommes@gmx.de</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="auto">
<div>I'm just buffled because OpenCV uses the same code <span style="font-family:sans-serif"> (in fact I copied the retrieveFrame funtion from the videoio module 1:1)</span> and it does not show this weird behaviour. There, the runtime of sws_scale is constant
 regardless of the calling frequency and retrieving one frame takes always around 1.3 ms.</div>
<div dir="auto">However, my OpenCV build (version 4.1) uses FFMPEG 3.4.6, not 4.1. So, I'm gonna try building my code with FFMPEG 3.4.6 and see if the problem persists. </div>
<div dir="auto">Alternatively, I add a function to the OpenCV videoio module which retrieves frame + motion vectors. However, altering the OpenCV API brings a lot of other challenges.</div>
<div dir="auto"><br>
</div>
<div dir="auto">But maybe someone else has noticed a similar issue with sws_scale in FFMPEG 4.1 before.</div>
<div dir="auto"><br>
<div class="gmail_extra" dir="auto">Lukas</div>
<div class="gmail_extra" dir="auto"><br>
</div>
<div class="gmail_extra" dir="auto"><br>
<div class="gmail_quote">On 1 Jun 2019 7:04 pm, Carl Eugen Hoyos <<a href="mailto:ceffmpeg@gmail.com" target="_blank">ceffmpeg@gmail.com</a>> wrote:<br type="attribution">
<blockquote class="gmail-m_1335320627791674332quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<p dir="ltr">Am Do., 30. Mai 2019 um 11:59 Uhr schrieb lukas <<a href="mailto:lukas.bommes@gmx.de" target="_blank">lukas.bommes@gmx.de</a>>:</p>
<p dir="ltr">> I wrote a program which extracts motion vectors from a video stream and<br>
> encountered the problem that the runtime of sws_scale changes depending<br>
> on whether I put a sleep command in the main loop of the caller.</p>
<p dir="ltr">Shouldn't you ask this your CPU provider?</p>
<p dir="ltr">Carl Eugen<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a></p>
<p dir="ltr">To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</p>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div dir="ltr"><span>_______________________________________________</span><br>
<span>Libav-user mailing list</span><br>
<span><a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a></span><br>
<span><a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a></span><br>
<span></span><br>
<span>To unsubscribe, visit link above, or email</span><br>
<span><a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</span></div>
</blockquote>
</div>
</div>

_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>