AI_Charging_Station/libs/common/drm/include/tool.h

146 lines
5.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
*/
#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: pFilePathbmp保存路径
pDatargb图像数据内存指针rgb图像数据排练顺序为bgrbgr...bgrrgb值必须为8bit
width图像宽
height图像高
Output: 无
*************************************************************/
extern void ReadBmpFile(char *pFilePath, unsigned char *pData, int & width, int & height);
/*************************************************************
Function: SaveBmpFile
Description: 把rgb图像数据保存为bmp
Input: pFilePathbmp保存路径
pDatargb图像数据内存指针rgb图像数据排练顺序为bgrbgr...bgrrgb值必须为8bit
width图像宽
height图像高
Output: 无
*************************************************************/
extern void SaveBmpFile(char *pFilePath, unsigned char *pData, int width, int height);
/*************************************************************
Function: SaveRaw
Description: 保存raw图
Input: pSavePathraw保存路径
pDataraw数据
widthraw图像宽
heightraw图像高
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: pFilePathbmp保存路径
width图像宽
height图像高
bitValue图像数据位宽
pRGBDatargb图像数据内存指针rgb图像数据排练顺序为bgrbgr...bgr
Output: 无
*************************************************************/
extern void SaveBmpFile2(char *pFilePath, int width, int height, int bitValue, short *pRGBData);
/*************************************************************
Function: SaveYUVData
Description: 保存8bit YUV图
Input: pSavePath保存路径
pDatayuv数据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保存路径
pDatayuv数据数据位宽大于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保存路径
pDatayuv数据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保存路径
pDatayuv数据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图
widthraw图宽
heightraw图高
bayerPatternbayer pattern格式取值范围[03]
bitValueraw数据位宽
Output: 无
*************************************************************/
extern void SaveCfaBmp(char *pFilePath, short *pRawData, int width, int height, int bayerPattern, int bitValue);
#ifdef __cplusplus
}
#endif
#endif // TOOL_H_