Go to the documentation of this file.
27 double scale =
s->dither.noise_scale;
39 switch(
s->dither.method){
43 v = ((double)
seed) / UINT_MAX;
45 v-= ((double)
seed) / UINT_MAX;
54 switch(
s->dither.method){
103 scale *= 1<<(32-
s->dither.output_sample_bits);
106 s->dither.method = 0;
110 s->dither.ns_pos = 0;
111 s->dither.noise_scale=
scale;
112 s->dither.ns_scale =
scale;
114 memset(
s->dither.ns_errors, 0,
sizeof(
s->dither.ns_errors));
117 if (llabs(
s->out_sample_rate -
f->rate)*20 <=
f->rate &&
f->name ==
s->dither.method) {
119 s->dither.ns_taps =
f->len;
120 for (j=0; j<
f->len; j++)
121 s->dither.ns_coeffs[j] =
f->coefs[j];
127 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
@ SWR_DITHER_TRIANGULAR_HIGHPASS
@ AV_SAMPLE_FMT_FLTP
float, planar
#define AV_LOG_WARNING
Something somehow does not look correct.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
static av_always_inline float scale(float x, float s)
#define filters(fmt, inverse, clip, i, c)
@ SWR_DITHER_NB
not part of API/ABI
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ SWR_DITHER_NS
not part of API/ABI
The libswresample context.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define i(width, name, range_min, range_max)
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
int swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt)
#define av_malloc_array(a, b)
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16
signed 16 bits
av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt)
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S32
signed 32 bits