Removed unused variables in tests.

This commit is contained in:
Armin Novak 2018-08-23 13:15:46 +02:00
parent d7d5567891
commit 6d3beabd54
5 changed files with 62 additions and 186 deletions

View File

@ -2795,77 +2795,6 @@ static const BYTE TEST_RLE_UNCOMPRESSED_BITMAP_16BPP[2048] =
"\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,
@ -3020,7 +2949,7 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar,
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;

View File

@ -56,19 +56,6 @@ static const BYTE bmp_DST[256] =
"\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] =
{

View File

@ -572,48 +572,6 @@ static const BYTE line_to_R2_WHITE[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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\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\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
{

View File

@ -19,11 +19,6 @@
#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)
@ -36,7 +31,6 @@ static const int block_size[] = { 4, 64, 256 };
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;
}
@ -51,8 +45,8 @@ static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_
/* ------------------------------------------------------------------------- */
static UINT32 alpha_add(
UINT32 c1,
UINT32 c2)
UINT32 c1,
UINT32 c2)
{
UINT32 a1 = ALF(c1);
UINT32 r1 = RED(c1);
@ -71,8 +65,8 @@ static UINT32 alpha_add(
/* ------------------------------------------------------------------------- */
static UINT32 colordist(
UINT32 c1,
UINT32 c2)
UINT32 c1,
UINT32 c2)
{
int d, maxd = 0;
d = ABS((INT32)(ALF(c1) - ALF(c2)));
@ -96,11 +90,12 @@ static UINT32 colordist(
/* ------------------------------------------------------------------------- */
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)
@ -130,41 +125,39 @@ static BOOL test_alphaComp_func(void)
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;
@ -184,7 +177,6 @@ static int test_alphaComp_speed(void)
src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2));
/* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2;
@ -193,11 +185,11 @@ static int test_alphaComp_speed(void)
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;
@ -206,6 +198,7 @@ static int test_alphaComp_speed(void)
int TestPrimitivesAlphaComp(int argc, char* argv[])
{
prim_test_setup(FALSE);
if (!test_alphaComp_func())
return -1;

View File

@ -19,23 +19,17 @@
#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;
}
}
@ -52,11 +46,12 @@ static BOOL test_set8u_func(void)
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;
@ -68,11 +63,12 @@ static BOOL test_set8u_func(void)
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;
@ -91,13 +87,14 @@ static BOOL test_set8u_speed(void)
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;
}
@ -107,12 +104,13 @@ static BOOL test_set8u_speed(void)
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;
}
}
@ -131,11 +129,12 @@ static BOOL test_set32s_func(void)
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;
@ -147,11 +146,12 @@ static BOOL test_set32s_func(void)
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;
@ -166,12 +166,13 @@ static BOOL test_set32s_func(void)
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;
}
}
@ -190,11 +191,12 @@ static BOOL test_set32u_func(void)
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;
@ -206,11 +208,12 @@ static BOOL test_set32u_func(void)
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;
@ -229,13 +232,14 @@ static BOOL test_set32u_speed(void)
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;
}
@ -249,13 +253,14 @@ static BOOL test_set32s_speed(void)
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;
}
@ -268,8 +273,10 @@ int TestPrimitivesSet(int argc, char* argv[])
if (!test_set8u_func())
return -1;
if (!test_set32s_func())
return -1;
if (!test_set32u_func())
return -1;
@ -277,8 +284,10 @@ int TestPrimitivesSet(int argc, char* argv[])
{
if (!test_set8u_speed())
return -1;
if (!test_set32s_speed())
return -1;
if (!test_set32u_speed())
return -1;
}