21 #include "libavutil/avassert.h"
34 seed = seed* 1664525 + 1013904223;
40 v = ((double)seed) / UINT_MAX;
41 seed = seed*1664525 + 1013904223;
42 v-= ((double)seed) / UINT_MAX;
57 v = (- tmp[i] + 2*tmp[i+1] - tmp[i+2]) / sqrt(6);
106 for (i=0;
filters[i].coefs; i++) {
111 for (j=0; j<f->
len; j++)
118 av_log(s,
AV_LOG_WARNING,
"Requested noise shaping dither not available at this sampling rate, using triangular hp dither\n");
134 #define TEMPLATE_DITHER_S16
136 #undef TEMPLATE_DITHER_S16
138 #define TEMPLATE_DITHER_S32
140 #undef TEMPLATE_DITHER_S32
142 #define TEMPLATE_DITHER_FLT
144 #undef TEMPLATE_DITHER_FLT
146 #define TEMPLATE_DITHER_DBL
148 #undef TEMPLATE_DITHER_DBL
AudioData temp
temporary storage when writing into the input buffer isnt possible
int out_sample_rate
output sample rate
enum AVResampleDitherMethod method
#define AV_LOG_WARNING
Something somehow does not look correct.
int count
number of samples
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
float ns_scale
Noise shaping dither scale.
float ns_coeffs[NS_TAPS]
Noise shaping filter coefficients.
float ns_errors[SWR_CH_MAX][2 *NS_TAPS]
enum AVSampleFormat fmt
sample format
static const vf_info_t *const filters[]
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int output_sample_bits
the number of used output bits, needed to scale dither correctly
AudioData preout
pre-output audio data: used for rematrix/resample
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
AudioData noise
noise used for dithering
float ns_scale_1
Noise shaping dither scale^-1.
float noise_scale
Noise scale.
AVSampleFormat
Audio Sample Formats.
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
int ns_pos
Noise shaping dither position.
struct DitherContext dither
static const uint16_t scale[4]
int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
int ns_taps
Noise shaping dither taps.