20 #ifndef FREERDP_PRIMITIVES_H
21 #define FREERDP_PRIMITIVES_H
23 #include <winpr/wtypes.h>
25 #include <freerdp/api.h>
26 #include <freerdp/types.h>
27 #include <freerdp/codec/color.h>
29 #include <winpr/platform.h>
36 typedef INT32 pstatus_t;
37 #define PRIMITIVES_SUCCESS (0)
40 #define PIXMAP4_ADDR(_dst_, _x_, _y_, _span_) \
41 ((void*)(((BYTE*)(_dst_)) + (((_x_) + (_y_) * (_span_)) << 2)))
43 #define PRIM_X86_MMX_AVAILABLE (1U << 0)
44 #define PRIM_X86_3DNOW_AVAILABLE (1U << 1)
45 #define PRIM_X86_3DNOW_PREFETCH_AVAILABLE (1U << 2)
46 #define PRIM_X86_SSE_AVAILABLE (1U << 3)
47 #define PRIM_X86_SSE2_AVAILABLE (1U << 4)
48 #define PRIM_X86_SSE3_AVAILABLE (1U << 5)
49 #define PRIM_X86_SSSE3_AVAILABLE (1U << 6)
50 #define PRIM_X86_SSE41_AVAILABLE (1U << 7)
51 #define PRIM_X86_SSE42_AVAILABLE (1U << 8)
52 #define PRIM_X86_AVX_AVAILABLE (1U << 9)
53 #define PRIM_X86_FMA_AVAILABLE (1U << 10)
54 #define PRIM_X86_AVX_AES_AVAILABLE (1U << 11)
55 #define PRIM_X86_AVX2_AVAILABLE (1U << 12)
57 #define PRIM_ARM_VFP1_AVAILABLE (1U << 0)
58 #define PRIM_ARM_VFP2_AVAILABLE (1U << 1)
59 #define PRIM_ARM_VFP3_AVAILABLE (1U << 2)
60 #define PRIM_ARM_VFP4_AVAILABLE (1U << 3)
61 #define PRIM_ARM_FPA_AVAILABLE (1U << 4)
62 #define PRIM_ARM_FPE_AVAILABLE (1U << 5)
63 #define PRIM_ARM_IWMMXT_AVAILABLE (1U << 6)
64 #define PRIM_ARM_NEON_AVAILABLE (1U << 7)
69 PRIM_FLAGS_HAVE_EXTCPU = (1U << 0),
70 PRIM_FLAGS_HAVE_EXTGPU = (1U << 1),
87 typedef pstatus_t (*__copy_t)(
const void* WINPR_RESTRICT pSrc,
void* WINPR_RESTRICT pDst,
89 typedef pstatus_t (*__copy_8u_t)(
const BYTE* WINPR_RESTRICT pSrc, BYTE* WINPR_RESTRICT pDst,
91 typedef pstatus_t (*__copy_8u_AC4r_t)(
const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
92 BYTE* WINPR_RESTRICT pDst, INT32 dstStep,
93 INT32 width, INT32 height);
94 typedef pstatus_t (*__set_8u_t)(BYTE val, BYTE* WINPR_RESTRICT pDst, UINT32 len);
95 typedef pstatus_t (*__set_32s_t)(INT32 val, INT32* WINPR_RESTRICT pDst, UINT32 len);
96 typedef pstatus_t (*__set_32u_t)(UINT32 val, UINT32* WINPR_RESTRICT pDst, UINT32 len);
97 typedef pstatus_t (*__zero_t)(
void* WINPR_RESTRICT pDst,
size_t bytes);
98 typedef pstatus_t (*__alphaComp_argb_t)(
const BYTE* WINPR_RESTRICT pSrc1, UINT32 src1Step,
99 const BYTE* WINPR_RESTRICT pSrc2, UINT32 src2Step,
100 BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 width,
102 typedef pstatus_t (*__add_16s_t)(
const INT16* WINPR_RESTRICT pSrc1,
103 const INT16* WINPR_RESTRICT pSrc2, INT16* WINPR_RESTRICT pDst,
113 typedef pstatus_t (*__add_16s_inplace_t)(INT16* WINPR_RESTRICT pSrcDst1,
114 INT16* WINPR_RESTRICT pSrcDst2, UINT32 len);
136 typedef pstatus_t (*__copy_no_overlap_t)(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
137 UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
138 UINT32 nHeight,
const BYTE* WINPR_RESTRICT pSrcData,
139 DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc,
140 UINT32 nYSrc,
const gdiPalette* WINPR_RESTRICT palette,
142 typedef pstatus_t (*__lShiftC_16s_inplace_t)(INT16* WINPR_RESTRICT pSrcDst, UINT32 val, UINT32 len);
143 typedef pstatus_t (*__lShiftC_16s_t)(
const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len);
144 typedef pstatus_t (*__lShiftC_16u_t)(
const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len);
145 typedef pstatus_t (*__rShiftC_16s_t)(
const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len);
146 typedef pstatus_t (*__rShiftC_16u_t)(
const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len);
147 typedef pstatus_t (*__shiftC_16s_t)(
const INT16* pSrc, INT32 val, INT16* pSrcDst, UINT32 len);
148 typedef pstatus_t (*__shiftC_16u_t)(
const UINT16* pSrc, INT32 val, UINT16* pSrcDst, UINT32 len);
149 typedef pstatus_t (*__sign_16s_t)(
const INT16* pSrc, INT16* pSrcDst, UINT32 len);
150 typedef pstatus_t (*__yCbCrToRGB_16s8u_P3AC4R_t)(
const INT16* WINPR_RESTRICT pSrc[3],
151 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
152 UINT32 dstStep, UINT32 DstFormat,
154 typedef pstatus_t (*__yCbCrToRGB_16s16s_P3P3_t)(
const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep,
155 INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
157 typedef pstatus_t (*__RGBToYCbCr_16s16s_P3P3_t)(
const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep,
158 INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
160 typedef pstatus_t (*__RGBToRGB_16s8u_P3AC4R_t)(
const INT16* WINPR_RESTRICT pSrc[3], UINT32 srcStep,
161 BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
164 typedef pstatus_t (*__YCoCgToRGB_8u_AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
165 BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat,
166 INT32 dstStep, UINT32 width, UINT32 height, UINT8 shift,
168 typedef pstatus_t (*__RGB565ToARGB_16u32u_C3C4_t)(
const UINT16* WINPR_RESTRICT pSrc, INT32 srcStep,
169 UINT32* WINPR_RESTRICT pDst, INT32 dstStep,
170 UINT32 width, UINT32 height, UINT32 format);
171 typedef pstatus_t (*__YUV420ToRGB_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc[3],
172 const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
173 UINT32 dstStep, UINT32 DstFormat,
175 typedef pstatus_t (*__YUV444ToRGB_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc[3],
176 const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
177 UINT32 dstStep, UINT32 DstFormat,
179 typedef pstatus_t (*__RGBToYUV420_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
180 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
181 const UINT32 dstStep[3],
183 typedef pstatus_t (*__RGBToYUV444_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
184 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
187 typedef pstatus_t (*__YUV420CombineToYUV444_t)(avc444_frame_type type,
188 const BYTE* WINPR_RESTRICT pSrc[3],
189 const UINT32 srcStep[3], UINT32 nWidth,
190 UINT32 nHeight, BYTE* WINPR_RESTRICT pDst[3],
191 const UINT32 dstStep[3],
193 typedef pstatus_t (*__YUV444SplitToYUV420_t)(
194 const BYTE* WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pMainDst[3],
195 const UINT32 dstMainStep[3], BYTE* WINPR_RESTRICT pAuxDst[3],
const UINT32 srcAuxStep[3],
197 typedef pstatus_t (*__RGBToAVC444YUV_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
198 UINT32 srcStep, BYTE* WINPR_RESTRICT pMainDst[3],
199 const UINT32 dstMainStep[3],
200 BYTE* WINPR_RESTRICT pAuxDst[3],
const UINT32 dstAuxStep[3],
202 typedef pstatus_t (*__andC_32u_t)(
const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
203 UINT32* WINPR_RESTRICT pDst, INT32 len);
204 typedef pstatus_t (*__orC_32u_t)(
const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
205 UINT32* WINPR_RESTRICT pDst, INT32 len);
206 typedef pstatus_t (*primitives_uninit_t)(void);
213 __copy_8u_AC4r_t copy_8u_AC4r;
222 __andC_32u_t andC_32u;
225 __lShiftC_16s_t lShiftC_16s;
226 __lShiftC_16u_t lShiftC_16u;
227 __rShiftC_16s_t rShiftC_16s;
228 __rShiftC_16u_t rShiftC_16u;
229 __shiftC_16s_t shiftC_16s;
230 __shiftC_16u_t shiftC_16u;
232 __alphaComp_argb_t alphaComp_argb;
234 __sign_16s_t sign_16s;
236 __yCbCrToRGB_16s8u_P3AC4R_t yCbCrToRGB_16s8u_P3AC4R;
237 __yCbCrToRGB_16s16s_P3P3_t yCbCrToRGB_16s16s_P3P3;
238 __RGBToYCbCr_16s16s_P3P3_t RGBToYCbCr_16s16s_P3P3;
239 __RGBToRGB_16s8u_P3AC4R_t RGBToRGB_16s8u_P3AC4R;
240 __YCoCgToRGB_8u_AC4R_t YCoCgToRGB_8u_AC4R;
241 __YUV420ToRGB_8u_P3AC4R_t YUV420ToRGB_8u_P3AC4R;
242 __RGBToYUV420_8u_P3AC4R_t RGBToYUV420_8u_P3AC4R;
243 __RGBToYUV444_8u_P3AC4R_t RGBToYUV444_8u_P3AC4R;
244 __YUV420CombineToYUV444_t YUV420CombineToYUV444;
245 __YUV444SplitToYUV420_t YUV444SplitToYUV420;
246 __YUV444ToRGB_8u_P3AC4R_t YUV444ToRGB_8u_P3AC4R;
247 __RGBToAVC444YUV_t RGBToAVC444YUV;
248 __RGBToAVC444YUV_t RGBToAVC444YUVv2;
251 primitives_uninit_t uninit;
263 PRIMITIVES_PURE_SOFT,
266 PRIMITIVES_AUTODETECT
270 FREERDP_API
void primitives_set_hints(primitive_hints hints);
271 FREERDP_API primitive_hints primitives_get_hints(
void);
274 FREERDP_API BOOL primitives_init(
primitives_t* p, primitive_hints hints);
275 FREERDP_API
void primitives_uninit(
void);
__lShiftC_16s_inplace_t lShiftC_16s_inplace
__copy_no_overlap_t copy_no_overlap
__add_16s_inplace_t add_16s_inplace
Do vecotor addition, store result in both input buffers pSrcDst1 = pSrcDst2 = pSrcDst1 + pSrcDst2.