Commit 950a21e8 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33

This makes the changed code-path faster.

Change not tested except with the fuzzer testcase as I found no other testcase.

Improves: Timeout (136sec -> 74sec)
Improves: 16040/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5705876062601216
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
parent 1fedba3c
...@@ -532,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -532,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s->current_frame->linesize[0] / 4); s->current_frame->linesize[0] / 4);
} else if (type == 17 || type == 33) { } else if (type == 17 || type == 33) {
uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0]; uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
int x, y; int y;
frame->key_frame = 1; frame->key_frame = 1;
bytestream2_skip(gb, 1); bytestream2_skip(gb, 1);
...@@ -548,9 +548,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -548,9 +548,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
clr = bytestream2_get_le24(gb); clr = bytestream2_get_le24(gb);
} }
for (y = 0; y < avctx->height; y++) { for (y = 0; y < avctx->height; y++) {
for (x = 0; x < avctx->width; x++) { dst[0] = clr;
dst[x] = clr; av_memcpy_backptr((uint8_t*)(dst+1), 4, 4*avctx->width - 4);
}
dst += s->current_frame->linesize[0] / 4; dst += s->current_frame->linesize[0] / 4;
} }
} else if (type == 0 || type == 1) { } else if (type == 0 || type == 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment