diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-09 18:41:12 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-09 18:41:12 +0100 |
commit | 3ab1970612b5d343d013d57083c2bf0f01d997ca (patch) | |
tree | 9e2942cde5be2e78fd038e0cb4253e5a2b235bb0 /libswresample/dither.c | |
parent | ba1314c2efc478e4c6a0023d36860aabf0ab133a (diff) | |
download | ffmpeg-3ab1970612b5d343d013d57083c2bf0f01d997ca.tar.gz |
swr: move dither related fields to their own context
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/dither.c')
-rw-r--r-- | libswresample/dither.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libswresample/dither.c b/libswresample/dither.c index f43d8911df..c79d37213a 100644 --- a/libswresample/dither.c +++ b/libswresample/dither.c @@ -41,35 +41,35 @@ void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSa if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<24; if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<8; - scale *= s->dither_scale; + scale *= s->dither.scale; - s->ns_pos = 0; - s->ns_scale = scale; - s->ns_scale_1 = 1/scale; - memset(s->ns_errors, 0, sizeof(s->ns_errors)); + s->dither.ns_pos = 0; + s->dither.ns_scale = scale; + s->dither.ns_scale_1 = 1/scale; + memset(s->dither.ns_errors, 0, sizeof(s->dither.ns_errors)); for (i=0; filters[i].coefs; i++) { const filter_t *f = &filters[i]; - if (fabs(s->out_sample_rate - f->rate) / f->rate <= .05 && f->name == s->dither_method) { + if (fabs(s->out_sample_rate - f->rate) / f->rate <= .05 && f->name == s->dither.method) { int j; - s->ns_taps = f->len; + s->dither.ns_taps = f->len; for (j=0; j<f->len; j++) - s->ns_coeffs[j] = f->coefs[j]; + s->dither.ns_coeffs[j] = f->coefs[j]; break; } } - if (!filters[i].coefs && s->dither_method > SWR_DITHER_NS) { + if (!filters[i].coefs && s->dither.method > SWR_DITHER_NS) { av_log(s, AV_LOG_WARNING, "Requested noise shaping dither not available at this sampling rate, using triangular hp dither\n"); - s->dither_method = SWR_DITHER_TRIANGULAR_HIGHPASS; + s->dither.method = SWR_DITHER_TRIANGULAR_HIGHPASS; } for(i=0; i<len + TMP_EXTRA; i++){ double v; seed = seed* 1664525 + 1013904223; - switch(s->dither_method){ + switch(s->dither.method){ case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break; default: - av_assert0(s->dither_method < SWR_DITHER_NB); + av_assert0(s->dither.method < SWR_DITHER_NB); v = ((double)seed) / UINT_MAX; seed = seed*1664525 + 1013904223; v-= ((double)seed) / UINT_MAX; @@ -81,9 +81,9 @@ void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSa for(i=0; i<len; i++){ double v; - switch(s->dither_method){ + switch(s->dither.method){ default: - av_assert0(s->dither_method < SWR_DITHER_NB); + av_assert0(s->dither.method < SWR_DITHER_NB); v = tmp[i]; break; case SWR_DITHER_TRIANGULAR_HIGHPASS : |