diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-10 19:52:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-10 19:54:41 +0200 |
commit | db2eadb2f57ad5a580c9ad5b2d288c4f6a2eeecb (patch) | |
tree | 1f2a13cd4aa60f6c16490efd2731681f2cad98c2 /libswresample/rematrix.c | |
parent | 5c1f312888fc0094e4755c10c9700af87c9c3a40 (diff) | |
download | ffmpeg-db2eadb2f57ad5a580c9ad5b2d288c4f6a2eeecb.tar.gz |
swr: add dither support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r-- | libswresample/rematrix.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index e9f919cf50..1dc8ffbaa4 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -272,6 +272,14 @@ int swri_rematrix_init(SwrContext *s){ return 0; } +void swri_sum2(enum AVSampleFormat format, void *dst, const void *src0, const void *src1, float coef0, float coef1, int len){ + if(format == AV_SAMPLE_FMT_FLT){ + sum2_float((float *)dst, (const float *)src0, (const float *)src1, coef0, coef1, len); + }else{ + sum2_s16 ((int16_t*)dst, (const int16_t*)src0, (const int16_t*)src1, lrintf(coef0 * 32768), lrintf(coef1 * 32768), len); + } +} + int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){ int out_i, in_i, i, j; @@ -295,15 +303,8 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus } break; case 2: - if(s->int_sample_fmt == AV_SAMPLE_FMT_FLT){ - sum2_float((float *)out->ch[out_i], (const float *)in->ch[ s->matrix_ch[out_i][1] ], (const float *)in->ch[ s->matrix_ch[out_i][2] ], - s->matrix[out_i][ s->matrix_ch[out_i][1] ], s->matrix[out_i][ s->matrix_ch[out_i][2] ], - 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->matrix32[out_i][ s->matrix_ch[out_i][1] ], s->matrix32[out_i][ s->matrix_ch[out_i][2] ], - len); - } + swri_sum2(s->int_sample_fmt, out->ch[out_i], in->ch[ s->matrix_ch[out_i][1] ], in->ch[ s->matrix_ch[out_i][2] ], + s->matrix[out_i][ s->matrix_ch[out_i][1] ], s->matrix[out_i][ s->matrix_ch[out_i][2] ], len); break; default: if(s->int_sample_fmt == AV_SAMPLE_FMT_FLT){ |