Go to the documentation of this file.
32 const uint8_t **
bands,
const int* num_bands,
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->ch_layout.nb_channels;
i++)
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
int sample_rate
samples per second
struct FFIIRFilterCoeffs * fcoeffs
int nb_channels
Number of channels in this layout.
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.
AVChannelLayout ch_layout
Audio channel layout.
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
IIR filter global parameters.
const FFPsyModel ff_aac_psy_model
void ff_iir_filter_init(FFIIRFilterContext *f)
Initialize FFIIRFilterContext.
static const float bands[]
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 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.
#define i(width, name, range_min, range_max)
av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
Free filter coefficients.
#define av_malloc_array(a, b)
int cutoff
Audio cutoff bandwidth (0 means "automatic")
struct FFIIRFilterContext fiir
av_cold struct FFPsyPreprocessContext * ff_psy_preprocess_init(AVCodecContext *avctx)
psychoacoustic model audio preprocessing initialization
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_calloc(size_t nmemb, size_t size)
struct FFIIRFilterState ** fstate
psychoacoustic information for an arbitrary group of channels
av_cold struct FFIIRFilterState * ff_iir_filter_init_state(int order)
Create new filter state.
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.
codec-specific psychoacoustic model implementation
FFPsyChannelGroup * ff_psy_find_group(FFPsyContext *ctx, int channel)
Determine what group a channel belongs to.
av_cold void ff_iir_filter_free_statep(struct FFIIRFilterState **state)
Free and zero filter state.
@ FF_FILTER_TYPE_BUTTERWORTH
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
Cleanup audio preprocessing module.
context used by psychoacoustic model