Exemplo n.º 1
0
int TestPrimitivesCopy(int argc, char* argv[])
{
	int status;

	status = test_copy8u_func();

	if (status != SUCCESS)
		return 1;

	if (g_TestPrimitivesPerformance)
	{
		status = test_copy8u_speed();

		if (status != SUCCESS)
			return 1;
	}

	return 0;
}
Exemplo n.º 2
0
int main(int argc, char** argv)
{
	int i;
	char hints[1024];
	UINT32 testSet = 0;
	UINT32 testTypes = 0;
	int results = SUCCESS;

	/* Parse command line for the test set. */

	for (i = 1; i < argc; ++i)
	{
		int j;
		BOOL found = 0;

		for (j=0; j<NUMTESTS; ++j)
		{
			if (strcasecmp(argv[i], testList[j].testStr) == 0)
			{
				testSet |= testList[j].bits;
				found = 1;
				break;
			}
		}
		for (j=0; j<NUMTESTTYPES; ++j)
		{
			if (strcasecmp(argv[i], testTypeList[j].testStr) == 0)
			{
				testTypes |= testTypeList[j].bits;
				found = 1;
				break;
			}
		}
		if (!found)
		{
			if (strstr(argv[i], "help") != NULL)
			{
				printf("Available tests:\n");
				for (j=0; j<NUMTESTS; ++j)
				{
					printf("  %s\n", testList[j].testStr);
				}
				for (j=0; j<NUMTESTTYPES; ++j)
				{
					printf("  %s\n", testTypeList[j].testStr);
				}
			}
			else fprintf(stderr, "Unknown parameter '%s'!\n", argv[i]);
		}
	}

	if (testSet == 0)
		testSet = 0xffffffff;
	if (testTypes == 0)
		testTypes = 0xffffffff;

	primitives_init();

	primitives_flags_str(hints, sizeof(hints));
	printf("Hints: %s\n", hints);

	/* COPY */
	if (testSet & TEST_COPY8)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_copy8u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_copy8u_speed();
		}
	}
	/* SET */
	if (testSet & TEST_SET8)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_set8u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_set8u_speed();
		}
	}
	if (testSet & TEST_SET32S)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_set32s_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_set32s_speed();
		}
	}
	if (testSet & TEST_SET32U)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_set32u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_set32u_speed();
		}
	}
	/* SIGN */
	if (testSet & TEST_SIGN16S)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_sign16s_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_sign16s_speed();
		}
	}
	/* ADD */
	if (testSet & TEST_ADD16S)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_add16s_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_add16s_speed();
		}
	}
	/* SHIFTS */
	if (testSet & TEST_LSHIFT16S)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_lShift_16s_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_lShift_16s_speed();
		}
	}
	if (testSet & TEST_LSHIFT16U)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_lShift_16u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_lShift_16u_speed();
		}
	}
	if (testSet & TEST_RSHIFT16S)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_rShift_16s_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_rShift_16s_speed();
		}
	}
	if (testSet & TEST_RSHIFT16U)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_rShift_16u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_rShift_16u_speed();
		}
	}
	/* COLORS */
	if (testSet & TEST_RGB)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_RGBToRGB_16s8u_P3AC4R_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_RGBToRGB_16s8u_P3AC4R_speed();
		}
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_yCbCrToRGB_16s16s_P3P3_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_yCbCrToRGB_16s16s_P3P3_speed();
		}
	}
	/* ALPHA COMPOSITION */
	if (testSet & TEST_ALPHA)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_alphaComp_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_alphaComp_speed();
		}
	}
	/* AND & OR */
	if (testSet & TEST_AND)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_and_32u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_and_32u_speed();
		}
	}
	if (testSet & TEST_OR)
	{
		if (testTypes & TEST_FUNCTIONALITY)
		{
			results |= test_or_32u_func();
		}
		if (testTypes & TEST_PERFORMANCE)
		{
			results |= test_or_32u_speed();
		}
	}

	primitives_deinit();
	return results;
}