diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2013-03-06 00:25:18 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-03-06 00:25:18 +0100 |
commit | 940b06aeb8927ca78239007b7b19f2f160055d0c (patch) | |
tree | 139d0c5673a7d9f2627869446b9dda05615d0291 /libavcodec/kgv1dec.c | |
parent | d9293648147013403de729958ea4c19a5b6c40e4 (diff) | |
download | ffmpeg-940b06aeb8927ca78239007b7b19f2f160055d0c.tar.gz |
kgv1dec: Simplify kega decoding by using memcpy instead of loops
Fixes decoding errors with icc 13.1
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Diffstat (limited to 'libavcodec/kgv1dec.c')
-rw-r--r-- | libavcodec/kgv1dec.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index 008843c673..6687e6bc0c 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -93,8 +93,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, out[outcnt++] = code; // rgb555 pixel coded directly } else { int count; - int inp_off; - uint16_t *inp; if ((code & 0x6000) == 0x6000) { // copy from previous frame @@ -112,7 +110,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, start = (outcnt + offsets[oidx]) % maxcnt; - if (maxcnt - start < count) + if (maxcnt - start < count || maxcnt - outcnt < count) break; if (!prev) { @@ -121,8 +119,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, break; } - inp = prev; - inp_off = start; + memcpy(out + outcnt, prev + start, 2 * count); } else { // copy from earlier in this frame int offset = (code & 0x1FFF) + 1; @@ -137,19 +134,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, count = 4 + *buf++; } - if (outcnt < offset) + if (outcnt < offset || maxcnt - outcnt < count) break; - inp = out; - inp_off = outcnt - offset; - } - - if (maxcnt - outcnt < count) - break; - - for (i = inp_off; i < count + inp_off; i++) { - out[outcnt++] = inp[i]; + av_memcpy_backptr((uint8_t *)out + 2 * outcnt, 2 * offset, 2 * count); } + outcnt += count; } } |