[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] tools/dtdriver/decoder/video Umakefil, 1.5,
From:       hychoi () helixcommunity ! org
Date:       2008-08-22 7:47:15
Message-ID: 200808220751.m7M7pHRl010387 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/tools/dtdriver/decoder/video
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv22764

Modified Files:
	Umakefil vdecoder.cpp 
Log Message:
Modified by: Hayoung CHOI (hayoung.choi@ap.real.com)

Date: August 19, 2008

Project: Thumbnail Generation Improvement  Sub CR for color format conversion

Bug Number:

Bug URL: 

 

Synopsis:

=============

Basically, this CR is a sub one of thumbnail generation improvement CR.

Because to generate a thumbnail image file from a video file, the color format \
conversion should be done first while creating a thumbnail image.

Also the command-line option ¡°-CC¡± which stands for color conversion is added into \
the dtdrive application.

 

Overview: 

=============

1) OnVideoBlt() method modified

In datatype/tools/decoder/video/vdecoder.cpp, OnVideoBlt() method has been modified \
to be possible to convert to any color format supported by helix.

 

2) Adding color converting command-line option into the dtdrive application

In datatype/tools/dtdriver/app/main.cpp, the color convert command-line option is \
added so it could be used like below.

 > dtdrive +u +f -DV 1 -CC RGB24 -W prisoner_450k_480x_rgb24.raw \
prisoner_450k_480x.rm

In above example, the option -CC (Color Convert) means that this video color format \
to be converted as RGB24 color format and it to be written to the \
prisoner_450k_480x_rgb24.raw file.

 

Files Modified:

=============

[File 1]  Umakefil  I just added \
¡°project.AddSubModule('video/colconverter\\Umakefil', \
'video\\colconverter\\Makefile')¡± line to include colorcvt.dll library.

[File 2]  datatype/tools/dtdriver/apps/dtdrive/Umakefil

[File 3]  datatype/tools/dtdriver/apps/dtdrive/main.cpp

[File 4]  datatype/tools/dtdriver/engine/pub/ffdriver.h

[File 5]  datatype/tools/dtdriver/decoder/video/Umakefil

[File 6]  datatype/tools/dtdriver/decoder/video/vdecoder.cpp

[File 7]  datatype/tools/dtdriver/decoder/video/pub/vdecoder.h

[File 8] - video/vidutil/colormap.c

[File 9] - video/include/colormap.h

 

=============

Image Size and Heap Use impact (Client -Only):

NA

 

=============

Platforms and Profiles Affected:

x86 Windows XP professional SP2 (Pentium D CPU 3.40 Ghz)

 

=============

Distribution Libraries Affected:

dtdrviddec.lib

vidutillib.lib

 

=============

Distribution library impact and planned action:

NA

 

=============

Platforms and Profiles Build Verified:

System id: win32-i386-vc7

x86 Windows XP professional SP2 (Pentium D CPU 3.40 Ghz)

Microsoft Compiler 13.10.6030

 

=============

Platforms and Profiles Functionality verified:

x86 Windows XP professional SP2 (Pentium D CPU 3.40 Ghz)

 

Branch: hxclient_restricted

Target: dtdrive

Profile: helix-client-all-defineds

 

=============

Copyright assignment: 

I am a RealNetworks employee or contractor

=============

QA Instructions:

NA



Index: vdecoder.cpp
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/decoder/video/vdecoder.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- vdecoder.cpp	4 Jun 2008 13:13:03 -0000	1.19
+++ vdecoder.cpp	22 Aug 2008 07:47:13 -0000	1.20
@@ -57,10 +57,14 @@
 #include "stubstrm.h"
 #include "stubvplay.h"
 #include "stubsite.h"
-#include "vdecoder.h"
+
 #define HELIX_FEATURE_LOGLEVEL_NONE // uncomment to disable logging
 #include "hxtlogutil.h"
 
+#include "coloracc.h"	
+#include "colormap.h"
+#include "vdecoder.h"
+#include "hlxclib/stdlib.h"
 
 /*
 #ifndef HELIX_FEATURE_VIDREND_UNTIMED_DECODE
@@ -79,6 +83,8 @@
 #define TRACE_TARGET_DEBUGGER  0
 #endif
 
+#define HX_NO_COLOR_CONVERSION	0xFFFFFFFF
+
 CVideoSourceHandler::CVideoSourceHandler(IUnknown* pContext) :
 	CSourceHandler(pContext)
 {
@@ -107,6 +113,12 @@
     m_bProcessHeadersOnly     = 0;
     m_bSetSrcProperties       = 0;
     m_bFirstWrite	      = 1;
+	
+	m_ulColorFormatIn			= 0;
+	m_ulColorFormatOut		= 0;
+	m_bDoConversion			= FALSE;	
+	m_pNewData					= NULL;
+	m_pColorFuncAccessor	= NULL;
 
     if (m_pContext)
     {
@@ -528,6 +540,9 @@
     HX_RELEASE(m_pStream);
     HX_RELEASE(m_pSite);
     HX_RELEASE(m_pErrorMessages);
+	
+	HX_VECTOR_DELETE(m_pNewData);
+	HX_DELETE(m_pColorFuncAccessor);
 
     return HXR_OK;
 }
@@ -551,6 +566,11 @@
     m_bSetSrcProperties   = GetBOOLOption("SetSrcProperties",    \
                m_bSetSrcProperties);
     m_ulStartTime	  = GetULONG32Option("StartTime",        m_ulStartTime);
     m_ulProcessTimeUnits  = GetULONG32Option("ProcessTimeUnits", \
m_ulProcessTimeUnits); +	m_ulColorFormatOut = GetULONG32Option("ColorConvert", \
HX_NO_COLOR_CONVERSION); +	if (m_ulColorFormatOut != HX_NO_COLOR_CONVERSION)
+	{
+		m_bDoConversion = TRUE;		
+	}
 
     return retVal;
 }
@@ -660,10 +680,82 @@
 
     UINT32 currentTime = 0;
     m_pRenderTimeLine->GetTimeLineValue(currentTime);
+	
+	if (m_bFirstWrite) 
+	{
+		if (m_bDoConversion)
+		{
+			m_ulColorFormatIn = MapFourCCtoCID(pHeader->biCompression);
 
-    if(m_bFirstWrite && !m_bProcessHeadersOnly)
+			m_pColorFuncAccessor = new ColorFuncAccess(m_pContext);
+			if (m_pColorFuncAccessor)
+			{
+				m_pColorFuncAccessor->InitColorConverter();
+
+				HXBOOL bHasConvert = \
m_pColorFuncAccessor->CheckColorConverter(m_ulColorFormatIn, m_ulColorFormatOut); \
+				if (bHasConvert) +				{
+					memcpy(&m_cNewHeader, pHeader, sizeof(HXBitmapInfoHeader));
+
+					HXBitmapInfo btmInfo;
+					#ifdef _WIN32
+						MakeBitmap((LPBITMAPINFO)&btmInfo, sizeof(HXBitmapInfo), m_ulColorFormatOut, \
pHeader->biWidth, pHeader->biHeight, NULL, NULL); +					#else
+						MakeBitmap((HXBitmapInfo)&btmInfo, sizeof(HXBitmapInfo), m_ulColorFormatOut, \
pHeader->biWidth, pHeader->biHeight, NULL, NULL); +					#endif
+
+					m_cNewHeader.biWidth		= btmInfo.bmiHeader.biWidth;
+					m_cNewHeader.biHeight		= btmInfo.bmiHeader.biHeight;
+					m_cNewHeader.biCompression	= btmInfo.bmiHeader.biCompression;
+					m_cNewHeader.biBitCount		= btmInfo.bmiHeader.biBitCount;
+					m_cNewHeader.biSizeImage	= btmInfo.bmiHeader.biSizeImage;
+
+					m_pNewData = new BYTE[m_cNewHeader.biSizeImage];						
+					if (m_pNewData == NULL)
+					{
+						// OUT OF MEMORY
+						m_bDoConversion = FALSE;
+					}
+				}
+			}	
+			else 
+			{
+				// OUT OF MEMORY
+				m_bDoConversion = FALSE;
+			}
+		}
+	}
+
+	if (m_bDoConversion)
+	{
+		pHeader = &m_cNewHeader;
+		
+		if (m_pNewData)
+		{
+			memset(m_pNewData, 0, pHeader->biSizeImage);
+			int iRet = m_pColorFuncAccessor->ColorConvert(
+				m_ulColorFormatOut,											
+				m_pNewData,													
+				pHeader->biWidth, pHeader->biHeight,
+				abs(GetBitmapPitch2(m_ulColorFormatOut, pHeader->biWidth)),	// destination pitch
+				0, 0, pHeader->biWidth, pHeader->biHeight,
+				m_ulColorFormatIn,
+				pData,
+				pHeader->biWidth, pHeader->biHeight,
+				abs(GetBitmapPitch2(m_ulColorFormatIn, pHeader->biWidth)),	// source pitch
+				0, 0, pHeader->biWidth, pHeader->biHeight
+				);
+
+			if (iRet != -1)
+			{
+				pData = m_pNewData;
+			}
+		}
+	}	
+
+	if(m_bFirstWrite && !m_bProcessHeadersOnly)
     {
-	retVal = MakeStreamHeader( pHeader, m_pStreamHeaderOut );
+		retVal = MakeStreamHeader( pHeader, m_pStreamHeaderOut );
         if (SUCCEEDED(retVal))
         {
             // Send the stream header to the sink
@@ -672,14 +764,14 @@
                 m_pSourceSink->OnStreamHeader(HXR_OK, m_pStreamHeaderOut);
             }
         }
-	m_bFirstWrite = FALSE;
+		m_bFirstWrite = FALSE;
     }
     else
     {
-	if( currentTime == m_ulPreviousPacketTime )
-	{
-	    return HXR_OK;
-	}
+		if( currentTime == m_ulPreviousPacketTime )
+		{
+			return HXR_OK;
+		}
     }
 
     IHXBuffer* pBuffer = NULL;
@@ -687,10 +779,10 @@
 
     if( SUCCEEDED(retVal) )
     {
-	IHXPacket* pPacket = NULL;
-	UINT32 size   = pHeader->biSizeImage;
+		IHXPacket* pPacket = NULL;
+		UINT32 size   = pHeader->biSizeImage;
 
-	pBuffer->Set( pData, size );
+		pBuffer->Set( pData, size );
 
         retVal = MakePacket( pBuffer,
 			     currentTime,
@@ -703,7 +795,7 @@
 
         m_ulBltCount++;
 
-	HX_RELEASE(pPacket);
+		HX_RELEASE(pPacket);
         HX_RELEASE(pBuffer);
     }
 
@@ -1246,5 +1338,4 @@
             pValues->SetPropertyULONG32(pszProp, ulValue);
         }
     }
-}
-
+}
\ No newline at end of file

Index: Umakefil
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/decoder/video/Umakefil,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Umakefil	4 Jun 2008 13:13:03 -0000	1.5
+++ Umakefil	22 Aug 2008 07:47:13 -0000	1.6
@@ -49,6 +49,8 @@
 			  "common/system/pub",
 			  "common/log/logutil/pub",
 			  "client/include",
+			  "video/include",
+			  "video/colconverter/pub",
 			  "client/common/container/pub",
 			  "protocol/transport/rtp/include")
 


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic