Reputation: 603
Does anyone know what is the effect of AV_CODEC_FLAG2_FAST
flag in libavcodec library (ffmpeg 4.0.2) when is set on AVCodecContext
?
AVCodecContext* avCodecContext;
AVCodec* avCodec;
...
avCodec = ...;
avCodecContext = avcodec_alloc_context3(avCodec);
avCodecContext->flags2 |= AV_CODEC_FLAG2_FAST;
...
// start receiving stream and parsing and decoding frames
...
As I have tested on an AXIS camera, I cannot see any difference in decoding performance when this flag is set, compared to not using this flag.
Any idea, any information appreciated.
Upvotes: 0
Views: 1227
Reputation: 495
If disable_deblocking_filter_idc = 2 (i.e. deblocking across slice boundaries is disabled and consequently each slice is completely self-contained) in input stream then the flag AV_CODEC_FLAG2_FAST has not effect.
Otherwise visual impairments can be observed (due to a drift between encoding and decoding processes), especially if number of slices per pframe is high and/or the interval between successive IDR frames is long (due to temporal propagation).
Notice that IDR frames don't eliminate the drift, they merely reduce it.
Upvotes: 1
Reputation: 93221
Based on a quick glance at the code, in multi-threaded decoding, the h264 decodes normally macroblocks in parallel, skipping the in-loop filter. Once the whole frame has been decoded, deblocking filter is applied serially, which can occur across slice boundaries.
With the flag set, the deblocking is no longer postponed. The tradeoff is that deblocking does not cross slice boundaries, so there may be discontinuities/artifacts at slice edges.
I would guess any relative speed-up would be prominent when decoding uses many threads.
Upvotes: 1