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),
87typedef pstatus_t (*fn_copy_t)(
const void* WINPR_RESTRICT pSrc,
void* WINPR_RESTRICT pDst,
89typedef pstatus_t (*fn_copy_8u_t)(
const BYTE* WINPR_RESTRICT pSrc, BYTE* WINPR_RESTRICT pDst,
91typedef pstatus_t (*fn_copy_8u_AC4r_t)(
const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
92 BYTE* WINPR_RESTRICT pDst, INT32 dstStep,
93 INT32 width, INT32 height);
94typedef pstatus_t (*fn_set_8u_t)(BYTE val, BYTE* WINPR_RESTRICT pDst, UINT32 len);
95typedef pstatus_t (*fn_set_32s_t)(INT32 val, INT32* WINPR_RESTRICT pDst, UINT32 len);
96typedef pstatus_t (*fn_set_32u_t)(UINT32 val, UINT32* WINPR_RESTRICT pDst, UINT32 len);
97typedef pstatus_t (*fn_zero_t)(
void* WINPR_RESTRICT pDst,
size_t bytes);
98typedef pstatus_t (*fn_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,
102typedef pstatus_t (*fn_add_16s_t)(
const INT16* WINPR_RESTRICT pSrc1,
103 const INT16* WINPR_RESTRICT pSrc2, INT16* WINPR_RESTRICT pDst,
113typedef pstatus_t (*fn_add_16s_inplace_t)(INT16* WINPR_RESTRICT pSrcDst1,
114 INT16* WINPR_RESTRICT pSrcDst2, UINT32 len);
136typedef pstatus_t (*fn_copy_no_overlap_t)(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
137 UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
138 UINT32 nWidth, UINT32 nHeight,
139 const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
140 UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
141 const gdiPalette* WINPR_RESTRICT palette, UINT32 flags);
142typedef pstatus_t (*fn_lShiftC_16s_inplace_t)(INT16* WINPR_RESTRICT pSrcDst, UINT32 val,
144typedef pstatus_t (*fn_lShiftC_16s_t)(
const INT16* WINPR_RESTRICT pSrc, UINT32 val,
145 INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
146typedef pstatus_t (*fn_lShiftC_16u_t)(
const UINT16* WINPR_RESTRICT pSrc, UINT32 val,
147 UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
148typedef pstatus_t (*fn_rShiftC_16s_t)(
const INT16* WINPR_RESTRICT pSrc, UINT32 val,
149 INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
150typedef pstatus_t (*fn_rShiftC_16u_t)(
const UINT16* WINPR_RESTRICT pSrc, UINT32 val,
151 UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
152typedef pstatus_t (*fn_shiftC_16s_t)(
const INT16* WINPR_RESTRICT pSrc, INT32 val,
153 INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
154typedef pstatus_t (*fn_shiftC_16u_t)(
const UINT16* WINPR_RESTRICT pSrc, INT32 val,
155 UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
156typedef pstatus_t (*fn_sign_16s_t)(
const INT16* WINPR_RESTRICT pSrc, INT16* WINPR_RESTRICT pSrcDst,
158typedef pstatus_t (*fn_yCbCrToRGB_16s8u_P3AC4R_t)(
const INT16* WINPR_RESTRICT pSrc[3],
159 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
160 UINT32 dstStep, UINT32 DstFormat,
162typedef pstatus_t (*fn_yCbCrToRGB_16s16s_P3P3_t)(
const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep,
163 INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
165typedef pstatus_t (*fn_RGBToYCbCr_16s16s_P3P3_t)(
const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep,
166 INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
168typedef pstatus_t (*fn_RGBToRGB_16s8u_P3AC4R_t)(
const INT16* WINPR_RESTRICT pSrc[3], UINT32 srcStep,
169 BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
172typedef pstatus_t (*fn_YCoCgToRGB_8u_AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
173 BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat,
174 INT32 dstStep, UINT32 width, UINT32 height,
175 UINT8 shift, BOOL withAlpha);
176typedef pstatus_t (*fn_RGB565ToARGB_16u32u_C3C4_t)(
const UINT16* WINPR_RESTRICT pSrc, INT32 srcStep,
177 UINT32* WINPR_RESTRICT pDst, INT32 dstStep,
178 UINT32 width, UINT32 height, UINT32 format);
179typedef pstatus_t (*fn_YUV420ToRGB_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc[3],
180 const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
181 UINT32 dstStep, UINT32 DstFormat,
183typedef pstatus_t (*fn_YUV444ToRGB_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc[3],
184 const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
185 UINT32 dstStep, UINT32 DstFormat,
187typedef pstatus_t (*fn_RGBToYUV420_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
188 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
189 const UINT32 dstStep[3],
191typedef pstatus_t (*fn_RGBToYUV444_8u_P3AC4R_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
192 UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
193 const UINT32 dstStep[3],
195typedef pstatus_t (*fn_YUV420CombineToYUV444_t)(avc444_frame_type type,
196 const BYTE* WINPR_RESTRICT pSrc[3],
197 const UINT32 srcStep[3], UINT32 nWidth,
198 UINT32 nHeight, BYTE* WINPR_RESTRICT pDst[3],
199 const UINT32 dstStep[3],
201typedef pstatus_t (*fn_YUV444SplitToYUV420_t)(
202 const BYTE* WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pMainDst[3],
203 const UINT32 dstMainStep[3], BYTE* WINPR_RESTRICT pAuxDst[3],
const UINT32 srcAuxStep[3],
205typedef pstatus_t (*fn_RGBToAVC444YUV_t)(
const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
206 UINT32 srcStep, BYTE* WINPR_RESTRICT pMainDst[3],
207 const UINT32 dstMainStep[3],
208 BYTE* WINPR_RESTRICT pAuxDst[3],
209 const UINT32 dstAuxStep[3],
211typedef pstatus_t (*fn_andC_32u_t)(
const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
212 UINT32* WINPR_RESTRICT pDst, INT32 len);
213typedef pstatus_t (*fn_orC_32u_t)(
const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
214 UINT32* WINPR_RESTRICT pDst, INT32 len);
215typedef pstatus_t (*primitives_uninit_t)(void);
217#if defined(WITH_FREERDP_3x_DEPRECATED)
218typedef fn_copy_t __copy_t;
219typedef fn_copy_8u_t __copy_8u_t;
220typedef fn_copy_8u_AC4r_t __copy_8u_AC4r_t;
221typedef fn_set_8u_t __set_8u_t;
222typedef fn_set_32s_t __set_32s_t;
223typedef fn_set_32u_t __set_32u_t;
224typedef fn_zero_t __zero_t;
225typedef fn_alphaComp_argb_t __alphaComp_argb_t;
226typedef fn_add_16s_t __add_16s_t;
227typedef fn_add_16s_inplace_t __add_16s_inplace_t;
228typedef fn_copy_no_overlap_t __copy_no_overlap_t;
229typedef fn_lShiftC_16s_inplace_t __lShiftC_16s_inplace_t;
230typedef fn_lShiftC_16s_t __lShiftC_16s_t;
231typedef fn_lShiftC_16u_t __lShiftC_16u_t;
232typedef fn_rShiftC_16s_t __rShiftC_16s_t;
233typedef fn_rShiftC_16u_t __rShiftC_16u_t;
234typedef fn_shiftC_16s_t __shiftC_16s_t;
235typedef fn_shiftC_16u_t __shiftC_16u_t;
236typedef fn_sign_16s_t __sign_16s_t;
237typedef fn_yCbCrToRGB_16s8u_P3AC4R_t __yCbCrToRGB_16s8u_P3AC4R_t;
238typedef fn_yCbCrToRGB_16s16s_P3P3_t __yCbCrToRGB_16s16s_P3P3_t;
239typedef fn_RGBToYCbCr_16s16s_P3P3_t __RGBToYCbCr_16s16s_P3P3_t;
240typedef fn_RGBToRGB_16s8u_P3AC4R_t __RGBToRGB_16s8u_P3AC4R_t;
241typedef fn_YCoCgToRGB_8u_AC4R_t __YCoCgToRGB_8u_AC4R_t;
242typedef fn_RGB565ToARGB_16u32u_C3C4_t __RGB565ToARGB_16u32u_C3C4_t;
243typedef fn_YUV420ToRGB_8u_P3AC4R_t __YUV420ToRGB_8u_P3AC4R_t;
244typedef fn_YUV444ToRGB_8u_P3AC4R_t __YUV444ToRGB_8u_P3AC4R_t;
245typedef fn_RGBToYUV420_8u_P3AC4R_t __RGBToYUV420_8u_P3AC4R_t;
246typedef fn_RGBToYUV444_8u_P3AC4R_t __RGBToYUV444_8u_P3AC4R_t;
247typedef fn_YUV420CombineToYUV444_t __YUV420CombineToYUV444_t;
248typedef fn_YUV444SplitToYUV420_t __YUV444SplitToYUV420_t;
249typedef fn_RGBToAVC444YUV_t __RGBToAVC444YUV_t;
250typedef fn_andC_32u_t __andC_32u_t;
251typedef fn_orC_32u_t __orC_32u_t;
258 fn_copy_8u_t copy_8u;
259 fn_copy_8u_AC4r_t copy_8u_AC4r;
262 fn_set_32s_t set_32s;
263 fn_set_32u_t set_32u;
266 fn_add_16s_t add_16s;
268 fn_andC_32u_t andC_32u;
269 fn_orC_32u_t orC_32u;
271 fn_lShiftC_16s_t lShiftC_16s;
272 fn_lShiftC_16u_t lShiftC_16u;
273 fn_rShiftC_16s_t rShiftC_16s;
274 fn_rShiftC_16u_t rShiftC_16u;
275 fn_shiftC_16s_t shiftC_16s;
276 fn_shiftC_16u_t shiftC_16u;
278 fn_alphaComp_argb_t alphaComp_argb;
280 fn_sign_16s_t sign_16s;
282 fn_yCbCrToRGB_16s8u_P3AC4R_t yCbCrToRGB_16s8u_P3AC4R;
283 fn_yCbCrToRGB_16s16s_P3P3_t yCbCrToRGB_16s16s_P3P3;
284 fn_RGBToYCbCr_16s16s_P3P3_t RGBToYCbCr_16s16s_P3P3;
285 fn_RGBToRGB_16s8u_P3AC4R_t RGBToRGB_16s8u_P3AC4R;
286 fn_YCoCgToRGB_8u_AC4R_t YCoCgToRGB_8u_AC4R;
287 fn_YUV420ToRGB_8u_P3AC4R_t YUV420ToRGB_8u_P3AC4R;
288 fn_RGBToYUV420_8u_P3AC4R_t RGBToYUV420_8u_P3AC4R;
289 fn_RGBToYUV444_8u_P3AC4R_t RGBToYUV444_8u_P3AC4R;
290 fn_YUV420CombineToYUV444_t YUV420CombineToYUV444;
291 fn_YUV444SplitToYUV420_t YUV444SplitToYUV420;
292 fn_YUV444ToRGB_8u_P3AC4R_t YUV444ToRGB_8u_P3AC4R;
293 fn_RGBToAVC444YUV_t RGBToAVC444YUV;
294 fn_RGBToAVC444YUV_t RGBToAVC444YUVv2;
297 primitives_uninit_t uninit;
309 PRIMITIVES_PURE_SOFT,
312 PRIMITIVES_AUTODETECT
316 FREERDP_API
void primitives_set_hints(primitive_hints hints);
317 FREERDP_API primitive_hints primitives_get_hints(
void);
320 FREERDP_API BOOL primitives_init(
primitives_t* p, primitive_hints hints);
321 FREERDP_API
void primitives_uninit(
void);
333 FREERDP_API
primitives_t* primitives_get_by_type(primitive_hints type);
341 FREERDP_API
const char* primitives_avc444_frame_type_str(avc444_frame_type type);
349 FREERDP_API
const char* primtives_hint_str(primitive_hints hint);
fn_add_16s_inplace_t add_16s_inplace
Do vecotor addition, store result in both input buffers pSrcDst1 = pSrcDst2 = pSrcDst1 + pSrcDst2.
fn_copy_no_overlap_t copy_no_overlap
fn_lShiftC_16s_inplace_t lShiftC_16s_inplace