Click here to Skip to main content
15,903,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Registry editor Pin
Roger Stoltz12-Apr-07 2:29
Roger Stoltz12-Apr-07 2:29 
AnswerRe: Registry editor Pin
Hamid_RT19-Apr-07 21:56
Hamid_RT19-Apr-07 21:56 
QuestionProblem with Mnemonics of a Group box Pin
sw@thi12-Apr-07 0:14
sw@thi12-Apr-07 0:14 
QuestionProblem in running Window service Pin
ArunkumarSundaravelu11-Apr-07 23:43
ArunkumarSundaravelu11-Apr-07 23:43 
AnswerRe: Problem in running Window service Pin
bob1697212-Apr-07 5:40
bob1697212-Apr-07 5:40 
QuestionMemory Leak Pin
Rassul Yunussov11-Apr-07 23:30
Rassul Yunussov11-Apr-07 23:30 
QuestionRe: Memory Leak Pin
Mark Salsbery12-Apr-07 7:50
Mark Salsbery12-Apr-07 7:50 
AnswerRe: Memory Leak Pin
Rassul Yunussov12-Apr-07 22:43
Rassul Yunussov12-Apr-07 22:43 
Well, i looked in the task manager - when this process is running the momory grows up.
Here is code in pre tags
UINT __cdecl CGNTGDALDlg::GNTClassificationFunction( LPVOID pParam )
{
	ThreadStruct* pStruct = (ThreadStruct*)pParam;
	int n = pStruct->pDlg->m_Image.GetHeight();
	int m = pStruct->pDlg->m_Image.GetWidth();
	int LineLength = pStruct->pDlg->m_Image.GetPitch();
	unsigned char* Bitmap = (unsigned char*)pStruct->pDlg->m_Image.GetBits();
	Bitmap+=LineLength*pStruct->Offset;
	if(pStruct->pDlg->m_floatingWindowSize==0)
	{
		__declspec(align(16)) float* pInputs =(float*) _aligned_malloc(pStruct->pDlg->m_poDataset->GetRasterCount()*sizeof(float),16);
		for(int i =pStruct->Offset;i<pStruct->End;i++)
			{
				for(int j = abs(LineLength%m),l=0;j<m*3,l<m;j+=3,l++)
				{
						double distance;
						CGNTNeuron* pNeuron;
						double Norm = 0;
						for(int k = 0;k<pStruct->pDlg->m_poDataset->GetRasterCount();k++)
						{
							pInputs[k] = pStruct->pDlg->m_pImageMatrix[k][i][m-l-1];
							Norm+=pInputs[k];
						}
						Norm = sqrt(Norm);
						for(int k = 0;k<pStruct->pDlg->m_poDataset->GetRasterCount();k++)
							pInputs[k]/=Norm;
						EnterCriticalSection(&pStruct->pDlg->m_CriticalSection);
						unsigned int value = pStruct->pDlg->m_pGNTNet->Propagate(pInputs,distance,&pNeuron);		
						LeaveCriticalSection(&pStruct->pDlg->m_CriticalSection);
						
						*(Bitmap-LineLength-j-1) = GetRValue(value);//eto krasnii
						*(Bitmap-LineLength-j-2) = GetGValue(value);//eto zelenii
						*(Bitmap-LineLength-j-3) = GetBValue(value);//eto sinii
				}
				Bitmap+=LineLength;
			}
		_aligned_free(pInputs);
	}
	else
	{
		__declspec(align(16)) float* pInputs =(float*) _aligned_malloc(pStruct->pDlg->m_floatingWindowSize*pStruct->pDlg->m_floatingWindowSize*pStruct->pDlg->m_poDataset->GetRasterCount()*sizeof(float),16);
		for(int i =pStruct->Offset;i<pStruct->End;i++)
			{
				if(i<pStruct->pDlg->m_poDataset->GetRasterYSize()-pStruct->pDlg->m_floatingWindowSize)
				for(int j = abs(LineLength%m),l=0;j<m*3,l<m;j+=3,l++)
				{
					if(l<pStruct->pDlg->m_poDataset->GetRasterXSize()-pStruct->pDlg->m_floatingWindowSize)
					{
							double distance;
							CGNTNeuron* pNeuron;
							int ll = 0;
							double Norm = 0;
							for(int k = 0;k<pStruct->pDlg->m_poDataset->GetRasterCount();k++)
								for(int ii = i;ii<i+pStruct->pDlg->m_floatingWindowSize;ii++)
									for(int jj = l;jj<l+pStruct->pDlg->m_floatingWindowSize;jj++)
									{
										pInputs[ll++] = pStruct->pDlg->m_pImageMatrix[k][ii][m-jj-1];
										Norm+=pStruct->pDlg->m_pImageMatrix[k][ii][m-jj-1]*pStruct->pDlg->m_pImageMatrix[k][ii][m-jj-1];
									}
							Norm = sqrt(Norm);
							for(int k = 0;k<pStruct->pDlg->m_poDataset->GetRasterCount()*pStruct->pDlg->m_floatingWindowSize*pStruct->pDlg->m_floatingWindowSize;k++)
								pInputs[k]/=Norm;
							EnterCriticalSection(&pStruct->pDlg->m_CriticalSection);
							unsigned int Value  = pStruct->pDlg->m_pGNTNet->Propagate(pInputs,distance,&pNeuron);		
							LeaveCriticalSection(&pStruct->pDlg->m_CriticalSection);
							*(Bitmap-LineLength-j-1) = GetRValue(Value);//eto krasnii
							*(Bitmap-LineLength-j-2) = GetGValue(Value);//eto zelenii
							*(Bitmap-LineLength-j-3) = GetBValue(Value);//eto sinii

					}
				}
				Bitmap+=LineLength;
		}
		_aligned_free(pInputs);
	}
	return 0;
}

GeneralRe: Memory Leak Pin
Mark Salsbery13-Apr-07 7:23
Mark Salsbery13-Apr-07 7:23 
GeneralRe: Memory Leak Pin
Rassul Yunussov15-Apr-07 18:33
Rassul Yunussov15-Apr-07 18:33 
QuestionKEYEVENTF_UNICODE macro Pin
Syamlal S Nair11-Apr-07 23:20
Syamlal S Nair11-Apr-07 23:20 
AnswerRe: KEYEVENTF_UNICODE macro Pin
Gospodin Baron12-Apr-07 3:19
Gospodin Baron12-Apr-07 3:19 
GeneralRe: KEYEVENTF_UNICODE macro Pin
Syamlal S Nair16-Apr-07 22:47
Syamlal S Nair16-Apr-07 22:47 
Questionprograming with port USB Pin
maheno11-Apr-07 23:12
maheno11-Apr-07 23:12 
AnswerRe: programing with port USB Pin
Rajesh R Subramanian12-Apr-07 1:51
professionalRajesh R Subramanian12-Apr-07 1:51 
Questionloading the whole text file into an array Pin
cyn811-Apr-07 22:44
cyn811-Apr-07 22:44 
AnswerRe: loading the whole text file into an array Pin
toxcct11-Apr-07 23:04
toxcct11-Apr-07 23:04 
GeneralRe: loading the whole text file into an array Pin
cyn811-Apr-07 23:15
cyn811-Apr-07 23:15 
GeneralRe: loading the whole text file into an array Pin
toxcct11-Apr-07 23:19
toxcct11-Apr-07 23:19 
GeneralRe: loading the whole text file into an array Pin
cyn811-Apr-07 23:35
cyn811-Apr-07 23:35 
AnswerRe: loading the whole text file into an array Pin
Cedric Moonen11-Apr-07 23:10
Cedric Moonen11-Apr-07 23:10 
GeneralRe: loading the whole text file into an array Pin
cyn811-Apr-07 23:19
cyn811-Apr-07 23:19 
AnswerRe: loading the whole text file into an array Pin
Paresh Chitte11-Apr-07 23:10
Paresh Chitte11-Apr-07 23:10 
AnswerRe: loading the whole text file into an array Pin
Gospodin Baron11-Apr-07 23:17
Gospodin Baron11-Apr-07 23:17 
GeneralRe: loading the whole text file into an array Pin
toxcct11-Apr-07 23:21
toxcct11-Apr-07 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.