Ejemplo n.º 1
0
static void
ContigCompare(int sample, uint32 row, unsigned char* p1, unsigned char* p2, int size)
{
    register uint32 pix;
    register int ppb = 8/bitspersample;

    if (memcmp(p1, p2, size) == 0)
        return;
    switch (bitspersample) {
    case 1:
    case 2:
    case 4:
    case 8: {
        register unsigned char *pix1 = p1, *pix2 = p2;

        for (pix = 0; pix < imagewidth; pix1++, pix2++, pix += ppb)
            if (*pix1 != *pix2)
                PrintDiff(row, sample, pix,
                          *pix1, *pix2);
        break;
    }
    case 16: {
        register uint16 *pix1 = (uint16 *)p1, *pix2 = (uint16 *)p2;

        for (pix = 0; pix < imagewidth; pix1++, pix2++, pix++)
            if (*pix1 != *pix2)
                PrintDiff(row, sample, pix,
                          *pix1, *pix2);
        break;
    }
    }
}
Ejemplo n.º 2
0
int main(int argc, char** argv) {
	Options options;
	ParseOptions(argc, argv, &options);

	srand(options.seed);

	std::vector<float> matrix_a(options.row_a * options.column_a);
	std::vector<float> matrix_b(options.row_b * options.column_b);
	std::vector<float> matrix_c(options.row_b * options.column_a);

	SetRandomInit(matrix_a.size(), &matrix_a[0]);
	SetRandomInit(matrix_b.size(), &matrix_b[0]);

	//std::cout << "Matrix a" << std::endl;
	//PrintMatrix(options.column_a, options.row_a, &matrix_a[0]);
	std::cout << "Matrix a size=(\t" << options.column_a << ",\t"
			<< options.row_a << ")" << std::endl;
	//std::cout << "Matrix b" << std::endl;
	//PrintMatrix(options.column_b, options.row_b, &matrix_b[0]);
	std::cout << "Matrix b size=(\t" << options.column_b << ",\t"
			<< options.row_b << ")" << std::endl;

	std::cout << "Matrix c size=(\t" << options.column_a << ",\t"
				<< options.row_b << ")" << std::endl;
       
	std::cout << "Selected implimentation is " << GetName(options.implementation) << std::endl;
	double start_time = GetTimeSec();
	if (MultiplyMatrices(options.implementation, options.column_a,
			options.row_a, &matrix_a[0], options.column_b, options.row_b,
			&matrix_b[0], &matrix_c[0])) {
		std::cerr << "Error : multiply" << std::endl;
	}
	double end_time = GetTimeSec();

	//std::cout << "Matrix c" << std::endl;
	//PrintMatrix(options.column_a, options.row_b, &matrix_c[0]);

	std::cout << "Time : ";
	std::cout.precision(6);
	std::cout.width(10);
	std::cout << end_time - start_time << " sec" << std::endl;

	if (options.checking_result) {
		std::cout << "Checking Result" << std::endl;
		std::vector<float> reference_matrix_c(options.row_b * options.column_a);
		if (MultiplyMatrices(kCpuReference, options.column_a, options.row_a,
				&matrix_a[0], options.column_b, options.row_b, &matrix_b[0],
				&reference_matrix_c[0])) {
			std::cerr << "Error : multiply" << std::endl;
		}
		PrintDiff(options.column_a, options.row_b, &reference_matrix_c[0],
				&matrix_c[0], 100, 1.0e-5f);
	}
}
Ejemplo n.º 3
0
int main (int argc, char **argv){
	PassConsoleParams (argc, argv);
	
	AllocArrays ();
	
	ReadSubFunc ();

	//	PrintSubFile ();
	
	CalcForceZ ();
	
	CalcSigmas ();
	
	CalcDivSigma ();
	
	PrintDiff ();
}