3073
- 收藏
- 点赞
- 分享
- 举报
程序运行不报错,osd贴的图片不显示
哪位大神帮忙给瞅瞅,看是哪里出错了。程序运行也不报错,就是osd贴的图片就是不显示。
HI_S32 SampleVoLoadRgnBmp(const char *filename, BITMAP_S *pstBitmap, HI_BOOL bFil, HI_U32 u16FilColor)
{
OSD_SURFACE_S Surface;
OSD_BITMAPFILEHEADER bmpFileHeader;
OSD_BITMAPINFO bmpInfo;
if (GetBmpInfo(filename, &bmpFileHeader, &bmpInfo) < 0)
{
printf("GetBmpInfo err!\n");
return HI_FAILURE;
}
Surface.enColorFmt = OSD_COLOR_FMT_RGB1555;
pstBitmap->pData = malloc(2 * (bmpInfo.bmiHeader.biWidth) * (bmpInfo.bmiHeader.biHeight));
if (NULL == pstBitmap->pData)
{
printf("malloc osd memroy err!\n");
return HI_FAILURE;
}
CreateSurfaceByBitMap(filename, &Surface, (HI_U8 *)(pstBitmap->pData));
pstBitmap->u32Width = Surface.u16Width;
pstBitmap->u32Height = Surface.u16Height;
pstBitmap->enPixelFormat = PIXEL_FORMAT_ARGB_1555;
int i, j;
HI_U16 *pu16Temp;
pu16Temp = (HI_U16 *)pstBitmap->pData;
if (bFil)
{
for (i = 0; i < pstBitmap->u32Height; i++)
{
for (j = 0; j < pstBitmap->u32Width; j++)
{
if (u16FilColor == *pu16Temp)
{
*pu16Temp &= 0x7FFF;
}
pu16Temp++;
}
}
}
return HI_SUCCESS;
}
HI_S32 SampleVoChnCreateRegion(HI_S32 Chn)
{
HI_S32 s32Ret;
MPP_CHN_S stChn;
RGN_ATTR_S stRgnAttr;
RGN_CHN_ATTR_S stChnAttr;
BITMAP_S stBitmap;
/* creat region*/
stRgnAttr.enType = OVERLAYEX_RGN;
stRgnAttr.unAttr.stOverlayEx.enPixelFmt = PIXEL_FORMAT_ARGB_1555;
stRgnAttr.unAttr.stOverlayEx.stSize.u32Width = 64; //128;
stRgnAttr.unAttr.stOverlayEx.stSize.u32Height = 64; //128;
stRgnAttr.unAttr.stOverlayEx.u32BgColor = 0x0000ffff;
stRgnAttr.unAttr.stOverlayEx.u32CanvasNum = 2;
RGN_HANDLE Handle = 0;
s32Ret = HI_MPI_RGN_Create(Handle, &stRgnAttr);
if (s32Ret != HI_SUCCESS)
{
printf("region of chn %d create fail. value=0x%x.", Handle, s32Ret);
return s32Ret;
}
/*attach region to chn*/
stChn.enModId = HI_ID_VPSS;
stChn.s32DevId = 1;
stChn.s32ChnId = Chn;
memset(&stChnAttr, 0, sizeof(stChnAttr));
stChnAttr.bShow = HI_TRUE;
stChnAttr.enType = OVERLAYEX_RGN;
stChnAttr.unChnAttr.stOverlayExChn.stPoint.s32X = 0; //128;
stChnAttr.unChnAttr.stOverlayExChn.stPoint.s32Y = 0; //128;
stChnAttr.unChnAttr.stOverlayExChn.u32BgAlpha = 64;
stChnAttr.unChnAttr.stOverlayExChn.u32FgAlpha = 64;
stChnAttr.unChnAttr.stOverlayExChn.u32Layer = 0;
s32Ret = HI_MPI_RGN_AttachToChn(Handle, &stChn, &stChnAttr);
if (s32Ret != HI_SUCCESS)
{
printf("region attach to chn %d fail. value=0x%x.", Chn, s32Ret);
return s32Ret;
}
/* load bitmap*/
s32Ret = SampleVoLoadRgnBmp("/nfsroot/res/mm2.bmp", &stBitmap, HI_FALSE, 0);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
s32Ret = HI_MPI_RGN_SetBitMap(Chn, &stBitmap);
if (s32Ret != HI_SUCCESS)
{
printf("region set bitmap to chn %d fail. value=0x%x.", Chn, s32Ret);
free(stBitmap.pData);
return s32Ret;
}
// free(stBitmap.pData);
s32Ret = HI_MPI_RGN_SetDisplayAttr(Handle, &stChn, &stChnAttr);
if (s32Ret != HI_SUCCESS)
{
printf("HI_MPI_RGN_SetDisplayAttr fail.\n");
return s32Ret;
}
return HI_SUCCESS;
}
HI_S32 SAMPLE_H265_VDEC_VPSS_VO(HI_VOID)
{
VB_CONFIG_S stVbConfig;
HI_S32 i, s32Ret = HI_SUCCESS;
VDEC_THREAD_PARAM_S stVdecSend[VDEC_MAX_CHN_NUM];
SIZE_S stDispSize;
VO_LAYER VoLayer;
HI_U32 u32VdecChnNum, VpssGrpNum;
VPSS_GRP VpssGrp;
pthread_t VdecThread[2 * VDEC_MAX_CHN_NUM];
PIC_SIZE_E enDispPicSize;
SAMPLE_VDEC_ATTR astSampleVdec[VDEC_MAX_CHN_NUM];
VPSS_CHN_ATTR_S astVpssChnAttr[VPSS_MAX_CHN_NUM];
SAMPLE_VO_CONFIG_S stVoConfig;
VPSS_GRP_ATTR_S stVpssGrpAttr;
HI_BOOL abChnEnable[VPSS_MAX_CHN_NUM];
VO_INTF_SYNC_E enIntfSync;
VPSS_MOD_PARAM_S stModParam;
u32VdecChnNum = 1;
VpssGrpNum = u32VdecChnNum;
/************************************************
step1: init SYS, init common VB(for VPSS and VO)
*************************************************/
if (VO_OUTPUT_3840x2160_30 == g_enIntfSync)
{
enDispPicSize = PIC_3840x2160;
enIntfSync = VO_OUTPUT_3840x2160_30;
}
else
{
enDispPicSize = PIC_1080P;
enIntfSync = VO_OUTPUT_1080P60;
}
s32Ret = SAMPLE_COMM_SYS_GetPicSize(enDispPicSize, &stDispSize);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("sys get pic size fail for %#x!\n", s32Ret);
goto END1;
}
memset(&stVbConfig, 0, sizeof(VB_CONFIG_S));
stVbConfig.u32MaxPoolCnt = 1;
stVbConfig.astCommPool[0].u32BlkCnt = 10 * u32VdecChnNum;
stVbConfig.astCommPool[0].u64BlkSize = COMMON_GetPicBufferSize(stDispSize.u32Width, stDispSize.u32Height,
PIXEL_FORMAT_YVU_SEMIPLANAR_420, DATA_BITWIDTH_10, COMPRESS_MODE_SEG, 0);
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConfig);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init sys fail for %#x!\n", s32Ret);
goto END1;
}
/************************************************
step2: init module VB or user VB(for VDEC)
*************************************************/
for (i = 0; i < u32VdecChnNum; i++)
{
astSampleVdec[i].enType = PT_H265;
astSampleVdec[i].u32Width = 3840;
astSampleVdec[i].u32Height = 2160;
astSampleVdec[i].enMode = VIDEO_MODE_FRAME;
astSampleVdec[i].stSapmleVdecVideo.enDecMode = VIDEO_DEC_MODE_IP;
astSampleVdec[i].stSapmleVdecVideo.enBitWidth = DATA_BITWIDTH_10;
astSampleVdec[i].stSapmleVdecVideo.u32RefFrameNum = 3;
astSampleVdec[i].u32DisplayFrameNum = 2;
astSampleVdec[i].u32FrameBufCnt = astSampleVdec[i].stSapmleVdecVideo.u32RefFrameNum + astSampleVdec[i].u32DisplayFrameNum + 1;
}
s32Ret = SAMPLE_COMM_VDEC_InitVBPool(u32VdecChnNum, &astSampleVdec[0]);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init mod common vb fail for %#x!\n", s32Ret);
goto END2;
}
/************************************************
step3: start VDEC
*************************************************/
s32Ret = SAMPLE_COMM_VDEC_Start(u32VdecChnNum, &astSampleVdec[0]);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VDEC fail for %#x!\n", s32Ret);
goto END3;
}
/************************************************
step4: start VPSS
*************************************************/
s32Ret = HI_MPI_VPSS_GetModParam(&stModParam);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Get VPSS module param fali %#x!\n", s32Ret);
goto END4;
}
stModParam.bHdrSupport = HI_TRUE;
s32Ret = HI_MPI_VPSS_SetModParam(&stModParam);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Set VPSS module param fali %#x!\n", s32Ret);
goto END4;
}
stVpssGrpAttr.u32MaxW = 3840;
stVpssGrpAttr.u32MaxH = 2160;
stVpssGrpAttr.stFrameRate.s32SrcFrameRate = -1;
stVpssGrpAttr.stFrameRate.s32DstFrameRate = -1;
stVpssGrpAttr.enDynamicRange = DYNAMIC_RANGE_HDR10;
stVpssGrpAttr.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
stVpssGrpAttr.bNrEn = HI_FALSE;
memset(abChnEnable, 0, sizeof(abChnEnable));
abChnEnable[0] = HI_TRUE;
astVpssChnAttr[0].u32Width = stDispSize.u32Width;
astVpssChnAttr[0].u32Height = stDispSize.u32Height;
astVpssChnAttr[0].enChnMode = VPSS_CHN_MODE_AUTO;
astVpssChnAttr[0].enCompressMode = COMPRESS_MODE_SEG;
astVpssChnAttr[0].enDynamicRange = DYNAMIC_RANGE_HDR10;
astVpssChnAttr[0].enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
astVpssChnAttr[0].stFrameRate.s32SrcFrameRate = -1;
astVpssChnAttr[0].stFrameRate.s32DstFrameRate = -1;
astVpssChnAttr[0].u32Depth = 0;
astVpssChnAttr[0].bMirror = HI_FALSE;
astVpssChnAttr[0].bFlip = HI_FALSE;
astVpssChnAttr[0].stAspectRatio.enMode = ASPECT_RATIO_NONE;
astVpssChnAttr[0].enVideoFormat = VIDEO_FORMAT_LINEAR;
for (i = 0; i < u32VdecChnNum; i++)
{
VpssGrp = i;
s32Ret = SAMPLE_COMM_VPSS_Start(VpssGrp, &abChnEnable[0], &stVpssGrpAttr, &astVpssChnAttr[0]);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VPSS fail for %#x!\n", s32Ret);
goto END4;
}
}
/************************************************
step5: start VO
*************************************************/
stVoConfig.VoDev = SAMPLE_VO_DEV_UHD;
stVoConfig.enVoIntfType = VO_INTF_HDMI;
stVoConfig.enIntfSync = enIntfSync;
stVoConfig.enPicSize = enDispPicSize;
stVoConfig.u32BgColor = COLOR_RGB_BLUE;
stVoConfig.u32DisBufLen = 3;
stVoConfig.enDstDynamicRange = DYNAMIC_RANGE_HDR10;
stVoConfig.enVoMode = VO_MODE_1MUX;
stVoConfig.enPixFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;
stVoConfig.stDispRect.s32X = 0;
stVoConfig.stDispRect.s32Y = 0;
stVoConfig.stDispRect.u32Width = stDispSize.u32Width;
stVoConfig.stDispRect.u32Height = stDispSize.u32Height;
stVoConfig.stImageSize.u32Width = stDispSize.u32Width;
stVoConfig.stImageSize.u32Height = stDispSize.u32Height;
stVoConfig.enVoPartMode = VO_PART_MODE_SINGLE;
s32Ret = SAMPLE_COMM_VO_StartVO(&stVoConfig);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VO fail for %#x!\n", s32Ret);
goto END5;
}
/************************************************
step6: VDEC bind VPSS
*************************************************/
for (i = 0; i < u32VdecChnNum; i++)
{
s32Ret = SAMPLE_COMM_VDEC_Bind_VPSS(i, i);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END6;
}
}
/************************************************
step7: VPSS bind VO
*************************************************/
VoLayer = stVoConfig.VoDev;
for (i = 0; i < VpssGrpNum; i++)
{
s32Ret = SAMPLE_COMM_VPSS_Bind_VO(i, 0, VoLayer, i);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss bind vo fail for %#x!\n", s32Ret);
goto END7;
}
}
/************************************************
step8: send stream to VDEC
*************************************************/
for (i = 0; i < u32VdecChnNum; i++)
{
snprintf(stVdecSend[i].cFileName, sizeof(stVdecSend[i].cFileName), "3840x2160_10bit.h265");
snprintf(stVdecSend[i].cFilePath, sizeof(stVdecSend[i].cFilePath), "%s", SAMPLE_STREAM_PATH);
stVdecSend[i].enType = astSampleVdec[i].enType;
stVdecSend[i].s32StreamMode = astSampleVdec[i].enMode;
stVdecSend[i].s32ChnId = i;
stVdecSend[i].s32IntervalTime = 1000;
stVdecSend[i].u64PtsInit = 0;
stVdecSend[i].u64PtsIncrease = 0;
stVdecSend[i].eThreadCtrl = THREAD_CTRL_START;
stVdecSend[i].bCircleSend = HI_TRUE;
stVdecSend[i].s32MilliSec = 0;
stVdecSend[i].s32MinBufSize = (astSampleVdec[i].u32Width * astSampleVdec[i].u32Height * 3) >> 1;
}
SAMPLE_COMM_VDEC_StartSendStream(u32VdecChnNum, &stVdecSend[0], &VdecThread[0]);
/************************************************
step9: add OSD to VO chan
*************************************************/
printf("OSD starting ... \n");
HI_S32 Chn = 0;
s32Ret = SampleVoChnCreateRegion(Chn);
if (s32Ret != HI_SUCCESS)
{
printf("chn %d SampleVoChnCreateRegion err, value = 0x%x. \n", Chn, s32Ret);
goto END7;
}
/************************************************
step10: wait command to stop the stream
*************************************************/
SAMPLE_COMM_VDEC_CmdCtrl(u32VdecChnNum, &stVdecSend[0], &VdecThread[0]);
SAMPLE_COMM_VDEC_StopSendStream(u32VdecChnNum, &stVdecSend[0], &VdecThread[0]);
END7:
for (i = 0; i < VpssGrpNum; i++)
{
s32Ret = SAMPLE_COMM_VPSS_UnBind_VO(i, 0, VoLayer, i);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss unbind vo fail for %#x!\n", s32Ret);
}
}
printf("OSD ending ... ");
END6:
for (i = 0; i < u32VdecChnNum; i++)
{
s32Ret = SAMPLE_COMM_VDEC_UnBind_VPSS(i, i);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec unbind vpss fail for %#x!\n", s32Ret);
}
}
END5:
SAMPLE_COMM_VO_StopVO(&stVoConfig);
END4:
for (i = VpssGrp; i >= 0; i--)
{
VpssGrp = i;
SAMPLE_COMM_VPSS_Stop(VpssGrp, &abChnEnable[0]);
}
END3:
SAMPLE_COMM_VDEC_Stop(u32VdecChnNum);
END2:
SAMPLE_COMM_VDEC_ExitVBPool();
END1:
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
我来回答
回答4个
时间排序
认可量排序
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2024-05-15 16:28:55
-
2019-09-20 16:32:04
-
2021-06-07 16:39:27
-
2021-04-13 13:18:30
-
2017-03-31 22:59:39
-
2019-02-25 14:29:33
-
2018-12-18 16:46:28
-
2020-09-22 09:48:11
-
2020-03-03 17:51:42
-
2019-01-19 09:36:49
-
2018-12-12 10:11:28
-
2019-01-21 14:24:34
-
2020-12-24 16:01:17
-
2008-12-19 13:05:51
-
2018-11-15 15:16:11
-
2020-09-01 10:00:27
-
2018-05-22 16:51:51
-
2018-05-18 17:00:41
-
2016-09-08 16:42:11
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认