27 #include "libavutil/mem.h"
32 const uint8_t **bands,
const int* num_bands,
33 int num_groups,
const uint8_t *group_map)
42 memcpy(ctx->
bands, bands,
sizeof(ctx->
bands[0]) * num_lens);
46 for (i = 0; i < num_groups; i++) {
73 return &ctx->
group[i-1];
99 float cutoff_coeff = 0;
109 cutoff_coeff, 0.0, 0.0);
112 for (i = 0; i < avctx->
channels; i++)
124 for (ch = 0; ch < channels; ch++)
126 &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
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.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
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
static const uint8_t frame_size[4]
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
FFPsyChannel * ch[PSY_MAX_CHANS]
pointers to the individual channels in the group
Libavcodec external API header.
codec-specific psychoacoustic model implementation
void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const float *src, int sstep, float *dst, int dstep)
Perform IIR filtering on floating-point input samples.
int(* init)(FFPsyContext *apc)
uint8_t num_ch
number of channels in this group
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
Free filter coefficients.
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.
const struct FFPsyModel * model
encoder-specific model functions
IIR filter global parameters.
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.
int cutoff
Audio cutoff bandwidth (0 means "automatic")
int channels
number of audio channels
FFPsyChannel * ch
single channel information
AVCodecContext * avctx
encoder context
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *state)
Free filter state.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...