/*
|
|
*/
|
|
#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_
|