[xiph-commits] r15480 - trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Sat Nov 1 17:05:45 PDT 2008


Author: cristianadam
Date: 2008-11-01 17:05:45 -0700 (Sat, 01 Nov 2008)
New Revision: 15480

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
Log:
Fixed bugs related to the RGB output.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2008-11-01 22:12:28 UTC (rev 15479)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2008-11-02 00:05:45 UTC (rev 15480)
@@ -714,9 +714,9 @@
 			short pr, pg, pb, y;
 			short r, g, b;
 
-			pr = (short)(-56992 + ptrv[j/2] * 409) >> 8;
+			pr = (-56992 + ptrv[j/2] * 409) >> 8;
 			pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
-			pb = (short)(-70688 + ptru[j/2] * 516) >> 8;
+			pb = (-70688 + ptru[j/2] * 516) >> 8;
 
 			y = 298*ptry[j] >> 8;
 			r = y + pr;
@@ -785,9 +785,9 @@
 			short pr, pg, pb, y;
 			short r, g, b;
 
-			pr = (short)(-56992 + ptrv[j/2] * 409) >> 8;
+			pr = (-56992 + ptrv[j/2] * 409) >> 8;
 			pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
-			pb = (short)(-70688 + ptru[j/2] * 516) >> 8;
+			pb = (-70688 + ptru[j/2] * 516) >> 8;
 
 			y = 298*ptry[j] >> 8;
 			r = y + pr;
@@ -1032,24 +1032,35 @@
 	return S_OK;
 }
 HRESULT TheoraDecodeFilter::TheoraDecoded (yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) 
-{
+{	
+	AM_MEDIA_TYPE* sampleMediaType;
+	outSample->GetMediaType(&sampleMediaType);
 
-	if (mCurrentOutputSubType == MEDIASUBTYPE_YV12) 
+	static GUID sampleMediaSubType = mCurrentOutputSubType;
+		
+	if (sampleMediaType != NULL)
 	{
+		sampleMediaSubType = sampleMediaType->subtype;
+	}
+
+	DeleteMediaType(sampleMediaType);
+
+	if (sampleMediaSubType == MEDIASUBTYPE_YV12) 
+	{
 		debugLog<<"Decoding to YV12"<<endl;
 		return DecodeToYV12(inYUVBuffer, outSample, inIsKeyFrame, inStart, inEnd);
 	} 
-	else if (mCurrentOutputSubType == MEDIASUBTYPE_YUY2) 
+	else if (sampleMediaSubType == MEDIASUBTYPE_YUY2) 
 	{
 		debugLog<<"Decoding to YUY2"<<endl;
 		return DecodeToYUY2(inYUVBuffer, outSample, inIsKeyFrame, inStart, inEnd);
 	} 
-	else if (mCurrentOutputSubType == MEDIASUBTYPE_RGB565) 
+	else if (sampleMediaSubType == MEDIASUBTYPE_RGB565) 
 	{
 		debugLog<<"Decoding to RGB565"<<endl;
 		return DecodeToRGB565(inYUVBuffer, outSample, inIsKeyFrame, inStart, inEnd);
 	} 
-	else if (mCurrentOutputSubType == MEDIASUBTYPE_RGB32) 
+	else if (sampleMediaSubType == MEDIASUBTYPE_RGB32) 
 	{
 		debugLog<<"Decoding to RGB32"<<endl;
 		return DecodeToRGB32(inYUVBuffer, outSample, inIsKeyFrame, inStart, inEnd);



More information about the commits mailing list