[FFmpeg-cvslog] swr: add native_simd_one

Michael Niedermayer git at videolan.org
Tue Jun 4 23:51:33 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jun  4 23:35:19 2013 +0200| [4cfc92081dfe9dfd14045b99b60e531b4f2cf6e7] | committer: Michael Niedermayer

swr: add native_simd_one

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

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

 libswresample/rematrix.c            |    1 +
 libswresample/swresample_internal.h |    1 +
 libswresample/x86/swresample_x86.c  |    5 +++++
 3 files changed, 7 insertions(+)

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 3abfb3e..48aff3b 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -403,6 +403,7 @@ av_cold void swri_rematrix_free(SwrContext *s){
     av_freep(&s->native_matrix);
     av_freep(&s->native_one);
     av_freep(&s->native_simd_matrix);
+    av_freep(&s->native_simd_one);
 }
 
 int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 17b85d5..108f837 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -134,6 +134,7 @@ struct SwrContext {
     float matrix[SWR_CH_MAX][SWR_CH_MAX];           ///< floating point rematrixing coefficients
     uint8_t *native_matrix;
     uint8_t *native_one;
+    uint8_t *native_simd_one;
     uint8_t *native_simd_matrix;
     int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];       ///< 17.15 fixed point rematrixing coefficients
     uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];    ///< Lists of input channels per output channel that have non zero rematrixing coefficients
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c
index e18f0c5..581dc17 100644
--- a/libswresample/x86/swresample_x86.c
+++ b/libswresample/x86/swresample_x86.c
@@ -169,6 +169,7 @@ av_cold void swri_rematrix_init_x86(struct SwrContext *s){
             s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
         }
         s->native_simd_matrix = av_mallocz(2 * num * sizeof(int16_t));
+        s->native_simd_one    = av_mallocz(2 * sizeof(int16_t));
         for(i=0; i<nb_out; i++){
             int sh = 0;
             for(j=0; j<nb_in; j++)
@@ -180,6 +181,8 @@ av_cold void swri_rematrix_init_x86(struct SwrContext *s){
                     ((((int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh;
             }
         }
+        ((int16_t*)s->native_simd_one)[1] = 14;
+        ((int16_t*)s->native_simd_one)[0] = 16384;
     } else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){
         if(mm_flags & AV_CPU_FLAG_SSE) {
             s->mix_1_1_simd = ff_mix_1_1_a_float_sse;
@@ -191,5 +194,7 @@ av_cold void swri_rematrix_init_x86(struct SwrContext *s){
         }
         s->native_simd_matrix = av_mallocz(num * sizeof(float));
         memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float));
+        s->native_simd_one = av_mallocz(sizeof(float));
+        memcpy(s->native_simd_one, s->native_one, sizeof(float));
     }
 }



More information about the ffmpeg-cvslog mailing list