-
Notifications
You must be signed in to change notification settings - Fork 2
/
jhVideoOutputDealer.h
85 lines (73 loc) · 3.99 KB
/
jhVideoOutputDealer.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
/*
**************************************************************************************
* CopyRight (C) jhsys Corp, Ltd.
*
* Filename: jhVideoOutputDealer.h
* Description: header file
*
* Version: 1.0
* Created: Friday, June 16, 2012 10:15:10 CST
* Author: dujf [[email protected]]
*
* Revision: initial draft;
**************************************************************************************
*/
/** Last updated by xshl5 2013-11-27 **/
#ifndef JHSYS_VIDEO_OUTPUT_DEALER_H
#define JHSYS_VIDEO_OUTPUT_DEALER_H
namespace jhsys {
#ifndef max
#define max(a,b) ({typeof(a) _a = (a); typeof(b) _b = (b); _a > _b ? _a : _b; })
#define min(a,b) ({typeof(a) _a = (a); typeof(b) _b = (b); _a < _b ? _a : _b; })
#endif
#pragma pack (2)
struct BmpFileHeader
{
unsigned short bfType; /*2byte 'BM'*/
unsigned long bfSize; /* 4byte file size*/
unsigned short bfReserved1; /*2byte*/
unsigned short bfReserved2; /*2byte */
unsigned long bfOffBits; /*4byte */
};
#pragma pack ()
struct BmpInfoHeader
{
unsigned long biSize; /* 4byte */
unsigned long biWidth; /*/4byte */
unsigned long biHeight; /*4 byte */
unsigned short biPlanes; /*2 byte*/
unsigned short biBitCount ; /* 2 byte*/
unsigned long biCompression; /*4 byte */
unsigned long biSizeImage; /*4 byte */
unsigned long biXPelsPerMeter; /*4 byte */
unsigned long biYPelsPerMeter; /*4 byte */
unsigned long biClrUsed; /*4 byte*/
unsigned long biClrImportant; /*4 byte*/
};
class jhVideoOutputDealer
{
public:
jhVideoOutputDealer();
~jhVideoOutputDealer();
inline void YV12_to_RGB24 (unsigned char * pSrcY, unsigned char * pSrcU, unsigned char * pSrcV,
int Width, int Height, double dXSrc, double dYSrc, int & nR, int & nG, int & nB);
void yuv420pToRgb24(unsigned char *pSrcY, unsigned char *pSrcU,
unsigned char *pSrcV, int width, int height, unsigned char *pDst);
void saveAsBmpFile(char* fileName, unsigned char* data, int W, int H);
void yuv420pToRgb565Center(unsigned char *pSrcY, unsigned char *pSrcU, unsigned char *pSrcV, int srcWidth,
int srcHeight, __u16 *pDst, int dstWidth, int dstHeight, int stepSize);
void yuv420pNearestNeighborScale(unsigned char *pSrcY, unsigned char *pSrcU, unsigned char *pSrcV, int srcWidth,
int srcHeight, __u16 *pDst, int dstWidth, int dstHeight, int stepSize);
void yuv420pNearestNeighborScaleCenter(unsigned char *pSrcY, unsigned char *pSrcU, unsigned char *pSrcV, int srcWidth,
int srcHeight, __u16 *pDst, int dstWidth, int dstHeight, int stepSize);
void yuv420pNearestNeighborScaleCenter_v2(unsigned char * pSrcY, unsigned char * pSrcU, unsigned char * pSrcV,
int srcWidth, int srcHeight, __u16 * pDst, int dstWidth, int dstHeight, int stepSize);
void yuv420pCalcNearestNeighbor(unsigned char *pSrcY, unsigned char *pSrcU,unsigned char *pSrcV, int Width,
int Height,double dXSrc, double dYSrc, int &nR, int &nG, int &nB);
inline void getScaledSize(int srcWidth, int srcHeight,int dstWidth, int dstHeight, int *scaledWidth, int *scaledHeight);
private:
struct BmpFileHeader mFileHeader;
struct BmpInfoHeader mInfoHeader;
};
}// namespace jhsys
#endif //JHSYS_VIDEO_OUTPUT_DEALER_H