36 soxr_datatype_t
type =
46 soxr_io_spec_t io_spec = soxr_io_spec(type, type);
48 soxr_quality_spec_t q_spec = soxr_quality_spec((
int)((precision-2)/4), (SOXR_HI_PREC_CLOCK|SOXR_ROLLOFF_NONE)*!!cheby);
49 q_spec.precision = precision;
50 #if !defined SOXR_VERSION
51 q_spec.bw_pc = cutoff?
FFMAX(
FFMIN(cutoff,.995),.8)*100 : q_spec.bw_pc;
53 q_spec.passband_end = cutoff?
FFMAX(
FFMIN(cutoff,.995),.8) : q_spec.passband_end;
56 soxr_delete((soxr_t)c);
58 soxr_create(in_rate, out_rate, 0, &error, &io_spec, &q_spec, 0);
65 soxr_delete((soxr_t)*c);
77 soxr_process((soxr_t)s->
resample, &f, 0, &idone, &f, 0, &odone);
88 soxr_error_t
error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->
ch_count));
90 error = soxr_process((soxr_t)c, src->
ch, (
size_t)src_size,
91 &idone, dst->
ch, (
size_t)dst_size, &odone);
95 *consumed = (
int)idone;
96 return error? -1 : odone;
100 double delayed_samples = soxr_delay((soxr_t)s->
resample);
108 return (int64_t)(delay_s * base + .5);
112 int in_count,
int *out_idx,
int *out_sz){
118 double delayed_samples = soxr_delay((soxr_t)s->
resample);
123 return (int64_t)(out_samples + delayed_samples + 1 + .5);
static int64_t get_out_samples(struct SwrContext *s, int in_samples)
int out_sample_rate
output sample rate
Audio buffer used for intermediate storage between conversion phases.
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
int ch_count
number of channels
SwrFilterType
Resampling Filter Types.
double delayed_samples_fixup
soxr 0.1.1: needed to fixup delayed_samples after flush has been called.
static int64_t get_delay(struct SwrContext *s, int64_t base)
struct ResampleContext * resample
resampling context
static int process(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed)
enum AVResampleFilterType filter_type
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
The libswresample context.
static struct ResampleContext * create(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational)
int in_sample_rate
input sample rate
static void error(const char *err)
static int flush(struct SwrContext *s)
static void destroy(struct ResampleContext **c)
AVSampleFormat
Audio sample formats.
static const char * format
int flushed
1 if data is to be flushed and no further input is expected
static int invert_initial_buffer(struct ResampleContext *c, AudioData *dst, const AudioData *src, int in_count, int *out_idx, int *out_sz)
struct Resampler const swri_soxr_resampler
uint8_t * ch[SWR_CH_MAX]
samples buffer per channel