33 int num_groups,
const uint8_t *group_map)
44 if (!
ctx->ch || !
ctx->group || !
ctx->bands || !
ctx->num_bands) {
49 memcpy(
ctx->bands,
bands,
sizeof(
ctx->bands[0]) * num_lens);
50 memcpy(
ctx->num_bands, num_bands,
sizeof(
ctx->num_bands[0]) * num_lens);
53 for (
i = 0;
i < num_groups;
i++) {
58 ctx->group[
i].num_ch = group_map[
i] + 1;
59 for (j = 0; j <
ctx->group[
i].num_ch * 2; j++)
60 ctx->group[
i].ch[j] = &
ctx->ch[k++];
63 switch (
ctx->avctx->codec_id) {
69 return ctx->model->init(
ctx);
78 ch +=
ctx->group[
i++].num_ch;
80 return &
ctx->group[
i-1];
85 if (
ctx->model &&
ctx->model->end)
107 float cutoff_coeff = 0;
118 if (cutoff_coeff && cutoff_coeff < 0.98)
121 cutoff_coeff, 0.0, 0.0);
157 for (
i = 0;
i <
ctx->avctx->channels;
i++)
static const float bands[]
Libavcodec external API header.
channel
Use these values when setting the channel map with ebur128_set_channel().
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
Free filter coefficients.
void ff_iir_filter_init(FFIIRFilterContext *f)
Initialize FFIIRFilterContext.
av_cold struct FFIIRFilterCoeffs * ff_iir_filter_init_coeffs(void *avc, enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple)
Initialize filter coefficients.
av_cold void ff_iir_filter_free_statep(struct FFIIRFilterState **state)
Free and zero filter state.
av_cold struct FFIIRFilterState * ff_iir_filter_init_state(int order)
Create new filter state.
@ FF_FILTER_TYPE_BUTTERWORTH
Memory handling functions.
FFPsyChannelGroup * ff_psy_find_group(FFPsyContext *ctx, int channel)
Determine what group a channel belongs to.
av_cold struct FFPsyPreprocessContext * ff_psy_preprocess_init(AVCodecContext *avctx)
psychoacoustic model audio preprocessing initialization
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
Cleanup audio preprocessing module.
av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int *num_bands, int num_groups, const uint8_t *group_map)
Initialize psychoacoustic model.
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
const FFPsyModel ff_aac_psy_model
void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels)
Preprocess several channel in audio frame in order to compress it better.
main external API structure.
int sample_rate
samples per second
int channels
number of audio channels
int cutoff
Audio cutoff bandwidth (0 means "automatic")
IIR filter global parameters.
void(* filter_flt)(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const float *src, ptrdiff_t sstep, float *dst, ptrdiff_t dstep)
Perform IIR filtering on floating-point input samples.
psychoacoustic information for an arbitrary group of channels
context used by psychoacoustic model
codec-specific psychoacoustic model implementation
struct FFIIRFilterContext fiir
struct FFIIRFilterCoeffs * fcoeffs
struct FFIIRFilterState ** fstate
#define av_malloc_array(a, b)