diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-18 12:44:42 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-18 12:50:14 +0300 |
commit | 946acacdcdff7eb9ac6430691ac6121516da9083 (patch) | |
tree | c17e67a81c3e4f93302f78a99dae8a75c06cb59b | |
parent | f866f22c3f581d776d1592f337809fb4a8036564 (diff) |
swresample: move dither init up
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libswresample/dither.c | 9 | ||||
-rw-r--r-- | libswresample/swresample.c | 13 |
2 files changed, 11 insertions, 11 deletions
diff --git a/libswresample/dither.c b/libswresample/dither.c index 08c793d4cf..76f8ccf2c6 100644 --- a/libswresample/dither.c +++ b/libswresample/dither.c @@ -123,15 +123,6 @@ av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AV s->dither.method = SWR_DITHER_TRIANGULAR_HIGHPASS; } - av_assert0(!s->preout.count); - s->dither.noise = s->preout; - s->dither.temp = s->preout; - if (s->dither.method > SWR_DITHER_NS) { - s->dither.noise.bps = 4; - s->dither.noise.fmt = AV_SAMPLE_FMT_FLTP; - s->dither.noise_scale = 1; - } - return 0; } diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 351623b9d6..ade81efd2c 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -322,6 +322,9 @@ av_assert0(s->out.ch_count); s->silence = s->in; s->drop_temp= s->out; + if ((ret = swri_dither_init(s, s->out_sample_fmt, s->int_sample_fmt)) < 0) + goto fail; + if(!s->resample && !s->rematrix && !s->channel_map && !s->dither.method){ s->full_convert = swri_audio_convert_alloc(s->out_sample_fmt, s-> in_sample_fmt, s-> in.ch_count, NULL, 0); @@ -362,8 +365,14 @@ av_assert0(s->out.ch_count); set_audiodata_fmt(&s->in_buffer, s->int_sample_fmt); } - if ((ret = swri_dither_init(s, s->out_sample_fmt, s->int_sample_fmt)) < 0) - goto fail; + av_assert0(!s->preout.count); + s->dither.noise = s->preout; + s->dither.temp = s->preout; + if (s->dither.method > SWR_DITHER_NS) { + s->dither.noise.bps = 4; + s->dither.noise.fmt = AV_SAMPLE_FMT_FLTP; + s->dither.noise_scale = 1; + } if(s->rematrix || s->dither.method) { ret = swri_rematrix_init(s); |