diff options
author | Nathan Caldwell <saintdev@gmail.com> | 2011-06-15 02:50:25 -0600 |
---|---|---|
committer | Alex Converse <alex.converse@gmail.com> | 2011-06-29 14:28:52 -0700 |
commit | 0bc01cc9fe83fe676690fd200e7d74cdab595f15 (patch) | |
tree | 635bc129c5d29085f9e1692bdf54233e76cbe2a3 /libavcodec/psymodel.h | |
parent | a3e1f80e8ba28151ea5d84c15ecf454b8170aa13 (diff) | |
download | ffmpeg-0bc01cc9fe83fe676690fd200e7d74cdab595f15.tar.gz |
psymodel: Add channels and channel groups to the psymodel.
Diffstat (limited to 'libavcodec/psymodel.h')
-rw-r--r-- | libavcodec/psymodel.h | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/libavcodec/psymodel.h b/libavcodec/psymodel.h index 02dc9c92b1..241f8ecdb3 100644 --- a/libavcodec/psymodel.h +++ b/libavcodec/psymodel.h @@ -41,6 +41,23 @@ typedef struct FFPsyBand { } FFPsyBand; /** + * single channel psychoacoustic information + */ +typedef struct FFPsyChannel { + FFPsyBand psy_bands[PSY_MAX_BANDS]; ///< channel bands information + float entropy; ///< total PE for this channel +} FFPsyChannel; + +/** + * psychoacoustic information for an arbitrary group of channels + */ +typedef struct FFPsyChannelGroup { + FFPsyChannel *ch[PSY_MAX_CHANS]; ///< pointers to the individual channels in the group + uint8_t num_ch; ///< number of channels in this group + uint8_t coupling[PSY_MAX_BANDS]; ///< allow coupling for this band in the group +} FFPsyChannelGroup; + +/** * windowing related information */ typedef struct FFPsyWindowInfo { @@ -58,14 +75,14 @@ typedef struct FFPsyContext { AVCodecContext *avctx; ///< encoder context const struct FFPsyModel *model; ///< encoder-specific model functions - FFPsyBand *psy_bands; ///< frame bands information + FFPsyChannel *ch; ///< single channel information + FFPsyChannelGroup *group; ///< channel group information + int num_groups; ///< number of channel groups uint8_t **bands; ///< scalefactor band sizes for possible frame sizes int *num_bands; ///< number of scalefactor bands for possible frame sizes int num_lens; ///< number of scalefactor band sets - float pe[PSY_MAX_CHANS]; ///< total PE for each channel in the frame - struct { int size; ///< size of the bitresevoir in bits int bits; ///< number of bits used in the bitresevoir @@ -95,7 +112,7 @@ typedef struct FFPsyModel { FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type); /** - * Perform psychoacoustic analysis and set band info (threshold, energy). + * Perform psychoacoustic analysis and set band info (threshold, energy) for a single channel. * * @param ctx model context * @param channel audio channel number @@ -104,6 +121,16 @@ typedef struct FFPsyModel { */ void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, const FFPsyWindowInfo *wi); + /** + * Perform psychoacoustic analysis and set band info (threshold, energy) for a group of channels. + * + * @param ctx model context + * @param channel channel number of the first channel in the group to perform analysis on + * @param coeffs array of pointers to the transformed coefficients + * @param wi window information for the channels in the group + */ + void (*analyze_group)(FFPsyContext *ctx, int channel, const float **coeffs, const FFPsyWindowInfo *wi); + void (*end) (FFPsyContext *apc); } FFPsyModel; @@ -115,12 +142,24 @@ typedef struct FFPsyModel { * @param num_lens number of possible frame lengths * @param bands scalefactor band lengths for all frame lengths * @param num_bands number of scalefactor bands for all frame lengths + * @param num_groups number of channel groups + * @param group_map array with # of channels in group - 1, for each group * * @return zero if successful, a negative value if not */ -av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, - int num_lens, - const uint8_t **bands, const int* num_bands); +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); + +/** + * Determine what group a channel belongs to. + * + * @param ctx psymodel context + * @param channel channel to locate the group for + * + * @return pointer to the FFPsyChannelGroup this channel belongs to + */ +FFPsyChannelGroup *ff_psy_find_group(FFPsyContext *ctx, int channel); /** * Cleanup model context at the end. |