xref: /OK3568_Linux_fs/external/linux-rga/samples/im2d_slt/third-party/libdrm/include/tool.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2 
3  */
4 
5 #ifndef TOOL_H_
6 #define TOOL_H_
7 //�ڴ˴���������ͷ�ļ�
8 #include "stdio.h"
9 #include "string.h"
10 #include "stdlib.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 #define YUV420	0
16 #define YUV422 	YUV420 	+ 1
17 #define YUV444 	YUV422 	+ 1
18 /*************************************************************
19 Function:       ReadBmpFile
20 Description:    ��ȡbmpͼ���ڴ�
21 Input:          pFilePath��bmp����·��
22                 pData��rgbͼ�������ڴ�ָ�룬rgbͼ����������˳��Ϊbgrbgr...bgr��rgbֵ����Ϊ8bit
23 				width��ͼ���
24 				height��ͼ���
25 Output:         ��
26 *************************************************************/
27 extern void ReadBmpFile(char *pFilePath, unsigned char *pData, int & width, int & height);
28 /*************************************************************
29 Function:       SaveBmpFile
30 Description:    ��rgbͼ�����ݱ���Ϊbmp
31 Input:          pFilePath��bmp����·��
32                 pData��rgbͼ�������ڴ�ָ�룬rgbͼ����������˳��Ϊbgrbgr...bgr��rgbֵ����Ϊ8bit
33 				width��ͼ���
34 				height��ͼ���
35 Output:         ��
36 *************************************************************/
37 extern void SaveBmpFile(char *pFilePath, unsigned char *pData, int width, int height);
38 /*************************************************************
39 Function:       SaveRaw
40 Description:    ����rawͼ
41 Input:          pSavePath��raw����·��
42                 pData��raw����
43 				width��rawͼ���
44 				height��rawͼ���
45 Output:         ��
46 *************************************************************/
47 extern void SaveRaw(char *pSavePath, short *pRawData, int width, int height);
48 
49 extern void SaveRaw32bit(char *pSavePath, long *pRawData, int width, int height);
50 
51 /*************************************************************
52 Function:       SaveBmpFile2
53 Description:    ��������λ�����8bit��bmpͼ��
54 Input:          pFilePath��bmp����·��
55 				width��ͼ���
56 				height��ͼ���
57 				bitValue��ͼ������λ��
58 				pRGBData��rgbͼ�������ڴ�ָ�룬rgbͼ����������˳��Ϊbgrbgr...bgr
59 Output:         ��
60 *************************************************************/
61 extern void SaveBmpFile2(char *pFilePath, int width, int height, int bitValue, short *pRGBData);
62 
63 /*************************************************************
64 Function:       SaveYUVData
65 Description:    ����8bit YUVͼ
66 Input:          pSavePath������·��
67                 pData��yuv���ݣ�8bit������˳��yyy...yyyuuu...uuuvvv...vvv
68 				width��ͼ���
69 				height��ͼ���
70 Output:         ��
71 *************************************************************/
72 extern void SaveYUVData(char *pSavePath, unsigned char *pData, int width, int height);
73 
74 
75 
76 /*************************************************************
77 Function:       SaveYUVData2
78 Description:    ��������λ�����8bit��YUVͼ
79 Input:          pSavePath������·��
80                 pData��yuv���ݣ�����λ�����8bit������˳��yyy...yyyuuu...uuuvvv...vvv
81 				width��ͼ���
82 				height��ͼ���
83 Output:         ��
84 *************************************************************/
85 extern void SaveYUVData2(char *pSavePath, short *pData, int width, int height, int bitValue);
86 /*************************************************************
87 Function:       SaveYUVData1
88 Description:    ����8bit YUV420ͼ
89 Input:          pSavePath������·��
90                 pData��yuv���ݣ�8bit������˳��yyy...yyyuuu...uuuvvv...vvv
91 				width��ͼ���
92 				height��ͼ���
93 Output:         ��
94 *************************************************************/
95 extern void SaveYUVData1(char *pSavePath, unsigned char *pData, int width, int height, int fmt);
96 /*************************************************************
97 Function:       ReadYUVData1
98 Description:    ��ȡ8bit YUV420ͼ
99 Input:          pReadPath������·��
100                 pData��yuv���ݣ�8bit������˳��yyy...yyyuuu...uuuvvv...vvv
101 				width��ͼ���
102 				height��ͼ���
103 Output:         ��
104 *************************************************************/
105 extern void ReadYUVData1(char *pReadPath, unsigned char *pData, int width, int height, int fmt);
106 /*************************************************************
107 Function:     Yuvfmtconv
108 Description:    yuv fmt conversion.444 420 422 to 444 420 422
109 Input:   	pDatain ���뻺��
110 		pDataout �������
111 		width ��
112 		height ��
113 		fmt_in �����ʽ
114 		fmt_out �����ʽ
115 Output:	      ��
116 *************************************************************/
117 extern void Yuvfmtconv(void *pDatain, void *pDataout, int width, int height, int fmt_in, int fmt_out, int size);
118 /*************************************************************
119 Function:     Yuvbitstochar
120 Description:    save yuv to 8 bitdepth
121 Input:   	pDatain ���뻺��
122 		pDataout �������
123 		size yuv����
124 		height ����λ��
125 Output:	      ��
126 *************************************************************/
127 extern void Yuvbitstochar(short *pDatain, unsigned char *pDataout, int size,  int bitdepth);
128 
129 /*************************************************************
130 Function:       SaveCfaBmp
131 Description:    ��raw�����cfaͼ��
132 Input:          pRawData�������rawͼ��
133                 width��rawͼ��
134 				height��rawͼ�ߣ�
135 				bayerPattern��bayer pattern��ʽ��ȡֵ��Χ[0��3]��
136 				bitValue��raw����λ��
137 Output:         ��
138 *************************************************************/
139 extern void SaveCfaBmp(char *pFilePath, short *pRawData, int width, int height, int bayerPattern, int bitValue);
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif  // TOOL_H_
146