testScanLineApi (const std::string &tempDir)
{
    try
    {
        cout << "Testing the scanline API for tiled files" << endl;

        const int W = 48;
        const int H = 81;
        const int DX = -17;
        const int DY = -29;
        
        Array2D<unsigned int> pi (H, W);
        Array2D<half> ph (H, W);
        Array2D<float> pf (H, W);
        fillPixels (pi, ph, pf, W, H);

	int maxThreads = ILMTHREAD_NAMESPACE::supportsThreads()? 3: 0;

	for (int n = 0; n <= maxThreads; ++n)
	{
	    if (ILMTHREAD_NAMESPACE::supportsThreads())
	    {
		setGlobalThreadCount (n);
		cout << "\nnumber of threads: " << globalThreadCount() << endl;
	    }

	    for (int lorder = 0; lorder < NUM_LINEORDERS; ++lorder)
	    {
		for (int rmode = 0; rmode < NUM_ROUNDINGMODES; ++rmode)
		{
		    writeRead (tempDir, pi, ph, pf,  W, H, 
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 1, 1);

		    writeRead (tempDir, pi, ph, pf, W, H, 
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 1, 1);
		    
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 24, 26);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 24, 26);
		    
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 48, 81);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 48, 81);
			       
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 128, 96);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 128, 96);
		}
	    }
	}

        cout << "ok\n" << endl;
    }
    catch (const std::exception &e)
    {
        cerr << "ERROR -- caught exception: " << e.what() << endl;
        assert (false);
    }
}
testScanLineApi (const std::string &tempDir)
{
    try
    {
        cout << "Testing the scanline API for tiled files" << endl;

        const int W = 48;
        const int H = 81;
        const int DX = -17;
        const int DY = -29;
        
        Array2D<unsigned int> pi (H, W);
        Array2D<half> ph (H, W);
        Array2D<float> pf (H, W);
        fillPixels (pi, ph, pf, W, H);

	int maxThreads = ILMTHREAD_NAMESPACE::supportsThreads()? 3: 0;

	for (int n = 0; n <= maxThreads; ++n)
	{
	    if (ILMTHREAD_NAMESPACE::supportsThreads())
	    {
		setGlobalThreadCount (n);
		cout << "\nnumber of threads: " << globalThreadCount() << endl;
	    }

	    for (int lorder = 0; lorder < NUM_LINEORDERS; ++lorder)
	    {
		for (int rmode = 0; rmode < NUM_ROUNDINGMODES; ++rmode)
		{
		    writeRead (tempDir, pi, ph, pf,  W, H, 
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 1, 1);

		    writeRead (tempDir, pi, ph, pf, W, H, 
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 1, 1);
		    
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 24, 26);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 24, 26);
		    
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 48, 81);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 48, 81);
			       
		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       0, 0, 128, 96);

		    writeRead (tempDir, pi, ph, pf, W, H,
			       LineOrder (lorder),
			       ZIP_COMPRESSION,
			       LevelRoundingMode (rmode),
			       DX, DY, 128, 96);
		}
	    }
	}

        cout << "ok\n" << endl;
    }
    catch (const std::exception &e)
    {
        cerr << "ERROR -- caught exception: " << e.what() << endl;
        assert (false);
    }
}