houyongnan

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan  发布于  2018-02-04 19:02:15
采纳率 0%
32个问答
3931

我现在在做视频录制叠加时间信息,有些问题需要请教一下

 
因为只是叠加时间只有几个字符所以不想用,sdl和freetype想问一下如何将点阵字体转成bmp呢?点阵字体如下
/******************************************************************************

* 逻辑字体: 宋体, 常规, 24

* 点阵大小: 13x23

* 字符数量: 13

* 扫描方式: 水平扫描,MSB

*******************************************************************************/

static const unsigned char data[]=

{

//0x0030(0)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0,

0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,

0x60,0x60,0x30,0xC0,0x30,0xC0,0x19,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,

//0x0031(1)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x3E,0x00,0x06,0x00,

0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,

0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,

//0x0032(2)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x80,0x40,0xC0,

0x60,0xC0,0x60,0xC0,0x00,0xC0,0x00,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x04,0x00,

0x08,0x00,0x10,0x40,0x20,0x40,0x60,0x40,0x7F,0xC0,0x00,0x00,0x00,0x00,

//0x0033(3)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x63,0x00,0x61,0x80,

0x61,0x80,0x01,0x80,0x01,0x80,0x03,0x00,0x0E,0x00,0x01,0x80,0x00,0x80,0x00,0xC0,

0x00,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,

//0x0034(4)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x80,

0x05,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xF0,

0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x07,0xE0,0x00,0x00,0x00,0x00,

//0x0035(5)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x20,0x00,0x20,0x00,

0x20,0x00,0x20,0x00,0x20,0x00,0x2F,0x00,0x31,0x80,0x20,0xC0,0x00,0xC0,0x00,0xC0,

0x60,0xC0,0x60,0xC0,0x41,0x80,0x21,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,

//0x0036(6)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0xC0,0x30,0xC0,

0x30,0x00,0x20,0x00,0x60,0x00,0x67,0x80,0x68,0xC0,0x70,0x60,0x60,0x60,0x60,0x60,

0x60,0x60,0x20,0x60,0x30,0x40,0x18,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,

//0x0037(7)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x30,0x60,0x20,0x40,

0x20,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0x00,

0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,

//0x0038(8)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0x60,

0x60,0x60,0x60,0x60,0x30,0x40,0x38,0xC0,0x0F,0x00,0x13,0x80,0x30,0xC0,0x60,0x60,

0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,

//0x0039(9)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x30,0xC0,

0x60,0x40,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xE0,0x31,0x60,0x1E,0x60,0x00,0x60,

0x00,0xC0,0x00,0xC0,0x30,0x80,0x31,0x80,0x1E,0x00,0x00,0x00,0x00,0x00,

//0x003A(:)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,

//0x002D(-)

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

//0x0020( )

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

};
我来回答
回答14个
时间排序
认可量排序

zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2018-02-05 10:04:01
认可0
如果是用HI_MPI_RGN_SetBitMap, 都有点阵了还要什么bmp呀, 直接把点阵转换成ARGB1555(region中通用的格式)的buffer即可

比如楼主的"0", 13x23, 点阵共46bytes, 每行两个bytes共23行, 每个bit代表一个像素, 1表示有前景, 0表示背景

简单的转换代码:
int height, width, i, bytes, bits;
unsigned char *src, *dst;

for ( height = 0; height < 23; height++ )
{
        src = data[0] + height * 2;
        dst = buffer + height * stride;
        for ( width = 0; width < 13 ; width++ )
        {
                bytes = width / 8;
                bits = width % 8;
                if ( !(src[bytes] & (1 << bits)) )
                {
                        *dst = 0;
                }
                else
                {
                        *dst = 0x7fff;
                }
                dst++;
        }
}

没有测试过, 只是简单意思一下
其中, data[0]表示字符0, buffer表示输出用于region的buffer, 格式是ARGB1555(0x7fff表示黑色, 当然还要和region的alpha配合)
stride是输出buffer的, 意味着可以把多个字符放到同一个buffer中(当然buffer的起始坐标要修改)

另外, 一般来说长宽最好都是2的倍数

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-02-06 10:36:55
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=84182&ptid=38843]zhuangweiye 发表于 2018-2-5 10:04[/url]
如果是用HI_MPI_RGN_SetBitMap, 都有点阵了还要什么bmp呀, 直接把点阵转换成ARGB1555(region中通用的格式) ...[/quote]

十分感谢已经实现了(但是有一个问题,localtime得到的时间总是1970年,与调用海思rtc例程得到的时间不一样),共享一下源码
static const unsigned char data[13][32]=
{
//0x0030(0)
{0x0F,0x00,0x19,0x80,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x30,0xC0,0x30,0xC0,0x19,0x80,0x0F,0x00,},
//0x0031(1)
{0x02,0x00,0x3E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,
0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3F,0xC0,},
//0x0032(2)
{0x1F,0x00,0x21,0x80,0x40,0xC0,0x60,0xC0,0x60,0xC0,0x00,0xC0,0x00,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x04,0x00,
0x08,0x00,0x10,0x40,0x20,0x40,0x60,0x40,0x7F,0xC0,},
//0x0033(3)
{0x1E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x01,0x80,0x03,0x00,0x0E,0x00,0x01,0x80,0x00,0x80,0x00,0xC0,
0x00,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x1F,0x00,},
//0x0034(4)
{0x01,0x80,0x01,0x80,0x03,0x80,0x05,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xF0,
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x07,0xE0,},
//0x0035(5)
{0x3F,0xC0,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x2F,0x00,0x31,0x80,0x20,0xC0,0x00,0xC0,0x00,0xC0,
0x60,0xC0,0x60,0xC0,0x41,0x80,0x21,0x80,0x1F,0x00,},
//0x0036(6)
{0x07,0x80,0x18,0xC0,0x30,0xC0,0x30,0x00,0x20,0x00,0x60,0x00,0x67,0x80,0x68,0xC0,0x70,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x20,0x60,0x30,0x40,0x18,0xC0,0x0F,0x00,},
//0x0037(7)
{0x1F,0xE0,0x30,0x60,0x20,0x40,0x20,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0x00,
0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,},
//0x0038(8)
{0x1F,0x80,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x40,0x38,0xC0,0x0F,0x00,0x13,0x80,0x30,0xC0,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x0F,0x80,},
//0x0039(9)
{0x0F,0x00,0x30,0x80,0x30,0xC0,0x60,0x40,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xE0,0x31,0x60,0x1E,0x60,0x00,0x60,
0x00,0xC0,0x00,0xC0,0x30,0x80,0x31,0x80,0x1E,0x00,},
//0x003A(:)
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,},
//0x002D(-)
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,},
//0x0020( )
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,}
};
static const unsigned char data2[]=
{
0x04,0x80,0x0E,0xA0,0x78,0x90,0x08,0x90,0x08,0x84,0xFF,0xFE,0x08,0x80,0x08,0x90,
0x0A,0x90,0x0C,0x60,0x18,0x40,0x68,0xA0,0x09,0x20,0x0A,0x14,0x28,0x14,0x10,0x0C,
};
static const unsigned char data3[]=
{
0x0F,0x00,0x19,0x80,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x19,0x80,0x0F,0x00,
};
HI_S32 SAMPLE_RGN_CreateOverlayForVenc(RGN_HANDLE Handle, HI_U32 u32Num)
{
    HI_S32 i;
    HI_S32 s32Ret;
    MPP_CHN_S stChn[4];//模块设备通道结构体
    RGN_ATTR_S stRgnAttr;//区域属性结构体
    RGN_CHN_ATTR_S stChnAttr;//区域通道显示属性结构体
   
    /* Add cover to vpss group */
    printf(" SAMPLE_RGN_CreateOverlayForVenc u32Num:%d\n",u32Num);
    for(i=0;i     {
        stChn.enModId  = HI_ID_VENC;//模块号
        stChn.s32DevId = 0;
        stChn.s32ChnId = i;
    }  
    for (i=Handle; i<(Handle + u32Num); i++)
    {
        stRgnAttr.enType = OVERLAY_RGN;
        stRgnAttr.unAttr.stOverlay.enPixelFmt       = PIXEL_FORMAT_RGB_1555;
        stRgnAttr.unAttr.stOverlay.stSize.u32Width  =320;
        stRgnAttr.unAttr.stOverlay.stSize.u32Height =16;
        stRgnAttr.unAttr.stOverlay.u32BgColor       = 0x00007c00;

        s32Ret = HI_MPI_RGN_Create(i, &stRgnAttr);
        if(s32Ret != HI_SUCCESS)
        {
            SAMPLE_RGN_NOT_PASS(s32Ret);
        }
   
        stChnAttr.bShow  = HI_TRUE;//区域是否显示。
        stChnAttr.enType = OVERLAY_RGN;//区域类型。
        stChnAttr.unChnAttr.stOverlayChn.stPoint.s32X =0;//stOverlayChn叠加区域通道显示属性
        stChnAttr.unChnAttr.stOverlayChn.stPoint.s32Y =0;//
        stChnAttr.unChnAttr.stOverlayChn.u32BgAlpha   =0;//取值越小,越透明
        stChnAttr.unChnAttr.stOverlayChn.u32FgAlpha   = 128;
        stChnAttr.unChnAttr.stOverlayChn.u32Layer     = i;//区域层次。
        
        stChnAttr.unChnAttr.stOverlayChn.stQpInfo.bAbsQp = HI_FALSE;//是否绝对 QP
        stChnAttr.unChnAttr.stOverlayChn.stQpInfo.s32Qp  = 0;//QP 值
        // stInvertColorOSD 反色相关属性
        stChnAttr.unChnAttr.stOverlayChn.stInvertColor.stInvColArea.u32Height = 16*(i%2+1);//单元反色区域,反色处理的基本单元。
        stChnAttr.unChnAttr.stOverlayChn.stInvertColor.stInvColArea.u32Width  = 16*(i%2+1);
        stChnAttr.unChnAttr.stOverlayChn.stInvertColor.u32LumThresh = 128;//亮度阈值
        stChnAttr.unChnAttr.stOverlayChn.stInvertColor.enChgMod     = LESSTHAN_LUM_THRESH;//OSD 反色触发模式
        stChnAttr.unChnAttr.stOverlayChn.stInvertColor.bInvColEn    = HI_FALSE;//OSD 反色开关

        s32Ret = HI_MPI_RGN_AttachToChn(i, &stChn, &stChnAttr);
        if(s32Ret != HI_SUCCESS)
        {
            SAMPLE_RGN_NOT_PASS(s32Ret);
        }
    }

    return HI_SUCCESS;
   
}
void draw_osd( HI_U8*pdst,int a,int stride)
{
    int i,j,k;
    unsigned char mat[16][2];
    HI_U16 *pDst;
    int col=0;  
    int row=0;
    memcpy(mat,data[a],sizeof(data3));
       for(i=0; i<16; i++) //16  
    {   
        pDst = (HI_U16*)(pdst+i*stride);
        for(j=0; j<2; j++) //2  
        {   
            for(k=0; k<8 ; k++) //8bits , 1 byte  
            {   
                if( mat[j] & (0x80>>k))  
                {      
                   *pDst=0xffff;
                    //printf("*");  
                }   
                else   
                {  
                    //printf(" ");   
                    *pDst=0;
                }
                 pDst++;  
                col++;  
            }//for  
        }//for  
       // printf("\n");   
        row++;  
    }//for
}
HI_S32 SAMPLE_RGN_UpdateCanvas(BITMAP_S *pstBitmap, HI_BOOL bFil,
    HI_U32 u16FilColor, SIZE_S *pstSize, HI_U32 u32Stride, PIXEL_FORMAT_E enPixelFmt)
{
    OSD_SURFACE_S Surface;  
    int i,j;
    //HI_U16 *pDst;
   // unsigned char mat[16][2];
    time_t timep;
    struct tm *p;
    int temp_g,temp_s,temp_b,temp_q;
    if (PIXEL_FORMAT_RGB_1555 == enPixelFmt)
    {   
        Surface.enColorFmt = OSD_COLOR_FMT_RGB1555;
    }
    else if (PIXEL_FORMAT_RGB_4444 == enPixelFmt)
    {
        Surface.enColorFmt = OSD_COLOR_FMT_RGB4444;
    }
    else if (PIXEL_FORMAT_RGB_8888 == enPixelFmt)
    {
        Surface.enColorFmt = OSD_COLOR_FMT_RGB8888;
    }
    else
    {
        printf("Pixel format is not support!\n");        
        return HI_FAILURE;
    }
    if(NULL == pstBitmap->pData)
    {
        printf("malloc osd memroy err!\n");        
        return HI_FAILURE;
    }
        Surface.u16Height = pstSize->u32Height;
    Surface.u16Width = pstSize->u32Width;
    Surface.u16Stride = u32Stride;
    pstBitmap->u32Width  = Surface.u16Width;
    pstBitmap->u32Height = Surface.u16Height;
    memcpy(mat,data3,sizeof(data3));
    //printf("size:%d\n",size);
    time(&timep);
    p=localtime(&timep);
    //printf("%04d-%02d-%02d-%02d:%02d:%02d\n",p->tm_year+1900,p->tm_mon,p->tm_mday,p->tm_hour,p->tm_min,p->tm_sec);
   
    temp_q=(p->tm_year+1900)/1000;
    temp_b=(p->tm_year+1900)%1000;
    temp_s=temp_b;
    temp_b=temp_b/100;
    temp_s=temp_s%100;
    temp_g=temp_s;
    temp_s=temp_s/10;
    temp_g=temp_g%10;
    draw_osd((HI_U8*)pstBitmap->pData,temp_q,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+32,temp_b,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+64,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+96,temp_g,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+128,11,Surface.u16Width*2);
    temp_s=p->tm_mon/10;
    temp_g=p->tm_mon%10;
    draw_osd((HI_U8*)pstBitmap->pData+160,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+192,temp_g,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+224,11,Surface.u16Width*2);
    temp_s=p->tm_mday/10;
    temp_g=p->tm_mday%10;
    draw_osd((HI_U8*)pstBitmap->pData+256,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+288,temp_g,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+320,12,Surface.u16Width*2);
    temp_s=p->tm_hour/10;
    temp_g=p->tm_hour%10;
    draw_osd((HI_U8*)pstBitmap->pData+352,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+384,temp_g,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+416,10,Surface.u16Width*2);
    temp_s=p->tm_min/10;
    temp_g=p->tm_min%10;
    draw_osd((HI_U8*)pstBitmap->pData+448,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+480,temp_g,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+512,10,Surface.u16Width*2);
    temp_s=p->tm_sec/10;
    temp_g=p->tm_sec%10;
    draw_osd((HI_U8*)pstBitmap->pData+544,temp_s,Surface.u16Width*2);
    draw_osd((HI_U8*)pstBitmap->pData+576,temp_g,Surface.u16Width*2);
    if (PIXEL_FORMAT_RGB_1555 == enPixelFmt)
    {
        pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_1555;
    }
    else if (PIXEL_FORMAT_RGB_4444 == enPixelFmt)
    {
        pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_4444;
    }
    else if (PIXEL_FORMAT_RGB_8888 == enPixelFmt)
    {
        pstBitmap->enPixelFormat = PIXEL_FORMAT_RGB_8888;
    }

    //int i,j;
    HI_U16 *pu16Temp;
    pu16Temp = (HI_U16*)pstBitmap->pData;
   
    if (bFil)
    {
       for (i=0; iu32Height; i++)
       //for (i=0; i<32; i++)
        {
            for (j=0; ju32Width; j++)
            //for (j=0; j<32; j++)
            {
                if (u16FilColor == *pu16Temp)
                {
                    *pu16Temp &= 0x7FFF;
                }
                pu16Temp++;
            }
        }
    }
        
    return HI_SUCCESS;
}
HI_S32 SAMPLE_RGN_AddOsdToVenc(HI_VOID)
{
    HI_S32 s32Ret = HI_SUCCESS;
    RGN_HANDLE OverlayHandle;
    HI_S32 u32OverlayRgnNum;
    RGN_ATTR_S stRgnAttrSet;//区域属性结构体
    RGN_CANVAS_INFO_S stCanvasInfo;//画布信息结构体
    BITMAP_S stBitmap;//定义位图图像信息结构
    SIZE_S stSize;
    HI_U32 i;  
    /*************************************************
    step 1: create region and attach to venc
    *************************************************/
    OverlayHandle    = 0;
    u32OverlayRgnNum = OVERLAY_MAX_NUM_VENC/2;
    s32Ret = SAMPLE_RGN_CreateOverlayForVenc(OverlayHandle, u32OverlayRgnNum);
    if(HI_SUCCESS != s32Ret)
    {
        printf("SAMPLE_RGN_CreateOverlayForVenc failed! s32Ret: 0x%x.\n", s32Ret);
       return 0;
    }
    while(1)
    {
    for(i=0; i     {
        s32Ret = HI_MPI_RGN_GetAttr(OverlayHandle+i, &stRgnAttrSet);
        if(HI_SUCCESS != s32Ret)
        {
            printf("HI_MPI_RGN_GetAttr failed! s32Ret: 0x%x.\n", s32Ret);
            //goto END_O_VENC4;
            return 0;
        }
        //获取区域的显示画布信息
        s32Ret = HI_MPI_RGN_GetCanvasInfo(OverlayHandle+i, &stCanvasInfo);
        if(HI_SUCCESS != s32Ret)
        {
            printf("HI_MPI_RGN_GetCanvasInfo failed! s32Ret: 0x%x.\n", s32Ret);
            //goto END_O_VENC4;
            return 0;
        }
            
        stBitmap.pData   = (HI_VOID *)stCanvasInfo.u32VirtAddr;
        stSize.u32Width  = stCanvasInfo.stSize.u32Width;
        stSize.u32Height = stCanvasInfo.stSize.u32Height;
        s32Ret = SAMPLE_RGN_UpdateCanvas(&stBitmap, HI_FALSE, 0, &stSize, stCanvasInfo.u32Stride,
            stRgnAttrSet.unAttr.stOverlay.enPixelFmt);
        if(HI_SUCCESS != s32Ret)
        {
            printf("SAMPLE_RGN_UpdateCanvas failed! s32Ret: 0x%x.\n", s32Ret);
            //goto END_O_VENC4;
            return 0;
        }
        
        s32Ret = HI_MPI_RGN_UpdateCanvas(OverlayHandle+i);
        if(HI_SUCCESS != s32Ret)
        {
            printf("HI_MPI_RGN_UpdateCanvas failed! s32Ret: 0x%x.\n", s32Ret);
           // goto END_O_VENC4;
           return 0;
        }
    }
    sleep(1);
    }
    return s32Ret;
}
调用最后一个函数就可以,在venc的四个通道里叠加时间

zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2018-02-07 07:38:30
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=84254&ptid=38843]houyongnan 发表于 2018-2-6 10:36[/url]
十分感谢已经实现了(但是有一个问题,localtime得到的时间总是1970年,与调用海思rtc例程得到的时间不一 ...[/quote]

时间一般来说是到rtc驱动读一下时间, 然后同步到系统时间, 当然可以用各线程来做, 防止两边不同步

ljr13141503189

0个粉丝

32

问答

0

专栏

0

资料

ljr13141503189 2018-02-07 07:49:34
认可0
请教楼主 您这个显示时间是用点阵描绘出每个数字的吧  请问有没有相关的资料链接可以分享一下    小弟最近想学习一下

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-03-19 10:29:48
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=84299&ptid=38843]ljr13141503189 发表于 2018-2-7 07:49[/url]
请教楼主 您这个显示时间是用点阵描绘出每个数字的吧  请问有没有相关的资料链接可以分享一下    小弟最近 ...[/quote]

把我上面的代码拿去直接用就好了

zxc

0个粉丝

1

问答

0

专栏

0

资料

zxc 2018-03-21 17:22:06
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=84254&ptid=38843]houyongnan 发表于 2018-2-6 10:36[/url]
十分感谢已经实现了(但是有一个问题,localtime得到的时间总是1970年,与调用海思rtc例程得到的时间不一 ...[/quote]

试了一下出不来

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-03-22 12:27:22
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85610&ptid=38843]zxc 发表于 2018-3-21 17:22[/url]
试了一下出不来[/quote]

遇到了什么问题?

zxc

0个粉丝

1

问答

0

专栏

0

资料

zxc 2018-03-22 14:34:58
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85635&ptid=38843]houyongnan 发表于 2018-3-22 12:27[/url]
遇到了什么问题?[/quote]

叠加都正常 我看了  就是在编码端没有显示  也没有报错  我在编译的时候报错了if( mat[j] & (0x80>>k))   我强制改变mat【j】的类型为int  编译通过了 但是运行不显示

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-03-22 15:31:57
认可0
本帖最后由 houyongnan 于 2018-3-22 15:52 编辑

[quote][url=forum.php?mod=redirect&goto=findpost&pid=85645&ptid=38843]zxc 发表于 2018-3-22 14:34[/url]
叠加都正常 我看了  就是在编码端没有显示  也没有报错  我在编译的时候报错了if( mat[j] & (0x80>>k))   ...[/quote]

stChnAttr.unChnAttr.stOverlayChn.u32BgAlpha   =0;//取值越小,越透明这个值调高一些看看,还有mat[j]不应该改成int型

zxc

0个粉丝

1

问答

0

专栏

0

资料

zxc 2018-03-23 10:41:53
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85649&ptid=38843]houyongnan 发表于 2018-3-22 15:31[/url]
stChnAttr.unChnAttr.stOverlayChn.u32BgAlpha   =0;//取值越小,越透明这个值调高一些看看,还有mat[j ...[/quote]

不改我这边就报错  编译不通过

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-03-24 10:17:09
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85683&ptid=38843]zxc 发表于 2018-3-23 10:41[/url]
不改我这边就报错  编译不通过[/quote]

我这边可以

zxc

0个粉丝

1

问答

0

专栏

0

资料

zxc 2018-03-26 11:37:26
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85734&ptid=38843]houyongnan 发表于 2018-3-24 10:17[/url]
我这边可以[/quote]

能出来字幕么  我是用3536的400编译器编的

houyongnan

1个粉丝

32

问答

0

专栏

0

资料

houyongnan 2018-03-31 10:34:13
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=85765&ptid=38843]zxc 发表于 2018-3-26 11:37[/url]
能出来字幕么  我是用3536的400编译器编的[/quote]

我觉得叠加时间和字幕一个道理

wsswan

0个粉丝

8

问答

0

专栏

0

资料

wsswan 2018-04-02 15:21:23
认可0
收藏。太牛了。哈哈,如果有中文点阵字体就更好了
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区