sanm: make use of dsputil

About 27% faster decoding.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/59/head
Paul B Mahol 13 years ago
parent acdf9a6ca5
commit 2d42008757
  1. 24
      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)

Loading…
Cancel
Save