Page MenuHomePhabricator

alimiter.h
No OneTemporary

alimiter.h

/***************************************************************************
* email : yijiangyang@tencent.com *
***************************************************************************/
//+ ----------------------------------------------------+
//+ _oo0oo_ +
//+ o8888888o +
//+ 88" . "88 +
//+ (| -_- |) +
//+ 0\ = /0 +
//+ ___/`---'\___ +
//+ .' \\| |// '. +
//+ / \\||| : |||// \ +
//+ / _||||| -:- |||||- \ +
//+ | | \\\ - /// | | +
//+ | \_| ''\---/'' |_/ | +
//+ \ .-\__ '-' ___/-. / +
//+ ___'. .' /--.--\ `. .'___ +
//+ ."" '< `.___\_<|>_/___.' >' "". +
//+ | | : `- \`.;`\ _ /`;.`/ - ` : | | +
//+ \ \ `_. \_ __\ /__ _/ .-` / / +
//+ =====`-.____`.___ \_____/___.-`___.-'===== +
//+ `=---=' +
//+ +
//+ +
//+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
//+ +
//+ 佛祖保佑 永无BUG +
//+ ----------------------------------------------------+
//实现 FFMPEG 中的限制器,这个压限器对频谱友好,但是压得比较厉害
#ifndef __ALIMITER_H__
#define __ALIMITER_H__
#include <stdint.h>
#define ERROR_SUPERSOUND_SUCCESS 0
#define ERROR_SUPERSOUND_PARAM -1
#define ERROR_SUPERSOUND_MEMORY -2
typedef struct AudioLimiterContext
{
float limit;
float attack;
float release;
float att;
float level_in;
float level_out;
int32_t auto_release;
int32_t auto_level;
float asc;
int32_t asc_c;
int32_t asc_pos;
float asc_coeff;
float *buffer;
int32_t buffer_size;
int32_t buffer_max_size;
int32_t pos;
int32_t *nextpos;
float *nextdelta;
float delta;
int32_t nextiter;
int32_t nextlen;
int32_t asc_changed;
}AudioLimiterContext;
namespace SUPERSOUND
{
class Alimiter
{
public:
Alimiter();
~Alimiter();
public:
void Flush();
int32_t GetLatecy();
int32_t SetParam(int32_t fs, int32_t channels);
void Filter(float * input, float * output, int32_t num);
private:
void Uninit();
int32_t config_input();
float get_rdelta(AudioLimiterContext *s, float release, int sample_rate, float peak, float limit, float patt, int asc);
private:
AudioLimiterContext m_alimiterCtx;
int m_nChannels;
int m_nFs;
};
}
#endif /* __ALIMITER_H__ */

File Metadata

Mime Type
text/x-c++
Expires
Mon, May 19, 06:42 (23 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1433532
Default Alt Text
alimiter.h (2 KB)

Event Timeline