FFmpeg
Data Structures | Macros | Functions
psymodel.h File Reference
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  FFPsyBand
 single band psychoacoustic information More...
 
struct  FFPsyChannel
 single channel psychoacoustic information More...
 
struct  FFPsyChannelGroup
 psychoacoustic information for an arbitrary group of channels More...
 
struct  FFPsyWindowInfo
 windowing related information More...
 
struct  FFPsyContext
 context used by psychoacoustic model More...
 
struct  FFPsyModel
 codec-specific psychoacoustic model implementation More...
 

Macros

#define PSY_MAX_BANDS   128
 maximum possible number of bands More...
 
#define PSY_MAX_CHANS   20
 maximum number of channels More...
 
#define AAC_CUTOFF_FROM_BITRATE(bit_rate, channels, sample_rate)
 
#define AAC_CUTOFF(s)
 

Functions

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. More...
 
FFPsyChannelGroupff_psy_find_group (FFPsyContext *ctx, int channel)
 Determine what group a channel belongs to. More...
 
void ff_psy_end (FFPsyContext *ctx)
 Cleanup model context at the end. More...
 
struct FFPsyPreprocessContextff_psy_preprocess_init (AVCodecContext *avctx)
 psychoacoustic model audio preprocessing initialization More...
 
void ff_psy_preprocess (struct FFPsyPreprocessContext *ctx, float **audio, int channels)
 Preprocess several channel in audio frame in order to compress it better. More...
 
void ff_psy_preprocess_end (struct FFPsyPreprocessContext *ctx)
 Cleanup audio preprocessing module. More...
 

Macro Definition Documentation

◆ PSY_MAX_BANDS

#define PSY_MAX_BANDS   128

maximum possible number of bands

Definition at line 28 of file psymodel.h.

◆ PSY_MAX_CHANS

#define PSY_MAX_CHANS   20

maximum number of channels

Definition at line 30 of file psymodel.h.

◆ AAC_CUTOFF_FROM_BITRATE

#define AAC_CUTOFF_FROM_BITRATE (   bit_rate,
  channels,
  sample_rate 
)
Value:
(bit_rate ? FFMIN3(FFMIN3( \
FFMAX(bit_rate/channels/5, bit_rate/channels*15/32 - 5500), \
3000 + bit_rate/channels/4, \
12000 + bit_rate/channels/16), \
22000, \
sample_rate / 2): (sample_rate / 2))

Definition at line 35 of file psymodel.h.

◆ AAC_CUTOFF

#define AAC_CUTOFF (   s)
Value:
( \
(s->flags & AV_CODEC_FLAG_QSCALE) \
? s->sample_rate / 2 \
: AAC_CUTOFF_FROM_BITRATE(s->bit_rate, s->ch_layout.nb_channels, s->sample_rate) \
)

Definition at line 41 of file psymodel.h.

Function Documentation

◆ ff_psy_init()

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.

Parameters
ctxmodel context
avctxcodec context
num_lensnumber of possible frame lengths
bandsscalefactor band lengths for all frame lengths
num_bandsnumber of scalefactor bands for all frame lengths
num_groupsnumber of channel groups
group_maparray with # of channels in group - 1, for each group
Returns
zero if successful, a negative value if not

Definition at line 31 of file psymodel.c.

Referenced by aac_encode_init().

◆ ff_psy_find_group()

FFPsyChannelGroup* ff_psy_find_group ( FFPsyContext ctx,
int  channel 
)

Determine what group a channel belongs to.

Parameters
ctxpsymodel context
channelchannel to locate the group for
Returns
pointer to the FFPsyChannelGroup this channel belongs to

Definition at line 73 of file psymodel.c.

Referenced by psy_3gpp_analyze().

◆ ff_psy_end()

void ff_psy_end ( FFPsyContext ctx)

Cleanup model context at the end.

Parameters
ctxmodel context

Definition at line 83 of file psymodel.c.

Referenced by aac_encode_end(), and ff_psy_init().

◆ ff_psy_preprocess_init()

struct FFPsyPreprocessContext* ff_psy_preprocess_init ( AVCodecContext avctx)

psychoacoustic model audio preprocessing initialization

Definition at line 103 of file psymodel.c.

Referenced by aac_encode_init().

◆ ff_psy_preprocess()

void ff_psy_preprocess ( struct FFPsyPreprocessContext ctx,
float **  audio,
int  channels 
)

Preprocess several channel in audio frame in order to compress it better.

Parameters
ctxpreprocessing context
audiosamples to be filtered (in place)
channelsnumber of channel to preprocess

Definition at line 139 of file psymodel.c.

Referenced by aac_encode_frame().

◆ ff_psy_preprocess_end()

void ff_psy_preprocess_end ( struct FFPsyPreprocessContext ctx)

Cleanup audio preprocessing module.

Definition at line 152 of file psymodel.c.

Referenced by aac_encode_end().

AV_CODEC_FLAG_QSCALE
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
Definition: avcodec.h:216
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
sample_rate
sample_rate
Definition: ffmpeg_filter.c:156
s
#define s(width, name)
Definition: cbs_vp9.c:256
channels
channels
Definition: aptx.h:31
AAC_CUTOFF_FROM_BITRATE
#define AAC_CUTOFF_FROM_BITRATE(bit_rate, channels, sample_rate)
Definition: psymodel.h:35
FFMIN3
#define FFMIN3(a, b, c)
Definition: macros.h:50