diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-08-31 23:25:22 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-09-01 14:19:19 +0200 |
commit | 97c73ba56505e180f6ab8f49b7b5642e0c09fa09 (patch) | |
tree | de3671bd97aae9981b3b02cce95d6ae7d978f3e2 /libavcodec/qpeg.c | |
parent | a13a23bdf2049d7ae439a5ee73cfdd1e223c32d8 (diff) |
avcodec/qpeg: speed-up copy of bytes
Diffstat (limited to 'libavcodec/qpeg.c')
-rw-r--r-- | libavcodec/qpeg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 40931e3bdc..8bc710acfd 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -101,8 +101,11 @@ static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst, } else { if (bytestream2_get_bytes_left(&qctx->buffer) < copy) copy = bytestream2_get_bytes_left(&qctx->buffer); - for(i = 0; i < copy; i++) { - dst[filled++] = bytestream2_get_byte(&qctx->buffer); + while (copy > 0) { + int step = FFMIN(copy, width - filled); + bytestream2_get_bufferu(&qctx->buffer, dst + filled, step); + filled += step; + copy -= step; if (filled >= width) { filled = 0; dst -= stride; |