KT24-1110_65E-HA-651B/include_lib/media/dynamic_eq.h

211 lines
7.9 KiB
C
Raw Normal View History

2024-11-10 10:44:17 +00:00
#ifndef __DYNAMIC_EQ_H__
#define __DYNAMIC_EQ_H__
#include "system/includes.h"
#include "media/audio_stream.h"
#include "media/DynamicEQ_api.h"
#include "media/DynamicEQ_Detection_api.h"
#include "media/audio_eq.h"
#include "media/drc_api.h"
#include "media/convert_data.h"
#define RUN_NORMAL 0
#define RUN_BYPASS 1
struct dynamic_eq_detection {
struct audio_stream_entry entry; // 音频流入口
void *workbuf; //算法运行buf
int *out_buf; //模块运行输出的buf 32bit位宽
int out_len; //输出buf的长度
int len; //输出buf的长度
DynamicEQDetectionParam parm[2]; //算法相关配置参数
struct audio_eq *eq[2];
u32 sample_rate; //采样率
u8 nsection; //eq段数
u8 channel; //通道数
u8 status; //内部运行状态机
u8 update; //设置参数更新标志
u8 in_32bit; //
s16 *in_buf;
u16 in_len;
};
/*
*********************************************************************
* dynamic_eq_detection_open
* Description: eq检测模块打开
* Arguments :*parm ()2parm[0], parm[1],
* nesection:eq检测模块支持的段数
* channel:
* sample_rate:
* Return : .
* Note(s) : None.
*********************************************************************
*/
struct dynamic_eq_detection *dynamic_eq_detection_open(DynamicEQDetectionParam *parm, u8 nsection, u8 channel, u32 sample_rate);
/*
*********************************************************************
* dynamic_eq_detection_run
* Description: eq检测模块数据处理,
* Arguments :*hdl:
* data:16bit位宽
* len:byte
* Return : None.
* Note(s) : None.
*********************************************************************
*/
int dynamic_eq_detection_run(struct dynamic_eq_detection *hdl, short *data, int len);
/*
*********************************************************************
* get_dynamic_eq_detection_parm
* Description: eq检测模块的结果
* Arguments :*hdl:
* **out:,32bit位宽
* *out_len:byte
* Return : None.
* Note(s) : None.
*********************************************************************
*/
int get_dynamic_eq_detection_parm(struct dynamic_eq_detection *hdl, int **out, int *out_len);
/*
*********************************************************************
* dynamic_eq_detection_bypass
* Description: eq检测模块设置直通
* Arguments :*hdl:
* bypass:(RUN_BYPASS)(RUN_NORMAL)
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_detection_bypass(struct dynamic_eq_detection *hdl, u8 bypass);
/*
*********************************************************************
* dynamic_eq_detection_update
* Description: eq检测模块设置直通
* Arguments :*hdl:
* bypass:(RUN_BYPASS)(RUN_NORMAL)
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_detection_update(struct dynamic_eq_detection *hdl, DynamicEQDetectionParam *param);
/*
*********************************************************************
* dynamic_eq_detection_close
* Description: eq检测模块关闭
* Arguments :*hdl:
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_detection_close(struct dynamic_eq_detection *hdl);
struct dynamic_eq {
struct audio_stream_entry entry; //音频流入口
void *workbuf; //算法运行buf
DynamicEQEffectParam *effectParam;
DynamicEQParam parm; //算法相关配置参数
// u32 sample_rate; //采样率
// u8 nsection; //eq段数
// u8 channel; //通道数
u8 status; //内部运行状态机
u8 update; //设置参数更新标志
struct dynamic_eq_detection *priv; //私有指针
int (*get_detect_parm)(struct dynamic_eq_detection *priv, int **out_data, int *out_len);//该回调由dynamic_eq_detection 模块实现
void *det_hdl;
};
/*
*********************************************************************
* dynamic_eq_open
* Description: eq打开
* Arguments :*parm 2parm[0], parm[1],
* nesection:eq检测模块支持的段数
* channel:
* sample_rate:
* Return : .
* Note(s) : None.
*********************************************************************
*/
// struct dynamic_eq *dynamic_eq_open(DynamicEQParam *parm, u8 nsection, u8 channel,u32 sample_rate);
struct dynamic_eq *dynamic_eq_open(DynamicEQEffectParam *effectParam, DynamicEQParam *parm);//, u8 nsection, u8 channel, u32 sample_rate)
/*
*********************************************************************
* dynamic_eq_set_detection_callback
* Description: eq
* Arguments :*hdl:
* priv:
* get_detect_parm:
* Return : .
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_set_detection_callback(struct dynamic_eq *hdl, void *priv, int (*get_detect_parm)(struct dynamic_eq_detection *priv, int **out_data, int *out_len));
/*
*********************************************************************
* dynamic_eq_run
* Description: eq模块数据处理
* Arguments :*hdl:
* data:32bit位宽
* len:byte
* Return : None.
* Note(s) : None.
*********************************************************************
*/
int dynamic_eq_run(struct dynamic_eq *hdl, int *data, int len);
/*
*********************************************************************
* dynamic_eq_bypass
* Description: eq模块设置直通
* Arguments :*hdl:
* bypass:(RUN_BYPASS)(RUN_NORMAL)
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_bypass(struct dynamic_eq *hdl, u8 bypass);
/*
*********************************************************************
* dynamic_eq_bypass
* Description: eq模块设置直通
* Arguments :*hdl:
* bypass:(RUN_BYPASS)(RUN_NORMAL)
* Return : None.
* Note(s) : None.
*********************************************************************
*/
// void dynamic_eq_update(struct dynamic_eq *hdl, DynamicEQParam *param);
void dynamic_eq_update(struct dynamic_eq *hdl, DynamicEQEffectParam *effectParam, DynamicEQParam *param);
/*
*********************************************************************
* dynamic_eq_close
* Description: eq检块关闭
* Arguments :*hdl:
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void dynamic_eq_close(struct dynamic_eq *hdl);
#endif/*__DYNAMIC_EQ_H__*/