28 double scale =
s->dither.noise_scale;
40 switch(
s->dither.method){
55 switch(
s->dither.method){
104 scale *= 1<<(32-
s->dither.output_sample_bits);
107 s->dither.method = 0;
111 s->dither.ns_pos = 0;
112 s->dither.noise_scale=
scale;
113 s->dither.ns_scale =
scale;
115 memset(
s->dither.ns_errors, 0,
sizeof(
s->dither.ns_errors));
118 if (llabs(
s->out_sample_rate -
f->rate)*20 <=
f->rate &&
f->name ==
s->dither.method) {
120 s->dither.ns_taps =
f->len;
121 for (j=0; j<
f->len; j++)
122 s->dither.ns_coeffs[j] =
f->coefs[j];
128 av_log(
s,
AV_LOG_WARNING,
"Requested noise shaping dither not available at this sampling rate, using triangular hp dither\n");
135#define TEMPLATE_DITHER_S16
137#undef TEMPLATE_DITHER_S16
139#define TEMPLATE_DITHER_S32
141#undef TEMPLATE_DITHER_S32
143#define TEMPLATE_DITHER_FLT
145#undef TEMPLATE_DITHER_FLT
147#define TEMPLATE_DITHER_DBL
149#undef TEMPLATE_DITHER_DBL
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt)
int swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt)
#define AV_LOG_WARNING
Something somehow does not look correct.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S16
signed 16 bits
@ SWR_DITHER_TRIANGULAR_HIGHPASS
@ SWR_DITHER_NB
not part of API/ABI
@ SWR_DITHER_NS
not part of API/ABI
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Memory handling functions.
The libswresample context.
#define av_malloc_array(a, b)