diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-07-07 17:01:31 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-07-07 22:33:13 +0000 |
commit | 2d42008757efb0328308179a2190ff04b38315fd (patch) | |
tree | b168842b92c9c1911245aeb697f2afa4b6def043 /libavcodec | |
parent | acdf9a6ca5515801e68a1f2a9649d4291c9b7b8a (diff) | |
download | ffmpeg-2d42008757efb0328308179a2190ff04b38315fd.tar.gz |
sanm: make use of dsputil
About 27% faster decoding.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/sanm.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 2b548f274a..2a0fb77a71 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -25,6 +25,7 @@ #include "avcodec.h" #include "bytestream.h" #include "libavutil/bswap.h" +#include "libavcodec/dsputil.h" #include "sanm_data.h" #define NGLYPHS 256 @@ -449,8 +450,7 @@ static int old_codec37(SANMVideoContext *ctx, int top, int code; if (skip_run) { skip_run--; - for (k = 0; k < 4; k++) - memcpy(dst + i + k * stride, prev + i + k * stride, 4); + copy_block4(dst + i, prev + i, stride, stride, 4); continue; } if (bytestream2_get_bytes_left(&ctx->gb) < 1) @@ -501,8 +501,7 @@ static int old_codec37(SANMVideoContext *ctx, int top, int code; if (skip_run) { skip_run--; - for (k = 0; k < 4; k++) - memcpy(dst + i + k * stride, prev + i + k * stride, 4); + copy_block4(dst + i, prev + i, stride, stride, 4); continue; } code = bytestream2_get_byte(&ctx->gb); @@ -769,10 +768,21 @@ static int decode_nop(SANMVideoContext *ctx) static void copy_block(uint16_t *pdest, uint16_t *psrc, int block_size, int pitch) { - int y; + uint8_t *dst = (uint8_t *)pdest; + uint8_t *src = (uint8_t *)psrc; + int stride = pitch * 2; - for (y = 0; y < block_size; y++, pdest += pitch, psrc += pitch) - memcpy(pdest, psrc, block_size * sizeof(pdest[0])); + switch (block_size) { + case 2: + copy_block4(dst, src, stride, stride, 2); + break; + case 4: + copy_block8(dst, src, stride, stride, 4); + break; + case 8: + copy_block16(dst, src, stride, stride, 8); + break; + } } static void fill_block(uint16_t *pdest, uint16_t color, int block_size, int pitch) |