37 for (
int x = 1; x < m; x++)
38 if (((n * x) % m) == 1)
46 int *in_map, *out_map;
49 const int inv =
s->inv;
51 const int m_inv =
mulinv(m, n);
52 const int n_inv =
mulinv(n, m);
59 out_map =
s->pfatab + n*m;
62 for (
int j = 0; j < m; j++) {
63 for (
int i = 0;
i < n;
i++) {
65 in_map[j*n +
i] = ((
i*m + j*n) %
len) << mdct;
66 out_map[(
i*m*m_inv + j*n*n_inv) %
len] =
i*m + j;
72 for (
int i = 0;
i < m;
i++) {
73 int *
in = &in_map[
i*n + 1];
74 for (
int j = 0; j < ((n - 1) >> 1); j++)
81 for (
int k = 0; k < m; k++) {
83 memcpy(
tmp, &in_map[k*15], 15*
sizeof(*
tmp));
84 for (
int i = 0;
i < 5;
i++) {
85 for (
int j = 0; j < 3; j++)
86 in_map[k*15 +
i*3 + j] =
tmp[(
i*3 + j*5) % 15];
96 const int m =
s->m, inv =
s->inv;
102 for (
int i = 0;
i < m;
i++) {
115 int nb_inplace_idx = 0;
117 if (!(
s->inplace_idx =
av_malloc(
s->m*
sizeof(*
s->inplace_idx))))
121 int dst =
s->revtab[
src];
128 for (
int j = 0; j < nb_inplace_idx; j++) {
129 if (dst ==
s->inplace_idx[j]) {
134 dst =
s->revtab[dst];
135 }
while (dst !=
src && !found);
138 s->inplace_idx[nb_inplace_idx++] =
src;
141 s->inplace_idx[nb_inplace_idx++] = 0;
161 int inv,
int len,
const void *scale, uint64_t
flags)
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_assert0(cond)
assert() equivalent, that is always enabled.
#define flags(name, subs,...)
#define FFSWAP(type, a, b)
static int split_radix_permutation(int i, int n, int inverse)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static av_always_inline int mulinv(int n, int m)
int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup)
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets ctx to NULL, does nothing when ctx == NULL.
int ff_tx_gen_ptwo_inplace_revtab_idx(AVTXContext *s)
int ff_tx_gen_compound_mapping(AVTXContext *s)
int ff_tx_type_is_mdct(enum AVTXType type)
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
@ AV_TX_DOUBLE_MDCT
Same as AV_TX_FLOAT_MDCT with data and scale type of double.
@ AV_TX_INT32_FFT
Same as AV_TX_FLOAT_FFT with a data type of AVComplexInt32.
@ AV_TX_FLOAT_FFT
Standard complex to complex FFT with sample data type AVComplexFloat.
@ AV_TX_FLOAT_MDCT
Standard MDCT with sample data type of float and a scale type of float.
@ AV_TX_DOUBLE_FFT
Same as AV_TX_FLOAT_FFT with a data type of AVComplexDouble.
@ AV_TX_INT32_MDCT
Same as AV_TX_FLOAT_MDCT with data type of int32_t and scale type of float.
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
int ff_tx_init_mdct_fft_int32(AVTXContext *s, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
int ff_tx_init_mdct_fft_double(AVTXContext *s, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
int ff_tx_init_mdct_fft_float(AVTXContext *s, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)