-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample_comm_ive.h
178 lines (160 loc) · 6.38 KB
/
sample_comm_ive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef __SAMPLE_COMM_IVE_H__
#define __SAMPLE_COMM_IVE_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include "hi_common.h"
#include "hi_debug.h"
#include "hi_comm_video.h"
#include "hi_comm_sys.h"
#include "hi_comm_ive.h"
#include "hi_comm_vi.h"
#include "hi_comm_vo.h"
#include "hi_comm_vgs.h"
#include "mpi_vb.h"
#include "mpi_sys.h"
#include "mpi_ive.h"
#include "sample_comm.h"
#define VIDEO_WIDTH 352
#define VIDEO_HEIGHT 288
#define IVE_ALIGN 16
#define IVE_CHAR_CALW 8
#define IVE_CHAR_CALH 8
#define IVE_CHAR_NUM (IVE_CHAR_CALW *IVE_CHAR_CALH)
#define IVE_FILE_NAME_LEN 256
#define SAMPLE_ALIGN_BACK(x, a) ((a) * (((x) / (a))))
#define SAMPLE_CHECK_EXPR_RET(expr, ret, fmt...)\
do\
{\
if(expr)\
{\
SAMPLE_PRT(fmt);\
return (ret);\
}\
}while(0)
#define SAMPLE_CHECK_EXPR_GOTO(expr, label, fmt...)\
do\
{\
if(expr)\
{\
SAMPLE_PRT(fmt);\
goto label;\
}\
}while(0)
typedef struct hiSAMPLE_IVE_VI_VO_CONFIG_S
{
SAMPLE_VI_CONFIG_S stViConfig;
VO_INTF_TYPE_E enVoIntfType;
VIDEO_NORM_E enNorm;
PIC_SIZE_E enPicSize;
}SAMPLE_IVE_VI_VO_CONFIG_S;
typedef struct hiSAMPLE_IVE_RECT_S
{
POINT_S astPoint[4];
}SAMPLE_IVE_RECT_S;
typedef struct hiSAMPLE_RECT_ARRAY_S
{
HI_U16 u16Num;
SAMPLE_IVE_RECT_S astRect[50];
}SAMPLE_RECT_ARRAY_S;
typedef struct hiIVE_LINEAR_DATA_S
{
HI_S32 s32LinearNum;
HI_S32 s32ThreshNum;
POINT_S *pstLinearPoint;
}IVE_LINEAR_DATA_S;
//free mmz
#define IVE_MMZ_FREE(phy,vir)\
do{\
if ((0 != (phy)) && (NULL != (vir)))\
{\
HI_MPI_SYS_MmzFree((phy),(vir));\
(phy) = 0;\
(vir) = NULL;\
}\
}while(0)
#define IVE_CLOSE_FILE(fp)\
do{\
if (NULL != (fp))\
{\
fclose((fp));\
(fp) = NULL;\
}\
}while(0)
#define SAMPLE_VI_PAUSE()\
do {\
printf("---------------press the Enter key to exit!---------------\n");\
getchar();\
} while (0)
/******************************************************************************
* function : Mpi init
******************************************************************************/
HI_VOID SAMPLE_COMM_IVE_CheckIveMpiInit(HI_VOID);
/******************************************************************************
* function : Mpi exit
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_IveMpiExit(HI_VOID);
/******************************************************************************
* function :VGS Add draw rect job
******************************************************************************/
HI_S32 SAMPLE_COMM_VGS_AddDrawRectJob(VGS_HANDLE VgsHandle, IVE_IMAGE_S *pstSrc, IVE_IMAGE_S *pstDst,
RECT_S *pstRect, HI_U16 u16RectNum);
/******************************************************************************
* function : Call vgs to fill rect
******************************************************************************/
HI_S32 SAMPLE_COMM_VGS_FillRect(VIDEO_FRAME_INFO_S *pstFrmInfo, SAMPLE_RECT_ARRAY_S *pstRect,HI_U32 u32Color);
/******************************************************************************
* function :Read file
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_ReadFile(IVE_IMAGE_S *pstImg, FILE *pFp);
/******************************************************************************
* function :Write file
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_WriteFile(IVE_IMAGE_S *pstImg, FILE *pFp);
/******************************************************************************
* function :Calc stride
******************************************************************************/
HI_U16 SAMPLE_COMM_IVE_CalcStride(HI_U16 u16Width, HI_U8 u8Align);
/******************************************************************************
* function : Start BT1120 720P vi/vo/venc
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_BT1120_720P_PreView(SAMPLE_IVE_VI_VO_CONFIG_S *pstViVoConfig,
HI_BOOL bOpenVi,HI_BOOL bOpenViExt,HI_BOOL bOpenVo,HI_BOOL bOpenVenc,HI_BOOL bOpenVpss,HI_U32 u32VpssChnNum);
/******************************************************************************
* function : Stop BT1120 720P vi/vo/venc
******************************************************************************/
HI_VOID SAMPLE_COMM_IVE_BT1120_720P_Stop(SAMPLE_IVE_VI_VO_CONFIG_S *pstViVoConfig,
HI_BOOL bOpenVi,HI_BOOL bOpenViExt,HI_BOOL bOpenVo,HI_BOOL bOpenVenc,HI_BOOL bOpenVpss,HI_U32 u32VpssChnNum);
/******************************************************************************
* function : Copy blob to rect
******************************************************************************/
HI_VOID SAMPLE_COMM_IVE_BlobToRect(IVE_CCBLOB_S *pstBlob, SAMPLE_RECT_ARRAY_S *pstRect,
HI_U16 u16RectMaxNum,HI_U16 u16AreaThrStep,
HI_U16 u16SrcWidth, HI_U16 u16SrcHeight,
HI_U16 u16DstWidth,HI_U16 u16DstHeight);
/******************************************************************************
* function : Create ive image
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_CreateImage(IVE_IMAGE_S *pstImg,IVE_IMAGE_TYPE_E enType,
HI_U16 u16Width,HI_U16 u16Height);
/******************************************************************************
* function : Create memory info
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_CreateMemInfo(IVE_MEM_INFO_S*pstMemInfo,HI_U32 u32Size);
/******************************************************************************
* function : Create ive image by cached
******************************************************************************/
HI_S32 SAMPLE_COMM_IVE_CreateImageByCached(IVE_IMAGE_S *pstImg,
IVE_IMAGE_TYPE_E enType,HI_U16 u16Width,HI_U16 u16Height);
/******************************************************************************
* function : Dma frame info to ive image
******************************************************************************/
HI_S32 SAMPLE_COMM_DmaImage(VIDEO_FRAME_INFO_S *pstFrameInfo,IVE_DST_IMAGE_S *pstDst,HI_BOOL bInstant);
#endif