[FFmpeg-devel] Allow interrupt callback for AVCodecContext

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 6 14:01:12 CET 2014

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.

More information about the ffmpeg-devel mailing list