|
|
|
@ -80,27 +80,8 @@ typedef struct FFPsyContext { |
|
|
|
|
typedef struct FFPsyModel { |
|
|
|
|
const char *name; |
|
|
|
|
int (*init) (FFPsyContext *apc); |
|
|
|
|
FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type); |
|
|
|
|
void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, const FFPsyWindowInfo *wi); |
|
|
|
|
void (*end) (FFPsyContext *apc); |
|
|
|
|
} FFPsyModel; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize psychoacoustic model. |
|
|
|
|
* |
|
|
|
|
* @param ctx model context |
|
|
|
|
* @param avctx codec context |
|
|
|
|
* @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 |
|
|
|
|
* |
|
|
|
|
* @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); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* Suggest window sequence for channel. |
|
|
|
|
* |
|
|
|
|
* @param ctx model context |
|
|
|
@ -111,12 +92,9 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, |
|
|
|
|
* |
|
|
|
|
* @return suggested window information in a structure |
|
|
|
|
*/ |
|
|
|
|
FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx, |
|
|
|
|
const int16_t *audio, const int16_t *la, |
|
|
|
|
int channel, int prev_type); |
|
|
|
|
|
|
|
|
|
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). |
|
|
|
|
* |
|
|
|
|
* @param ctx model context |
|
|
|
@ -124,8 +102,25 @@ FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx, |
|
|
|
|
* @param coeffs pointer to the transformed coefficients |
|
|
|
|
* @param wi window information |
|
|
|
|
*/ |
|
|
|
|
void ff_psy_set_band_info(FFPsyContext *ctx, int channel, const float *coeffs, |
|
|
|
|
const FFPsyWindowInfo *wi); |
|
|
|
|
void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, const FFPsyWindowInfo *wi); |
|
|
|
|
|
|
|
|
|
void (*end) (FFPsyContext *apc); |
|
|
|
|
} FFPsyModel; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize psychoacoustic model. |
|
|
|
|
* |
|
|
|
|
* @param ctx model context |
|
|
|
|
* @param avctx codec context |
|
|
|
|
* @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 |
|
|
|
|
* |
|
|
|
|
* @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); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Cleanup model context at the end. |
|
|
|
|