[xiph-commits] r16920 - in trunk/oggdsf/src/lib/codecs/theora: filters/dsfTheoraDecoder libs/libOOTheora

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Thu Feb 18 15:12:46 PST 2010


Author: cristianadam
Date: 2010-02-18 15:12:46 -0800 (Thu, 18 Feb 2010)
New Revision: 16920

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
Log:
Offsets work as expected now.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2010-02-18 19:53:13 UTC (rev 16919)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2010-02-18 23:12:46 UTC (rev 16920)
@@ -394,8 +394,8 @@
 	if (inMediaType->majortype == MEDIATYPE_Video) 
     {
 		LOG(logDEBUG) << "Querying for video - FAIL";
-		LOG(logDEBUG) << "Sub type = " << inMediaType->subtype.Data1 << "-" << inMediaType->subtype.Data2 << "-" << inMediaType->subtype.Data3 << "-";
-		LOG(logDEBUG) << "format type = " << inMediaType->formattype.Data1 << "-" << inMediaType->formattype.Data2 << "-" << inMediaType->formattype.Data3 << "-";
+		LOG(logDEBUG) << "Sub type = " << inMediaType->subtype;
+		LOG(logDEBUG) << "format type = " << inMediaType->formattype;
 	} 
     else 
     {
@@ -777,12 +777,12 @@
     BYTE* locBuffer = NULL;
 	outSample->GetPointer(&locBuffer);
 
-    unsigned char * ptry = inYUVBuffer->y + m_xOffset * inYUVBuffer->y_stride;
-    unsigned char * ptru = inYUVBuffer->u + (m_xOffset / 2) * inYUVBuffer->uv_stride;
-    unsigned char * ptrv = inYUVBuffer->v + (m_xOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptry = inYUVBuffer->y + m_yOffset * inYUVBuffer->y_stride;
+    unsigned char * ptru = inYUVBuffer->u + (m_yOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptrv = inYUVBuffer->v + (m_yOffset / 2) * inYUVBuffer->uv_stride;
 	unsigned char * ptro = locBuffer;
 
-	for (unsigned long i = m_yOffset; i < m_pictureHeight + m_yOffset; ++i) 
+	for (unsigned long i = 0; i < m_pictureHeight; ++i) 
 	{
 		unsigned char* ptro2 = ptro;
 		for (unsigned long j = m_xOffset; j < m_pictureWidth + m_xOffset; j += 2) 
@@ -839,12 +839,12 @@
 	unsigned char* locBuffer = NULL;
 	outSample->GetPointer(&locBuffer);
 
-    unsigned char * ptry = inYUVBuffer->y + m_xOffset * inYUVBuffer->y_stride;
-    unsigned char * ptru = inYUVBuffer->u + (m_xOffset / 2) * inYUVBuffer->uv_stride;
-    unsigned char * ptrv = inYUVBuffer->v + (m_xOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptry = inYUVBuffer->y + m_yOffset * inYUVBuffer->y_stride;
+    unsigned char * ptru = inYUVBuffer->u + (m_yOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptrv = inYUVBuffer->v + (m_yOffset / 2) * inYUVBuffer->uv_stride;
 	unsigned char * ptro = locBuffer;
 
-	for (unsigned long i = m_yOffset; i < m_pictureHeight + m_yOffset; i++) 
+	for (unsigned long i = 0; i < m_pictureHeight; i++) 
 	{
 		unsigned char* ptro2 = ptro;
 		for (unsigned long j = m_xOffset; j < m_pictureWidth + m_xOffset; j += 2) 
@@ -897,12 +897,12 @@
     unsigned char* locBuffer = NULL;
     outSample->GetPointer(&locBuffer);
 
-    unsigned char * ptry = inYUVBuffer->y + m_xOffset * inYUVBuffer->y_stride;
-    unsigned char * ptru = inYUVBuffer->u + (m_xOffset / 2) * inYUVBuffer->uv_stride;
-    unsigned char * ptrv = inYUVBuffer->v + (m_xOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptry = inYUVBuffer->y + m_yOffset * inYUVBuffer->y_stride;
+    unsigned char * ptru = inYUVBuffer->u + (m_yOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptrv = inYUVBuffer->v + (m_yOffset / 2) * inYUVBuffer->uv_stride;
     unsigned char * ptro = locBuffer;
 
-    for (unsigned long i = m_yOffset; i < m_pictureHeight + m_yOffset; ++i) 
+    for (unsigned long i = 0; i < m_pictureHeight; ++i) 
     {
         unsigned char* ptro2 = ptro;
         for (unsigned long j = m_xOffset; j < m_pictureWidth + m_xOffset; j += 2) 
@@ -934,9 +934,9 @@
 	BYTE* locBuffer = NULL;
 	outSample->GetPointer(&locBuffer);
 
-    unsigned char * ptry = inYUVBuffer->y + m_xOffset * inYUVBuffer->y_stride;
-    unsigned char * ptru = inYUVBuffer->u + (m_xOffset / 2) * inYUVBuffer->uv_stride;
-    unsigned char * ptrv = inYUVBuffer->v + (m_xOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptry = inYUVBuffer->y + m_yOffset * inYUVBuffer->y_stride;
+    unsigned char * ptru = inYUVBuffer->u + (m_yOffset / 2) * inYUVBuffer->uv_stride;
+    unsigned char * ptrv = inYUVBuffer->v + (m_yOffset / 2) * inYUVBuffer->uv_stride;
     unsigned char * ptro = locBuffer;
 
 	for (unsigned long line = 0; line < m_pictureHeight; ++line) 
@@ -1012,9 +1012,10 @@
 			//LOG(logDEBUG) << "Setting format block";
 			SetTheoraFormat(inMediaType->pbFormat);
 			
-			//Set some other stuff here too...
+            // TODO: after using th_decode_headerin to get the theora informations
+            // remove the vertical flip of the yoffset
 			m_xOffset = m_theoraFormatInfo->xOffset;
-			m_yOffset = m_theoraFormatInfo->yOffset;
+			m_yOffset = m_theoraFormatInfo->outerFrameHeight - m_theoraFormatInfo->pictureHeight - m_theoraFormatInfo->yOffset;
 
 			m_pictureWidth = m_theoraFormatInfo->pictureWidth;
 			m_pictureHeight = m_theoraFormatInfo->pictureHeight;
@@ -1073,6 +1074,8 @@
 	delete m_theoraFormatInfo;
 	m_theoraFormatInfo = new sTheoraFormatBlock;			//Deelted in destructor.
 
+    // TODO: replace code blow with th_decode_headerin
+
 	//0		-	55			theora ident						0	-	6
 	//56	-	63			ver major							7	-	7
 	//64	-	71			ver minor							8	-	8

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2010-02-18 19:53:13 UTC (rev 16919)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2010-02-18 23:12:46 UTC (rev 16920)
@@ -31,6 +31,7 @@
 
 #include "stdafx.h"
 #include "theoradecoder.h"
+#include "common/Log.h"
 
 TheoraDecoder::TheoraDecoder()
 	: mFirstPacket(true)
@@ -61,6 +62,7 @@
 yuv_buffer* TheoraDecoder::decodeTheora(StampedOggPacket* inPacket) 
 {		
     //Accepts packet and deletes it.
+    LOG(logDEBUG3) << __FUNCTIONW__;
 
 	if (mPacketCount < 3) 
     {
@@ -72,6 +74,7 @@
 			//TODO::: Post processing http://people.xiph.org/~tterribe/doc/libtheora-exp/theoradec_8h.html#a1
 		}
 		
+        LOG(logDEBUG3) << __FUNCTIONW__ << " PacketCount under 3: " << mPacketCount;
 		return NULL;
 	} 
     else 
@@ -85,6 +88,8 @@
         {
 			//Ignore header packets
 			delete inPacket;
+
+            LOG(logDEBUG3) << __FUNCTIONW__ << " Ignoring header packets";
 			return NULL;
 		}
 
@@ -108,7 +113,9 @@
 		if (	!	(	(mYCbCrBuffer[1].width == mYCbCrBuffer[2].width)
 					&&	(mYCbCrBuffer[1].height == mYCbCrBuffer[2].height)
 					&&	(mYCbCrBuffer[1].stride == mYCbCrBuffer[2].stride)
-					)) {
+					)) 
+        {
+            LOG(logERROR) << "Not 4:2:0 - OOTheora needs fixing";
 			throw "Not 4:2:0 - OOTheora needs fixing";
 		}
 



More information about the commits mailing list