コード例 #1
0
ファイル: TestIntegral.cpp プロジェクト: pozdneev/Simd
    bool IntegralAutoTest(int width, int height, bool sqsumEnable, bool tiltedEnable, View::Format sumFormat, View::Format sqsumFormat, const Func & f1, const Func & f2)
    {
        bool result = true;

        TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "].");

        View src(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        FillRandom(src);

        View sum1(width + 1, height + 1, sumFormat, NULL, TEST_ALIGN(width));
        View sum2(width + 1, height + 1, sumFormat, NULL, TEST_ALIGN(width));
        View sqsum1, sqsum2, tilted1, tilted2;
        if(sqsumEnable)
        {
            sqsum1.Recreate(width + 1, height + 1, sqsumFormat, NULL, TEST_ALIGN(width));
            sqsum2.Recreate(width + 1, height + 1, sqsumFormat, NULL, TEST_ALIGN(width));
        }
        if(tiltedEnable)
        {
            tilted1.Recreate(width + 1, height + 1, sumFormat, NULL, TEST_ALIGN(width));
            tilted2.Recreate(width + 1, height + 1, sumFormat, NULL, TEST_ALIGN(width));
        }

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(src, sum1, sqsum1, tilted1));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(src, sum2, sqsum2, tilted2));

        result = result && Compare(sum1, sum2, 0, true, 32, 0, "sum");
        if(sqsumEnable)
            result = result && Compare(sqsum1, sqsum2, 0, true, 32, 0, "sqsum");
        if(tiltedEnable)
            result = result && Compare(tilted1, tilted2, 0, true, 32, 0, "tilted");

        return result;
    }
コード例 #2
0
	bool YuvToAnyAutoTest(int width, int height, bool is420, View::Format dstType, const Func & f1, const Func & f2)
	{
		bool result = true;

		std::cout << "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "]." << std::endl;

		const int uvWidth = is420 ? width/2 : width;
		const int uvHeight = is420 ? height/2 : height;

		View y(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(y);
		View u(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
		FillRandom(u);
		View v(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
		FillRandom(v);

		View dst1(width, height, dstType, NULL, TEST_ALIGN(width));
		View dst2(width, height, dstType, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(y, u, v, dst1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(y, u, v, dst2));

		result = result && Compare(dst1, dst2, 0, true, 64);

		return result;
	}
コード例 #3
0
ファイル: TestYuvToBgra.cpp プロジェクト: pozdneev/Simd
	bool YuvToBgraAutoTest(int width, int height, const Func & f1, const Func & f2, int dx, int dy)
	{
		bool result = true;

		TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "].");

		const int uvWidth = width/dx;
		const int uvHeight = height/dy;

		View y(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(y);
		View u(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
		FillRandom(u);
		View v(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
		FillRandom(v);

		View bgra1(width, height, View::Bgra32, NULL, TEST_ALIGN(width));
		View bgra2(width, height, View::Bgra32, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(y, u, v, bgra1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(y, u, v, bgra2));

		result = result && Compare(bgra1, bgra2, 0, true, 64);

		return result;
	}
コード例 #4
0
ファイル: TestBgr48pToBgra32.cpp プロジェクト: pozdneev/Simd
    bool Bgr48pToBgra32AutoTest(int width, int height, const Func & f1, const Func & f2)
    {
        bool result = true;

        TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " for size [" << width << "," << height << "].");

        View blue(width, height, View::Int16, NULL, TEST_ALIGN(width));
        FillRandom(blue);
        View green(width, height, View::Int16, NULL, TEST_ALIGN(width));
        FillRandom(green);
        View red(width, height, View::Int16, NULL, TEST_ALIGN(width));
        FillRandom(red);

        uint8_t alpha = 0xFF;

        View bgra1(width, height, View::Bgra32, NULL, TEST_ALIGN(width));
        View bgra2(width, height, View::Bgra32, NULL, TEST_ALIGN(width));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(blue, green, red, bgra1, alpha));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(blue, green, red, bgra2, alpha));

        result = result && Compare(bgra1, bgra2, 0, true, 32);

        return result;
    }
コード例 #5
0
	bool AddFeatureDifferenceAutoTest(int width, int height, uint16_t weight, const Func & f1, const Func & f2)
	{
		bool result = true;

		TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "] (" << weight/256 << "*256).");

		View value(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(value);
		View lo(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(lo);
		View hi(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(hi);
        View differenceSrc(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        FillRandom(differenceSrc);

		View differenceDst1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		View differenceDst2(width, height, View::Gray8, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(value, lo, hi, weight, differenceSrc, differenceDst1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(value, lo, hi, weight, differenceSrc, differenceDst2));

		result = result && Compare(differenceDst1, differenceDst2, 0, true, 32, 0);

		return result;
	}
コード例 #6
0
    bool AddFeatureDifferenceDataTest(bool create, int width, int height, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View value(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View lo(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View hi(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View differenceSrc(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        View differenceDst1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View differenceDst2(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        const uint16_t weight = 256*7;

        if(create)
        {
            FillRandom(value);
            FillRandom(lo);
            FillRandom(hi);
            FillRandom(differenceSrc);

            TEST_SAVE(value);
            TEST_SAVE(lo);
            TEST_SAVE(hi);
            TEST_SAVE(differenceSrc);

            f.Call(value, lo, hi, weight, differenceSrc, differenceDst1);

            TEST_SAVE(differenceDst1);
        }
        else
        {
            TEST_LOAD(value);
            TEST_LOAD(lo);
            TEST_LOAD(hi);

            TEST_LOAD(differenceSrc);
            TEST_LOAD(differenceDst1);

            f.Call(value, lo, hi, weight, differenceSrc, differenceDst2);

            TEST_SAVE(differenceDst2);

            result = result && Compare(differenceDst1, differenceDst2, 0, true, 32, 0);
        }

        return result;
    }
コード例 #7
0
ファイル: TestIntegral.cpp プロジェクト: pozdneev/Simd
    bool IntegralDataTest(bool create, int width, int height, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View src(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        View sum1(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));
        View sum2(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));
        View sqsum1(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));
        View sqsum2(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));
        View tilted1(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));
        View tilted2(width + 1, height + 1, View::Int32, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(src);

            TEST_SAVE(src);

            f.Call(src, sum1, sqsum1, tilted1);

            TEST_SAVE(sum1);
            TEST_SAVE(sqsum1);
            TEST_SAVE(tilted1);
        }
        else
        {
            TEST_LOAD(src);

            TEST_LOAD(sum1);
            TEST_LOAD(sqsum1);
            TEST_LOAD(tilted1);

            f.Call(src, sum2, sqsum2, tilted2);

            TEST_SAVE(sum2);
            TEST_SAVE(sqsum2);
            TEST_SAVE(tilted2);

            result = result && Compare(sum1, sum2, 0, true, 32, 0, "sum");
            result = result && Compare(sqsum1, sqsum2, 0, true, 32, 0, "sqsum");
            result = result && Compare(tilted1, tilted2, 0, true, 32, 0, "tilted");
        }

        return result;
    }
コード例 #8
0
    bool YuvToAnyDataTest(bool create, int width, int height, bool is420, View::Format dstType, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        std::cout << (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "]." << std::endl;

        const int uvWidth = is420 ? width/2 : width;
        const int uvHeight = is420 ? height/2 : height;

        View y(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View u(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
        View v(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));

        View dst1(width, height, dstType, NULL, TEST_ALIGN(width));
        View dst2(width, height, dstType, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(y);
            FillRandom(u);
            FillRandom(v);

            TEST_SAVE(y);
            TEST_SAVE(u);
            TEST_SAVE(v);

            f.Call(y, u, v, dst1);

            TEST_SAVE(dst1);
        }
        else
        {
            TEST_LOAD(y);
            TEST_LOAD(u);
            TEST_LOAD(v);

            TEST_LOAD(dst1);

            f.Call(y, u, v, dst2);

            TEST_SAVE(dst2);

            result = result && Compare(dst1, dst2, 0, true, 64);
        }

        return result;
    }
コード例 #9
0
ファイル: TestYuvToBgra.cpp プロジェクト: pozdneev/Simd
    bool YuvToBgraDataTest(bool create, int width, int height, const Func & f, int dx, int dy)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        const int uvWidth = width/dx;
        const int uvHeight = height/dy;

        View y(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View u(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));
        View v(uvWidth, uvHeight, View::Gray8, NULL, TEST_ALIGN(uvWidth));

        View bgra1(width, height, View::Bgra32, NULL, TEST_ALIGN(width));
        View bgra2(width, height, View::Bgra32, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(y);
            FillRandom(u);
            FillRandom(v);

            TEST_SAVE(y);
            TEST_SAVE(u);
            TEST_SAVE(v);

            f.Call(y, u, v, bgra1);

            TEST_SAVE(bgra1);
        }
        else
        {
            TEST_LOAD(y);
            TEST_LOAD(u);
            TEST_LOAD(v);

            TEST_LOAD(bgra1);

            f.Call(y, u, v, bgra2);

            TEST_SAVE(bgra2);

            result = result && Compare(bgra1, bgra2, 0, true, 64);
        }

        return result;
    }
コード例 #10
0
ファイル: TestBgr48pToBgra32.cpp プロジェクト: pozdneev/Simd
    bool Bgr48pToBgra32DataTest(bool create, int width, int height, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View blue(width, height, View::Int16, NULL, TEST_ALIGN(width));
        View green(width, height, View::Int16, NULL, TEST_ALIGN(width));
        View red(width, height, View::Int16, NULL, TEST_ALIGN(width));

        uint8_t alpha = 0xFF;

        View bgra1(width, height, View::Bgra32, NULL, TEST_ALIGN(width));
        View bgra2(width, height, View::Bgra32, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(blue);
            FillRandom(green);
            FillRandom(red);

            TEST_SAVE(blue);
            TEST_SAVE(green);
            TEST_SAVE(red);

            f.Call(blue, green, red, bgra1, alpha);

            TEST_SAVE(bgra1);
        }
        else
        {
            TEST_LOAD(blue);
            TEST_LOAD(green);
            TEST_LOAD(red);

            TEST_LOAD(bgra1);

            f.Call(blue, green, red, bgra2, alpha);

            TEST_SAVE(bgra2);

            result = result && Compare(bgra1, bgra2, 0, true, 32);
        }

        return result;
    }
コード例 #11
0
ファイル: TestDeinterleave.cpp プロジェクト: ashh87/Simd
    bool DeinterleaveUvDataTest(bool create, int width, int height, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View uv(width, height, View::Uv16, NULL, TEST_ALIGN(width));

        View u1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View v1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View u2(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View v2(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(uv);

            TEST_SAVE(uv);

            f.Call(uv, u1, v1);

            TEST_SAVE(u1);
            TEST_SAVE(v1);
        }
        else
        {
            TEST_LOAD(uv);

            TEST_LOAD(u1);
            TEST_LOAD(v1);

            f.Call(uv, u2, v2);

            TEST_SAVE(u2);
            TEST_SAVE(v2);

            result = result && Compare(u1, u2, 0, true, 32, 0, "u");
            result = result && Compare(v1, v2, 0, true, 32, 0, "v");
        }

        return result;
    }
コード例 #12
0
ファイル: TestShift.cpp プロジェクト: fengbingchun/CUDA_Test
    bool ShiftBilinearDataTest(bool create, int width, int height, View::Format format, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        std::cout << (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "]." << std::endl;

        View s(width, height, format, NULL, TEST_ALIGN(width));
        View b(width, height, format, NULL, TEST_ALIGN(width));
        View d1(width, height, format, NULL, TEST_ALIGN(width));
        View d2(width, height, format, NULL, TEST_ALIGN(width));

        const double dx = -5.3, dy = 3.7;
        const int crop = 3;

        if(create)
        {
            FillRandom(s);
            FillRandom(b);
            TEST_SAVE(s);
            TEST_SAVE(b);

            f.Call(s, b, dx, dy, crop, crop, width - crop, height - crop, d1);

            TEST_SAVE(d1);
        }
        else
        {
            TEST_LOAD(s);
            TEST_LOAD(b);
            TEST_LOAD(d1);

            f.Call(s, b, dx, dy, crop, crop, width - crop, height - crop, d2);

            TEST_SAVE(d2);

            result = result && Compare(d1, d2, 0, true, 64);
        }

        return result;
    }
コード例 #13
0
ファイル: TestAnyToAny.cpp プロジェクト: Winddoing/MyCode
    bool AnyToAnyAutoTest(int width, int height, View::Format srcType, View::Format dstType, const Func & f1, const Func & f2)
    {
        bool result = true;

        TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " for size [" << width << "," << height << "].");

        View src(width, height, srcType, NULL, TEST_ALIGN(width));
        FillRandom(src);

        View dst1(width, height, dstType, NULL, TEST_ALIGN(width));
        View dst2(width, height, dstType, NULL, TEST_ALIGN(width));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(src, dst1));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(src, dst2));

        result = result && Compare(dst1, dst2, 0, true, 64);

        return result;
    }
コード例 #14
0
ファイル: TestStretchGray.cpp プロジェクト: nagyist/Simd
    bool StretchGrayDataTest(bool create, int width, int height, const Func & f, int stretch)
    {
        bool result = true;

        Data data(f.description);

        std::cout << (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "]." << std::endl;

        const int stretchedWidth = width*stretch;
        const int stretchedHeight = height*stretch;

        View s(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        View d1(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));
        View d2(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));

        if(create)
        {
            FillRandom(s);

            TEST_SAVE(s);

            f.Call(s, d1);

            TEST_SAVE(d1);
        }
        else
        {
            TEST_LOAD(s);

            TEST_LOAD(d1);

            f.Call(s, d2);

            TEST_SAVE(d2);

            result = result && Compare(d1, d2, 0, true, 64);
        }

        return result;
    }
コード例 #15
0
ファイル: TestAnyToAny.cpp プロジェクト: Winddoing/MyCode
    bool AnyToAnyDataTest(bool create, int width, int height, View::Format srcType, View::Format dstType, const Func & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View src(width, height, srcType, NULL, TEST_ALIGN(width));

        View dst1(width, height, dstType, NULL, TEST_ALIGN(width));
        View dst2(width, height, dstType, NULL, TEST_ALIGN(width));

        if(create)
        {
            FillRandom(src);

            TEST_SAVE(src);

            f.Call(src, dst1);

            TEST_SAVE(dst1);
        }
        else
        {
            TEST_LOAD(src);

            TEST_LOAD(dst1);

            f.Call(src, dst2);

            TEST_SAVE(dst2);

            result = result && Compare(dst1, dst2, 0, true, 64, 0);
        }

        return result;
    }
コード例 #16
0
ファイル: TestShift.cpp プロジェクト: Winddoing/MyCode
	bool ShiftAutoTest(View::Format format, int width, int height, double dx, double dy, int crop, const Func & f1, const Func & f2)
	{
		bool result = true;

		TEST_LOG_SS(Info, std::setprecision(1) << std::fixed << "Test " << f1.description << " & " << f2.description 
            << " [" << width << ", " << height << "]," << " (" << dx << ", " << dy << ", " << crop << ").");

		View s(width, height, format, NULL, TEST_ALIGN(width));
		FillRandom(s);
		View b(width, height, format, NULL, TEST_ALIGN(width));
		FillRandom(b);

		View d1(width, height, format, NULL, TEST_ALIGN(width));
		View d2(width, height, format, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(s, b, dx, dy, crop, crop, width - crop, height - crop, d1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(s, b, dx, dy, crop, crop, width - crop, height - crop, d2));

		result = result && Compare(d1, d2, 0, true, 32);

		return result;
	}
コード例 #17
0
ファイル: TestStretchGray.cpp プロジェクト: nagyist/Simd
	bool StretchGrayAutoTest(int width, int height, const Func & f1, const Func & f2, int stretch)
	{
		bool result = true;

		std::cout << "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "]." << std::endl;

		const int stretchedWidth = width*stretch;
		const int stretchedHeight = height*stretch;

		View s(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		FillRandom(s);

		View d1(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));
		View d2(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(s, d1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(s, d2));

		result = result && Compare(d1, d2, 0, true, 64);

		return result;
	}
コード例 #18
0
ファイル: TestDeinterleave.cpp プロジェクト: ashh87/Simd
	bool DeinterleaveUvAutoTest(int width, int height, const Func & f1, const Func & f2)
	{
		bool result = true;

		TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "].");

		View uv(width, height, View::Uv16, NULL, TEST_ALIGN(width));
		FillRandom(uv);

		View u1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		View v1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		View u2(width, height, View::Gray8, NULL, TEST_ALIGN(width));
		View v2(width, height, View::Gray8, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(uv, u1, v1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(uv, u2, v2));

		result = result && Compare(u1, u2, 0, true, 32);
		result = result && Compare(v1, v2, 0, true, 32);

		return result;
	}