comparison psymodel.h @ 9936:7f42ae22c351 libavcodec

Cosmetics: Pretty print the AAC encoder.
author alexc
date Wed, 08 Jul 2009 20:36:45 +0000
parents d09283aeeef8
children 94b578d0af10
comparison
equal deleted inserted replaced
9935:d09283aeeef8 9936:7f42ae22c351
28 #define PSY_MAX_BANDS 128 28 #define PSY_MAX_BANDS 128
29 29
30 /** 30 /**
31 * single band psychoacoustic information 31 * single band psychoacoustic information
32 */ 32 */
33 typedef struct FFPsyBand{ 33 typedef struct FFPsyBand {
34 int bits; 34 int bits;
35 float energy; 35 float energy;
36 float threshold; 36 float threshold;
37 float distortion; 37 float distortion;
38 float perceptual_weight; 38 float perceptual_weight;
39 }FFPsyBand; 39 } FFPsyBand;
40 40
41 /** 41 /**
42 * windowing related information 42 * windowing related information
43 */ 43 */
44 typedef struct FFPsyWindowInfo{ 44 typedef struct FFPsyWindowInfo {
45 int window_type[3]; ///< window type (short/long/transitional, etc.) - current, previous and next 45 int window_type[3]; ///< window type (short/long/transitional, etc.) - current, previous and next
46 int window_shape; ///< window shape (sine/KBD/whatever) 46 int window_shape; ///< window shape (sine/KBD/whatever)
47 int num_windows; ///< number of windows in a frame 47 int num_windows; ///< number of windows in a frame
48 int grouping[8]; ///< window grouping (for e.g. AAC) 48 int grouping[8]; ///< window grouping (for e.g. AAC)
49 int *window_sizes; ///< sequence of window sizes inside one frame (for eg. WMA) 49 int *window_sizes; ///< sequence of window sizes inside one frame (for eg. WMA)
50 }FFPsyWindowInfo; 50 } FFPsyWindowInfo;
51 51
52 /** 52 /**
53 * context used by psychoacoustic model 53 * context used by psychoacoustic model
54 */ 54 */
55 typedef struct FFPsyContext{ 55 typedef struct FFPsyContext {
56 AVCodecContext *avctx; ///< encoder context 56 AVCodecContext *avctx; ///< encoder context
57 const struct FFPsyModel *model; ///< encoder-specific model functions 57 const struct FFPsyModel *model; ///< encoder-specific model functions
58 58
59 FFPsyBand *psy_bands; ///< frame bands information 59 FFPsyBand *psy_bands; ///< frame bands information
60 60
61 uint8_t **bands; ///< scalefactor band sizes for possible frame sizes 61 uint8_t **bands; ///< scalefactor band sizes for possible frame sizes
62 int *num_bands; ///< number of scalefactor bands for possible frame sizes 62 int *num_bands; ///< number of scalefactor bands for possible frame sizes
63 int num_lens; ///< number of scalefactor band sets 63 int num_lens; ///< number of scalefactor band sets
64 64
65 void* model_priv_data; ///< psychoacoustic model implementation private data 65 void* model_priv_data; ///< psychoacoustic model implementation private data
66 }FFPsyContext; 66 } FFPsyContext;
67 67
68 /** 68 /**
69 * codec-specific psychoacoustic model implementation 69 * codec-specific psychoacoustic model implementation
70 */ 70 */
71 typedef struct FFPsyModel { 71 typedef struct FFPsyModel {
72 const char *name; 72 const char *name;
73 int (*init) (FFPsyContext *apc); 73 int (*init) (FFPsyContext *apc);
74 FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type); 74 FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type);
75 void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, FFPsyWindowInfo *wi); 75 void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, FFPsyWindowInfo *wi);
76 void (*end) (FFPsyContext *apc); 76 void (*end) (FFPsyContext *apc);
77 }FFPsyModel; 77 } FFPsyModel;
78 78
79 /** 79 /**
80 * Initialize psychoacoustic model. 80 * Initialize psychoacoustic model.
81 * 81 *
82 * @param ctx model context 82 * @param ctx model context