diff options
author | Martin Vignali <martin.vignali@gmail.com> | 2017-05-05 22:20:58 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-14 20:58:53 +0200 |
commit | 2c6179aa829e6f50eea6faf47b2b6efd7650a41d (patch) | |
tree | 90d2c1d6ad3e8204a279bfed9c6fe9d817241a71 /libavcodec/exr.c | |
parent | a453f5549a8c3f8307200b32d3b342f0b4af3153 (diff) | |
download | ffmpeg-2c6179aa829e6f50eea6faf47b2b6efd7650a41d.tar.gz |
libavcodec/exr : simplify reorder_pixels
reorder_pixels is call by rle_uncompress and zip_uncompress
with size == uncompress_size
uncompress_size is a multiple of 2 (because exr store data
in half, float, or uint32)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/exr.c')
-rw-r--r-- | libavcodec/exr.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c index bf18ad0c79..759880756d 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -37,6 +37,7 @@ #include <float.h> #include <zlib.h> +#include "libavutil/avassert.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" #include "libavutil/intfloat.h" @@ -276,21 +277,17 @@ static void predictor(uint8_t *src, int size) static void reorder_pixels(uint8_t *src, uint8_t *dst, int size) { - const int8_t *t1 = src; - const int8_t *t2 = src + (size + 1) / 2; - int8_t *s = dst; - int8_t *stop = s + size; - - while (1) { - if (s < stop) - *(s++) = *(t1++); - else - break; + const uint8_t *t1 = src; + int half_size = size / 2; + const uint8_t *t2 = src + half_size; + uint8_t *s = dst; + int i; - if (s < stop) - *(s++) = *(t2++); - else - break; + av_assert1(size % 2 == 0); + + for (i = 0; i < half_size; i++) { + *(s++) = *(t1++); + *(s++) = *(t2++); } } |