[primitives,yuv] use WINPR_RESTRICT

This commit is contained in:
akallabeth 2023-08-22 15:43:51 +02:00 committed by akallabeth
parent 26279413ab
commit 3dcd702676
12 changed files with 449 additions and 360 deletions

View File

@ -20,6 +20,8 @@
#ifndef FREERDP_PRIMITIVES_H
#define FREERDP_PRIMITIVES_H
#include <winpr/wtypes.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/color.h>
@ -83,70 +85,96 @@ typedef enum
} avc444_frame_type;
/* Function prototypes for all of the supported primitives. */
typedef pstatus_t (*__copy_t)(const void* pSrc, void* pDst, INT32 bytes);
typedef pstatus_t (*__copy_8u_t)(const BYTE* pSrc, BYTE* pDst, INT32 len);
typedef pstatus_t (*__copy_8u_AC4r_t)(const BYTE* pSrc, INT32 srcStep, /* bytes */
BYTE* pDst, INT32 dstStep, /* bytes */
INT32 width, INT32 height); /* pixels */
typedef pstatus_t (*__set_8u_t)(BYTE val, BYTE* pDst, UINT32 len);
typedef pstatus_t (*__set_32s_t)(INT32 val, INT32* pDst, UINT32 len);
typedef pstatus_t (*__set_32u_t)(UINT32 val, UINT32* pDst, UINT32 len);
typedef pstatus_t (*__zero_t)(void* pDst, size_t bytes);
typedef pstatus_t (*__alphaComp_argb_t)(const BYTE* pSrc1, UINT32 src1Step, const BYTE* pSrc2,
UINT32 src2Step, BYTE* pDst, UINT32 dstStep, UINT32 width,
UINT32 height);
typedef pstatus_t (*__add_16s_t)(const INT16* pSrc1, const INT16* pSrc2, INT16* pDst, UINT32 len);
typedef pstatus_t (*__lShiftC_16s_t)(const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__lShiftC_16u_t)(const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__rShiftC_16s_t)(const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__rShiftC_16u_t)(const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__shiftC_16s_t)(const INT16* pSrc, INT32 val, INT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__shiftC_16u_t)(const UINT16* pSrc, INT32 val, UINT16* pSrcDst, UINT32 len);
typedef pstatus_t (*__sign_16s_t)(const INT16* pSrc, INT16* pDst, UINT32 len);
typedef pstatus_t (*__yCbCrToRGB_16s8u_P3AC4R_t)(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi);
typedef pstatus_t (*__yCbCrToRGB_16s16s_P3P3_t)(const INT16* const pSrc[3], INT32 srcStep,
INT16* pDst[3], INT32 dstStep,
const prim_size_t* roi);
typedef pstatus_t (*__RGBToYCbCr_16s16s_P3P3_t)(const INT16* const pSrc[3], INT32 srcStep,
INT16* pDst[3], INT32 dstStep,
const prim_size_t* roi);
typedef pstatus_t (*__RGBToRGB_16s8u_P3AC4R_t)(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi);
typedef pstatus_t (*__YCoCgToRGB_8u_AC4R_t)(const BYTE* pSrc, INT32 srcStep, BYTE* pDst,
UINT32 DstFormat, INT32 dstStep, UINT32 width,
UINT32 height, UINT8 shift, BOOL withAlpha);
typedef pstatus_t (*__RGB565ToARGB_16u32u_C3C4_t)(const UINT16* pSrc, INT32 srcStep, UINT32* pDst,
INT32 dstStep, UINT32 width, UINT32 height,
UINT32 format);
typedef pstatus_t (*__YUV420ToRGB_8u_P3AC4R_t)(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi);
typedef pstatus_t (*__YUV444ToRGB_8u_P3AC4R_t)(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi);
typedef pstatus_t (*__RGBToYUV420_8u_P3AC4R_t)(const BYTE* pSrc, UINT32 SrcFormat, UINT32 srcStep,
BYTE* pDst[3], const UINT32 dstStep[3],
const prim_size_t* roi);
typedef pstatus_t (*__RGBToYUV444_8u_P3AC4R_t)(const BYTE* pSrc, UINT32 SrcFormat, UINT32 srcStep,
BYTE* pDst[3], UINT32 dstStep[3],
const prim_size_t* roi);
typedef pstatus_t (*__YUV420CombineToYUV444_t)(avc444_frame_type type, const BYTE* const pSrc[3],
const UINT32 srcStep[3], UINT32 nWidth,
UINT32 nHeight, BYTE* pDst[3],
const UINT32 dstStep[3], const RECTANGLE_16* roi);
typedef pstatus_t (*__YUV444SplitToYUV420_t)(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pMainDst[3], const UINT32 dstMainStep[3],
BYTE* pAuxDst[3], const UINT32 srcAuxStep[3],
const prim_size_t* roi);
typedef pstatus_t (*__RGBToAVC444YUV_t)(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pMainDst[3], const UINT32 dstMainStep[3],
BYTE* pAuxDst[3], const UINT32 dstAuxStep[3],
const prim_size_t* roi);
typedef pstatus_t (*__andC_32u_t)(const UINT32* pSrc, UINT32 val, UINT32* pDst, INT32 len);
typedef pstatus_t (*__orC_32u_t)(const UINT32* pSrc, UINT32 val, UINT32* pDst, INT32 len);
typedef pstatus_t (*__copy_t)(const void* WINPR_RESTRICT pSrc, void* WINPR_RESTRICT pDst,
INT32 bytes);
typedef pstatus_t (*__copy_8u_t)(const BYTE* WINPR_RESTRICT pSrc, BYTE* WINPR_RESTRICT pDst,
INT32 len);
typedef pstatus_t (*__copy_8u_AC4r_t)(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep, /* bytes */
BYTE* WINPR_RESTRICT pDst, INT32 dstStep, /* bytes */
INT32 width, INT32 height); /* pixels */
typedef pstatus_t (*__set_8u_t)(BYTE val, BYTE* WINPR_RESTRICT pDst, UINT32 len);
typedef pstatus_t (*__set_32s_t)(INT32 val, INT32* WINPR_RESTRICT pDst, UINT32 len);
typedef pstatus_t (*__set_32u_t)(UINT32 val, UINT32* WINPR_RESTRICT pDst, UINT32 len);
typedef pstatus_t (*__zero_t)(void* WINPR_RESTRICT pDst, size_t bytes);
typedef pstatus_t (*__alphaComp_argb_t)(const BYTE* WINPR_RESTRICT pSrc1, UINT32 src1Step,
const BYTE* WINPR_RESTRICT pSrc2, UINT32 src2Step,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 width,
UINT32 height);
typedef pstatus_t (*__add_16s_t)(const INT16* WINPR_RESTRICT pSrc1,
const INT16* WINPR_RESTRICT pSrc2, INT16* WINPR_RESTRICT pDst,
UINT32 len);
typedef pstatus_t (*__lShiftC_16s_t)(const INT16* WINPR_RESTRICT pSrc, UINT32 val,
INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__lShiftC_16u_t)(const UINT16* WINPR_RESTRICT pSrc, UINT32 val,
UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__rShiftC_16s_t)(const INT16* WINPR_RESTRICT pSrc, UINT32 val,
INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__rShiftC_16u_t)(const UINT16* WINPR_RESTRICT pSrc, UINT32 val,
UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__shiftC_16s_t)(const INT16* WINPR_RESTRICT pSrc, INT32 val,
INT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__shiftC_16u_t)(const UINT16* WINPR_RESTRICT pSrc, INT32 val,
UINT16* WINPR_RESTRICT pSrcDst, UINT32 len);
typedef pstatus_t (*__sign_16s_t)(const INT16* WINPR_RESTRICT pSrc, INT16* WINPR_RESTRICT pDst,
UINT32 len);
typedef pstatus_t (*__yCbCrToRGB_16s8u_P3AC4R_t)(const INT16* const WINPR_RESTRICT pSrc[3],
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__yCbCrToRGB_16s16s_P3P3_t)(const INT16* const WINPR_RESTRICT pSrc[3],
INT32 srcStep, INT16* WINPR_RESTRICT pDst[3],
INT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__RGBToYCbCr_16s16s_P3P3_t)(const INT16* const WINPR_RESTRICT pSrc[3],
INT32 srcStep, INT16* WINPR_RESTRICT pDst[3],
INT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__RGBToRGB_16s8u_P3AC4R_t)(const INT16* const WINPR_RESTRICT pSrc[3],
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__YCoCgToRGB_8u_AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat,
INT32 dstStep, UINT32 width, UINT32 height, UINT8 shift,
BOOL withAlpha);
typedef pstatus_t (*__RGB565ToARGB_16u32u_C3C4_t)(const UINT16* WINPR_RESTRICT pSrc, INT32 srcStep,
UINT32* WINPR_RESTRICT pDst, INT32 dstStep,
UINT32 width, UINT32 height, UINT32 format);
typedef pstatus_t (*__YUV420ToRGB_8u_P3AC4R_t)(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__YUV444ToRGB_8u_P3AC4R_t)(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__RGBToYUV420_8u_P3AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__RGBToYUV444_8u_P3AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__YUV420CombineToYUV444_t)(avc444_frame_type type,
const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], UINT32 nWidth,
UINT32 nHeight, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi);
typedef pstatus_t (*__YUV444SplitToYUV420_t)(
const BYTE* const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3],
BYTE* WINPR_RESTRICT pMainDst[3], const UINT32 dstMainStep[3], BYTE* WINPR_RESTRICT pAuxDst[3],
const UINT32 srcAuxStep[3], const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__RGBToAVC444YUV_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pMainDst[3],
const UINT32 dstMainStep[3],
BYTE* WINPR_RESTRICT pAuxDst[3], const UINT32 dstAuxStep[3],
const prim_size_t* WINPR_RESTRICT roi);
typedef pstatus_t (*__andC_32u_t)(const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
UINT32* WINPR_RESTRICT pDst, INT32 len);
typedef pstatus_t (*__orC_32u_t)(const UINT32* WINPR_RESTRICT pSrc, UINT32 val,
UINT32* WINPR_RESTRICT pDst, INT32 len);
typedef pstatus_t (*primitives_uninit_t)(void);
typedef struct

View File

@ -37,9 +37,10 @@ static primitives_t* generic = NULL;
#ifdef WITH_SSE2
/* ------------------------------------------------------------------------- */
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_invert(const BYTE* pSrc, UINT32 srcStep, BYTE* pDst,
UINT32 DstFormat, UINT32 dstStep, UINT32 width,
UINT32 height, UINT8 shift, BOOL withAlpha)
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_invert(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat,
UINT32 dstStep, UINT32 width, UINT32 height,
UINT8 shift, BOOL withAlpha)
{
const BYTE* sptr = pSrc;
BYTE* dptr = (BYTE*)pDst;
@ -216,7 +217,8 @@ static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_invert(const BYTE* pSrc, UINT32 srcSt
}
/* ------------------------------------------------------------------------- */
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_no_invert(const BYTE* pSrc, UINT32 srcStep, BYTE* pDst,
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_no_invert(const BYTE* WINPR_RESTRICT pSrc,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 DstFormat, UINT32 dstStep, UINT32 width,
UINT32 height, UINT8 shift, BOOL withAlpha)
{
@ -401,9 +403,10 @@ static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R_no_invert(const BYTE* pSrc, UINT32 sr
#ifdef WITH_SSE2
/* ------------------------------------------------------------------------- */
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R(const BYTE* pSrc, INT32 srcStep, BYTE* pDst,
UINT32 DstFormat, INT32 dstStep, UINT32 width,
UINT32 height, UINT8 shift, BOOL withAlpha)
static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat,
INT32 dstStep, UINT32 width, UINT32 height, UINT8 shift,
BOOL withAlpha)
{
switch (DstFormat)
{
@ -424,9 +427,10 @@ static pstatus_t ssse3_YCoCgRToRGB_8u_AC4R(const BYTE* pSrc, INT32 srcStep, BYTE
}
#elif defined(WITH_NEON)
static pstatus_t neon_YCoCgToRGB_8u_X(const BYTE* pSrc, INT32 srcStep, BYTE* pDst, UINT32 DstFormat,
INT32 dstStep, UINT32 width, UINT32 height, UINT8 shift,
BYTE bPos, BYTE gPos, BYTE rPos, BYTE aPos, BOOL alpha)
static pstatus_t neon_YCoCgToRGB_8u_X(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat, INT32 dstStep,
UINT32 width, UINT32 height, UINT8 shift, BYTE bPos,
BYTE gPos, BYTE rPos, BYTE aPos, BOOL alpha)
{
UINT32 y;
BYTE* dptr = pDst;
@ -502,9 +506,10 @@ static pstatus_t neon_YCoCgToRGB_8u_X(const BYTE* pSrc, INT32 srcStep, BYTE* pDs
return PRIMITIVES_SUCCESS;
}
static pstatus_t neon_YCoCgToRGB_8u_AC4R(const BYTE* pSrc, INT32 srcStep, BYTE* pDst,
UINT32 DstFormat, INT32 dstStep, UINT32 width,
UINT32 height, UINT8 shift, BOOL withAlpha)
static pstatus_t neon_YCoCgToRGB_8u_AC4R(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat, INT32 dstStep,
UINT32 width, UINT32 height, UINT8 shift, BOOL withAlpha)
{
switch (DstFormat)
{
@ -548,7 +553,7 @@ static pstatus_t neon_YCoCgToRGB_8u_AC4R(const BYTE* pSrc, INT32 srcStep, BYTE*
#endif /* WITH_SSE2 */
/* ------------------------------------------------------------------------- */
void primitives_init_YCoCg_opt(primitives_t* prims)
void primitives_init_YCoCg_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_YCoCg(prims);

View File

@ -21,6 +21,8 @@
* limitations under the License.
*/
#include <winpr/wtypes.h>
#include <freerdp/config.h>
#include <freerdp/types.h>
@ -28,9 +30,10 @@
#include <freerdp/codec/color.h>
#include "prim_internal.h"
static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32 srcStep[3],
BYTE* pDstRaw[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
static pstatus_t general_LumaToYUV444(const BYTE* const WINPR_RESTRICT pSrcRaw[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDstRaw[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
const UINT32 nWidth = roi->right - roi->left;
const UINT32 nHeight = roi->bottom - roi->top;
@ -87,8 +90,8 @@ static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_ChromaFilter(BYTE* pDst[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
static pstatus_t general_ChromaFilter(BYTE* WINPR_RESTRICT pDst[3], const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
const UINT32 oddY = 1;
const UINT32 evenY = 0;
@ -136,9 +139,10 @@ static pstatus_t general_ChromaFilter(BYTE* pDst[3], const UINT32 dstStep[3],
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_ChromaV1ToYUV444(const BYTE* const pSrcRaw[3], const UINT32 srcStep[3],
BYTE* pDstRaw[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
static pstatus_t general_ChromaV1ToYUV444(const BYTE* const WINPR_RESTRICT pSrcRaw[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDstRaw[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
const UINT32 mod = 16;
UINT32 uY = 0;
@ -211,9 +215,11 @@ static pstatus_t general_ChromaV1ToYUV444(const BYTE* const pSrcRaw[3], const UI
return general_ChromaFilter(pDst, dstStep, roi);
}
static pstatus_t general_ChromaV2ToYUV444(const BYTE* const pSrc[3], const UINT32 srcStep[3],
UINT32 nTotalWidth, UINT32 nTotalHeight, BYTE* pDst[3],
const UINT32 dstStep[3], const RECTANGLE_16* roi)
static pstatus_t general_ChromaV2ToYUV444(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], UINT32 nTotalWidth,
UINT32 nTotalHeight, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
UINT32 x, y;
const UINT32 nWidth = roi->right - roi->left;
@ -261,10 +267,12 @@ static pstatus_t general_ChromaV2ToYUV444(const BYTE* const pSrc[3], const UINT3
return general_ChromaFilter(pDst, dstStep, roi);
}
static pstatus_t general_YUV420CombineToYUV444(avc444_frame_type type, const BYTE* const pSrc[3],
static pstatus_t general_YUV420CombineToYUV444(avc444_frame_type type,
const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], UINT32 nWidth,
UINT32 nHeight, BYTE* pDst[3],
const UINT32 dstStep[3], const RECTANGLE_16* roi)
UINT32 nHeight, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
if (!pSrc || !pSrc[0] || !pSrc[1] || !pSrc[2])
return -1;
@ -291,10 +299,11 @@ static pstatus_t general_YUV420CombineToYUV444(avc444_frame_type type, const BYT
}
}
static pstatus_t general_YUV444SplitToYUV420(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pMainDst[3], const UINT32 dstMainStep[3],
BYTE* pAuxDst[3], const UINT32 dstAuxStep[3],
const prim_size_t* roi)
static pstatus_t
general_YUV444SplitToYUV420(const BYTE* const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3],
BYTE* WINPR_RESTRICT pMainDst[3], const UINT32 dstMainStep[3],
BYTE* WINPR_RESTRICT pAuxDst[3], const UINT32 dstAuxStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y, uY = 0, vY = 0;
UINT32 halfWidth, halfHeight;
@ -377,10 +386,11 @@ static pstatus_t general_YUV444SplitToYUV420(const BYTE* const pSrc[3], const UI
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_general(const BYTE* const pSrc[3],
const UINT32 srcStep[3], BYTE* pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_general(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3],
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y;
UINT32 nWidth, nHeight;
@ -411,25 +421,24 @@ static pstatus_t general_YUV444ToRGB_8u_P3AC4R_general(const BYTE* const pSrc[3]
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const pSrc[3],
const UINT32 srcStep[3], BYTE* pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3],
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y;
UINT32 nWidth, nHeight;
const DWORD formatSize = FreeRDPGetBytesPerPixel(DstFormat);
nWidth = roi->width;
nHeight = roi->height;
const UINT32 nWidth = roi->width;
const UINT32 nHeight = roi->height;
for (y = 0; y < nHeight; y++)
for (UINT32 y = 0; y < nHeight; y++)
{
const BYTE* pY = pSrc[0] + y * srcStep[0];
const BYTE* pU = pSrc[1] + y * srcStep[1];
const BYTE* pV = pSrc[2] + y * srcStep[2];
BYTE* pRGB = pDst + y * dstStep;
for (x = 0; x < nWidth; x++)
for (UINT32 x = 0; x < nWidth; x++)
{
const BYTE Y = pY[x];
const BYTE U = pU[x];
@ -444,9 +453,10 @@ static pstatus_t general_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const pSrc[3],
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_YUV444ToRGB_8u_P3AC4R(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_YUV444ToRGB_8u_P3AC4R(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
switch (DstFormat)
{
@ -464,9 +474,10 @@ static pstatus_t general_YUV444ToRGB_8u_P3AC4R(const BYTE* const pSrc[3], const
* | G | = ( | 256 -48 -120 | | U - 128 | ) >> 8
* | B | ( | 256 475 0 | | V - 128 | )
*/
static pstatus_t general_YUV420ToRGB_8u_P3AC4R(const BYTE* const pSrc[3], const UINT32 srcStep[3],
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_YUV420ToRGB_8u_P3AC4R(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y;
UINT32 dstPad;
@ -608,9 +619,10 @@ static INLINE BYTE RGB2V(INT32 R, INT32 G, INT32 B)
return ((128 * R - 116 * G - 12 * B) >> 8) + 128;
}
static pstatus_t general_RGBToYUV444_8u_P3AC4R(const BYTE* pSrc, UINT32 SrcFormat,
const UINT32 srcStep, BYTE* pDst[3],
UINT32 dstStep[3], const prim_size_t* roi)
static pstatus_t general_RGBToYUV444_8u_P3AC4R(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
const UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
const UINT32 bpp = FreeRDPGetBytesPerPixel(SrcFormat);
UINT32 x, y;
@ -639,8 +651,10 @@ static pstatus_t general_RGBToYUV444_8u_P3AC4R(const BYTE* pSrc, UINT32 SrcForma
return PRIMITIVES_SUCCESS;
}
static INLINE pstatus_t general_RGBToYUV420_BGRX(const BYTE* pSrc, UINT32 srcStep, BYTE* pDst[3],
const UINT32 dstStep[3], const prim_size_t* roi)
static INLINE pstatus_t general_RGBToYUV420_BGRX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y, i;
size_t x1 = 0, x2 = 4, x3 = srcStep, x4 = srcStep + 4;
@ -705,8 +719,10 @@ static INLINE pstatus_t general_RGBToYUV420_BGRX(const BYTE* pSrc, UINT32 srcSte
return PRIMITIVES_SUCCESS;
}
static INLINE pstatus_t general_RGBToYUV420_RGBX(const BYTE* pSrc, UINT32 srcStep, BYTE* pDst[3],
const UINT32 dstStep[3], const prim_size_t* roi)
static INLINE pstatus_t general_RGBToYUV420_RGBX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y, i;
size_t x1 = 0, x2 = 4, x3 = srcStep, x4 = srcStep + 4;
@ -771,9 +787,10 @@ static INLINE pstatus_t general_RGBToYUV420_RGBX(const BYTE* pSrc, UINT32 srcSte
return PRIMITIVES_SUCCESS;
}
static INLINE pstatus_t general_RGBToYUV420_ANY(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst[3], const UINT32 dstStep[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToYUV420_ANY(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
const UINT32 bpp = FreeRDPGetBytesPerPixel(srcFormat);
UINT32 x, y, i;
@ -848,9 +865,10 @@ static INLINE pstatus_t general_RGBToYUV420_ANY(const BYTE* pSrc, UINT32 srcForm
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_RGBToYUV420_8u_P3AC4R(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst[3], const UINT32 dstStep[3],
const prim_size_t* roi)
static pstatus_t general_RGBToYUV420_8u_P3AC4R(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
switch (srcFormat)
{
@ -867,14 +885,13 @@ static pstatus_t general_RGBToYUV420_8u_P3AC4R(const BYTE* pSrc, UINT32 srcForma
}
}
static INLINE void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, const BYTE* srcOdd,
BYTE* b1Even, BYTE* b1Odd, BYTE* b2,
BYTE* b3, BYTE* b4, BYTE* b5, BYTE* b6,
BYTE* b7, UINT32 width)
static INLINE void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW(
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd,
BYTE* WINPR_RESTRICT b1Even, BYTE* WINPR_RESTRICT b1Odd, BYTE* WINPR_RESTRICT b2,
BYTE* WINPR_RESTRICT b3, BYTE* WINPR_RESTRICT b4, BYTE* WINPR_RESTRICT b5,
BYTE* WINPR_RESTRICT b6, BYTE* WINPR_RESTRICT b7, UINT32 width)
{
UINT32 x;
for (x = 0; x < width; x += 2)
for (UINT32 x = 0; x < width; x += 2)
{
const BOOL lastX = (x + 1) >= width;
BYTE Y1e, Y2e, U1e, V1e, U2e, V2e;
@ -964,10 +981,12 @@ static INLINE void general_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, c
}
}
static INLINE pstatus_t general_RGBToAVC444YUV_BGRX(const BYTE* pSrc, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUV_BGRX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst1[3],
const UINT32 dst1Step[3],
BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* WINPR_RESTRICT roi)
{
/**
* Note:
@ -998,14 +1017,13 @@ static INLINE pstatus_t general_RGBToAVC444YUV_BGRX(const BYTE* pSrc, UINT32 src
return PRIMITIVES_SUCCESS;
}
static INLINE void general_RGBToAVC444YUV_RGBX_DOUBLE_ROW(const BYTE* srcEven, const BYTE* srcOdd,
BYTE* b1Even, BYTE* b1Odd, BYTE* b2,
BYTE* b3, BYTE* b4, BYTE* b5, BYTE* b6,
BYTE* b7, UINT32 width)
static INLINE void general_RGBToAVC444YUV_RGBX_DOUBLE_ROW(
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd,
BYTE* WINPR_RESTRICT b1Even, BYTE* WINPR_RESTRICT b1Odd, BYTE* WINPR_RESTRICT b2,
BYTE* WINPR_RESTRICT b3, BYTE* WINPR_RESTRICT b4, BYTE* WINPR_RESTRICT b5,
BYTE* WINPR_RESTRICT b6, BYTE* WINPR_RESTRICT b7, UINT32 width)
{
UINT32 x;
for (x = 0; x < width; x += 2)
for (UINT32 x = 0; x < width; x += 2)
{
const BOOL lastX = (x + 1) >= width;
BYTE Y1e, Y2e, U1e, V1e, U2e, V2e;
@ -1095,19 +1113,20 @@ static INLINE void general_RGBToAVC444YUV_RGBX_DOUBLE_ROW(const BYTE* srcEven, c
}
}
static INLINE pstatus_t general_RGBToAVC444YUV_RGBX(const BYTE* pSrc, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUV_RGBX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst1[3],
const UINT32 dst1Step[3],
BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* WINPR_RESTRICT roi)
{
/**
* Note:
* Read information in function general_RGBToAVC444YUV_ANY below !
*/
UINT32 y;
const BYTE* pMaxSrc = pSrc + (roi->height - 1) * srcStep;
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BOOL last = (y >= (roi->height - 1));
const BYTE* srcEven = y < roi->height ? pSrc + y * srcStep : pMaxSrc;
@ -1129,15 +1148,14 @@ static INLINE pstatus_t general_RGBToAVC444YUV_RGBX(const BYTE* pSrc, UINT32 src
return PRIMITIVES_SUCCESS;
}
static INLINE void general_RGBToAVC444YUV_ANY_DOUBLE_ROW(const BYTE* srcEven, const BYTE* srcOdd,
UINT32 srcFormat, BYTE* b1Even,
BYTE* b1Odd, BYTE* b2, BYTE* b3, BYTE* b4,
BYTE* b5, BYTE* b6, BYTE* b7, UINT32 width)
static INLINE void general_RGBToAVC444YUV_ANY_DOUBLE_ROW(
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd, UINT32 srcFormat,
BYTE* WINPR_RESTRICT b1Even, BYTE* WINPR_RESTRICT b1Odd, BYTE* WINPR_RESTRICT b2,
BYTE* WINPR_RESTRICT b3, BYTE* WINPR_RESTRICT b4, BYTE* WINPR_RESTRICT b5,
BYTE* WINPR_RESTRICT b6, BYTE* WINPR_RESTRICT b7, UINT32 width)
{
const UINT32 bpp = FreeRDPGetBytesPerPixel(srcFormat);
UINT32 x;
for (x = 0; x < width; x += 2)
for (UINT32 x = 0; x < width; x += 2)
{
const BOOL lastX = (x + 1) >= width;
BYTE Y1e, Y2e, U1e, V1e, U2e, V2e;
@ -1227,10 +1245,10 @@ static INLINE void general_RGBToAVC444YUV_ANY_DOUBLE_ROW(const BYTE* srcEven, co
}
}
static INLINE pstatus_t general_RGBToAVC444YUV_ANY(const BYTE* pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* pDst1[3],
const UINT32 dst1Step[3], BYTE* pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUV_ANY(
const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst1[3], const UINT32 dst1Step[3], BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* WINPR_RESTRICT roi)
{
/**
* Note: According to [MS-RDPEGFX 2.2.4.4 RFX_AVC420_BITMAP_STREAM] the
@ -1289,10 +1307,9 @@ static INLINE pstatus_t general_RGBToAVC444YUV_ANY(const BYTE* pSrc, UINT32 srcF
* }
*
*/
UINT32 y;
const BYTE* pMaxSrc = pSrc + (roi->height - 1) * srcStep;
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BOOL last = (y >= (roi->height - 1));
const BYTE* srcEven = y < roi->height ? pSrc + y * srcStep : pMaxSrc;
@ -1314,10 +1331,12 @@ static INLINE pstatus_t general_RGBToAVC444YUV_ANY(const BYTE* pSrc, UINT32 srcF
return PRIMITIVES_SUCCESS;
}
static INLINE pstatus_t general_RGBToAVC444YUV(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUV(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[3],
const UINT32 dst1Step[3],
BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* WINPR_RESTRICT roi)
{
if (!pSrc || !pDst1 || !dst1Step || !pDst2 || !dst2Step)
return -1;
@ -1355,15 +1374,17 @@ static INLINE pstatus_t general_RGBToAVC444YUV(const BYTE* pSrc, UINT32 srcForma
}
static INLINE void general_RGBToAVC444YUVv2_ANY_DOUBLE_ROW(
const BYTE* srcEven, const BYTE* srcOdd, UINT32 srcFormat, BYTE* yLumaDstEven,
BYTE* yLumaDstOdd, BYTE* uLumaDst, BYTE* vLumaDst, BYTE* yEvenChromaDst1, BYTE* yEvenChromaDst2,
BYTE* yOddChromaDst1, BYTE* yOddChromaDst2, BYTE* uChromaDst1, BYTE* uChromaDst2,
BYTE* vChromaDst1, BYTE* vChromaDst2, UINT32 width)
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd, UINT32 srcFormat,
BYTE* WINPR_RESTRICT yLumaDstEven, BYTE* WINPR_RESTRICT yLumaDstOdd,
BYTE* WINPR_RESTRICT uLumaDst, BYTE* WINPR_RESTRICT vLumaDst,
BYTE* WINPR_RESTRICT yEvenChromaDst1, BYTE* WINPR_RESTRICT yEvenChromaDst2,
BYTE* WINPR_RESTRICT yOddChromaDst1, BYTE* WINPR_RESTRICT yOddChromaDst2,
BYTE* WINPR_RESTRICT uChromaDst1, BYTE* WINPR_RESTRICT uChromaDst2,
BYTE* WINPR_RESTRICT vChromaDst1, BYTE* WINPR_RESTRICT vChromaDst2, UINT32 width)
{
UINT32 x;
const UINT32 bpp = FreeRDPGetBytesPerPixel(srcFormat);
for (x = 0; x < width; x += 2)
for (UINT32 x = 0; x < width; x += 2)
{
BYTE Ya, Ua, Va;
BYTE Yb, Ub, Vb;
@ -1478,11 +1499,10 @@ static INLINE void general_RGBToAVC444YUVv2_ANY_DOUBLE_ROW(
}
}
static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY(const BYTE* pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* pDst1[3],
const UINT32 dst1Step[3], BYTE* pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY(
const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst1[3], const UINT32 dst1Step[3], BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* WINPR_RESTRICT roi)
{
/**
* Note: According to [MS-RDPEGFX 2.2.4.4 RFX_AVC420_BITMAP_STREAM] the
@ -1534,12 +1554,10 @@ static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY(const BYTE* pSrc, UINT32 sr
* }
*
*/
UINT32 y;
if (roi->height < 1 || roi->width < 1)
return !PRIMITIVES_SUCCESS;
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BYTE* srcEven = (pSrc + y * srcStep);
const BYTE* srcOdd = (y < roi->height - 1) ? (srcEven + srcStep) : NULL;
@ -1565,14 +1583,15 @@ static INLINE pstatus_t general_RGBToAVC444YUVv2_ANY(const BYTE* pSrc, UINT32 sr
}
static INLINE void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
const BYTE* srcEven, const BYTE* srcOdd, BYTE* yLumaDstEven, BYTE* yLumaDstOdd, BYTE* uLumaDst,
BYTE* vLumaDst, BYTE* yEvenChromaDst1, BYTE* yEvenChromaDst2, BYTE* yOddChromaDst1,
BYTE* yOddChromaDst2, BYTE* uChromaDst1, BYTE* uChromaDst2, BYTE* vChromaDst1,
BYTE* vChromaDst2, UINT32 width)
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd,
BYTE* WINPR_RESTRICT yLumaDstEven, BYTE* WINPR_RESTRICT yLumaDstOdd,
BYTE* WINPR_RESTRICT uLumaDst, BYTE* WINPR_RESTRICT vLumaDst,
BYTE* WINPR_RESTRICT yEvenChromaDst1, BYTE* WINPR_RESTRICT yEvenChromaDst2,
BYTE* WINPR_RESTRICT yOddChromaDst1, BYTE* WINPR_RESTRICT yOddChromaDst2,
BYTE* WINPR_RESTRICT uChromaDst1, BYTE* WINPR_RESTRICT uChromaDst2,
BYTE* WINPR_RESTRICT vChromaDst1, BYTE* WINPR_RESTRICT vChromaDst2, UINT32 width)
{
UINT32 x;
for (x = 0; x < width; x += 2)
for (UINT32 x = 0; x < width; x += 2)
{
BYTE Ya, Ua, Va;
BYTE Yb, Ub, Vb;
@ -1687,17 +1706,17 @@ static INLINE void general_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
}
}
static INLINE pstatus_t general_RGBToAVC444YUVv2_BGRX(const BYTE* pSrc, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUVv2_BGRX(const BYTE* WINPR_RESTRICT pSrc,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[3],
const UINT32 dst1Step[3],
BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 y;
if (roi->height < 1 || roi->width < 1)
return !PRIMITIVES_SUCCESS;
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BYTE* srcEven = (pSrc + y * srcStep);
const BYTE* srcOdd = (y < roi->height - 1) ? (srcEven + srcStep) : NULL;
@ -1722,10 +1741,12 @@ static INLINE pstatus_t general_RGBToAVC444YUVv2_BGRX(const BYTE* pSrc, UINT32 s
return PRIMITIVES_SUCCESS;
}
static INLINE pstatus_t general_RGBToAVC444YUVv2(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static INLINE pstatus_t general_RGBToAVC444YUVv2(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[3],
const UINT32 dst1Step[3],
BYTE* WINPR_RESTRICT pDst2[3],
const UINT32 dst2Step[3],
const prim_size_t* WINPR_RESTRICT roi)
{
switch (srcFormat)
{
@ -1742,7 +1763,7 @@ static INLINE pstatus_t general_RGBToAVC444YUVv2(const BYTE* pSrc, UINT32 srcFor
return !PRIMITIVES_SUCCESS;
}
void primitives_init_YUV(primitives_t* prims)
void primitives_init_YUV(primitives_t* WINPR_RESTRICT prims)
{
prims->YUV420ToRGB_8u_P3AC4R = general_YUV420ToRGB_8u_P3AC4R;
prims->YUV444ToRGB_8u_P3AC4R = general_YUV444ToRGB_8u_P3AC4R;

View File

@ -20,6 +20,7 @@
* limitations under the License.
*/
#include <winpr/wtypes.h>
#include <freerdp/config.h>
#include <winpr/sysinfo.h>
@ -41,7 +42,8 @@ static primitives_t* generic = NULL;
/****************************************************************************/
/* SSSE3 YUV420 -> RGB conversion */
/****************************************************************************/
static __m128i* ssse3_YUV444Pixel(__m128i* dst, __m128i Yraw, __m128i Uraw, __m128i Vraw, UINT8 pos)
static __m128i* ssse3_YUV444Pixel(__m128i* WINPR_RESTRICT dst, __m128i Yraw, __m128i Uraw,
__m128i Vraw, UINT8 pos)
{
/* Visual Studio 2010 doesn't like _mm_set_epi32 in array initializer list */
/* Note: This also applies to Visual Studio 2013 before Update 4 */
@ -148,8 +150,10 @@ static __m128i* ssse3_YUV444Pixel(__m128i* dst, __m128i Yraw, __m128i Uraw, __m1
return dst;
}
static pstatus_t ssse3_YUV420ToRGB_BGRX(const BYTE* const* pSrc, const UINT32* srcStep, BYTE* pDst,
UINT32 dstStep, const prim_size_t* roi)
static pstatus_t ssse3_YUV420ToRGB_BGRX(const BYTE* const WINPR_RESTRICT pSrc[],
const UINT32* WINPR_RESTRICT srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi)
{
const UINT32 nWidth = roi->width;
const UINT32 nHeight = roi->height;
@ -202,8 +206,10 @@ static pstatus_t ssse3_YUV420ToRGB_BGRX(const BYTE* const* pSrc, const UINT32* s
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_YUV420ToRGB(const BYTE* const* pSrc, const UINT32* srcStep, BYTE* pDst,
UINT32 dstStep, UINT32 DstFormat, const prim_size_t* roi)
static pstatus_t ssse3_YUV420ToRGB(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
switch (DstFormat)
{
@ -216,9 +222,10 @@ static pstatus_t ssse3_YUV420ToRGB(const BYTE* const* pSrc, const UINT32* srcSte
}
}
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const* pSrc, const UINT32* srcStep,
BYTE* pDst, UINT32 dstStep,
const prim_size_t* roi)
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const WINPR_RESTRICT pSrc[],
const UINT32 srcStep[], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi)
{
const UINT32 nWidth = roi->width;
const UINT32 nHeight = roi->height;
@ -262,9 +269,10 @@ static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R_BGRX(const BYTE* const* pSrc, const
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R(const BYTE* const* pSrc, const UINT32* srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R(const BYTE* const WINPR_RESTRICT pSrc[],
const UINT32 srcStep[], BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
if ((uintptr_t)pSrc[0] % 16 || (uintptr_t)pSrc[1] % 16 || (uintptr_t)pSrc[2] % 16 ||
srcStep[0] % 16 || srcStep[1] % 16 || srcStep[2] % 16)
@ -336,7 +344,7 @@ PRIM_ALIGN_128 static const BYTE rgbx_v_factors[] = {
/* compute the luma (Y) component from a single rgb source line */
static INLINE void ssse3_RGBToYUV420_BGRX_Y(const BYTE* src, BYTE* dst, UINT32 width)
static INLINE void ssse3_RGBToYUV420_BGRX_Y(const BYTE* WINPR_RESTRICT src, BYTE* dst, UINT32 width)
{
UINT32 x;
__m128i x0, x1, x2, x3;
@ -371,8 +379,10 @@ static INLINE void ssse3_RGBToYUV420_BGRX_Y(const BYTE* src, BYTE* dst, UINT32 w
/* compute the chrominance (UV) components from two rgb source lines */
static INLINE void ssse3_RGBToYUV420_BGRX_UV(const BYTE* src1, const BYTE* src2, BYTE* dst1,
BYTE* dst2, UINT32 width)
static INLINE void ssse3_RGBToYUV420_BGRX_UV(const BYTE* WINPR_RESTRICT src1,
const BYTE* WINPR_RESTRICT src2,
BYTE* WINPR_RESTRICT dst1, BYTE* WINPR_RESTRICT dst2,
UINT32 width)
{
UINT32 x;
const __m128i u_factors = BGRX_U_FACTORS;
@ -433,9 +443,10 @@ static INLINE void ssse3_RGBToYUV420_BGRX_UV(const BYTE* src1, const BYTE* src2,
}
}
static pstatus_t ssse3_RGBToYUV420_BGRX(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst[3], const UINT32 dstStep[3],
const prim_size_t* roi)
static pstatus_t ssse3_RGBToYUV420_BGRX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[],
const UINT32 dstStep[],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 y;
const BYTE* argb = pSrc;
@ -476,8 +487,9 @@ static pstatus_t ssse3_RGBToYUV420_BGRX(const BYTE* pSrc, UINT32 srcFormat, UINT
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_RGBToYUV420(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst[3], const UINT32 dstStep[3], const prim_size_t* roi)
static pstatus_t ssse3_RGBToYUV420(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[],
const UINT32 dstStep[], const prim_size_t* WINPR_RESTRICT roi)
{
switch (srcFormat)
{
@ -494,10 +506,11 @@ static pstatus_t ssse3_RGBToYUV420(const BYTE* pSrc, UINT32 srcFormat, UINT32 sr
/* SSSE3 RGB -> AVC444-YUV conversion **/
/****************************************************************************/
static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, const BYTE* srcOdd,
BYTE* b1Even, BYTE* b1Odd, BYTE* b2,
BYTE* b3, BYTE* b4, BYTE* b5, BYTE* b6,
BYTE* b7, UINT32 width)
static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW(
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd,
BYTE* WINPR_RESTRICT b1Even, BYTE* WINPR_RESTRICT b1Odd, BYTE* WINPR_RESTRICT b2,
BYTE* WINPR_RESTRICT b3, BYTE* WINPR_RESTRICT b4, BYTE* WINPR_RESTRICT b5,
BYTE* WINPR_RESTRICT b6, BYTE* WINPR_RESTRICT b7, UINT32 width)
{
UINT32 x;
const __m128i* argbEven = (const __m128i*)srcEven;
@ -697,11 +710,12 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, con
}
}
static pstatus_t ssse3_RGBToAVC444YUV_BGRX(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3], BYTE* pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* roi)
static pstatus_t ssse3_RGBToAVC444YUV_BGRX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[],
const UINT32 dst1Step[], BYTE* WINPR_RESTRICT pDst2[],
const UINT32 dst2Step[],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 y;
const BYTE* pMaxSrc = pSrc + (roi->height - 1) * srcStep;
if (roi->height < 1 || roi->width < 1)
@ -711,7 +725,7 @@ static pstatus_t ssse3_RGBToAVC444YUV_BGRX(const BYTE* pSrc, UINT32 srcFormat, U
return generic->RGBToAVC444YUV(pSrc, srcFormat, srcStep, pDst1, dst1Step, pDst2, dst2Step,
roi);
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BOOL last = (y >= (roi->height - 1));
const BYTE* srcEven = y < roi->height ? pSrc + y * srcStep : pMaxSrc;
@ -733,9 +747,11 @@ static pstatus_t ssse3_RGBToAVC444YUV_BGRX(const BYTE* pSrc, UINT32 srcFormat, U
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_RGBToAVC444YUV(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3], BYTE* pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* roi)
static pstatus_t ssse3_RGBToAVC444YUV(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[],
const UINT32 dst1Step[], BYTE* WINPR_RESTRICT pDst2[],
const UINT32 dst2Step[],
const prim_size_t* WINPR_RESTRICT roi)
{
switch (srcFormat)
{
@ -764,10 +780,13 @@ static pstatus_t ssse3_RGBToAVC444YUV(const BYTE* pSrc, UINT32 srcFormat, UINT32
* b9 -> vChromaDst2
*/
static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
const BYTE* srcEven, const BYTE* srcOdd, BYTE* yLumaDstEven, BYTE* yLumaDstOdd, BYTE* uLumaDst,
BYTE* vLumaDst, BYTE* yEvenChromaDst1, BYTE* yEvenChromaDst2, BYTE* yOddChromaDst1,
BYTE* yOddChromaDst2, BYTE* uChromaDst1, BYTE* uChromaDst2, BYTE* vChromaDst1,
BYTE* vChromaDst2, UINT32 width)
const BYTE* WINPR_RESTRICT srcEven, const BYTE* WINPR_RESTRICT srcOdd,
BYTE* WINPR_RESTRICT yLumaDstEven, BYTE* WINPR_RESTRICT yLumaDstOdd,
BYTE* WINPR_RESTRICT uLumaDst, BYTE* WINPR_RESTRICT vLumaDst,
BYTE* WINPR_RESTRICT yEvenChromaDst1, BYTE* WINPR_RESTRICT yEvenChromaDst2,
BYTE* WINPR_RESTRICT yOddChromaDst1, BYTE* WINPR_RESTRICT yOddChromaDst2,
BYTE* WINPR_RESTRICT uChromaDst1, BYTE* WINPR_RESTRICT uChromaDst2,
BYTE* WINPR_RESTRICT vChromaDst1, BYTE* WINPR_RESTRICT vChromaDst2, UINT32 width)
{
UINT32 x;
const __m128i vector128 = CONST128_FACTORS;
@ -994,13 +1013,12 @@ static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW(
}
}
static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3],
BYTE* pDst2[3], const UINT32 dst2Step[3],
const prim_size_t* roi)
static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[],
const UINT32 dst1Step[], BYTE* WINPR_RESTRICT pDst2[],
const UINT32 dst2Step[],
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 y;
if (roi->height < 1 || roi->width < 1)
return !PRIMITIVES_SUCCESS;
@ -1008,7 +1026,7 @@ static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX(const BYTE* pSrc, UINT32 srcFormat,
return generic->RGBToAVC444YUVv2(pSrc, srcFormat, srcStep, pDst1, dst1Step, pDst2, dst2Step,
roi);
for (y = 0; y < roi->height; y += 2)
for (UINT32 y = 0; y < roi->height; y += 2)
{
const BYTE* srcEven = (pSrc + y * srcStep);
const BYTE* srcOdd = (srcEven + srcStep);
@ -1033,9 +1051,11 @@ static pstatus_t ssse3_RGBToAVC444YUVv2_BGRX(const BYTE* pSrc, UINT32 srcFormat,
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_RGBToAVC444YUVv2(const BYTE* pSrc, UINT32 srcFormat, UINT32 srcStep,
BYTE* pDst1[3], const UINT32 dst1Step[3], BYTE* pDst2[3],
const UINT32 dst2Step[3], const prim_size_t* roi)
static pstatus_t ssse3_RGBToAVC444YUVv2(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat,
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst1[],
const UINT32 dst1Step[], BYTE* WINPR_RESTRICT pDst2[],
const UINT32 dst2Step[],
const prim_size_t* WINPR_RESTRICT roi)
{
switch (srcFormat)
{
@ -1050,9 +1070,9 @@ static pstatus_t ssse3_RGBToAVC444YUVv2(const BYTE* pSrc, UINT32 srcFormat, UINT
}
}
static pstatus_t ssse3_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32 srcStep[3],
BYTE* pDstRaw[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
static pstatus_t ssse3_LumaToYUV444(const BYTE* const WINPR_RESTRICT pSrcRaw[],
const UINT32 srcStep[], BYTE* WINPR_RESTRICT pDstRaw[],
const UINT32 dstStep[], const RECTANGLE_16* WINPR_RESTRICT roi)
{
UINT32 x, y;
const UINT32 nWidth = roi->right - roi->left;
@ -1136,7 +1156,7 @@ static pstatus_t ssse3_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32 s
return PRIMITIVES_SUCCESS;
}
static INLINE void ssse3_filter(BYTE* pSrcDst, const BYTE* pSrc2)
static INLINE void ssse3_filter(BYTE* WINPR_RESTRICT pSrcDst, const BYTE* WINPR_RESTRICT pSrc2)
{
const __m128i even =
_mm_set_epi8(0x80, 14, 0x80, 12, 0x80, 10, 0x80, 8, 0x80, 6, 0x80, 4, 0x80, 2, 0x80, 0);
@ -1158,7 +1178,8 @@ static INLINE void ssse3_filter(BYTE* pSrcDst, const BYTE* pSrc2)
_mm_storeu_si128((__m128i*)pSrcDst, interleaved);
}
static pstatus_t ssse3_ChromaFilter(BYTE* pDst[3], const UINT32 dstStep[3], const RECTANGLE_16* roi)
static pstatus_t ssse3_ChromaFilter(BYTE* WINPR_RESTRICT pDst[], const UINT32 dstStep[],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
const UINT32 oddY = 1;
const UINT32 evenY = 0;
@ -1212,9 +1233,10 @@ static pstatus_t ssse3_ChromaFilter(BYTE* pDst[3], const UINT32 dstStep[3], cons
return PRIMITIVES_SUCCESS;
}
static pstatus_t ssse3_ChromaV1ToYUV444(const BYTE* const pSrcRaw[3], const UINT32 srcStep[3],
BYTE* pDstRaw[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
static pstatus_t ssse3_ChromaV1ToYUV444(const BYTE* const WINPR_RESTRICT pSrcRaw[3],
const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDstRaw[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
const UINT32 mod = 16;
UINT32 uY = 0;
@ -1309,9 +1331,11 @@ static pstatus_t ssse3_ChromaV1ToYUV444(const BYTE* const pSrcRaw[3], const UINT
return ssse3_ChromaFilter(pDst, dstStep, roi);
}
static pstatus_t ssse3_ChromaV2ToYUV444(const BYTE* const pSrc[3], const UINT32 srcStep[3],
UINT32 nTotalWidth, UINT32 nTotalHeight, BYTE* pDst[3],
const UINT32 dstStep[3], const RECTANGLE_16* roi)
static pstatus_t ssse3_ChromaV2ToYUV444(const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], UINT32 nTotalWidth,
UINT32 nTotalHeight, BYTE* WINPR_RESTRICT pDst[3],
const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
UINT32 x, y;
const UINT32 nWidth = roi->right - roi->left;
@ -1420,10 +1444,11 @@ static pstatus_t ssse3_ChromaV2ToYUV444(const BYTE* const pSrc[3], const UINT32
return ssse3_ChromaFilter(pDst, dstStep, roi);
}
static pstatus_t ssse3_YUV420CombineToYUV444(avc444_frame_type type, const BYTE* const pSrc[3],
static pstatus_t ssse3_YUV420CombineToYUV444(avc444_frame_type type,
const BYTE* const WINPR_RESTRICT pSrc[3],
const UINT32 srcStep[3], UINT32 nWidth, UINT32 nHeight,
BYTE* pDst[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
BYTE* WINPR_RESTRICT pDst[3], const UINT32 dstStep[3],
const RECTANGLE_16* WINPR_RESTRICT roi)
{
if (!pSrc || !pSrc[0] || !pSrc[1] || !pSrc[2])
return -1;
@ -1450,7 +1475,7 @@ static pstatus_t ssse3_YUV420CombineToYUV444(avc444_frame_type type, const BYTE*
}
}
void primitives_init_YUV_opt(primitives_t* prims)
void primitives_init_YUV_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_YUV(prims);

View File

@ -43,7 +43,7 @@ SSE3_SSD_ROUTINE(sse3_add_16s, INT16, generic->add_16s, _mm_adds_epi16,
#endif
/* ------------------------------------------------------------------------- */
void primitives_init_add_opt(primitives_t* prims)
void primitives_init_add_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_add(prims);

View File

@ -43,8 +43,9 @@ static primitives_t* generic = NULL;
#ifdef WITH_SSE2
#if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
static pstatus_t sse2_alphaComp_argb(const BYTE* pSrc1, UINT32 src1Step, const BYTE* pSrc2,
UINT32 src2Step, BYTE* pDst, UINT32 dstStep, UINT32 width,
static pstatus_t sse2_alphaComp_argb(const BYTE* WINPR_RESTRICT pSrc1, UINT32 src1Step,
const BYTE* WINPR_RESTRICT pSrc2, UINT32 src2Step,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 width,
UINT32 height)
{
const UINT32* sptr1 = (const UINT32*)pSrc1;
@ -218,7 +219,7 @@ static pstatus_t ipp_alphaComp_argb(const BYTE* pSrc1, INT32 src1Step, const BYT
#endif
/* ------------------------------------------------------------------------- */
void primitives_init_alphaComp_opt(primitives_t* prims)
void primitives_init_alphaComp_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_alphaComp(prims);

View File

@ -43,7 +43,7 @@ SSE3_SCD_PRE_ROUTINE(sse3_orC_32u, UINT32, generic->orC_32u, _mm_or_si128, *dptr
#endif
/* ------------------------------------------------------------------------- */
void primitives_init_andor_opt(primitives_t* prims)
void primitives_init_andor_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_andor(prims);

View File

@ -29,9 +29,10 @@
#define MINMAX(_v_, _l_, _h_) ((_v_) < (_l_) ? (_l_) : ((_v_) > (_h_) ? (_h_) : (_v_)))
#endif /* !MINMAX */
/* ------------------------------------------------------------------------- */
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const WINPR_RESTRICT pSrc[3],
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y;
BYTE* pRGB = pDst;
@ -70,9 +71,10 @@ static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3]
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_general(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep,
UINT32 DstFormat, const prim_size_t* roi)
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_general(const INT16* const WINPR_RESTRICT pSrc[3],
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
UINT32 x, y;
BYTE* pRGB = pDst;
@ -112,9 +114,10 @@ static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_general(const INT16* const pSrc
return PRIMITIVES_SUCCESS;
}
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi)
static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R(const INT16* const WINPR_RESTRICT pSrc[3],
UINT32 srcStep, BYTE* WINPR_RESTRICT pDst,
UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi)
{
switch (DstFormat)
{
@ -131,9 +134,10 @@ static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], UIN
/* ------------------------------------------------------------------------- */
static pstatus_t general_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], INT32 srcStep,
INT16* pDst[3], INT32 dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
general_yCbCrToRGB_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], INT32 srcStep,
INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
/**
* The decoded YCbCr coeffectients are represented as 11.5 fixed-point
@ -210,9 +214,10 @@ static pstatus_t general_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], INT3
}
/* ------------------------------------------------------------------------- */
static pstatus_t general_RGBToYCbCr_16s16s_P3P3(const INT16* const pSrc[3], INT32 srcStep,
INT16* pDst[3], INT32 dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
general_RGBToYCbCr_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], INT32 srcStep,
INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
/* The encoded YCbCr coefficients are represented as 11.5 fixed-point
* numbers:
@ -434,13 +439,12 @@ static INLINE fkt_writeScanline getScanlineWriteFunction(DWORD format)
}
/* ------------------------------------------------------------------------- */
static pstatus_t
general_RGBToRGB_16s8u_P3AC4R_general(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat,
const prim_size_t* roi) /* region of interest */
static pstatus_t general_RGBToRGB_16s8u_P3AC4R_general(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const INT16* r = pSrc[0];
const INT16* g = pSrc[1];
@ -462,13 +466,12 @@ general_RGBToRGB_16s8u_P3AC4R_general(const INT16* const pSrc[3], /* 16-bit R,G,
return PRIMITIVES_SUCCESS;
}
static pstatus_t
general_RGBToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat,
const prim_size_t* roi) /* region of interest */
static pstatus_t general_RGBToRGB_16s8u_P3AC4R_BGRX(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const INT16* r = pSrc[0];
const INT16* g = pSrc[1];
@ -489,12 +492,12 @@ general_RGBToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], /* 16-bit R,G, an
return PRIMITIVES_SUCCESS;
}
static pstatus_t
general_RGBToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* roi) /* region of interest */
static pstatus_t general_RGBToRGB_16s8u_P3AC4R(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
switch (DstFormat)
{

View File

@ -52,7 +52,7 @@ static primitives_t* generic = NULL;
#ifdef DO_PREFETCH
/*---------------------------------------------------------------------------*/
static inline void GNU_INLINE _mm_prefetch_buffer(char* buffer, int num_bytes)
static inline void GNU_INLINE _mm_prefetch_buffer(char* WINPR_RESTRICT buffer, int num_bytes)
{
__m128i* buf = (__m128i*)buffer;
unsigned int i;
@ -65,9 +65,10 @@ static inline void GNU_INLINE _mm_prefetch_buffer(char* buffer, int num_bytes)
#endif /* DO_PREFETCH */
/*---------------------------------------------------------------------------*/
static pstatus_t sse2_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], int srcStep,
INT16* pDst[3], int dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
sse2_yCbCrToRGB_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], int srcStep,
INT16* WINPR_RESTRICT pDst[3], int dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
__m128i zero, max, r_cr, g_cb, g_cr, b_cb, c4096;
const __m128i *y_buf, *cb_buf, *cr_buf;
@ -192,9 +193,10 @@ static pstatus_t sse2_yCbCrToRGB_16s16s_P3P3(const INT16* const pSrc[3], int src
}
/*---------------------------------------------------------------------------*/
static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
sse2_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const WINPR_RESTRICT pSrc[3], UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const __m128i zero = _mm_setzero_si128();
const __m128i max = _mm_set1_epi16(255);
@ -379,9 +381,10 @@ static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], U
}
/*---------------------------------------------------------------------------*/
static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R_RGBX(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
sse2_yCbCrToRGB_16s8u_P3AC4R_RGBX(const INT16* const WINPR_RESTRICT pSrc[3], UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const __m128i zero = _mm_setzero_si128();
const __m128i max = _mm_set1_epi16(255);
@ -565,9 +568,10 @@ static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R_RGBX(const INT16* const pSrc[3], U
return PRIMITIVES_SUCCESS;
}
static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], UINT32 srcStep,
BYTE* pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* roi) /* region of interest */
static pstatus_t
sse2_yCbCrToRGB_16s8u_P3AC4R(const INT16* const WINPR_RESTRICT pSrc[3], UINT32 srcStep,
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 DstFormat,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
if (((ULONG_PTR)(pSrc[0]) & 0x0f) || ((ULONG_PTR)(pSrc[1]) & 0x0f) ||
((ULONG_PTR)(pSrc[2]) & 0x0f) || ((ULONG_PTR)(pDst)&0x0f) || (srcStep & 0x0f) ||
@ -594,9 +598,10 @@ static pstatus_t sse2_yCbCrToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], UINT32
/* The encodec YCbCr coeffectients are represented as 11.5 fixed-point
* numbers. See the general code above.
*/
static pstatus_t sse2_RGBToYCbCr_16s16s_P3P3(const INT16* const pSrc[3], int srcStep,
INT16* pDst[3], int dstStep,
const prim_size_t* roi) /* region of interest */
static pstatus_t
sse2_RGBToYCbCr_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], int srcStep,
INT16* WINPR_RESTRICT pDst[3], int dstStep,
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
__m128i min, max, y_r, y_g, y_b, cb_r, cb_g, cb_b, cr_r, cr_g, cr_b;
const __m128i* r_buf = (const __m128i*)(pSrc[0]);
@ -718,12 +723,12 @@ static pstatus_t sse2_RGBToYCbCr_16s16s_P3P3(const INT16* const pSrc[3], int src
}
/*---------------------------------------------------------------------------*/
static pstatus_t
sse2_RGBToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* roi) /* region of interest */
static pstatus_t sse2_RGBToRGB_16s8u_P3AC4R_BGRX(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const UINT16* pr = (const UINT16*)(pSrc[0]);
const UINT16* pg = (const UINT16*)(pSrc[1]);
@ -822,12 +827,12 @@ sse2_RGBToRGB_16s8u_P3AC4R_BGRX(const INT16* const pSrc[3], /* 16-bit R,G, and B
return PRIMITIVES_SUCCESS;
}
static pstatus_t
sse2_RGBToRGB_16s8u_P3AC4R_RGBX(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* roi) /* region of interest */
static pstatus_t sse2_RGBToRGB_16s8u_P3AC4R_RGBX(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const UINT16* pr = (const UINT16*)(pSrc[0]);
const UINT16* pg = (const UINT16*)(pSrc[1]);
@ -926,12 +931,12 @@ sse2_RGBToRGB_16s8u_P3AC4R_RGBX(const INT16* const pSrc[3], /* 16-bit R,G, and B
return PRIMITIVES_SUCCESS;
}
static pstatus_t
sse2_RGBToRGB_16s8u_P3AC4R_XBGR(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* roi) /* region of interest */
static pstatus_t sse2_RGBToRGB_16s8u_P3AC4R_XBGR(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const UINT16* pr = (const UINT16*)(pSrc[0]);
const UINT16* pg = (const UINT16*)(pSrc[1]);
@ -1030,12 +1035,12 @@ sse2_RGBToRGB_16s8u_P3AC4R_XBGR(const INT16* const pSrc[3], /* 16-bit R,G, and B
return PRIMITIVES_SUCCESS;
}
static pstatus_t
sse2_RGBToRGB_16s8u_P3AC4R_XRGB(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* roi) /* region of interest */
static pstatus_t sse2_RGBToRGB_16s8u_P3AC4R_XRGB(
const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
{
const UINT16* pr = (const UINT16*)(pSrc[0]);
const UINT16* pg = (const UINT16*)(pSrc[1]);
@ -1135,11 +1140,11 @@ sse2_RGBToRGB_16s8u_P3AC4R_XRGB(const INT16* const pSrc[3], /* 16-bit R,G, and B
}
static pstatus_t
sse2_RGBToRGB_16s8u_P3AC4R(const INT16* const pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* roi)
sse2_RGBToRGB_16s8u_P3AC4R(const INT16* const WINPR_RESTRICT pSrc[3], /* 16-bit R,G, and B arrays */
UINT32 srcStep, /* bytes between rows in source data */
BYTE* WINPR_RESTRICT pDst, /* 32-bit interleaved ARGB (ABGR?) data */
UINT32 dstStep, /* bytes between rows in dest data */
UINT32 DstFormat, const prim_size_t* WINPR_RESTRICT roi)
{
if (((ULONG_PTR)pSrc[0] & 0x0f) || ((ULONG_PTR)pSrc[1] & 0x0f) || ((ULONG_PTR)pSrc[2] & 0x0f) ||
(srcStep & 0x0f) || ((ULONG_PTR)pDst & 0x0f) || (dstStep & 0x0f))

View File

@ -35,7 +35,7 @@ static primitives_t* generic = NULL;
/* ========================================================================= */
#ifdef WITH_SSE2
#if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
static pstatus_t sse2_set_8u(BYTE val, BYTE* pDst, UINT32 len)
static pstatus_t sse2_set_8u(BYTE val, BYTE* WINPR_RESTRICT pDst, UINT32 len)
{
BYTE byte, *dptr;
__m128i xmm0;
@ -121,7 +121,7 @@ static pstatus_t sse2_set_8u(BYTE val, BYTE* pDst, UINT32 len)
/* ------------------------------------------------------------------------- */
#ifdef WITH_SSE2
#if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
static pstatus_t sse2_set_32u(UINT32 val, UINT32* pDst, UINT32 len)
static pstatus_t sse2_set_32u(UINT32 val, UINT32* WINPR_RESTRICT pDst, UINT32 len)
{
const primitives_t* prim = primitives_get_generic();
UINT32* dptr = (UINT32*)pDst;
@ -213,7 +213,7 @@ static pstatus_t sse2_set_32u(UINT32 val, UINT32* pDst, UINT32 len)
}
/* ------------------------------------------------------------------------- */
static pstatus_t sse2_set_32s(INT32 val, INT32* pDst, UINT32 len)
static pstatus_t sse2_set_32s(INT32 val, INT32* WINPR_RESTRICT pDst, UINT32 len)
{
UINT32 uval = *((UINT32*)&val);
return sse2_set_32u(uval, (UINT32*)pDst, len);
@ -223,7 +223,7 @@ static pstatus_t sse2_set_32s(INT32 val, INT32* pDst, UINT32 len)
#ifdef WITH_IPP
/* ------------------------------------------------------------------------- */
static pstatus_t ipp_wrapper_set_32u(UINT32 val, UINT32* pDst, INT32 len)
static pstatus_t ipp_wrapper_set_32u(UINT32 val, UINT32* WINPR_RESTRICT pDst, INT32 len)
{
/* A little type conversion, then use the signed version. */
INT32 sval = *((INT32*)&val);
@ -232,7 +232,7 @@ static pstatus_t ipp_wrapper_set_32u(UINT32 val, UINT32* pDst, INT32 len)
#endif
/* ------------------------------------------------------------------------- */
void primitives_init_set_opt(primitives_t* prims)
void primitives_init_set_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_set(prims);

View File

@ -56,15 +56,15 @@ SSE3_SCD_ROUTINE(sse2_rShiftC_16u, UINT16, generic->rShiftC_16u, _mm_srli_epi16,
*/
/* ------------------------------------------------------------------------- */
void primitives_init_shift_opt(primitives_t* prims)
void primitives_init_shift_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_shift(prims);
#if defined(WITH_IPP)
prims->lShiftC_16s = (__lShiftC_16s_t)ippsLShiftC_16s;
prims->rShiftC_16s = (__rShiftC_16s_t)ippsRShiftC_16s;
prims->lShiftC_16u = (__lShiftC_16u_t)ippsLShiftC_16u;
prims->rShiftC_16u = (__rShiftC_16u_t)ippsRShiftC_16u;
prims->lShiftC_16s = ippsLShiftC_16s;
prims->rShiftC_16s = ippsRShiftC_16s;
prims->lShiftC_16u = ippsLShiftC_16u;
prims->rShiftC_16u = ippsRShiftC_16u;
#elif defined(WITH_SSE2)
if (IsProcessorFeaturePresent(PF_SSE2_INSTRUCTIONS_AVAILABLE) &&

View File

@ -30,7 +30,8 @@ static primitives_t* generic = NULL;
#ifdef WITH_SSE2
/* ------------------------------------------------------------------------- */
static pstatus_t ssse3_sign_16s(const INT16* pSrc, INT16* pDst, UINT32 len)
static pstatus_t ssse3_sign_16s(const INT16* WINPR_RESTRICT pSrc, INT16* WINPR_RESTRICT pDst,
UINT32 len)
{
const INT16* sptr = (const INT16*)pSrc;
INT16* dptr = (INT16*)pDst;
@ -152,7 +153,7 @@ static pstatus_t ssse3_sign_16s(const INT16* pSrc, INT16* pDst, UINT32 len)
#endif /* WITH_SSE2 */
/* ------------------------------------------------------------------------- */
void primitives_init_sign_opt(primitives_t* prims)
void primitives_init_sign_opt(primitives_t* WINPR_RESTRICT prims)
{
generic = primitives_get_generic();
primitives_init_sign(prims);