33 int num_groups,
const uint8_t *group_map)
49 memcpy(ctx->
bands, bands,
sizeof(ctx->
bands[0]) * num_lens);
53 for (i = 0; i < num_groups; i++) {
80 return &ctx->
group[i-1];
107 float cutoff_coeff = 0;
118 if (cutoff_coeff && cutoff_coeff < 0.98)
121 cutoff_coeff, 0.0, 0.0);
129 for (i = 0; i < avctx->
channels; i++)
148 &audio[ch][frame_size], 1, &audio[ch][frame_size], 1);
void(* end)(FFPsyContext *apc)
uint8_t ** bands
scalefactor band sizes for possible frame sizes
FFPsyChannelGroup * group
channel group information
Memory handling functions.
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
Cleanup audio preprocessing module.
psychoacoustic information for an arbitrary group of channels
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.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int * num_bands
number of scalefactor bands for possible frame sizes
av_cold struct FFIIRFilterState * ff_iir_filter_init_state(int order)
Create new filter state.
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.
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.
struct FFIIRFilterCoeffs * fcoeffs
context used by psychoacoustic model
const FFPsyModel ff_aac_psy_model
FFPsyChannel * ch[PSY_MAX_CHANS]
pointers to the individual channels in the group
av_cold void ff_iir_filter_free_statep(struct FFIIRFilterState **state)
Free and zero filter state.
codec-specific psychoacoustic model implementation
int(* init)(FFPsyContext *apc)
uint8_t num_ch
number of channels in this group
int frame_size
Number of samples per channel in an audio frame.
Libavcodec external API header.
int sample_rate
samples per second
FFPsyChannelGroup * ff_psy_find_group(FFPsyContext *ctx, int channel)
Determine what group a channel belongs to.
main external API structure.
static const float bands[]
int cutoff
lowpass frequency cutoff for analysis
const struct FFPsyModel * model
encoder-specific model functions
IIR filter global parameters.
void ff_iir_filter_init(FFIIRFilterContext *f)
Initialize FFIIRFilterContext.
struct FFIIRFilterState ** fstate
av_cold struct FFPsyPreprocessContext * ff_psy_preprocess_init(AVCodecContext *avctx)
psychoacoustic model audio preprocessing initialization
channel
Use these values when setting the channel map with ebur128_set_channel().
void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels)
Preprocess several channel in audio frame in order to compress it better.
struct FFIIRFilterContext fiir
int cutoff
Audio cutoff bandwidth (0 means "automatic")
int channels
number of audio channels
FFPsyChannel * ch
single channel information
av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
Free filter coefficients.
#define av_malloc_array(a, b)
AVCodecContext * avctx
encoder context
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
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
void * av_mallocz_array(size_t nmemb, size_t size)