aboutsummaryrefslogtreecommitdiff
path: root/Src/libvp6/include/cclib.h
blob: ed58877fb328b63edd2258d3bf403c0fe95ea314 (plain) (blame)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#ifndef _CCLIB_H
#define _CCLIB_H
#include "cpuidlib.h"

#ifdef __cplusplus
extern "C"
{
#else
#if !defined(bool)
    typedef int bool;
#endif
#endif

int InitCCLib( PROCTYPE CpuType );

void DeInitCCLib( void );

extern void (*RGB32toYV12)( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
                            unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );

extern void (*RGB24toYV12)( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
                            unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );

extern void (*UYVYtoYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
                           unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );

extern void (*YUY2toYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
                           unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );

extern void (*YVYUtoYV12)( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
                           unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );

extern void RGB24toYV12F
(
    unsigned char *RGBBuffer,
    int ImageWidth,
    int ImageHeight,
    unsigned char *YBuffer,
    unsigned char *UBuffer,
    unsigned char *VBuffer,
    int SrcPitch,
    int DstPitch
);

extern void RGB32toYV12F
(
    unsigned char *RGBBuffer,
    int ImageWidth,
    int ImageHeight,
    unsigned char *YBuffer,
    unsigned char *UBuffer,
    unsigned char *VBuffer,
    int SrcPitch,
    int DstPitch
);

extern void UYVYtoYV12F
(
    unsigned char *UYVYBuffer,
    int ImageWidth,
    int ImageHeight,
    unsigned char *YBuffer,
    unsigned char *UBuffer,
    unsigned char *VBuffer,
    int SrcPitch,
    int DstPitch
);

extern void YUY2toYV12F
(
    unsigned char *YUY2Buffer,
    int ImageWidth,
    int ImageHeight,
    unsigned char *YBuffer,
    unsigned char *UBuffer,
    unsigned char *VBuffer,
    int SrcPitch,
    int DstPitch
);

extern void YVYUtoYV12F
(
    unsigned char *YVYUBuffer,
    int ImageWidth,
    int ImageHeight,
    unsigned char *YBuffer,
    unsigned char *UBuffer,
    unsigned char *VBuffer,
    int SrcPitch,
    int DstPitch
);

/*
 * Macros to make it easier to call the needed functions
 */
#define CC_RGB32toYV12( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
        (*RGB32toYV12)( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*4, _ImageWidth )

#define CC_RGB24toYV12( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
        (*RGB24toYV12)( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*3, _ImageWidth )

#define CC_UYVYtoYV12( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
        (*UYVYtoYV12)( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )

#define CC_YUY2toYV12( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
        (*YUY2toYV12)( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )

#define CC_YVYUtoYV12( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
        (*YVYUtoYV12)( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )

// super generic rgb to yuv color conversion can handle any rgb to yuv conversion
// provided r,g,b components are 1 byte apiece, and that the resulting y is 1 byte
extern void ConvertRGBtoYUV(
    const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
    int width, int height, int rgb_step, int rgb_pitch,
    unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
    int uv_width_shift, int uv_height_shift,
    int y_step, int y_pitch,int uv_step,int uv_pitch);

extern void ConvertRGBtoYUVI(
    const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
    int iWidth, int iHeight, int iStepRGB, int iStrideRGB,
    unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
    int uv_width_shift, int uv_height_shift,
    int iStepY, int iStrideY, int iStepUV, int iStrideUV);

//  This assumes 3 byte RGB data with the same component ordering in the source and destination
extern void ConvertRGBtoRGB(const unsigned char* const pucSource, long lWidth, long lHeight, long lStepIn, long lStrideIn,
    unsigned char* const pucDest, long lStepOut, long lStrideOut);

extern void ConvertYUVtoRGB(
    const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
    long lWidth, long lHeight,
    long uv_width_shift, long uv_height_shift,  //  not used, should both be set to 1
    long lStepY, long lStrideY,long lStepUV, long lStrideUV,
    unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
    long lStepRGB, long lStrideRGB);

extern void ConvertYUVItoRGB(
    const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
    long lWidth, long lHeight,
    long uv_width_shift, long uv_height_shift,  //  not used, should both be set to 1
    long lStepY, long lStrideY,long lStepUV, long lStrideUV,
    unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
    long lStepRGB, long lStrideRGB);

extern void ConvertYUVtoRGB2(
    const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
    long lWidth, long lHeight,
    long uv_width_shift, long uv_height_shift,  //  not used, should both be set to 1
    long lStepY, long lStrideY,long lStepUV, long lStrideUV,
    unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
    long lStepRGB, long lStrideRGB,
    bool bSupersampleHoriz, bool bSupersampleVert);

extern void ConvertYUVItoRGB2(
    const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
    long lWidth, long lHeight,
    long uv_width_shift, long uv_height_shift,  //  not used, should both be set to 1
    long lStepY, long lStrideY,long lStepUV, long lStrideUV,
    unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
    long lStepRGB, long lStrideRGB,
    bool bSupersampleHoriz, bool bSupersampleVert);

//  This assumes packed planar data
extern void ConvertYUVtoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
    long m_lWidth, long m_lHeight,
    unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);

//  This assumes packed planar data
extern void ConvertYUVtoYUVI(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
    long m_lWidth, long m_lHeight,
    unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);

//  This assumes packed planar data
extern void ConvertYUVItoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
    long m_lWidth, long m_lHeight,
    unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);

#ifdef __cplusplus
}
#endif
#endif /* _CCLIB_H */