[FFmpeg-devel] [PATCH 3/4] libavcodec/qsvdec.c: The ff_qsv_decode() now guarantees the consumption of whole packet.
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 24 01:48:45 CEST 2015
On Thu, Jul 23, 2015 at 12:46:47PM +0300, Ivan Uskov wrote:
> Hello All ,
>
> There is updated version of patch which should be applied without conflicts.
> Also here couple wrong places have been corrected into ff_qsv_decode().
>
> Tuesday, July 21, 2015, 4:08:47 PM, you wrote:
>
> IU> Hello all,
>
> IU> Actual implementation of ff_qsv_decode() is not reliable, it may
> IU> return without consumption of 1..3 last bytes of packet which
> IU> initiates infinitive loop. New implementation guarantees that packet
> IU> will consumed, now internal fifo uses to join unconsumed previous packet
> IU> tail with new packet.
> IU> Please review.
> IU>
>
>
>
>
> --
> Best regards,
> Ivan mailto:ivan.uskov at nablet.com
> qsvdec.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++----------------
> qsvdec.h | 1
> 2 files changed, 100 insertions(+), 31 deletions(-)
> eb551cc0e8ef21a3557cebb850b5a15ce385e30e 0002-libavcodec-qsvdec.c-The-ff_qsv_decode-now-guarantees.patch
> From 1b1d3cae1910eb1a4dcea3ddee31a1b2a42292f5 Mon Sep 17 00:00:00 2001
> From: Ivan Uskov <ivan.uskov at nablet.com>
> Date: Tue, 21 Jul 2015 08:31:14 -0400
> Subject: [PATCH 2/2] libavcodec/qsvdec.c: The ff_qsv_decode() now guarantees
> the consumption of whole packet.
>
> ---
> libavcodec/qsvdec.c | 130 +++++++++++++++++++++++++++++++++++++++-------------
> libavcodec/qsvdec.h | 1 +
> 2 files changed, 100 insertions(+), 31 deletions(-)
>
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 4e7a0ac..b81781b 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -126,6 +126,10 @@ int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt)
> if (!q->async_fifo)
> return AVERROR(ENOMEM);
>
> + q->input_fifo = av_fifo_alloc(1024*16);
> + if (!q->input_fifo)
> + return AVERROR(ENOMEM);
> +
> q->engine_ready = 1;
>
> return 0;
> @@ -223,6 +227,31 @@ static QSVFrame *find_frame(QSVContext *q, mfxFrameSurface1 *surf)
> return NULL;
> }
>
> +static void qsv_fifo_relocate(AVFifoBuffer *f, int bytes_to_free)
this should be documented, maybe something like
drains specifiified amount of data and re-locates the remaining to
the start of the buffer
[...]
> + /* 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));
the DPB cannot be arbitrary large, so maybe the grow code could be
avoided ?
or maybe i missunderstand
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150724/9dc93052/attachment.sig>
More information about the ffmpeg-devel
mailing list