hc
2023-11-22 f743a7adbd6e230d66a6206fa115b59fec2d88eb
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
/*
 
 */
 
#ifndef TOOL_H_
#define TOOL_H_
//ÔÚ´Ë´¦°üº¬ÆäËüÍ·Îļþ
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
 
#ifdef __cplusplus
extern "C" {
#endif
#define YUV420    0
#define YUV422     YUV420     + 1
#define YUV444     YUV422     + 1
/*************************************************************
Function:       ReadBmpFile
Description:    ¶ÁÈ¡bmpͼÏñµ½ÄÚ´æ
Input:          pFilePath£ºbmp±£´æÂ·¾¶
                pData£ºrgbͼÏñÊý¾ÝÄÚ´æÖ¸Õ룬rgbͼÏñÊý¾ÝÅÅÁ·Ë³ÐòΪbgrbgr...bgr£»rgbÖµ±ØÐëΪ8bit
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void ReadBmpFile(char *pFilePath, unsigned char *pData, int & width, int & height);
/*************************************************************
Function:       SaveBmpFile
Description:    °ÑrgbͼÏñÊý¾Ý±£´æÎªbmp
Input:          pFilePath£ºbmp±£´æÂ·¾¶
                pData£ºrgbͼÏñÊý¾ÝÄÚ´æÖ¸Õ룬rgbͼÏñÊý¾ÝÅÅÁ·Ë³ÐòΪbgrbgr...bgr£»rgbÖµ±ØÐëΪ8bit
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void SaveBmpFile(char *pFilePath, unsigned char *pData, int width, int height);
/*************************************************************
Function:       SaveRaw
Description:    ±£´ærawͼ
Input:          pSavePath£ºraw±£´æÂ·¾¶
                pData£ºrawÊý¾Ý
               width£ºrawͼÏñ¿í
               height£ºrawͼÏñ¸ß
Output:         ÎÞ
*************************************************************/
extern void SaveRaw(char *pSavePath, short *pRawData, int width, int height);
 
extern void SaveRaw32bit(char *pSavePath, long *pRawData, int width, int height);
 
/*************************************************************
Function:       SaveBmpFile2
Description:    ±£´æÊý¾Ýλ¿í´óÓÚ8bitµÄbmpͼÏñ
Input:          pFilePath£ºbmp±£´æÂ·¾¶
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
               bitValue£ºÍ¼ÏñÊý¾Ýλ¿í
               pRGBData£ºrgbͼÏñÊý¾ÝÄÚ´æÖ¸Õ룬rgbͼÏñÊý¾ÝÅÅÁ·Ë³ÐòΪbgrbgr...bgr
Output:         ÎÞ
*************************************************************/
extern void SaveBmpFile2(char *pFilePath, int width, int height, int bitValue, short *pRGBData);
 
/*************************************************************
Function:       SaveYUVData
Description:    ±£´æ8bit YUVͼ
Input:          pSavePath£º±£´æÂ·¾¶
                pData£ºyuvÊý¾Ý£¬8bit£¬ÅÅÁÐ˳Ðòyyy...yyyuuu...uuuvvv...vvv
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void SaveYUVData(char *pSavePath, unsigned char *pData, int width, int height);
 
 
 
/*************************************************************
Function:       SaveYUVData2
Description:    ±£´æÊý¾Ýλ¿í´óÓÚ8bitµÄYUVͼ
Input:          pSavePath£º±£´æÂ·¾¶
                pData£ºyuvÊý¾Ý£¬Êý¾Ýλ¿í´óÓÚ8bit£¬ÅÅÁÐ˳Ðòyyy...yyyuuu...uuuvvv...vvv
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void SaveYUVData2(char *pSavePath, short *pData, int width, int height, int bitValue);
/*************************************************************
Function:       SaveYUVData1
Description:    ±£´æ8bit YUV420ͼ
Input:          pSavePath£º±£´æÂ·¾¶
                pData£ºyuvÊý¾Ý£¬8bit£¬ÅÅÁÐ˳Ðòyyy...yyyuuu...uuuvvv...vvv
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void SaveYUVData1(char *pSavePath, unsigned char *pData, int width, int height, int fmt);
/*************************************************************
Function:       ReadYUVData1
Description:    ¶ÁÈ¡8bit YUV420ͼ
Input:          pReadPath£º±£´æÂ·¾¶
                pData£ºyuvÊý¾Ý£¬8bit£¬ÅÅÁÐ˳Ðòyyy...yyyuuu...uuuvvv...vvv
               width£ºÍ¼Ïñ¿í
               height£ºÍ¼Ïñ¸ß
Output:         ÎÞ
*************************************************************/
extern void ReadYUVData1(char *pReadPath, unsigned char *pData, int width, int height, int fmt);
/*************************************************************
Function:     Yuvfmtconv
Description:    yuv fmt conversion.444 420 422 to 444 420 422
Input:       pDatain ÊäÈ뻺´æ
       pDataout Êä³ö»º´æ
       width ¿í
       height ¸ß
       fmt_in ÊäÈë¸ñʽ
       fmt_out Êä³ö¸ñʽ
Output:          ÎÞ
*************************************************************/
extern void Yuvfmtconv(void *pDatain, void *pDataout, int width, int height, int fmt_in, int fmt_out, int size);
/*************************************************************
Function:     Yuvbitstochar
Description:    save yuv to 8 bitdepth
Input:       pDatain ÊäÈ뻺´æ
       pDataout Êä³ö»º´æ
       size yuv×ÜÊý
       height ÊäÈëλ¿í
Output:          ÎÞ
*************************************************************/
extern void Yuvbitstochar(short *pDatain, unsigned char *pDataout, int size,  int bitdepth);
 
/*************************************************************
Function:       SaveCfaBmp
Description:    ½«raw±£´æ³ÉcfaͼÏñ
Input:          pRawData£ºÊäÈëµÄrawͼ£»
                width£ºrawͼ¿í£»
               height£ºrawͼ¸ß£»
               bayerPattern£ºbayer pattern¸ñʽ£¬È¡Öµ·¶Î§[0£¬3]£»
               bitValue£ºrawÊý¾Ýλ¿í£»
Output:         ÎÞ
*************************************************************/
extern void SaveCfaBmp(char *pFilePath, short *pRawData, int width, int height, int bayerPattern, int bitValue);
 
#ifdef __cplusplus
}
#endif
 
#endif  // TOOL_H_