swr: rename dither_pos to noise_pos

THis more closely matches what the field represents

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-01-10 18:01:26 +01:00
parent 36055aa876
commit fca51256d4
3 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,7 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *srcs, AudioData *noise
float S_1 = s->dither.ns_scale_1; float S_1 = s->dither.ns_scale_1;
for (ch=0; ch<srcs->ch_count; ch++) { for (ch=0; ch<srcs->ch_count; ch++) {
const float *noise = ((const float *)noises->ch[ch]) + s->dither.dither_pos; const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos;
DELEM *data = (DELEM*)srcs->ch[ch]; DELEM *data = (DELEM*)srcs->ch[ch];
pos = s->dither.ns_pos; pos = s->dither.ns_pos;
for (i=0; i<count; i++) { for (i=0; i<count; i++) {

View File

@ -657,8 +657,8 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
swri_get_dither(s, s->dither.noise.ch[ch], s->dither.noise.count, 12345678913579<<ch, s->dither.noise.fmt); swri_get_dither(s, s->dither.noise.ch[ch], s->dither.noise.count, 12345678913579<<ch, s->dither.noise.fmt);
av_assert0(s->dither.noise.ch_count == preout->ch_count); av_assert0(s->dither.noise.ch_count == preout->ch_count);
if(s->dither.dither_pos + out_count > s->dither.noise.count) if(s->dither.noise_pos + out_count > s->dither.noise.count)
s->dither.dither_pos = 0; s->dither.noise_pos = 0;
if (s->dither.method < SWR_DITHER_NS){ if (s->dither.method < SWR_DITHER_NS){
if (s->mix_2_1_simd) { if (s->mix_2_1_simd) {
@ -667,13 +667,13 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
if(len1) if(len1)
for(ch=0; ch<preout->ch_count; ch++) for(ch=0; ch<preout->ch_count; ch++)
s->mix_2_1_simd(preout->ch[ch], preout->ch[ch], s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.dither_pos, s->native_one, 0, 0, len1); s->mix_2_1_simd(preout->ch[ch], preout->ch[ch], s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.noise_pos, s->native_one, 0, 0, len1);
if(out_count != len1) if(out_count != len1)
for(ch=0; ch<preout->ch_count; ch++) for(ch=0; ch<preout->ch_count; ch++)
s->mix_2_1_f(preout->ch[ch] + off, preout->ch[ch] + off, s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.dither_pos + off + len1, s->native_one, 0, 0, out_count - len1); s->mix_2_1_f(preout->ch[ch] + off, preout->ch[ch] + off, s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.noise_pos + off + len1, s->native_one, 0, 0, out_count - len1);
} else { } else {
for(ch=0; ch<preout->ch_count; ch++) for(ch=0; ch<preout->ch_count; ch++)
s->mix_2_1_f(preout->ch[ch], preout->ch[ch], s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.dither_pos, s->native_one, 0, 0, out_count); s->mix_2_1_f(preout->ch[ch], preout->ch[ch], s->dither.noise.ch[ch] + s->dither.noise.bps * s->dither.noise_pos, s->native_one, 0, 0, out_count);
} }
} else { } else {
switch(s->int_sample_fmt) { switch(s->int_sample_fmt) {
@ -683,7 +683,7 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
case AV_SAMPLE_FMT_DBLP :swri_noise_shaping_double(s,preout, &s->dither.noise, out_count); break; case AV_SAMPLE_FMT_DBLP :swri_noise_shaping_double(s,preout, &s->dither.noise, out_count); break;
} }
} }
s->dither.dither_pos += out_count; s->dither.noise_pos += out_count;
} }
//FIXME packed doesnt need more than 1 chan here! //FIXME packed doesnt need more than 1 chan here!
swri_audio_convert(s->out_convert, out, preout, out_count); swri_audio_convert(s->out_convert, out, preout, out_count);

View File

@ -52,7 +52,7 @@ typedef struct AudioData{
struct DitherContext { struct DitherContext {
enum SwrDitherType method; enum SwrDitherType method;
int dither_pos; int noise_pos;
float scale; float scale;
float noise_scale; ///< Noise scale float noise_scale; ///< Noise scale
int ns_taps; ///< Noise shaping dither taps int ns_taps; ///< Noise shaping dither taps