hi3518ev200 OSD实现和LOGO实现

LOGO的实现步骤:

typedef enum hiMOD_ID_E  定义模块 ID 枚举类型
{
    HI_ID_CMPI    = 0,
    HI_ID_VB      = 1,
    HI_ID_SYS     = 2,
    HI_ID_RGN	  = 3,
    HI_ID_CHNL    = 4,
    HI_ID_VDEC    = 5,
    HI_ID_GROUP   = 6,
    HI_ID_VPSS    = 7,
    HI_ID_VENC    = 8,
    HI_ID_VDA     = 9,
    HI_ID_H264E   = 10,
    HI_ID_JPEGE   = 11,
    HI_ID_MPEG4E  = 12,
    HI_ID_H264D   = 13,
    HI_ID_JPEGD   = 14,
    HI_ID_VOU     = 15,
    HI_ID_VIU     = 16,
    HI_ID_DSU     = 17,
    HI_ID_VALG    = 18,
    HI_ID_RC      = 19,
    HI_ID_AIO     = 20,
    HI_ID_AI      = 21,
    HI_ID_AO      = 22,
    HI_ID_AENC    = 23,
    HI_ID_ADEC    = 24,
    HI_ID_AVENC   = 25,
    HI_ID_PCIV    = 26,
    HI_ID_PCIVFMW = 27,
    HI_ID_ISP	  = 28,
    HI_ID_IVE	  = 29,

    HI_ID_DCCM    = 31,
    HI_ID_DCCS    = 32,
    HI_ID_PROC    = 33,
    HI_ID_LOG     = 34,
    HI_ID_MST_LOG = 35,
    HI_ID_VD      = 36,

    HI_ID_VCMP    = 38,
    HI_ID_FB      = 39,
    HI_ID_HDMI    = 40,
    HI_ID_VOIE    = 41,
    HI_ID_TDE     = 42,
    HI_ID_USR     = 43,
    HI_ID_VEDU    = 44,
    HI_ID_VGS     = 45,
    HI_ID_H265E   = 46,
    HI_ID_FD	  = 47,
    HI_ID_ODT	  = 48, //Object detection trace
    HI_ID_VQA	  = 49, //Video quality  analysis
    HI_ID_LPR 	  = 50, // License Plate Recognition
	HI_ID_FISHEYE = 51,
	
    HI_ID_BUTT,
} MOD_ID_E;

typedef struct hiMPP_CHN_S  定义模块设备通道结构体
{
    MOD_ID_E    enModId;  模块号
    HI_S32      s32DevId; 设备号
    HI_S32      s32ChnId; 通道号
} MPP_CHN_S;


/* type of video regions */
typedef enum hiRGN_TYPE_E
{
    OVERLAY_RGN = 0,     /* video overlay region */VENC 通道视频叠加区域
    COVER_RGN,  VI 通道视频遮挡区域
    COVEREX_RGN,  扩展视频遮挡区域
    OVERLAYEX_RGN,  扩展视频叠加区域
    RGN_BUTT
} RGN_TYPE_E;

typedef struct hiOVERLAY_ATTR_S
{
    /* bitmap pixel format,now only support ARGB1555 or ARGB4444 */
    PIXEL_FORMAT_E enPixelFmt;

    /* background color, pixel format depends on "enPixelFmt" */
    HI_U32 u32BgColor;

    /* region size,W:[4,4096],align:2,H:[4,4096],align:2 */
    SIZE_S stSize;
}OVERLAY_ATTR_S;
typedef union hiRGN_ATTR_U
{
    OVERLAY_ATTR_S      stOverlay;      VENC 通道叠加区域属性
    OVERLAYEX_ATTR_S    stOverlayEx;   扩展叠加区域属性
} RGN_ATTR_U;

typedef struct hiRGN_ATTR_S  定义区域属性结构体
{
    RGN_TYPE_E enType;  /* region type */区域类型
    RGN_ATTR_U unAttr;  /* region attribute */区域属性
} RGN_ATTR_S;

typedef struct hiRGN_CANVAS_INFO_S  定义画布信息结构体
{
	HI_U32 u32PhyAddr;  画布物理地址
	HI_U32 u32VirtAddr;  画布虚拟地址
	SIZE_S stSize;  画布尺寸
	HI_U32 u32Stride;  画布的 stride
	PIXEL_FORMAT_E enPixelFmt;  画布的像素格式
} RGN_CANVAS_INFO_S;

HI_MPI_RGN_Create: 创建区域
HI_MPI_RGN_AttachToChn: 将区域叠加到通道上,我们是直接添加到了VENC通道上面
HI_MPI_RGN_GetAttr: 获取区域属性
HI_MPI_RGN_GetCanvasInfo: 获取区域的显示画布信息
用bitmap的pdata指向画布的虚拟地址,那么再向pdata上面写数据,就写到了画布的虚拟地址上
HI_MPI_RGN_UpdateCanvas: 更新显示画布


OSD的实现:
freetype + SDL + SDL_ttf
我采用的方式是利用sdl+freetype生成字符图像,然后将图像的像素赋值给stBitmap.pData,再调用
HI_MPI_RGN_SetBitMap来添加osd
参考:
https://blog.csdn.net/qq_26671365/article/details/79007066
https://blog.csdn.net/simonforfuture/article/details/78629905

1080p:1920 x 1080
720p:1280 x 720


你可能感兴趣的:(IPC-HI3518EV200)