summaryrefslogtreecommitdiff
path: root/libswresample/rematrix.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-12 16:22:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-12 16:35:07 +0200
commitbeb0cd6acfe6ad9f32b8fc673507f6189633cc90 (patch)
tree1a645dacd54ed2cbf6d5bf564bfd398411534636 /libswresample/rematrix.c
parent48a45f819f393b9a967b2ad891eef22227fc2040 (diff)
swr: SIMD rematrixing and SSE/AVX mix_1_1 float
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r--libswresample/rematrix.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index a7d000c016..18e89c96ba 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -340,6 +340,9 @@ int swri_rematrix_init(SwrContext *s){
}
s->matrix_ch[i][0]= ch_in;
}
+
+ if(HAVE_YASM && HAVE_MMX) swri_rematrix_init_x86(s);
+
return 0;
}
@@ -351,12 +354,19 @@ void swri_rematrix_free(SwrContext *s){
int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
int out_i, in_i, i, j;
+ int len1 = 0;
+ int off = 0;
if(s->mix_any_f) {
s->mix_any_f(out->ch, in->ch, s->native_matrix, len);
return 0;
}
+ if(s->mix_2_1_simd || s->mix_1_1_simd){
+ len1= len&~15;
+ off = len1 * out->bps;
+ }
+
av_assert0(out->ch_count == av_get_channel_layout_nb_channels(s->out_ch_layout));
av_assert0(in ->ch_count == av_get_channel_layout_nb_channels(s-> in_ch_layout));
@@ -369,7 +379,10 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus
case 1:
in_i= s->matrix_ch[out_i][1];
if(s->matrix[out_i][in_i]!=1.0){
- s->mix_1_1_f(out->ch[out_i], in->ch[in_i], s->native_matrix, in->ch_count*out_i + in_i, len);
+ if(s->mix_1_1_simd && len1)
+ s->mix_1_1_simd(out->ch[out_i] , in->ch[in_i] , s->native_matrix, in->ch_count*out_i + in_i, len1);
+ if(len != len1)
+ s->mix_1_1_f (out->ch[out_i]+off, in->ch[in_i]+off, s->native_matrix, in->ch_count*out_i + in_i, len-len1);
}else if(mustcopy){
memcpy(out->ch[out_i], in->ch[in_i], len*out->bps);
}else{
@@ -379,7 +392,12 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus
case 2: {
int in_i1 = s->matrix_ch[out_i][1];
int in_i2 = s->matrix_ch[out_i][2];
- s->mix_2_1_f(out->ch[out_i], in->ch[in_i1], in->ch[in_i2], s->native_matrix, in->ch_count*out_i + in_i1, in->ch_count*out_i + in_i2, len);
+ if(s->mix_2_1_simd && len1)
+ s->mix_2_1_simd(out->ch[out_i] , in->ch[in_i1] , in->ch[in_i2] , s->native_matrix, in->ch_count*out_i + in_i1, in->ch_count*out_i + in_i2, len1);
+ else
+ s->mix_2_1_f (out->ch[out_i] , in->ch[in_i1] , in->ch[in_i2] , s->native_matrix, in->ch_count*out_i + in_i1, in->ch_count*out_i + in_i2, len1);
+ if(len != len1)
+ s->mix_2_1_f (out->ch[out_i]+off, in->ch[in_i1]+off, in->ch[in_i2]+off, s->native_matrix, in->ch_count*out_i + in_i1, in->ch_count*out_i + in_i2, len-len1);
break;}
default:
if(s->int_sample_fmt == AV_SAMPLE_FMT_FLTP){