Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: FILETIME / WinAPI Pin
vasu_sri18-Oct-10 23:32
vasu_sri18-Oct-10 23:32 
GeneralRe: FILETIME / WinAPI Pin
Fareed Rizkalla18-Oct-10 23:51
Fareed Rizkalla18-Oct-10 23:51 
QuestionRe: FILETIME / WinAPI Pin
David Crow19-Oct-10 4:18
David Crow19-Oct-10 4:18 
AnswerRe: FILETIME / WinAPI Pin
Fareed Rizkalla19-Oct-10 13:16
Fareed Rizkalla19-Oct-10 13:16 
Questionedit box taking 1108 lines Pin
learningvisualc18-Oct-10 21:48
learningvisualc18-Oct-10 21:48 
AnswerRe: edit box taking 1108 lines Pin
Sauro Viti18-Oct-10 22:02
professionalSauro Viti18-Oct-10 22:02 
AnswerRe: edit box taking 1108 lines Pin
«_Superman_»18-Oct-10 22:42
professional«_Superman_»18-Oct-10 22:42 
QuestionChallenging question for AVI Reading experts Pin
gonsalvesroger18-Oct-10 19:34
gonsalvesroger18-Oct-10 19:34 
With same code and same AVI file, the intensity value read are different on different machine.
On some machine black area is read as 0 and on some machine it is read as non zero value (viz. 4, 5, 7 etc)
Both the machines uses Main Concept MJPEG codec for reading of AVI files.

Below is code snippet used to open the AVI file
HRESULT hResult = 0;
AVIFileInit() ;

hResult = AVIFileOpen( &m_AviFile, m_strAVIFileName, OF_READ, NULL ) ;
if(hResult != 0)
{
	TRACE( _T("AVIFileOpen() Error!!\n") ) ;
}

hResult = AVIFileGetStream(m_AviFile, &m_Stream, streamtypeVIDEO, 0);
if(hResult != 0)
{
	TRACE( _T("AVIFileGetStream() Error!!\n"));
}

AVIStreamAddRef(m_Stream );

hResult = AVIStreamInfo(m_Stream, &m_StreamInfo, sizeof(AVISTREAMINFO));
if(hResult != 0)
{
	TRACE( _T("AVIStreamInfo() Error!!\n") ) ;
}

m_nEndFrame = (short)((AVIStreamEnd( m_Stream )) - 1) ;

long nLength = AVIStreamLength(m_Stream);

long lSize;
hResult = AVIStreamReadFormat(m_Stream, 0, NULL, &lSize);

m_pBitmapInfoHeader = (BITMAPINFOHEADER*)GlobalAllocPtr(GHND, lSize);

hResult = AVIStreamReadFormat(m_Stream, 0, (LPVOID)m_pBitmapInfoHeader, &lSize);

if(m_pBitmapInfoHeader->biBitCount == 16)
{
	m_pBitmapInfoHeader->biBitCount = 24;
}
m_pBitmapInfoHeader->biCompression = BI_RGB;
m_pBitmapInfoHeader->biSizeImage   = (DWORD)m_StreamInfo.dwSampleSize;

m_pBitmapInfoHeader->biSize = sizeof(BITMAPINFOHEADER);
m_GetFrame = AVIStreamGetFrameOpen( m_Stream,m_pBitmapInfoHeader);


Below function is used to retrieve the starting address for particular Frame
BYTE* GetFrameAVI(UINT nFrameNumber)
{
	return (BYTE*)AVIStreamGetFrame(m_GetFrame,nFrameNumber);
}



Starting address of bit data is calculated as follows
BYTE* GetBitAddress( BYTE* pDIB ) 
{
	TRY
	{
		if ( pDIB == NULL )
		{
			return NULL ;
		}

		WORD wBitCount = ((BITMAPINFOHEADER*)pDIB)->biBitCount ;

		DWORD dwNumColors = 0 ;
		if ( wBitCount != 24 )
		{
			dwNumColors = ((BITMAPINFOHEADER*)pDIB)->biClrUsed ;
			if ( dwNumColors == 0 )
			{
				switch ( wBitCount )
				{
					// PixelBitMonochrome
				case 1 :
					dwNumColors = 2 ;
					break;

					// PixelBit16Color
				case 4 :
					dwNumColors  = 16 ;
					break;

					// PixelBit256Color
				case 8 :
					dwNumColors = 256 ;
					break;
				default:
					dwNumColors = 0;
					break;
				}
			}
		}

		DWORD dwColorTableSize = (dwNumColors * sizeof( RGBQUAD )) ;

		DWORD dSize = 0;
		dSize = ((BITMAPINFOHEADER*)pDIB)->biSize ;

		return ((BYTE*)pDIB + dSize + dwColorTableSize) ;
	}
	CATCH (CException, pEx)
	{
		return NULL;
	}
	END_CATCH
}


What is the possible reasons for intensity being read differently?
(Does it had something to do with the Luminance from HSL?)
In case you need sample application, do let me know, so that I can mail the same.
QuestionOverflow in LPtoDP function Pin
ashtwin18-Oct-10 18:31
ashtwin18-Oct-10 18:31 
AnswerRe: Overflow in LPtoDP function Pin
Richard MacCutchan18-Oct-10 22:35
mveRichard MacCutchan18-Oct-10 22:35 
GeneralRe: Overflow in LPtoDP function Pin
ashtwin19-Oct-10 3:11
ashtwin19-Oct-10 3:11 
GeneralRe: Overflow in LPtoDP function Pin
Richard MacCutchan19-Oct-10 4:30
mveRichard MacCutchan19-Oct-10 4:30 
GeneralRe: Overflow in LPtoDP function Pin
ashtwin21-Oct-10 23:09
ashtwin21-Oct-10 23:09 
GeneralRe: Overflow in LPtoDP function Pin
Richard MacCutchan22-Oct-10 2:44
mveRichard MacCutchan22-Oct-10 2:44 
Questionstatic text box new line problem Pin
raju_shiva18-Oct-10 18:04
raju_shiva18-Oct-10 18:04 
AnswerRe: static text box new line problem Pin
vasu_sri18-Oct-10 19:01
vasu_sri18-Oct-10 19:01 
QuestionHow to use " CMFCPropertyGridProperty "to have a button Pin
stevenyes18-Oct-10 5:42
stevenyes18-Oct-10 5:42 
AnswerRe: How to use " CMFCPropertyGridProperty "to have a button Pin
Andrew Truckle28-Feb-24 7:58
professionalAndrew Truckle28-Feb-24 7:58 
QuestionOn the Origin of CTabCtrlEx used in Tabbed Dialogs Pin
federico.strati18-Oct-10 4:00
federico.strati18-Oct-10 4:00 
AnswerRe: On the Origin of CTabCtrlEx used in Tabbed Dialogs Pin
Electron Shepherd18-Oct-10 6:16
Electron Shepherd18-Oct-10 6:16 
QuestionHow can get Domain name in given URL? Pin
Le@rner18-Oct-10 2:44
Le@rner18-Oct-10 2:44 
AnswerRe: How can get Domain name in given URL? Pin
Chris Losinger18-Oct-10 3:00
professionalChris Losinger18-Oct-10 3:00 
AnswerRe: How can get Domain name in given URL? Pin
Code-o-mat18-Oct-10 8:58
Code-o-mat18-Oct-10 8:58 
Questionfitnesse about C++ Pin
lxlenovostar18-Oct-10 2:12
lxlenovostar18-Oct-10 2:12 
AnswerRe: fitnesse about C++ Pin
Maximilien18-Oct-10 3:42
Maximilien18-Oct-10 3:42 

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.