[FFmpeg-devel] [PATCH] swr: special case for empty channels in rematrix.

Nicolas George nicolas.george at normalesup.org
Tue Feb 21 00:06:04 CET 2012


Speed += 10% overall for pan=stereo:FL=FC+FR from wav to null.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libswresample/rematrix.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


swresample_test unchanged (of course, its matrices have no empty lines).
Tested with pan and all sample formats.


diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index da817e1..e588fe9 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -280,6 +280,9 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus
 
     for(out_i=0; out_i<out->ch_count; out_i++){
         switch(s->matrix_ch[out_i][0]){
+        case 0:
+            memset(out->ch[out_i], 0, len * (s->int_sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t)));
+            break;
         case 1:
             in_i= s->matrix_ch[out_i][1];
             if(mustcopy || s->matrix[out_i][in_i]!=1.0){
-- 
1.7.9



More information about the ffmpeg-devel mailing list