[FFmpeg-cvslog] rematrix: change type of integers from 16 to 32bit to allow increasing volume with it .

Michael Niedermayer git at videolan.org
Wed Oct 26 01:08:20 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Oct 26 00:41:26 2011 +0200| [b1470d7a60636c7f2a2ea9e3c926ca57f10d0651] | committer: Michael Niedermayer

rematrix: change type of integers from 16 to 32bit to allow increasing volume with it.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1470d7a60636c7f2a2ea9e3c926ca57f10d0651
---

 libswresample/rematrix.c            |   10 +++++-----
 libswresample/swresample_internal.h |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index b3e3e4a..9dcfecb 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -197,7 +197,7 @@ int swr_rematrix_init(SwrContext *s){
         int ch_in=0;
         for(j=0; j<64; j++){
             s->matrix[out_i][in_i]= matrix[i][j];
-            s->matrix16[out_i][in_i]= lrintf(matrix[i][j] * 32768);
+            s->matrix32[out_i][in_i]= lrintf(matrix[i][j] * 32768);
             if(matrix[i][j]){
                 s->matrix_ch[out_i][++ch_in]= in_i;
                 sum += fabs(matrix[i][j]);
@@ -215,7 +215,7 @@ int swr_rematrix_init(SwrContext *s){
         for(i=0; i<SWR_CH_MAX; i++)
             for(j=0; j<SWR_CH_MAX; j++){
                 s->matrix[i][j] /= maxcoef;
-                s->matrix16[i][j]= lrintf(s->matrix[i][j] * 32768);
+                s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768);
             }
     }
     for(i=0; i<av_get_channel_layout_nb_channels(s->out_ch_layout); i++){
@@ -241,7 +241,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
                 if(s->int_sample_fmt == AV_SAMPLE_FMT_FLT){
                     copy_float((float  *)out->ch[out_i], (const float  *)in->ch[in_i], s->matrix  [out_i][in_i], len);
                 }else
-                    copy_s16  ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[in_i], s->matrix16[out_i][in_i], len);
+                    copy_s16  ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[in_i], s->matrix32[out_i][in_i], len);
             }else{
                 out->ch[out_i]= in->ch[in_i];
             }
@@ -253,7 +253,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
                            len);
             }else{
                 sum2_s16  ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[ s->matrix_ch[out_i][1] ],           (const int16_t*)in->ch[ s->matrix_ch[out_i][2] ],
-                                 s->matrix16[out_i][ s->matrix_ch[out_i][1] ], s->matrix16[out_i][ s->matrix_ch[out_i][2] ],
+                                 s->matrix32[out_i][ s->matrix_ch[out_i][1] ], s->matrix32[out_i][ s->matrix_ch[out_i][2] ],
                            len);
             }
             break;
@@ -272,7 +272,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
                     int v=0;
                     for(j=0; j<s->matrix_ch[out_i][0]; j++){
                         in_i= s->matrix_ch[out_i][1+j];
-                        v+= ((int16_t*)in->ch[in_i])[i] * s->matrix16[out_i][in_i];
+                        v+= ((int16_t*)in->ch[in_i])[i] * s->matrix32[out_i][in_i];
                     }
                     ((int16_t*)out->ch[out_i])[i]= (v + 16384)>>15;
                 }
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 3137be6..fc5f25c 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -62,7 +62,7 @@ typedef struct SwrContext {          //FIXME find unused fields
     struct AVResampleContext *resample;
 
     float matrix[SWR_CH_MAX][SWR_CH_MAX];
-    int16_t matrix16[SWR_CH_MAX][SWR_CH_MAX];
+    int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
     uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];
 
     //TODO callbacks for asm optims



More information about the ffmpeg-cvslog mailing list