[FFmpeg-devel] Allow interrupt callback for AVCodecContext

Don Moir donmoir at comcast.net
Mon Jan 6 09:19:48 CET 2014


----- Original Message ----- 
From: "Reimar Döffinger" <Reimar.Doeffinger at gmx.de>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Monday, January 06, 2014 8:01 AM
Subject: Re: [FFmpeg-devel] Allow interrupt callback for AVCodecContext


> On 06.01.2014, at 10:08, "Don Moir" <donmoir at comcast.net> wrote:
>> Le septidi 17 nivôse, an CCXXII, Don Moir a écrit :
>>>> user would probably do something like this if interested:
>>
>>> You think so, but obviously you do not know how much in cost compared to the
>>> actual process of decoding.
>>
>> return interupt; is expensive ?
>
> You picked the least expensive part.
> Calling the callback is somewhat expensive, since it uses up an entry in a jump table. Or to put it short: it will make at least 
> one other function call by maybe 10 (?) cycles slower.
> There is also going to be some code that aborts the loop if interrupted.
> The extra loop condition is a few cycles and possibly a register more inside the loop.
> It also takes up an entry in the branch predictor.
> The cost of that is not easily possible to estimate, but it does not take much to make code 1% slower.

Maybe but there is a lot more called that is potentially slower. It probably need not be called so often that it impacts much 
either. I guess no credence is given to the time it takes to process av_log for example. multiple calls, sprintf, etc

By default, I implied it need not do anything at all except check for null callback.

It also posible that it could be made interruptible without a callback with an event or something but bottom line is it has same 
impact code wise which we all agree is messy.

If it's the best it can be with cached context, then I can live with it but annoys me when an intense process is not interruptible. 
You also implied there is some other areas that might be improved timewise and maybe I should just focus on that since the interrupt 
callback is not going anywhere 



More information about the ffmpeg-devel mailing list