Go to the documentation of this file.
32 #include "libavutil/ffversion.h"
43 return FFMPEG_CONFIGURATION;
48 #define LICENSE_PREFIX "libswresample license: "
53 if(!
s ||
s->in_convert)
55 s->channel_map = channel_map;
66 s->log_level_offset= log_offset;
105 if (
a->ch_count == 1)
111 memset(
a, 0,
sizeof(*
a));
115 s->in_buffer_index= 0;
116 s->in_buffer_count= 0;
117 s->resample_in_constraint= 0;
118 memset(
s->in.ch, 0,
sizeof(
s->in.ch));
119 memset(
s->out.ch, 0,
sizeof(
s->out.ch));
133 s->delayed_samples_fixup = 0;
142 s->resampler->free(&
s->resample);
154 char l1[1024], l2[1024];
171 if(
s->out_sample_rate <= 0){
177 s->used_ch_count =
s->user_used_ch_count;
180 s->out_ch_layout =
s->user_out_ch_layout;
182 s->int_sample_fmt=
s->user_int_sample_fmt;
184 s->dither.method =
s->user_dither_method;
192 av_log(
s,
AV_LOG_WARNING,
"Output channel layout 0x%"PRIx64
" is invalid or unsupported.\n",
s->out_ch_layout);
193 s->out_ch_layout = 0;
206 if(!
s->used_ch_count)
207 s->used_ch_count=
s->in.ch_count;
210 av_log(
s,
AV_LOG_WARNING,
"Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
216 if(!
s->out_ch_layout)
219 s->rematrix=
s->out_ch_layout !=
s->in_ch_layout ||
s->rematrix_volume!=1.0 ||
228 &&
s->out_sample_rate==
s->in_sample_rate
234 &&
s->out_sample_rate ==
s->in_sample_rate
259 if (!
s->async &&
s->min_compensation >= FLT_MAX/2)
262 s->outpts =
s->firstpts_in_samples *
s->out_sample_rate;
267 if (
s->min_compensation >= FLT_MAX/2)
268 s->min_compensation = 0.001;
269 if (
s->async > 1.0001) {
270 s->max_soft_compensation =
s->async / (double)
s->in_sample_rate;
275 s->resample =
s->resampler->init(
s->resample,
s->out_sample_rate,
s->in_sample_rate,
s->filter_size,
s->phase_shift,
s->linear_interp,
s->cutoff,
s->int_sample_fmt,
s->filter_type,
s->kaiser_beta,
s->precision,
s->cheby,
s->exact_rational);
281 s->resampler->free(&
s->resample);
292 #define RSC 1 //FIXME finetune
295 if(!
s->used_ch_count)
296 s->used_ch_count=
s->in.ch_count;
300 if(!
s->
in.ch_count){
310 av_log(
s,
AV_LOG_ERROR,
"Output channel layout %s mismatches specified channel count %d\n", l2,
s->out.ch_count);
315 av_log(
s,
AV_LOG_ERROR,
"Input channel layout %s mismatches specified channel count %d\n", l1,
s->used_ch_count);
320 if ((!
s->out_ch_layout || !
s->in_ch_layout) &&
s->used_ch_count !=
s->out.ch_count && !
s->rematrix_custom) {
322 "but there is not enough information to do it\n", l1, l2);
333 s->drop_temp=
s->out;
338 if(!
s->resample && !
s->rematrix && !
s->channel_map && !
s->dither.method){
347 s->int_sample_fmt,
s->out.ch_count,
NULL, 0);
349 if (!
s->in_convert || !
s->out_convert) {
360 s->midbuf.ch_count=
s->used_ch_count;
362 s->in_buffer.ch_count=
s->used_ch_count;
364 if(!
s->resample_first){
365 s->midbuf.ch_count=
s->out.ch_count;
367 s->in_buffer.ch_count =
s->out.ch_count;
379 s->dither.noise =
s->preout;
380 s->dither.temp =
s->preout;
382 s->dither.noise.bps = 4;
384 s->dither.noise_scale = 1;
387 if(
s->rematrix ||
s->dither.method) {
404 if(count < 0 || count > INT_MAX/2/
a->bps/
a->ch_count)
407 if(
a->count >= count)
421 for(
i=0;
i<
a->ch_count;
i++){
422 a->ch[
i]=
a->data +
i*(
a->planar ? countb :
a->bps);
423 if(
a->count &&
a->planar) memcpy(
a->ch[
i], old.
ch[
i],
a->count*
a->bps);
425 if(
a->count && !
a->planar) memcpy(
a->ch[0], old.
ch[0],
a->count*
a->ch_count*
a->bps);
439 for(ch=0; ch<
out->ch_count; ch++)
440 memcpy(
out->ch[ch],
in->ch[ch], count*
out->bps);
442 memcpy(
out->ch[0],
in->ch[0], count*
out->ch_count*
out->bps);
448 memset(
out->ch, 0,
sizeof(
out->ch));
449 }
else if(
out->planar){
450 for(
i=0;
i<
out->ch_count;
i++)
451 out->ch[
i]= in_arg[
i];
453 for(
i=0;
i<
out->ch_count;
i++)
461 for(
i=0;
i<
out->ch_count;
i++)
462 in_arg[
i]=
out->ch[
i];
464 in_arg[0]=
out->ch[0];
475 for(ch=0; ch<
out->ch_count; ch++)
476 out->ch[ch]=
in->ch[ch] + count*
out->bps;
478 for(ch=
out->ch_count-1; ch>=0; ch--)
479 out->ch[ch]=
in->ch[0] + (ch + count*
out->ch_count) *
out->bps;
488 const AudioData * in_param,
int in_count){
501 border =
s->resampler->invert_initial_buffer(
s->resample, &
s->in_buffer,
502 &
in, in_count, &
s->in_buffer_index, &
s->in_buffer_count);
503 if (border == INT_MAX) {
505 }
else if (border < 0) {
510 s->resample_in_constraint = 0;
515 if(!
s->resample_in_constraint &&
s->in_buffer_count){
517 ret=
s->resampler->multiple_resample(
s->resample, &
out, out_count, &
tmp,
s->in_buffer_count, &consumed);
521 s->in_buffer_count -= consumed;
522 s->in_buffer_index += consumed;
526 if(
s->in_buffer_count <= border){
528 in_count +=
s->in_buffer_count;
529 s->in_buffer_count=0;
530 s->in_buffer_index=0;
535 if((
s->flushed || in_count > padless) && !
s->in_buffer_count){
536 s->in_buffer_index=0;
537 ret=
s->resampler->multiple_resample(
s->resample, &
out, out_count, &
in,
FFMAX(in_count-padless, 0), &consumed);
541 in_count -= consumed;
546 size=
s->in_buffer_index +
s->in_buffer_count + in_count;
547 if(
size >
s->in_buffer.count
550 copy(&
s->in_buffer, &
tmp,
s->in_buffer_count);
551 s->in_buffer_index=0;
558 if(
s->in_buffer_count &&
s->in_buffer_count+2 < count && out_count) count=
s->in_buffer_count+2;
560 buf_set(&
tmp, &
s->in_buffer,
s->in_buffer_index +
s->in_buffer_count);
562 s->in_buffer_count += count;
566 s->resample_in_constraint= 0;
567 if(
s->in_buffer_count != count || in_count)
577 s->resample_in_constraint= !!out_count;
599 if(
s->resample_first){
613 midbuf_tmp=
s->midbuf;
615 preout_tmp=
s->preout;
621 if(
s->resample_first ? !
s->resample : !
s->rematrix)
624 if(
s->resample_first ? !
s->rematrix : !
s->resample)
627 if(
s->int_sample_fmt ==
s->out_sample_fmt &&
s->out.planar
630 out_count=
FFMIN(out_count, in_count);
644 if(
s->resample_first){
658 if(
s->dither.method){
660 int dither_count=
FFMAX(out_count, 1<<16);
663 conv_src = &
s->dither.temp;
671 for(ch=0; ch<
s->dither.noise.ch_count; ch++)
672 if((
ret=
swri_get_dither(
s,
s->dither.noise.ch[ch],
s->dither.noise.count, (12345678913579ULL*ch + 3141592) % 2718281828
U,
s->dither.noise.fmt))<0)
676 if(
s->dither.noise_pos + out_count >
s->dither.noise.count)
677 s->dither.noise_pos = 0;
680 if (
s->mix_2_1_simd) {
681 int len1= out_count&~15;
686 s->mix_2_1_simd(conv_src->
ch[ch],
preout->
ch[ch],
s->dither.noise.ch[ch] +
s->dither.noise.bps *
s->dither.noise_pos,
s->native_simd_one, 0, 0, len1);
687 if(out_count != len1)
689 s->mix_2_1_f(conv_src->
ch[ch] + off,
preout->
ch[ch] + off,
s->dither.noise.ch[ch] +
s->dither.noise.bps *
s->dither.noise_pos + off,
s->native_one, 0, 0, out_count - len1);
692 s->mix_2_1_f(conv_src->
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);
695 switch(
s->int_sample_fmt) {
702 s->dither.noise_pos += out_count;
711 return !!
s->in_buffer.ch_count;
724 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >1
728 while(
s->drop_output > 0){
731 #define MAX_DROP_STEP 16384
736 s->drop_output *= -1;
738 s->drop_output *= -1;
741 s->drop_output -=
ret;
742 if (!
s->drop_output && !out_arg)
754 s->resampler->flush(
s);
755 s->resample_in_constraint = 0;
757 }
else if(!
s->in_buffer_count){
767 if(
ret>0 && !
s->drop_output)
768 s->outpts +=
ret * (int64_t)
s->in_sample_rate;
784 s->in_buffer_count -=
ret;
785 s->in_buffer_index +=
ret;
788 if(!
s->in_buffer_count)
789 s->in_buffer_index = 0;
793 size=
s->in_buffer_index +
s->in_buffer_count + in_count - out_count;
795 if(in_count > out_count) {
796 if(
size >
s->in_buffer.count
799 copy(&
s->in_buffer, &
tmp,
s->in_buffer_count);
800 s->in_buffer_index=0;
816 buf_set(&
tmp, &
s->in_buffer,
s->in_buffer_index +
s->in_buffer_count);
818 s->in_buffer_count += in_count;
821 if(ret2>0 && !
s->drop_output)
822 s->outpts += ret2 * (int64_t)
s->in_sample_rate;
823 av_assert2(max_output < 0 || ret2 < 0 || ret2 <= max_output);
830 s->drop_output += count;
832 if(
s->drop_output <= 0)
846 #define MAX_SILENCE_STEP 16384
856 if(
s->silence.planar)
for(
i=0;
i<
s->silence.ch_count;
i++) {
857 memset(
s->silence.ch[
i],
s->silence.bps==1 ? 0x80 : 0, count*
s->silence.bps);
859 memset(
s->silence.ch[0],
s->silence.bps==1 ? 0x80 : 0, count*
s->silence.bps*
s->silence.ch_count);
868 if (
s->resampler &&
s->resample){
869 return s->resampler->get_delay(
s,
base);
871 return (
s->in_buffer_count*
base + (
s->in_sample_rate>>1))/
s->in_sample_rate;
882 if (
s->resampler &&
s->resample) {
883 if (!
s->resampler->get_out_samples)
885 out_samples =
s->resampler->get_out_samples(
s, in_samples);
887 out_samples =
s->in_buffer_count + in_samples;
891 if (out_samples > INT_MAX)
900 if (!
s || compensation_distance < 0)
902 if (!compensation_distance && sample_delta)
910 if (!
s->resampler->set_compensation){
913 return s->resampler->set_compensation(
s->resample, sample_delta, compensation_distance);
922 s->outpts =
s->firstpts =
pts;
924 if(
s->min_compensation >= FLT_MAX) {
927 int64_t
delta =
pts -
swr_get_delay(
s,
s->in_sample_rate * (int64_t)
s->out_sample_rate) -
s->outpts +
s->drop_output*(int64_t)
s->in_sample_rate;
928 double fdelta =
delta /(
double)(
s->in_sample_rate * (int64_t)
s->out_sample_rate);
930 if(fabs(fdelta) >
s->min_compensation) {
931 if(
s->outpts ==
s->firstpts || fabs(fdelta) >
s->min_hard_compensation){
938 }
else if(
s->soft_compensation_duration &&
s->max_soft_compensation) {
939 int duration =
s->out_sample_rate *
s->soft_compensation_duration;
@ AV_SAMPLE_FMT_FLTP
float, planar
#define AV_LOG_WARNING
Something somehow does not look correct.
static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_count, AudioData *in, int in_count)
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
int64_t out_ch_layout
output channel layout
static void fill_audiodata(AudioData *out, uint8_t *in_arg[SWR_CH_MAX])
void swri_noise_shaping_int16(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count)
int in_sample_rate
input sample rate
static void free_temp(AudioData *a)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance)
Activate resampling compensation ("soft" compensation).
int user_in_ch_count
User set input channel count.
#define LIBSWRESAMPLE_VERSION_MICRO
uint8_t * data[AVRESAMPLE_MAX_CHANNELS]
data plane pointers
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
int out_sample_rate
output sample rate
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
struct Resampler const swri_resampler
void * av_mallocz_array(size_t nmemb, size_t size)
#define AV_LOG_VERBOSE
Detailed information.
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map)
Set a customized input channel mapping.
static void copy(AudioData *out, AudioData *in, int count)
int in_buffer_index
cached buffer position
void swri_noise_shaping_float(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count)
@ SWR_ENGINE_SOXR
SoX Resampler.
static void buf_set(AudioData *out, AudioData *in, int count)
out may be equal in.
Audio buffer used for intermediate storage between conversion phases.
enum AVSampleFormat out_sample_fmt
output sample format
int swri_realloc_audio(AudioData *a, int count)
int swr_is_initialized(struct SwrContext *s)
Check whether an swr context has been initialized or not.
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
#define ss(width, name, subs,...)
int64_t swr_next_pts(struct SwrContext *s, int64_t pts)
Convert the next timestamp from input to output timestamps are in 1/(in_sample_rate * out_sample_rate...
int64_t swr_get_delay(struct SwrContext *s, int64_t base)
Gets the delay the next input sample will experience relative to the next output sample.
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
Get the planar alternative form of the given sample format.
AudioData postin
post-input audio data: used for rematrix/resample
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int swr_inject_silence(struct SwrContext *s, int count)
Injects the specified number of silence samples.
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
av_cold struct SwrContext * swr_alloc(void)
Allocate SwrContext.
int user_out_ch_count
User set output channel count.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy)
@ SWR_DITHER_NS
not part of API/ABI
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg[SWR_CH_MAX], int in_count)
int planar
1 if planar audio, 0 otherwise
struct AudioConvert * in_convert
input conversion context
int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len)
Convert between audio sample formats.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
The libswresample context.
struct SwrContext * swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
uint8_t * ch[SWR_CH_MAX]
samples buffer per channel
void swri_noise_shaping_int32(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count)
AudioData midbuf
intermediate audio data (postin/preout)
static void reversefill_audiodata(AudioData *out, uint8_t *in_arg[SWR_CH_MAX])
const char * swresample_license(void)
Return the swr license.
void * log_ctx
parent logging context
static int resample(SwrContext *s, AudioData *out_param, int out_count, const AudioData *in_param, int in_count)
struct Resampler const swri_soxr_resampler
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
int ch_count
number of channels
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
AudioData preout
pre-output audio data: used for rematrix/resample
#define SWR_FLAG_RESAMPLE
Force resampling even if equal sample rate.
int swr_drop_output(struct SwrContext *s, int count)
Drops the specified number of output samples.
int swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt)
#define AV_NOPTS_VALUE
Undefined timestamp value.
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
av_cold void swri_rematrix_free(SwrContext *s)
@ SWR_ENGINE_SWR
SW Resampler.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
AudioConvert * swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags)
Create an audio sample format converter context.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
AVSampleFormat
Audio sample formats.
float max_soft_compensation
swr maximum soft compensation in seconds over soft_compensation_duration
void swri_noise_shaping_double(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count)
static void clear_context(SwrContext *s)
enum AVSampleFormat in_sample_fmt
input sample format
static void set_audiodata_fmt(AudioData *a, enum AVSampleFormat fmt)
enum AVSampleFormat fmt
sample format
const char swr_ffversion[]
av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt)
void swri_audio_convert_free(AudioConvert **ctx)
Free audio sample format converter context.
@ AV_SAMPLE_FMT_DBLP
double, planar
av_cold int swri_rematrix_init(SwrContext *s)
int swr_get_out_samples(struct SwrContext *s, int in_samples)
Find an upper bound on the number of samples that the next swr_convert call will output,...
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
int64_t user_in_ch_layout
User set input channel layout.
int64_t in_ch_layout
input channel layout
av_cold void swr_close(SwrContext *s)
Closes the context so that swr_is_initialized() returns 0.
const char * swresample_configuration(void)
Return the swr build-time configuration.
#define LIBSWRESAMPLE_VERSION_INT
unsigned swresample_version(void)
Return the LIBSWRESAMPLE_VERSION_INT constant.