"\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42"
"\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\xFF\xFF";
-/**
- * [MS-RDPEGDI] Test Bitmap 32x32 (RLE Encoded, not RDP6)
- */
-
-static const BYTE TEST_RLE_COMPRESSED_BITMAP[220] =
- "\x85\xFF\xFF\x99\xD6\x99\xD6\x99\xD6\x99\xD6\x06\x8B\x99\xD6\x99"
- "\xD6\x99\xD6\x10\x84\x08\x42\x08\x42\x10\x84\x99\xD6\x99\xD6\x99"
- "\xD6\x99\xD6\x06\x84\x99\xD6\x99\xD6\x99\xD6\xFF\xFF\x16\x69\x99"
- "\xD6\x06\x69\x99\xD6\x04\xCC\x89\x52\x03\x6E\xFF\xFF\x02\x6E\x08"
- "\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18\xC6\x01\x81\x08\x42\xCE"
- "\x66\x29\x02\xCD\x89\x52\x03\x88\x10\x84\x99\xD6\x99\xD6\x99\xD6"
- "\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x99\xD6\x03\xF8\x01\x00\x00"
- "\x00\x00\xF0\x66\x99\xD6\x05\x6A\x99\xD6\x00\xC4\xCC\x89\x52\x03"
- "\x6E\xFF\xFF\x02\x6E\x08\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18"
- "\xC6\x01\x81\x08\x42\xCE\x66\x29\x02\xCD\x89\x52\x03\x00\x04\xD6"
- "\x99\xD6\xC3\x80\x61\x00\xA5\x80\x40\xEC\x52\x00\x5A\x00\x2D\x00"
- "\x24\x00\x12\x00\x24\x00\x12\x00\x5A\x00\x2D\x00\xA5\x80\x52\x00"
- "\xC3\x80\x61\x00\x00\x00\x00\x00\xCC\x89\x52\x03\x6E\xFF\xFF\x02"
- "\xCB\x18\xC6\x84\x08\x42\x08\x42\x08\x42\xFF\xFF";
-
-static const BYTE TEST_RLE_SCANLINE_UNCOMPRESSED[12] =
- "AAAABBCCCCCD";
-
-/**
- * [MS-RDPEGDI] 3.1.9.2.1 Encoding Run-Length Sequences
- */
-
-/* Scanline Absolute Values */
-
-static const BYTE TEST_RDP6_SCANLINES_ABSOLUTE[3][6] =
-{
- { 255, 255, 255, 255, 254, 253 },
- { 254, 192, 132, 96, 75, 25 },
- { 253, 140, 62, 14, 135, 193 }
-};
-
-/* Scanline Delta Values */
-static const int TEST_RDP6_SCANLINES_DELTA[3][6] =
-{
- { 255, 255, 255, 255, 254, 253 },
- { -1, -63, -123, -159, -179, -228 },
- { -1, -52, -70, -82, 60, 168 }
-};
-
-/* Scanline Delta Values (1-byte two's complement) */
-
-static const BYTE TEST_RDP6_SCANLINES_DELTA_2C[3][6] =
-{
- { -1, -1, -1, -1, -2, -3 },
- { -1, -63, -123, 97, 77, 28 },
- { -1, -52, -70, -82, 60, -88 }
-};
-
-/* Scanline Delta Values (1-byte two's complement, encoded) */
-
-static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED[3][6] =
-{
- { -1, -1, -1, -1, -2, -3 },
- { -1, 125, 11, -62, -102, 56 },
- { 1, 103, -117, -93, 120, -81 }
-};
-
-/* Scanline Delta Values (1-byte two's complement, encoded, unsigned) */
-
-static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED_UNSIGNED[3][6] =
-{
- { 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFD },
- { 0x01, 0x7D, 0xF5, 0xC2, 0x9A, 0x38 },
- { 0x01, 0x67, 0x8B, 0xA3, 0x78, 0xAF }
-};
-
static const UINT32 colorFormatList[] =
{
PIXEL_FORMAT_RGB15,
UINT32 compressedSize;
const UINT32 fill = j;
const UINT32 color = FreeRDPGetColor(srcFormat, (fill >> 8) & 0xF, (fill >> 4) & 0xF,
- (fill) & 0xF, 0xFF);
+ (fill) & 0xF, 0xFF);
const UINT32 width = i;
const UINT32 height = i;
BOOL failed = TRUE;
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00"
};
-/* pattern bitmap (8x8) */
-static const BYTE bmp_PAT[64] =
-{
- "\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
- "\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
- "\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
- "\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
- "\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
- "\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
- "\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
- "\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
-};
-
/* SRCCOPY (0x00CC0020) */
static const BYTE bmp_SRCCOPY[256] =
{
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
};
-/* PolylineTo() Test Data */
-
-static const BYTE polyline_to_case_1[256] =
-{
- "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\x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xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
- "\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
- "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
-};
-
#define LINTETO_NUMBER 11
struct ropMap
{
#include "prim_test.h"
-static const int ALPHA_PRETEST_ITERATIONS = 5000000;
-static const float TEST_TIME = 5.0;
-
-static const int block_size[] = { 4, 64, 256 };
-#define NUM_BLOCK_SIZES (sizeof(block_size)/sizeof(int))
#define MAX_BLOCK_SIZE 256
#define SIZE_SQUARED (MAX_BLOCK_SIZE*MAX_BLOCK_SIZE)
static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_, UINT32 _y_)
{
const BYTE* addr = _addr_ + _x_ * sizeof(UINT32) + _y_ * _bytes_;
-
return (const UINT32*)addr;
}
/* ------------------------------------------------------------------------- */
static UINT32 alpha_add(
- UINT32 c1,
- UINT32 c2)
+ UINT32 c1,
+ UINT32 c2)
{
UINT32 a1 = ALF(c1);
UINT32 r1 = RED(c1);
/* ------------------------------------------------------------------------- */
static UINT32 colordist(
- UINT32 c1,
- UINT32 c2)
+ UINT32 c1,
+ UINT32 c2)
{
int d, maxd = 0;
d = ABS((INT32)(ALF(c1) - ALF(c2)));
/* ------------------------------------------------------------------------- */
static BOOL check(const BYTE* pSrc1, UINT32 src1Step,
- const BYTE* pSrc2, UINT32 src2Step,
- BYTE* pDst, UINT32 dstStep,
- UINT32 width, UINT32 height)
+ const BYTE* pSrc2, UINT32 src2Step,
+ BYTE* pDst, UINT32 dstStep,
+ UINT32 width, UINT32 height)
{
UINT32 x, y;
+
for (y = 0; y < height; ++y)
{
for (x = 0; x < width; ++x)
BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]);
UINT32* ptr;
UINT32 i;
-
winpr_RAND((BYTE*)src1, sizeof(src1));
-
/* Special-case the first two values */
src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2));
-
/* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2;
for (i = 0; i < sizeof(src2) / 4; ++i) *ptr++ |= 0xFF000000U;
memset(dst1, 0, sizeof(dst1));
-
status = generic->alphaComp_argb(src1, 4 * SRC1_WIDTH,
- src2, 4 * SRC2_WIDTH,
- dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
+ src2, 4 * SRC2_WIDTH,
+ dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
if (!check(src1, 4 * SRC1_WIDTH,
- src2, 4 * SRC2_WIDTH,
- dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
+ src2, 4 * SRC2_WIDTH,
+ dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
status = optimized->alphaComp_argb((const BYTE*) src1, 4 * SRC1_WIDTH,
- (const BYTE*) src2, 4 * SRC2_WIDTH,
- (BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
+ (const BYTE*) src2, 4 * SRC2_WIDTH,
+ (BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
if (!check(src1, 4 * SRC1_WIDTH,
- src2, 4 * SRC2_WIDTH,
- dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
+ src2, 4 * SRC2_WIDTH,
+ dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
return TRUE;
src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2));
-
/* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2;
memset(dst1, 0, sizeof(dst1));
if (!speed_test("add16s", "aligned", g_Iterations,
- (speed_test_fkt)generic->alphaComp_argb,
- (speed_test_fkt)optimized->alphaComp_argb,
- src1, 4 * SRC1_WIDTH,
- src2, 4 * SRC2_WIDTH,
- dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
+ (speed_test_fkt)generic->alphaComp_argb,
+ (speed_test_fkt)optimized->alphaComp_argb,
+ src1, 4 * SRC1_WIDTH,
+ src2, 4 * SRC2_WIDTH,
+ dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
return TRUE;
int TestPrimitivesAlphaComp(int argc, char* argv[])
{
prim_test_setup(FALSE);
+
if (!test_alphaComp_func())
return -1;
#include <winpr/sysinfo.h>
#include "prim_test.h"
-static const int MEMSET8_PRETEST_ITERATIONS = 100000000;
-static const int MEMSET32_PRETEST_ITERATIONS = 40000000;
-static const float TEST_TIME = 1.0;
-
-static const int set_sizes[] = { 1, 4, 16, 32, 64, 256, 1024, 4096 };
-#define NUM_SET_SIZES (sizeof(set_sizes)/sizeof(int))
-
/* ------------------------------------------------------------------------- */
static BOOL check8(const BYTE* src, UINT32 length, UINT32 offset, BYTE value)
{
UINT32 i;
+
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%02"PRIx8"\n",
- offset, length, i + offset, src[i + offset]);
+ offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 3, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_8u(0xa5, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 3, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_8u(0xa5, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
BYTE value;
UINT32 x;
- for (x=0; x<16; x++)
+ for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
+
if (!speed_test("set_8u", "", g_Iterations,
- (speed_test_fkt)generic->set_8u,
- (speed_test_fkt)optimized->set_8u,
- value, dest + x, x))
+ (speed_test_fkt)generic->set_8u,
+ (speed_test_fkt)optimized->set_8u,
+ value, dest + x, x))
return FALSE;
}
static BOOL check32s(const INT32* src, UINT32 length, UINT32 offset, INT32 value)
{
UINT32 i;
+
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n",
- offset, length, i + offset, src[i + offset]);
+ offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 0, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_32s(value, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 0, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_32s(value, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
static BOOL check32u(const UINT32* src, UINT32 length, UINT32 offset, UINT32 value)
{
UINT32 i;
+
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n",
- offset, length, i + offset, src[i + offset]);
+ offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 0, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_32u(value, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
for (off = 0; off < 16; ++off)
{
UINT32 len;
-
memset(dest, 0, sizeof(dest));
+
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_32u(value, dest + off, len);
+
if (status != PRIMITIVES_SUCCESS)
return FALSE;
BYTE value;
UINT32 x;
- for (x=0; x<16; x++)
+ for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
+
if (!speed_test("set_32u", "", g_Iterations,
- (speed_test_fkt)generic->set_32u,
- (speed_test_fkt)optimized->set_32u,
- value, dest + x, x))
+ (speed_test_fkt)generic->set_32u,
+ (speed_test_fkt)optimized->set_32u,
+ value, dest + x, x))
return FALSE;
}
BYTE value;
UINT32 x;
- for (x=0; x<16; x++)
+ for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
+
if (!speed_test("set_32s", "", g_Iterations,
- (speed_test_fkt)generic->set_32s,
- (speed_test_fkt)optimized->set_32s,
- value, dest + x, x))
+ (speed_test_fkt)generic->set_32s,
+ (speed_test_fkt)optimized->set_32s,
+ value, dest + x, x))
return FALSE;
}
if (!test_set8u_func())
return -1;
+
if (!test_set32s_func())
return -1;
+
if (!test_set32u_func())
return -1;
{
if (!test_set8u_speed())
return -1;
+
if (!test_set32s_speed())
return -1;
+
if (!test_set32u_speed())
return -1;
}