[xiph-commits] r8502 - in
trunk/oggdsf/src/lib/codecs/theora/filters: dsfTheoraDecoder
dsfTheoraEncoder
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Mon Dec 20 06:52:04 PST 2004
Author: illiminable
Date: 2004-12-20 06:52:03 -0800 (Mon, 20 Dec 2004)
New Revision: 8502
Modified:
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
Log:
* Decoder properly obeys offsets (i think!)
* Encoder now puts picture regions flush to the top right of the frame, to let the buffers be internally manipulated and only pad 2 sides instead of 4. Only for YV12 so far...
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2004-12-20 12:34:32 UTC (rev 8501)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2004-12-20 14:52:03 UTC (rev 8502)
@@ -543,7 +543,7 @@
}
//Skip the top padding
- locSourceUptoPtr += (locTopPad * locYStride);
+ locSourceUptoPtr += (mYOffset * locYStride);
for (long line = 0; line < mHeight; line++) {
memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + mXOffset), mWidth);
@@ -551,7 +551,7 @@
locDestUptoPtr += mWidth;
}
- locSourceUptoPtr += (mYOffset * locYStride);
+ locSourceUptoPtr += (locTopPad * locYStride);
//debugLog<<"Dest Distance(y) = "<<(unsigned long)(locDestUptoPtr - locBuffer)<<endl;
@@ -568,14 +568,14 @@
locSourceUptoPtr = inYUVBuffer->v;
//Skip the top padding
- locSourceUptoPtr += (locTopPad * locYStride);
+ locSourceUptoPtr += ((mYOffset/2) * locYStride);
for (long line = 0; line < mHeight / 2; line++) {
memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
locSourceUptoPtr += locUVStride;
locDestUptoPtr += (mWidth / 2);
}
- locSourceUptoPtr += ((mYOffset/2) * locUVStride);
+ locSourceUptoPtr += (locTopPad * locUVStride);
//Source advances by (locTopPad + mYOffset/2 + mHeight /2) * uv_stride
//where locTopPad for uv = (inYUVBuffer->y_height - mHeight - mYOffset) / 2
@@ -592,14 +592,14 @@
locSourceUptoPtr = inYUVBuffer->u;
//Skip the top padding
- locSourceUptoPtr += (locTopPad * locYStride);
+ locSourceUptoPtr += ((mYOffset/2) * locYStride);
for (long line = 0; line < mHeight / 2; line++) {
memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
locSourceUptoPtr += locUVStride;
locDestUptoPtr += (mWidth / 2);
}
- locSourceUptoPtr += ((mYOffset/2) * locUVStride);
+ locSourceUptoPtr += (locTopPad * locUVStride);
//debugLog<<"Dest Distance(U) = "<<(unsigned long)(locDestUptoPtr - locBuffer)<<endl;
//debugLog<<"Frame Size = "<<mFrameSize<<endl;
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-12-20 12:34:32 UTC (rev 8501)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-12-20 14:52:03 UTC (rev 8502)
@@ -151,12 +151,12 @@
char* locDestUptoPtr = mYUV.y;
//
- //Pad top (which is really bottom of the image) of output Y plane buffer with mYOffset lines of width mYUV.y_width
- //y_width is the out frame width.
- if (mYOffset != 0) {
- memset((void*)locDestUptoPtr, NULL, mYOffset * mYUV.y_width); //Is it needed to zero this out ? Or just leave junk ?
- locDestUptoPtr += (mYOffset * mYUV.y_width); //I'm fairly sure it can be junk... but leave for now !
- }
+ ////Pad top (which is really bottom of the image) of output Y plane buffer with mYOffset lines of width mYUV.y_width
+ ////y_width is the out frame width.
+ //if (mYOffset != 0) {
+ // memset((void*)locDestUptoPtr, NULL, mYOffset * mYUV.y_width); //Is it needed to zero this out ? Or just leave junk ?
+ // locDestUptoPtr += (mYOffset * mYUV.y_width); //I'm fairly sure it can be junk... but leave for now !
+ //}
//Source pointer does not advance
//
@@ -191,16 +191,13 @@
}
- //
- //This is no longer done... we just pad on one side for efficiency
- //
-
+
//Pad bottom of Y plane buffer with mYOffset lines of width mYUV.y_width
- //if (mYOffset != 0) {
- // memset((void*)locDestUptoPtr, NULL, mYOffset * mYUV.y_width); //Is it needed to zero this out ? Or just leave junk ?
- // locDestUptoPtr += (mYOffset * mYUV.y_width);
- // //Source pointer does not advance
- //}
+ if (mYOffset != 0) {
+ memset((void*)locDestUptoPtr, NULL, mYOffset * mYUV.y_width); //Is it needed to zero this out ? Or just leave junk ?
+ locDestUptoPtr += (mYOffset * mYUV.y_width);
+ //Source pointer does not advance
+ }
@@ -217,13 +214,13 @@
//ASSERT (mWidth is EVEN)
//
- //Pad top of V plane buffer with mYOffset/2 lines of width mYUV.uv_width
- if (mYOffset != 0) {
- memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
- locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
- //Source pointer does not advance
- }
- //
+ ////Pad top of V plane buffer with mYOffset/2 lines of width mYUV.uv_width
+ //if (mYOffset != 0) {
+ // memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
+ // locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
+ // //Source pointer does not advance
+ //}
+ ////
//Add mHeight/2 lines of data of length mWidth/2 plus padded by mXOffset/2 at each end
if (mXOffset == 0) {
@@ -256,16 +253,14 @@
}
}
- //
- //This is no longer done... we just pad on one side for efficiency
- //
- ////Pad bottom of V plane buffer with mYOffset / 2 lines of width mYUV.uv_width
- //if (mYOffset != 0) {
- // memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
- // locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
- // //Source pointer does not advance
- //}
+
+ //Pad bottom of V plane buffer with mYOffset / 2 lines of width mYUV.uv_width
+ if (mYOffset != 0) {
+ memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
+ locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
+ //Source pointer does not advance
+ }
@@ -279,13 +274,13 @@
locDestUptoPtr = mYUV.u;
//
- //Pad top of U plane buffer with mYOffset/2 lines of width mYUV.uv_width
- if (mYOffset != 0) {
- memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
- locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
- //Source pointer does not advance
- }
- //
+ ////Pad top of U plane buffer with mYOffset/2 lines of width mYUV.uv_width
+ //if (mYOffset != 0) {
+ // memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
+ // locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
+ // //Source pointer does not advance
+ //}
+ ////
//Add mHeight/2 lines of data of length mWidth/2 plus padded by mXOffset/2 at each end
if (mXOffset == 0) {
@@ -319,17 +314,14 @@
}
- //
- //This is no longer done... we just pad on one side for efficiency
- //
+
+ //Pad bottom of U plane buffer with mYOffset / 2 lines of width mYUV.uv_width
+ if (mYOffset != 0) {
+ memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
+ locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
+ //Source pointer does not advance
+ }
- ////Pad bottom of U plane buffer with mYOffset / 2 lines of width mYUV.uv_width
- //if (mYOffset != 0) {
- // memset((void*)locDestUptoPtr, NULL, (mYOffset * mYUV.uv_width) / 2); //Is it needed to zero this out ? Or just leave junk ?
- // locDestUptoPtr += ((mYOffset * mYUV.uv_width) / 2);
- // //Source pointer does not advance
- //}
-
//======================================================================================================
return 0;
More information about the commits
mailing list