嵌入式 hi3518a平台多编码通道同时绑定OSD实现以及反色实现

1、首先海思官方给予的代码中找到编码通道组是不变的,变化的是DevId可以参考的代码是:

{

/******************************************************************************
* function : venc bind vpss           
******************************************************************************/
HI_S32 SAMPLE_COMM_VENC_BindVpss(VENC_GRP GrpChn,VPSS_GRP VpssGrp,VPSS_CHN VpssChn)
{
    HI_S32 s32Ret = HI_SUCCESS;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;


    stSrcChn.enModId = HI_ID_VPSS;
    stSrcChn.s32DevId = VpssGrp;
    stSrcChn.s32ChnId = VpssChn;


    stDestChn.enModId = HI_ID_GROUP;
    stDestChn.s32DevId = GrpChn;
    stDestChn.s32ChnId = 0;



    s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }


    return s32Ret;
}

}

这样我们在看一下region中的编码通道以及编码通道组,同样我们只需要将OSD区域绑定到对应的编码通道即可,但是我们不是很清楚变化的编码通道组还是编码通道,这样由上面的代码可以看出变化的是编码通道而不是编码通道组,也就是编码通道组恒定,我们一般用不到扩展编码通道组,这样我们修改对应的编码通道就可以完成多编码通道同时绑定OSD区域了(见红色代码),怎么完成反色的呢?以及反色需要主要的是什么呢?主要是区域的对齐方式(见蓝色代码),参考代码如下:

{

for(Joseph_bind_DevId = 0; Joseph_bind_DevId < grpcnt; Joseph_bind_DevId++)
{

VencGrp = 0;
stChn.enModId = HI_ID_GROUP;
stChn.s32DevId = Joseph_bind_DevId;
stChn.s32ChnId = VencGrp;

RgnHandle = 0;

printf("%s:[%d] stChn.s32ChnId is %d ,\n",__FUNCTION__,__LINE__,stChn.s32ChnId);

memset(&stChnAttr,0,sizeof(stChnAttr));
stChnAttr.bShow = HI_TRUE;
stChnAttr.enType = OVERLAY_RGN;


stChnAttr.unChnAttr.stOverlayChn.stPoint.s32X = 16;
stChnAttr.unChnAttr.stOverlayChn.stPoint.s32Y = 16;

stChnAttr.unChnAttr.stOverlayChn.u32BgAlpha = 128;
stChnAttr.unChnAttr.stOverlayChn.u32FgAlpha = 0;
stChnAttr.unChnAttr.stOverlayChn.u32Layer = Joseph_u32Layer--;

stChnAttr.unChnAttr.stOverlayChn.stQpInfo.bAbsQp = HI_FALSE;
stChnAttr.unChnAttr.stOverlayChn.stQpInfo.s32Qp  = 0;


stChnAttr.unChnAttr.stOverlayChn.stInvertColor.stInvColArea.u32Height = 32;
stChnAttr.unChnAttr.stOverlayChn.stInvertColor.stInvColArea.u32Width = 16;
stChnAttr.unChnAttr.stOverlayChn.stInvertColor.u32LumThresh = 64;
stChnAttr.unChnAttr.stOverlayChn.stInvertColor.bInvColEn = HI_TRUE;
stChnAttr.unChnAttr.stOverlayChn.stInvertColor.enChgMod = LESSTHAN_LUM_THRESH;



s32Ret = HI_MPI_RGN_AttachToChn(RgnHandle, &stChn, &stChnAttr);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_RGN_AttachToChn (%d) failed with %#x!\n",\
RgnHandle, s32Ret);
return HI_FAILURE;
}
printf("display region to s32DevId %d chn success!\n",stChn.s32DevId);
}

}

注意:

1、使用完的区域,需要先撤出通道,然后再销毁区域!

2、同一区域可以多次依附在不同的编码通道!

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值