[FFmpeg-cvslog] avcodec/wcmv: prevent frame copying when outputting duplicate frames
James Almer
git at videolan.org
Wed Sep 4 16:27:16 EEST 2019
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Sep 3 23:53:46 2019 -0300| [343f8d514e521ea52fc64aab0ddf1d497b0e4cec] | committer: James Almer
avcodec/wcmv: prevent frame copying when outputting duplicate frames
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=343f8d514e521ea52fc64aab0ddf1d497b0e4cec
---
libavcodec/wcmv.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c
index 2f21c1430c..d7a3cbd1b7 100644
--- a/libavcodec/wcmv.c
+++ b/libavcodec/wcmv.c
@@ -45,7 +45,7 @@ static int decode_frame(AVCodecContext *avctx,
{
WCMVContext *s = avctx->priv_data;
AVFrame *frame = data;
- int skip, blocks, zret, ret, intra = 0, bpp = s->bpp;
+ int skip, blocks, zret, ret, intra = 0, flags = 0, bpp = s->bpp;
GetByteContext gb;
uint8_t *dst;
@@ -56,11 +56,13 @@ static int decode_frame(AVCodecContext *avctx,
}
bytestream2_init(&gb, avpkt->data, avpkt->size);
+ blocks = bytestream2_get_le16(&gb);
+ if (!blocks)
+ flags |= FF_REGET_BUFFER_FLAG_READONLY;
- if ((ret = ff_reget_buffer(avctx, s->prev_frame, 0)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->prev_frame, flags)) < 0)
return ret;
- blocks = bytestream2_get_le16(&gb);
if (blocks > 5) {
GetByteContext bgb;
int x = 0, size;
More information about the ffmpeg-cvslog
mailing list