aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-12-31 13:14:01 +0000
committerGravatar michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-12-31 13:14:01 +0000
commitf3f2e49ee2cea50fd990defb4434c245c3af55d4 (patch)
tree4e3058358e0801ecd4a2ed27bd304eb5768d0e78
parent0b7d411ad41754a32470ecf3c248379bee1595df (diff)
faster packed<->planar conversation
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14284 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libaf/af_lavcresample.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/libaf/af_lavcresample.c b/libaf/af_lavcresample.c
index 20d9ffc878..c99e29e7ee 100644
--- a/libaf/af_lavcresample.c
+++ b/libaf/af_lavcresample.c
@@ -118,9 +118,18 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
}
}
- for(j=0; j<in_len; j++){
- for(i=0; i<chans; i++){
- s->in[i][j + s->index]= *(in++);
+ if(chans==1){
+ memcpy(&s->in[0][s->index], in, in_len * sizeof(int16_t));
+ }else if(chans==2){
+ for(j=0; j<in_len; j++){
+ s->in[0][j + s->index]= *(in++);
+ s->in[1][j + s->index]= *(in++);
+ }
+ }else{
+ for(j=0; j<in_len; j++){
+ for(i=0; i<chans; i++){
+ s->in[i][j + s->index]= *(in++);
+ }
}
}
in_len += s->index;
@@ -135,9 +144,18 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
memmove(s->in[i], s->in[i] + consumed, s->index*sizeof(int16_t));
}
- for(j=0; j<out_len; j++){
- for(i=0; i<chans; i++){
- *(out++)= tmp[i][j];
+ if(chans==1){
+ memcpy(out, tmp[0], out_len*sizeof(int16_t));
+ }else if(chans==2){
+ for(j=0; j<out_len; j++){
+ *(out++)= tmp[0][j];
+ *(out++)= tmp[1][j];
+ }
+ }else{
+ for(j=0; j<out_len; j++){
+ for(i=0; i<chans; i++){
+ *(out++)= tmp[i][j];
+ }
}
}