swr: use memcpy when input and output match

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-04-29 15:28:16 +02:00
parent 106789dfa0
commit 9f98a8e9bc
1 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,10 @@ 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), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL),
}; };
static void cpy(uint8_t **dst, const uint8_t **src, int len){
memcpy(*dst, *src, len);
}
AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt, enum AVSampleFormat in_fmt,
int channels, const int *ch_map, int channels, const int *ch_map,
@ -126,6 +130,9 @@ AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
if (in_fmt == AV_SAMPLE_FMT_U8) if (in_fmt == AV_SAMPLE_FMT_U8)
memset(ctx->silence, 0x80, sizeof(ctx->silence)); memset(ctx->silence, 0x80, sizeof(ctx->silence));
if(out_fmt == in_fmt && !ch_map)
ctx->simd_f = cpy;
if(HAVE_YASM && HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels); if(HAVE_YASM && HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);
return ctx; return ctx;