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

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Fri Sep 10 03:08:52 PDT 2004


Author: illiminable
Date: 2004-09-10 03:08:52 -0700 (Fri, 10 Sep 2004)
New Revision: 7730

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
Log:
* Fiddling with buffers.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2004-09-09 18:04:28 UTC (rev 7729)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2004-09-10 10:08:52 UTC (rev 7730)
@@ -394,11 +394,13 @@
 		debugLog<<"Frame Durn = "<<mFrameDuration<<endl;
 		debugLog<<"FrameSize = "<<mFrameSize<<endl;
 		
+		
 	}
 
+	debugLog<<"y_height x width = "<<inYUVBuffer->y_height<<" x "<<inYUVBuffer->y_width<<"  ("<<inYUVBuffer->y_stride<<endl;
+	debugLog<<"uv_height x width = "<<inYUVBuffer->uv_height<<" x "<<inYUVBuffer->uv_width<<"  ("<<inYUVBuffer->y_stride<<endl;
 
-
-
+	debugLog<<"Offsets x,y = "<<mXOffset<<", "<<mYOffset<<endl;
 	////FIX::: Most of this will be obselete... the demux does it all.
 	//
 
@@ -508,6 +510,10 @@
 	unsigned char* locDestUptoPtr = locBuffer;
 	char* locSourceUptoPtr = inYUVBuffer->y;
 
+	//Strides from theora are generally -'ve so absolutise them.
+	unsigned long locYStride = inYUVBuffer->y_stride;
+	unsigned long locUVStride = inYUVBuffer->uv_stride;
+
 	//
 	//Y DATA
 	//
@@ -520,15 +526,15 @@
 	}
 
 	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+	locSourceUptoPtr += (locTopPad * locYStride);
 
 	for (long line = 0; line < mHeight; line++) {
 		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + mXOffset), mWidth);
-		locSourceUptoPtr += inYUVBuffer->y_stride;
+		locSourceUptoPtr += locYStride;
 		locDestUptoPtr += mWidth;
 	}
 
-	locSourceUptoPtr += (mYOffset * inYUVBuffer->y_stride);
+	locSourceUptoPtr += (mYOffset * locYStride);
 
 	//Source advances by (y_height * y_stride)
 	//Dest advances by (mHeight * mWidth)
@@ -543,14 +549,14 @@
 	locSourceUptoPtr = inYUVBuffer->v;
 
 	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+	locSourceUptoPtr += (locTopPad * locYStride);
 
 	for (long line = 0; line < mHeight / 2; line++) {
 		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
-		locSourceUptoPtr += inYUVBuffer->uv_stride;
+		locSourceUptoPtr += locUVStride;
 		locDestUptoPtr += (mWidth / 2);
 	}
-	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
+	locSourceUptoPtr += ((mYOffset/2) * locUVStride);
 
 	//Source advances by (locTopPad + mYOffset/2 + mHeight /2) * uv_stride
 	//where locTopPad for uv = (inYUVBuffer->y_height - mHeight - mYOffset) / 2
@@ -566,14 +572,14 @@
 	locSourceUptoPtr = inYUVBuffer->u;
 
 	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+	locSourceUptoPtr += (locTopPad * locYStride);
 
 	for (long line = 0; line < mHeight / 2; line++) {
 		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
-		locSourceUptoPtr += inYUVBuffer->uv_stride;
+		locSourceUptoPtr += locUVStride;
 		locDestUptoPtr += (mWidth / 2);
 	}
-	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
+	locSourceUptoPtr += ((mYOffset/2) * locUVStride);
 
 
 



More information about the commits mailing list