32 const uint8_t **bands,
const int* num_bands,
33 int num_groups,
const uint8_t *group_map)
48 memcpy(ctx->
bands, bands,
sizeof(ctx->
bands[0]) * num_lens);
52 for (i = 0; i < num_groups; i++) {
79 return &ctx->
group[i-1];
106 float cutoff_coeff = 0;
118 if (cutoff_coeff && cutoff_coeff < 0.98)
121 cutoff_coeff, 0.0, 0.0);
128 for (i = 0; i < avctx->
channels; i++)
144 for (ch = 0; ch < channels; ch++)
146 &audio[ch][frame_size], 1, &audio[ch][frame_size], 1);
void(* filter_flt)(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const float *src, int sstep, float *dst, int dstep)
Perform IIR filtering on floating-point input samples.
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.
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.
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.
Libavcodec external API header.
codec-specific psychoacoustic model implementation
uint8_t num_ch
number of channels in this group
int frame_size
Number of samples per channel in an audio frame.
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.
void(* end)(FFPsyContext *apc)
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
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
int(* init)(FFPsyContext *apc)
static void * av_mallocz_array(size_t nmemb, size_t size)
av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
Free filter coefficients.
#define av_malloc_array(a, b)
AVCodecContext * avctx
encoder context
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...