diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-07 00:04:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-07 00:04:44 +0200 |
commit | fecdc76a9ff685eec8807fc6cafadf8efdb3370c (patch) | |
tree | d8ca30383a276d10f3a1f053c17102c848cc6a71 /libswresample | |
parent | 715c8a5a5052d67423f27192444474a3d61dce60 (diff) | |
download | ffmpeg-streaming-fecdc76a9ff685eec8807fc6cafadf8efdb3370c.zip ffmpeg-streaming-fecdc76a9ff685eec8807fc6cafadf8efdb3370c.tar.gz |
swr: fix cpy() after the len was changed to be in samples.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r-- | libswresample/audioconvert.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c index 986c45d..3143d69 100644 --- a/libswresample/audioconvert.c +++ b/libswresample/audioconvert.c @@ -107,9 +107,18 @@ static conv_func_type * const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB*AV_SAM FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), }; -static void cpy(uint8_t **dst, const uint8_t **src, int len){ +static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len); } +static void cpy2(uint8_t **dst, const uint8_t **src, int len){ + memcpy(*dst, *src, 2*len); +} +static void cpy4(uint8_t **dst, const uint8_t **src, int len){ + memcpy(*dst, *src, 4*len); +} +static void cpy8(uint8_t **dst, const uint8_t **src, int len){ + memcpy(*dst, *src, 8*len); +} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, @@ -136,8 +145,14 @@ AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, if (in_fmt == AV_SAMPLE_FMT_U8) memset(ctx->silence, 0x80, sizeof(ctx->silence)); - if(out_fmt == in_fmt && !ch_map) - ctx->simd_f = cpy; + if(out_fmt == in_fmt && !ch_map) { + switch(av_get_bytes_per_sample(in_fmt)){ + case 1:ctx->simd_f = cpy1; break; + case 2:ctx->simd_f = cpy2; break; + case 4:ctx->simd_f = cpy4; break; + case 8:ctx->simd_f = cpy8; break; + } + } if(HAVE_YASM && HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels); |