History

swr: add native_simd_one

Michael Niedermayer committed 13 years ago

Commit 4cfc9201 parent e3e398b3 files · +7 −0Browse files

Showing the changes to libswresample (3 of 3 files). Show all

Unified · Split

3 files
  1. libswresample/rematrix.c +1 −0
  2. libswresample/swresample_internal.h +1 −0
  3. libswresample/x86/swresample_x86.c +5 −0
libswresample/rematrix.c+1−0
@@ -403,6 +403,7 @@ av_cold void swri_rematrix_free(SwrContext *s){ · 402 unmodified lines
403 av_freep(&s->native_matrix);403 av_freep(&s->native_matrix);
404 av_freep(&s->native_one);404 av_freep(&s->native_one);
405 av_freep(&s->native_simd_matrix);405 av_freep(&s->native_simd_matrix);
406 av_freep(&s->native_simd_one);
406}407}
407 408
408int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){409int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
libswresample/swresample_internal.h+1−0
@@ -134,6 +134,7 @@ struct SwrContext { · 133 unmodified lines
134 float matrix[SWR_CH_MAX][SWR_CH_MAX]; ///< floating point rematrixing coefficients134 float matrix[SWR_CH_MAX][SWR_CH_MAX]; ///< floating point rematrixing coefficients
135 uint8_t *native_matrix;135 uint8_t *native_matrix;
136 uint8_t *native_one;136 uint8_t *native_one;
137 uint8_t *native_simd_one;
137 uint8_t *native_simd_matrix;138 uint8_t *native_simd_matrix;
138 int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX]; ///< 17.15 fixed point rematrixing coefficients139 int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX]; ///< 17.15 fixed point rematrixing coefficients
139 uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1]; ///< Lists of input channels per output channel that have non zero rematrixing coefficients140 uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1]; ///< Lists of input channels per output channel that have non zero rematrixing coefficients
libswresample/x86/swresample_x86.c+5−0
@@ -169,6 +169,7 @@ av_cold void swri_rematrix_init_x86(struct SwrContext *s){ · 168 unmodified lines
169 s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;169 s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
170 }170 }
171 s->native_simd_matrix = av_mallocz(2 * num * sizeof(int16_t));171 s->native_simd_matrix = av_mallocz(2 * num * sizeof(int16_t));
172 s->native_simd_one = av_mallocz(2 * sizeof(int16_t));
172 for(i=0; i<nb_out; i++){173 for(i=0; i<nb_out; i++){
173 int sh = 0;174 int sh = 0;
174 for(j=0; j<nb_in; j++)175 for(j=0; j<nb_in; j++)
@@ -180,6 +181,8 @@ av_cold void swri_rematrix_init_x86(struct SwrContext *s){ · 5 unmodified lines
180 ((((int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh;181 ((((int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh;
181 }182 }
182 }183 }
184 ((int16_t*)s->native_simd_one)[1] = 14;
185 ((int16_t*)s->native_simd_one)[0] = 16384;
183 } else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){186 } else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){
184 if(mm_flags & AV_CPU_FLAG_SSE) {187 if(mm_flags & AV_CPU_FLAG_SSE) {
185 s->mix_1_1_simd = ff_mix_1_1_a_float_sse;188 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){ · 5 unmodified lines
191 }194 }
192 s->native_simd_matrix = av_mallocz(num * sizeof(float));195 s->native_simd_matrix = av_mallocz(num * sizeof(float));
193 memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float));196 memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float));
197 s->native_simd_one = av_mallocz(sizeof(float));
198 memcpy(s->native_simd_one, s->native_one, sizeof(float));
194 }199 }
195}200}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t