2492
- 收藏
- 点赞
- 分享
- 举报
hisi3519HDMI输入,音频编码的文体
大家好!这两天开始开始调音频编码这部分,之前没做过音频编码,对这部分有很多疑惑,看网上的信息感觉也说的人很迷糊,希望哪位有经验的大神能指导一二,在此感谢了。
音频流是通过HDMI进入使用ADV7611+hisi3519的模式的,现在是想先将编码后的音频流写进文件,但是文件全是噪声,而且只有一边有声音,下面是函数部分,以及ai部分的打印信息,我使用的是内置的codec,主模式和从模式都试了,现象基本一样,不知道还需要设置哪里,望大家给点建议。
HI_S32 SAMPLE_AUDIO_AiAenc(HI_VOID)
{
HI_S32 i, j, s32Ret;
AUDIO_DEV AiDev = SAMPLE_AUDIO_AI_DEV;
AI_CHN AiChn;
AUDIO_DEV AoDev = SAMPLE_AUDIO_AO_DEV;
AO_CHN AoChn = 0;
ADEC_CHN AdChn = 0;
HI_S32 s32AiChnCnt;
HI_S32 s32AoChnCnt;
HI_S32 s32AencChnCnt;
AENC_CHN AeChn;
HI_BOOL bSendAdec = HI_TRUE;
FILE* pfd = NULL;
AIO_ATTR_S stAioAttr;
VB_CONF_S stVbConf;
memset(&stVbConf, 0, sizeof(VB_CONF_S));
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
printf("%s: system init failed with %d!\n", __FUNCTION__, s32Ret);
return HI_FAILURE;
}
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_8000; // AUDIO_SAMPLE_RATE_8000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER; // AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_MONO; // AUDIO_SOUND_MODE_MONO;
stAioAttr.u32EXFlag = 0;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 2; // 1;
stAioAttr.u32ClkSel =0; //0
printf("HI_ACODEC_TYPE_INNER!!!!!!!!!!!\n");
gs_bAioReSample = HI_FALSE;
enInSampleRate = AUDIO_SAMPLE_RATE_BUTT;
enOutSampleRate = AUDIO_SAMPLE_RATE_BUTT;
u32AencPtNumPerFrm = stAioAttr.u32PtNumPerFrm;
/********************************************
step 1: config audio codec
********************************************/
s32Ret = SAMPLE_COMM_AUDIO_CfgAcodec(&stAioAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR6;
}
printf("config audio codec success !!! \n");
/********************************************
step 2: start Ai
********************************************/
s32AiChnCnt = stAioAttr.u32ChnCnt;
if(stAioAttr.enSoundmode == AUDIO_SOUND_MODE_STEREO)
{
s32AiChnCnt = 1;// stAioAttr.u32ChnCnt;
}
printf("AI will start &&&&&& AiDev = %d, s32AiChnCnt = %d !!! \n", AiDev, s32AiChnCnt);
s32Ret = SAMPLE_COMM_AUDIO_StartAi(AiDev, s32AiChnCnt, &stAioAttr, enOutSampleRate, gs_bAioReSample, NULL, 0);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR6;
}
/********************************************
step 3: start Aenc
********************************************/
s32AencChnCnt = 1; //stAioAttr.u32ChnCnt;
s32Ret = SAMPLE_COMM_AUDIO_StartAenc(s32AencChnCnt, u32AencPtNumPerFrm, gs_enPayloadType);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR5;
}
/********************************************
step 4: Aenc bind Ai Chn
********************************************/
for (i = 0; i < s32AencChnCnt; i++)
{
AeChn = i;
AiChn = i;
printf("AeChn = %d AiChn = %d AiDev = %d i = %d \n", AeChn, AiChn, AiDev, i);
if (HI_TRUE == gs_bUserGetMode)
{
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAiAenc(AiDev, AiChn, AeChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
for (j=0; j {
SAMPLE_COMM_AUDIO_DestoryTrdAi(AiDev, j);
}
goto AIAENC_ERR4;
}
}
else
{
printf("HI_FALSE == gs_bUserGetMode!!!!!!!!!!!!!!!\n");
s32Ret = SAMPLE_COMM_AUDIO_AencBindAi(AiDev, AiChn, AeChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
for (j=0; j {
SAMPLE_COMM_AUDIO_AencUnbindAi(AiDev, j, j);
}
goto AIAENC_ERR4;
}
}
printf("Ai(AiDev = %d,AiChn = %d) bind to AencChn:AeChn = %d ok!\n", AiDev , AiChn, AeChn);
}
pfd = SAMPLE_AUDIO_OpenAencFile(AdChn, gs_enPayloadType);
if (!pfd)
{
SAMPLE_DBG(HI_FAILURE);
goto AIAENC_ERR1;
}
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAencAdec(AeChn, AdChn, pfd);
if (s32Ret != HI_SUCCESS)
{
printf("SAMPLE_COMM_AUDIO_CreatTrdAencAdec erron s32Ret = %d !!!!!!!!!!!!!\n", s32Ret);
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR1;
}
}
cat /proc/umap/ai (从模式)
[AI] Version: [Hi3519V101_MPP_V1.0.4.0 B040 Release], Build Time: [Nov 10 2017, 14:09:28]
-----AI DEV ATTR----------------------------------------------------------------
AiDev WorkMod SampR BitWid ChnCnt ClkSel SoundMod PoiNum ExFlag FrmNum
0 i2s_sla 8kHZ 16bit 2 0 stereo 320 0 30
-----AI DEV STATUS0-------------------------------------------------------------
AiDev IntCnt fifoCnt buffInt FrmTime MaxFrmTime TranLen IsrTime
0 10 0 0 1164735 1223361 1280 141
-----AI DEV STATUS1-------------------------------------------------------------
AiDev MaxIsrTime CBPhy CBSize ROffSet WOffSet
0 141 84051000 3840 500 0
-----AI DEV EXTEND STATUS-------------------------------------------------------
AiDev enTrack bMute Volume
0 0 N 0
-----AI CHN STATUS--------------------------------------------------------------
AiDev AiChn State Read Write BufFul UsrQueLost UsrFrmDepth u32Data0 u32Data1 UserGet UserRls
0 0 enable 0 0 0 0 0 ffff01ff 0 0 0
0 1 enable 0 0 0 0 0 ffff0000 0 0 0
-----AI CHN RESAMPLE STATUS-----------------------------------------------------
AiDev AiChn State bResmp PoiNum InSampR OutSampR
0 0 enable N 0 (null) (null)
0 1 enable N 0 (null) (null)
-----AI CHN VQE STATUS0---------------------------------------------------------
AiDev AiChn State bVqe workmod RATE PoiNum GainVol bAnr bAgc bEq bHpf bAec bRnr bHdr bDrc bPeq WrFile
0 0 enable N comm (null) 0 0 N N N N N N N N N N
0 1 enable N comm (null) 0 0 N N N N N N N N N N
cat /proc/umap/ai (主模式)
[AI] Version: [Hi3519V101_MPP_V1.0.4.0 B040 Release], Build Time: [Nov 10 2017, 14:09:28]
-----AI DEV ATTR----------------------------------------------------------------
AiDev WorkMod SampR BitWid ChnCnt ClkSel SoundMod PoiNum ExFlag FrmNum
0 i2s_mas 8kHZ 16bit 2 0 stereo 320 0 30
-----AI DEV STATUS0-------------------------------------------------------------
AiDev IntCnt fifoCnt buffInt FrmTime MaxFrmTime TranLen IsrTime
0 298 0 0 40001 40011 1280 133
-----AI DEV STATUS1-------------------------------------------------------------
AiDev MaxIsrTime CBPhy CBSize ROffSet WOffSet
0 159 84051000 3840 500 0
-----AI DEV EXTEND STATUS-------------------------------------------------------
AiDev enTrack bMute Volume
0 0 N 0
-----AI CHN STATUS--------------------------------------------------------------
AiDev AiChn State Read Write BufFul UsrQueLost UsrFrmDepth u32Data0 u32Data1 UserGet UserRls
0 0 enable 0 0 0 0 0 40007 60007 0 0
0 1 enable 0 0 0 0 0 ffff0002 60000 0 0
-----AI CHN RESAMPLE STATUS-----------------------------------------------------
AiDev AiChn State bResmp PoiNum InSampR OutSampR
0 0 enable N 0 (null) (null)
0 1 enable N 0 (null) (null)
-----AI CHN VQE STATUS0---------------------------------------------------------
AiDev AiChn State bVqe workmod RATE PoiNum GainVol bAnr bAgc bEq bHpf bAec bRnr bHdr bDrc bPeq WrFile
0 0 enable N comm (null) 0 0 N N N N N N N N N N
0 1 enable N comm (null) 0 0 N N N N N N N N N N
音频流是通过HDMI进入使用ADV7611+hisi3519的模式的,现在是想先将编码后的音频流写进文件,但是文件全是噪声,而且只有一边有声音,下面是函数部分,以及ai部分的打印信息,我使用的是内置的codec,主模式和从模式都试了,现象基本一样,不知道还需要设置哪里,望大家给点建议。
HI_S32 SAMPLE_AUDIO_AiAenc(HI_VOID)
{
HI_S32 i, j, s32Ret;
AUDIO_DEV AiDev = SAMPLE_AUDIO_AI_DEV;
AI_CHN AiChn;
AUDIO_DEV AoDev = SAMPLE_AUDIO_AO_DEV;
AO_CHN AoChn = 0;
ADEC_CHN AdChn = 0;
HI_S32 s32AiChnCnt;
HI_S32 s32AoChnCnt;
HI_S32 s32AencChnCnt;
AENC_CHN AeChn;
HI_BOOL bSendAdec = HI_TRUE;
FILE* pfd = NULL;
AIO_ATTR_S stAioAttr;
VB_CONF_S stVbConf;
memset(&stVbConf, 0, sizeof(VB_CONF_S));
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
printf("%s: system init failed with %d!\n", __FUNCTION__, s32Ret);
return HI_FAILURE;
}
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_8000; // AUDIO_SAMPLE_RATE_8000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER; // AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_MONO; // AUDIO_SOUND_MODE_MONO;
stAioAttr.u32EXFlag = 0;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 2; // 1;
stAioAttr.u32ClkSel =0; //0
printf("HI_ACODEC_TYPE_INNER!!!!!!!!!!!\n");
gs_bAioReSample = HI_FALSE;
enInSampleRate = AUDIO_SAMPLE_RATE_BUTT;
enOutSampleRate = AUDIO_SAMPLE_RATE_BUTT;
u32AencPtNumPerFrm = stAioAttr.u32PtNumPerFrm;
/********************************************
step 1: config audio codec
********************************************/
s32Ret = SAMPLE_COMM_AUDIO_CfgAcodec(&stAioAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR6;
}
printf("config audio codec success !!! \n");
/********************************************
step 2: start Ai
********************************************/
s32AiChnCnt = stAioAttr.u32ChnCnt;
if(stAioAttr.enSoundmode == AUDIO_SOUND_MODE_STEREO)
{
s32AiChnCnt = 1;// stAioAttr.u32ChnCnt;
}
printf("AI will start &&&&&& AiDev = %d, s32AiChnCnt = %d !!! \n", AiDev, s32AiChnCnt);
s32Ret = SAMPLE_COMM_AUDIO_StartAi(AiDev, s32AiChnCnt, &stAioAttr, enOutSampleRate, gs_bAioReSample, NULL, 0);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR6;
}
/********************************************
step 3: start Aenc
********************************************/
s32AencChnCnt = 1; //stAioAttr.u32ChnCnt;
s32Ret = SAMPLE_COMM_AUDIO_StartAenc(s32AencChnCnt, u32AencPtNumPerFrm, gs_enPayloadType);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR5;
}
/********************************************
step 4: Aenc bind Ai Chn
********************************************/
for (i = 0; i < s32AencChnCnt; i++)
{
AeChn = i;
AiChn = i;
printf("AeChn = %d AiChn = %d AiDev = %d i = %d \n", AeChn, AiChn, AiDev, i);
if (HI_TRUE == gs_bUserGetMode)
{
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAiAenc(AiDev, AiChn, AeChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
for (j=0; j {
SAMPLE_COMM_AUDIO_DestoryTrdAi(AiDev, j);
}
goto AIAENC_ERR4;
}
}
else
{
printf("HI_FALSE == gs_bUserGetMode!!!!!!!!!!!!!!!\n");
s32Ret = SAMPLE_COMM_AUDIO_AencBindAi(AiDev, AiChn, AeChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
for (j=0; j {
SAMPLE_COMM_AUDIO_AencUnbindAi(AiDev, j, j);
}
goto AIAENC_ERR4;
}
}
printf("Ai(AiDev = %d,AiChn = %d) bind to AencChn:AeChn = %d ok!\n", AiDev , AiChn, AeChn);
}
pfd = SAMPLE_AUDIO_OpenAencFile(AdChn, gs_enPayloadType);
if (!pfd)
{
SAMPLE_DBG(HI_FAILURE);
goto AIAENC_ERR1;
}
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAencAdec(AeChn, AdChn, pfd);
if (s32Ret != HI_SUCCESS)
{
printf("SAMPLE_COMM_AUDIO_CreatTrdAencAdec erron s32Ret = %d !!!!!!!!!!!!!\n", s32Ret);
SAMPLE_DBG(s32Ret);
goto AIAENC_ERR1;
}
}
cat /proc/umap/ai (从模式)
[AI] Version: [Hi3519V101_MPP_V1.0.4.0 B040 Release], Build Time: [Nov 10 2017, 14:09:28]
-----AI DEV ATTR----------------------------------------------------------------
AiDev WorkMod SampR BitWid ChnCnt ClkSel SoundMod PoiNum ExFlag FrmNum
0 i2s_sla 8kHZ 16bit 2 0 stereo 320 0 30
-----AI DEV STATUS0-------------------------------------------------------------
AiDev IntCnt fifoCnt buffInt FrmTime MaxFrmTime TranLen IsrTime
0 10 0 0 1164735 1223361 1280 141
-----AI DEV STATUS1-------------------------------------------------------------
AiDev MaxIsrTime CBPhy CBSize ROffSet WOffSet
0 141 84051000 3840 500 0
-----AI DEV EXTEND STATUS-------------------------------------------------------
AiDev enTrack bMute Volume
0 0 N 0
-----AI CHN STATUS--------------------------------------------------------------
AiDev AiChn State Read Write BufFul UsrQueLost UsrFrmDepth u32Data0 u32Data1 UserGet UserRls
0 0 enable 0 0 0 0 0 ffff01ff 0 0 0
0 1 enable 0 0 0 0 0 ffff0000 0 0 0
-----AI CHN RESAMPLE STATUS-----------------------------------------------------
AiDev AiChn State bResmp PoiNum InSampR OutSampR
0 0 enable N 0 (null) (null)
0 1 enable N 0 (null) (null)
-----AI CHN VQE STATUS0---------------------------------------------------------
AiDev AiChn State bVqe workmod RATE PoiNum GainVol bAnr bAgc bEq bHpf bAec bRnr bHdr bDrc bPeq WrFile
0 0 enable N comm (null) 0 0 N N N N N N N N N N
0 1 enable N comm (null) 0 0 N N N N N N N N N N
cat /proc/umap/ai (主模式)
[AI] Version: [Hi3519V101_MPP_V1.0.4.0 B040 Release], Build Time: [Nov 10 2017, 14:09:28]
-----AI DEV ATTR----------------------------------------------------------------
AiDev WorkMod SampR BitWid ChnCnt ClkSel SoundMod PoiNum ExFlag FrmNum
0 i2s_mas 8kHZ 16bit 2 0 stereo 320 0 30
-----AI DEV STATUS0-------------------------------------------------------------
AiDev IntCnt fifoCnt buffInt FrmTime MaxFrmTime TranLen IsrTime
0 298 0 0 40001 40011 1280 133
-----AI DEV STATUS1-------------------------------------------------------------
AiDev MaxIsrTime CBPhy CBSize ROffSet WOffSet
0 159 84051000 3840 500 0
-----AI DEV EXTEND STATUS-------------------------------------------------------
AiDev enTrack bMute Volume
0 0 N 0
-----AI CHN STATUS--------------------------------------------------------------
AiDev AiChn State Read Write BufFul UsrQueLost UsrFrmDepth u32Data0 u32Data1 UserGet UserRls
0 0 enable 0 0 0 0 0 40007 60007 0 0
0 1 enable 0 0 0 0 0 ffff0002 60000 0 0
-----AI CHN RESAMPLE STATUS-----------------------------------------------------
AiDev AiChn State bResmp PoiNum InSampR OutSampR
0 0 enable N 0 (null) (null)
0 1 enable N 0 (null) (null)
-----AI CHN VQE STATUS0---------------------------------------------------------
AiDev AiChn State bVqe workmod RATE PoiNum GainVol bAnr bAgc bEq bHpf bAec bRnr bHdr bDrc bPeq WrFile
0 0 enable N comm (null) 0 0 N N N N N N N N N N
0 1 enable N comm (null) 0 0 N N N N N N N N N N
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2017-05-24 16:12:20
-
2017-03-23 14:37:55
-
2018-03-12 14:54:39
-
2018-09-20 08:52:52
-
2022-08-20 13:52:41
-
2017-09-13 20:58:54
-
2017-04-11 21:16:13
-
2018-07-10 17:27:29
-
2014-11-20 09:45:00
-
2018-07-24 17:27:23
-
12017-04-21 15:51:10
-
2015-02-16 18:46:03
-
2017-12-03 12:46:23
-
2023-04-04 17:16:03
-
2017-02-08 14:18:39
-
2017-01-15 17:27:11
-
2020-09-18 18:05:25
-
2020-09-18 18:06:10
-
2020-11-22 14:59:18
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认