Thank you Even, I maganed to compile properly in x86 today. I was setting WIN64 to NO, instead of just commenting it out. Maybe that was the culprit.
Unfortunately, I still get the same error: ERROR 7: Assertion `poNewest->poPrevious == NULL' failed in file `c:\ericsson\3rdparties\gdal-2.1.0\gcore\gdalrasterblock.cpp', line 800 I have attached a simple code to reproduce it (Test.cpp). If you need the whole solution just ask me, although it is a very simple console test. I have also shared with you the zipped datasets through this link: https://drive.google.com/file/d/0B-OCl1FjBi0YblRPRGZlQWx4eEE/view?usp=sharing Just place them along with Test.exe file. IMPORTANT: Bear in mind that these datasets come in a format still not supported officially by GDAL, as I am developing the driver. It is almost finished (just a few details pending) and fully working. Find the driver attached (Wizard_Driver.7z). By the way, what do we have to do to contribute with this new driver for GDAL? Thank you so much Even. Javier. -----Original Message----- From: Even Rouault [mailto:[email protected]] Sent: 28 July, 2016 17:42 To: Francisco Javier Calzado <[email protected]> Cc: [email protected] Subject: Re: [gdal-dev] Multithreading issue on pixel-based intensive access (GDAL 2.1.0) On Thursday 28 July 2016 13:11:13 Francisco Javier Calzado wrote: > Thanks Even, > > I don't want to waste your time, so just before sending any code to be > tested I would like to be sure it is not a bug from my side. Although > I usually work with GDAL compiled in 64bits, I had to swap to x86 for > these tests. When trying to compile in 32bits with Visual Studio 2015 > I got the following unresolved symbols: Javier, Make sure the Visual Studio 32bit environment is properly set up. Check that WIN64 from nmake.opt is let commented out. Example of successful build: https://ci.appveyor.com/project/rouault/gdal-coverage/build/job/8widewvmhgjotxs5 Even -- Spatialys - Geospatial professional services http://www.spatialys.com
Wizard_Driver.7z
Description: Wizard_Driver.7z
// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <gdal_priv.h>
#include <functional>
#include <thread>
#include <future>
int main()
{
// GDAL initialization.
GDALAllRegister();
GDALSetCacheMax(1048576 * 1000); // 1GB aprox.
// Vector with dataset files.
std::vector<std::string> files;
for (int i = 1; i < 3; i++)
{
std::string currFile = "Dataset_" + std::to_string(i) + ".grd";
files.push_back(currFile);
}
// Functor for the threads.
std::function<void(std::string)> funct = [=](std::string filePath)
{
// Open source DS.
GDALDataset* poDSsource =
(GDALDataset*)GDALOpen(filePath.c_str(), GA_ReadOnly);
int sizeX = poDSsource->GetRasterXSize();
int sizeY = poDSsource->GetRasterYSize();
double noDataValue =
poDSsource->GetRasterBand(1)->GetNoDataValue();
GDALDataType datatype =
poDSsource->GetRasterBand(1)->GetRasterDataType();
// Create target DS.
GDALDriver* driver = (GDALDriver*)GDALGetDriverByName("WIZARD");
char** papszCreationOptions = NULL;
papszCreationOptions = CSLAddNameValue(papszCreationOptions,
"WIZARD_OLD_FILE_VER", "YES");
papszCreationOptions = CSLAddNameValue(papszCreationOptions,
"WIZARD_GRID_TYPE", "TERELEV");
GDALDataset* poDStarget = driver->Create(std::string(filePath +
".out").c_str(), sizeX, sizeY, 1, datatype, papszCreationOptions);
// ITERATION. Just copy pixels from source to target
(increasing value by 1).
for (int y = 0; y < sizeY; y++)
{
for (int x = 0; x < sizeX; x++)
{
short value;
GDALRasterBlock* poBlockSource =
poDSsource->GetRasterBand(1)->GetLockedBlockRef(0, y);
void* poDataSource =
poBlockSource->GetDataRef();
value = ((short*)poDataSource)[x];
poBlockSource->DropLock();
GDALRasterBlock* poBlockTarget =
poDStarget->GetRasterBand(1)->GetLockedBlockRef(0, y);
void* poDataTarget =
poBlockTarget->GetDataRef();
((short*)poDataTarget)[x] = value + 1;
poBlockTarget->MarkDirty();
poBlockTarget->DropLock();
}
}
// Close Dataset.
GDALClose(poDSsource);
GDALClose(poDStarget);
// Destroy driver.
GDALDestroyDriver(driver);
};
std::vector<std::future<void>> futures;
for (std::string currFile : files)
{
futures.push_back(std::async(funct, currFile));
}
for (const std::future<void>& fut : futures)
{
fut.wait();
}
system("PAUSE");
return 0;
}
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
