[Gdal-dev] ECW Still hanging - is running on SMP a problem?

Bill Binko bill at binko.net
Fri Sep 2 02:06:28 EDT 2005


James, 

I have put together a collection of three fixes into a patch that might
get you through this.  Each one has reduced my hanging issues 
considerably, and I am now seeing my conversions progress.  There might be 
more, but for now I'm working.

I've included it below.  You can apply it with 
patch -p1 < patch.file
in your top-level ecw directory or 
patch -p2 < patch.file
from your Source directory.

I hope this helps.

Bill

diff -rc orig/Source/C/NCSEcw/NCSEcw/ncscbm.c ecw32beta/Source/C/NCSEcw/NCSEcw/ncscbm.c
*** orig/Source/C/NCSEcw/NCSEcw/ncscbm.c	2005-06-11 18:27:06.000000000 -0400
--- ecw32beta/Source/C/NCSEcw/NCSEcw/ncscbm.c	2005-09-01 18:27:39.762737634 -0400
***************
*** 1181,1189 ****
  	if(NCScbmGetFileBlockSizeLocal(pNCSFile, nBlock, &length, &offset)) {
  		QmfLevelStruct	*pTopQmf = pNCSFile->pTopQmf;		// we always go relative to the top level
  		UINT32  nPaddedLength = 1;
! 
! 		while(nPaddedLength < length) {
! 			nPaddedLength *= 2;
  		}
  		*pBlockLength = length;
  
--- 1181,1194 ----
  	if(NCScbmGetFileBlockSizeLocal(pNCSFile, nBlock, &length, &offset)) {
  		QmfLevelStruct	*pTopQmf = pNCSFile->pTopQmf;		// we always go relative to the top level
  		UINT32  nPaddedLength = 1;
! 		
! 		if (length %4 == 0) //on a word boundary
! 		{
! 			nPaddedLength = length;
! 		}
! 		else
! 		{
! 			nPaddedLength = (((int)(length/4)) + 1) *4;
  		}
  		*pBlockLength = length;
  
diff -rc orig/Source/C/NCSEcw/NCSEcw/NCSEcw.cpp ecw32beta/Source/C/NCSEcw/NCSEcw/NCSEcw.cpp
*** orig/Source/C/NCSEcw/NCSEcw/NCSEcw.cpp	2005-06-11 18:27:06.000000000 -0400
--- ecw32beta/Source/C/NCSEcw/NCSEcw/NCSEcw.cpp	2005-09-02 01:47:48.858287669 -0400
***************
*** 1019,1025 ****
  				NCSEcwStatsDecrement(&pNCSEcwInfo->pStatistics->nUnpackedBlocksCacheSize, pNextCachedBlock->nUnpackedECWBlockLength);
  				NCSEcwStatsUnLock();
  			}
! 			pNextCachedBlock = pNextCachedBlock->pNextCachedBlock;
  		}
  	}
  
--- 1019,1036 ----
  				NCSEcwStatsDecrement(&pNCSEcwInfo->pStatistics->nUnpackedBlocksCacheSize, pNextCachedBlock->nUnpackedECWBlockLength);
  				NCSEcwStatsUnLock();
  			}
! 			if (pNextCachedBlock == pNextCachedBlock->pNextCachedBlock)
! 			  {
! 			    /*Get rid of simple self-cycles here*/
! 			    pNextCachedBlock = NULL;
! 			  }
! 			else
! 			  {
! 			    /*And prevent bigger problems here*/
! 			    NCSFileCachedBlock *prevBlock = pNextCachedBlock;
! 			    pNextCachedBlock = pNextCachedBlock->pNextCachedBlock;
! 			    prevBlock->pNextCachedBlock = NULL; 
! 			  }
  		}
  	}
  
diff -rc orig/Source/C/NCSUtil/thread.c ecw32beta/Source/C/NCSUtil/thread.c
*** orig/Source/C/NCSUtil/thread.c	2005-05-24 09:37:20.000000000 -0400
--- ecw32beta/Source/C/NCSUtil/thread.c	2005-09-02 01:44:59.110019686 -0400
***************
*** 202,207 ****
--- 202,210 ----
  		NCSThreadInfo *pThreadInfo = (NCSThreadInfo*)NCSMalloc(sizeof(NCSThreadInfo), TRUE);
  
  		NCSMutexBegin(&mMutex);
+ 
+ 		pThreadInfo->bThreadRunning = FALSE; 
+ 
  		pThreadInfo->tid = tidNextTID++;
  		NCSMutexEnd(&mMutex);
  
***************
*** 271,276 ****
--- 274,282 ----
  	if( pThreadInfo ) {
  
  		NCSMutexBegin(&mMutex);
+ 
+ 		pThreadInfo->bThreadRunning = FALSE; 
+ 
  		pThreadInfo->tid = tidNextTID++;
  		NCSMutexEnd(&mMutex);
  
***************
*** 356,361 ****
--- 362,370 ----
  	NCSThreadInfo *pThreadInfo = (NCSThreadInfo*)NCSMalloc(sizeof(NCSThreadInfo), TRUE);
  
  	NCSMutexBegin(&mMutex);
+ 
+ 	pThreadInfo->bThreadRunning = FALSE; 
+ 
  	pThreadInfo->tid = tidNextTID++;
  	NCSMutexEnd(&mMutex);
  



More information about the Gdal-dev mailing list