diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-14 04:47:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-14 04:47:17 +0100 |
commit | ceb9f8d9271f2cd18a0d389be044ca93aa1b4870 (patch) | |
tree | fffcf641d23ca1323ac642b015167e13ee79621c /libswresample/audioconvert.c | |
parent | a286b04dafc43b9bd1fb884c3c87d636b399bd3e (diff) | |
download | ffmpeg-ceb9f8d9271f2cd18a0d389be044ca93aa1b4870.tar.gz |
audioconvert: support simd code with specific alignment requirements.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/audioconvert.c')
-rw-r--r-- | libswresample/audioconvert.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c index d2e3722a40..4ba0ff13b1 100644 --- a/libswresample/audioconvert.c +++ b/libswresample/audioconvert.c @@ -170,12 +170,28 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len int ch; int off=0; const int os= (out->planar ? 1 :out->ch_count) *out->bps; + unsigned misaligned = 0; av_assert0(ctx->channels == out->ch_count); + if (ctx->in_simd_align_mask) { + int planes = in->planar ? in->ch_count : 1; + unsigned m = 0; + for (ch = 0; ch < planes; ch++) + m |= (intptr_t)in->ch[ch]; + misaligned |= m & ctx->in_simd_align_mask; + } + if (ctx->out_simd_align_mask) { + int planes = out->planar ? out->ch_count : 1; + unsigned m = 0; + for (ch = 0; ch < planes; ch++) + m |= (intptr_t)out->ch[ch]; + misaligned |= m & ctx->out_simd_align_mask; + } + //FIXME optimize common cases - if(ctx->simd_f && !ctx->ch_map){ + if(ctx->simd_f && !ctx->ch_map && !misaligned){ off = len&~15; av_assert1(off>=0); av_assert1(off<=len); |