-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorConverter.h
83 lines (68 loc) · 2.02 KB
/
ColorConverter.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
#pragma once
#include <mfapi.h>
typedef void(*IMAGE_TRANSFORM_FN)(
BYTE* pDest,
LONG lDestStride,
const BYTE* pSrc,
LONG lSrcStride,
DWORD dwWidthInPixels,
DWORD dwHeightInPixels
);
struct ConversionFunction
{
GUID subtype;
IMAGE_TRANSFORM_FN xform;
};
class CColorConverter
{
public:
CColorConverter();
~CColorConverter();
HRESULT SetConversionFunction(REFGUID subtype);
void ConvertImageToRGB32(BYTE* pDest, LONG destStride, IMFMediaBuffer *buf);
bool IsFormatSupported(REFGUID subtype) const;
HRESULT GetFormat(DWORD index, GUID *pSubtype) const;
HRESULT SetVideoType(IMFMediaType *pType);
UINT m_width;
UINT m_height;
LONG m_lDefaultStride;
MFRatio m_PixelAR;
MFVideoInterlaceMode m_interlace;
protected:
IMAGE_TRANSFORM_FN m_convertFn;
static void TransformImage_RGB24(
BYTE* pDest,
LONG lDestStride,
const BYTE* pSrc,
LONG lSrcStride,
DWORD dwWidthInPixels,
DWORD dwHeightInPixels
);
static void TransformImage_RGB32(
BYTE* pDest,
LONG lDestStride,
const BYTE* pSrc,
LONG lSrcStride,
DWORD dwWidthInPixels,
DWORD dwHeightInPixels
);
static void TransformImage_YUY2(
BYTE* pDest,
LONG lDestStride,
const BYTE* pSrc,
LONG lSrcStride,
DWORD dwWidthInPixels,
DWORD dwHeightInPixels
);
static void TransformImage_NV12(
BYTE* pDst,
LONG dstStride,
const BYTE* pSrc,
LONG srcStride,
DWORD dwWidthInPixels,
DWORD dwHeightInPixels
);
static const ConversionFunction s_FormatConversions[];
static const int s_NumConversionFuncs;
HRESULT GetDefaultStride(IMFMediaType *pType, LONG *plStride);
};