1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/qpeg: speed-up copy of bytes

This commit is contained in:
Paul B Mahol 2020-08-31 23:25:22 +02:00
parent a13a23bdf2
commit 97c73ba565

View File

@ -101,8 +101,11 @@ static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
} else { } else {
if (bytestream2_get_bytes_left(&qctx->buffer) < copy) if (bytestream2_get_bytes_left(&qctx->buffer) < copy)
copy = bytestream2_get_bytes_left(&qctx->buffer); copy = bytestream2_get_bytes_left(&qctx->buffer);
for(i = 0; i < copy; i++) { while (copy > 0) {
dst[filled++] = bytestream2_get_byte(&qctx->buffer); int step = FFMIN(copy, width - filled);
bytestream2_get_bufferu(&qctx->buffer, dst + filled, step);
filled += step;
copy -= step;
if (filled >= width) { if (filled >= width) {
filled = 0; filled = 0;
dst -= stride; dst -= stride;