[FFmpeg-devel] [PATCH 3/4] libavcodec/qsvdec.c: The ff_qsv_decode() now guarantees the consumption of whole packet.

Ivan Uskov ivan.uskov at nablet.com
Fri Jul 24 10:56:54 CEST 2015

Hello Michael,

Friday, July 24, 2015, 2:48:45 AM, you wrote:

>> +            /* A decoder's latency depends not only by async_depth
>> +              but by DPB size too. The latency may acheve 16 frames.
>> +              So it is necessary to handle the size of async_fifo dynamically:
>> +            */
>> +            if (av_fifo_space(q->async_fifo) < sizeof(out_frame) + sizeof(sync))
>> +                av_fifo_grow(q->async_fifo, sizeof(out_frame)+sizeof(sync));

MN> the DPB cannot be arbitrary large, so maybe the grow code could be
MN> avoided ?
MN> or maybe i missunderstand

As you can see, the current implementation pre-allocates async_fifo
for async_depth+1 elements where async_depth==4 by default (see
tehff_qsv_decode_init() function).
For h.264 and HEVC max DPB size is 16. So we theoretically  can
hard-code 16+1 size for this fifo.
Also same code will be used for mpeg2, mjpeg, vc1 where 16+1 most
likely too big.
Are you agree to use fixed size for fifo?

Best regards,
 Ivan                            mailto:ivan.uskov at nablet.com

More information about the ffmpeg-devel mailing list