[xiph-commits] r7830 - in trunk/oggdsf/src/lib:
codecs/theora/filters/dsfTheoraEncoder
core/directshow/dsfAbstractVideoEncoder
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Wed Sep 22 04:45:16 PDT 2004
Author: illiminable
Date: 2004-09-22 04:45:16 -0700 (Wed, 22 Sep 2004)
New Revision: 7830
Modified:
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h
trunk/oggdsf/src/lib/core/directshow/dsfAbstractVideoEncoder/AbstractVideoEncodeInputPin.cpp
Log:
* Added encoder support for YVYU
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-09-22 11:36:25 UTC (rev 7829)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-09-22 11:45:16 UTC (rev 7830)
@@ -736,7 +736,51 @@
return 0;
}
+long TheoraEncodeInputPin::encodeYVYUToYV12(unsigned char* inBuf, long inNumBytes) {
+ //YVYU - Yellow Victor Yellow Ugly
+ unsigned char* locSourceUptoPtr = inBuf; //View only... don't delete locUptoPtr
+ //YUY2 is Y0 U0 Y1 V0 Y2 U1 Y3 V1
+ //YVYU is Y0 V0 Y1 U0 Y2 V1 Y3 U1
+ // it has twice as much sampling height as YV12 so downsample it.
+
+ char* locYUpto = mYUV.y;
+ char* locUUpto = mYUV.u;
+ char* locVUpto = mYUV.v;
+
+
+
+ //After downsampling... from each block of 8, we get 4 y samples and 1 each of u and v
+
+
+ for (int i = 0; i < mHeight / 2; i++) {
+ //TO DO: Draw memory layouts.
+
+
+
+ for (int j = 0; j < mWidth / 2; j++) {
+ *(locYUpto++) = *(locSourceUptoPtr++); //Y for Yellow
+ *(locVUpto++) = *(locSourceUptoPtr++); //V for victor
+
+ *(locYUpto++) = *(locSourceUptoPtr++); //Y for Yellow
+ *(locUUpto++) = *(locSourceUptoPtr++); //U for Ugly
+ }
+
+
+ //***Drop line method
+ for (int j = 0; j < mWidth / 2; j++) {
+ //Ignore the second line
+ *(locYUpto++) = *(locSourceUptoPtr++); //Y for Yellow
+ locSourceUptoPtr++; //V for victor
+ *(locYUpto++) = *(locSourceUptoPtr++); //Y for yellow
+ locSourceUptoPtr++; //U for ugly.
+ }
+
+ }
+ return 0;
+}
+
+
long TheoraEncodeInputPin::encodeUYVYToYV12(unsigned char* inBuf, long inNumBytes) {
//UYVY :: U0 Y0 V0 Y1 - Ugly Yellow Victor Yello
unsigned char* locSourceUptoPtr = inBuf; //View only... don't delete locUptoPtr
@@ -757,11 +801,7 @@
for (int i = 0; i < mHeight / 2; i++) {
//TO DO: Draw memory layouts.
- //***Part of the average method... store the pointer to the last of the previous line
- //locLastUUpto = locUUpto;
- //locLastVUpto = locVUpto;
- //***
-
+
for (int j = 0; j < mWidth / 2; j++) {
*(locUUpto++) = *(locSourceUptoPtr++); //U for Ugly
*(locYUpto++) = *(locSourceUptoPtr++); //Y for Yellow
@@ -783,22 +823,8 @@
*(locYUpto++) = *(locSourceUptoPtr++); //Y for yellow
}
- //***
- //*** PArt of the Alternate method to average...
- //for (int j = 0; j < mWidth / 2; j++) {
- // //Ignore the second line
- // *(locYUpto++) = *(locSourceUptoPtr++);
- // *(locLastUUpto++) = ((short)(*locLastUUpto) + ((short)(*locUUpto))) / 2;
- //
- // *(locYUpto++) = *(locSourceUptoPtr++);
- // *(locLastVUpto++) = ((short)(*locLastVUpto) + ((short)(*locVUpto))) / 2;
- //
- //}
- //***
-
-
}
return 0;
}
@@ -851,6 +877,13 @@
encodeUYVYToYV12(inBuf, inNumBytes);
+
+ } else if (mPinInputType.subtype == MEDIASUBTYPE_YVYU) {
+
+
+ encodeYVYUToYV12(inBuf, inNumBytes);
+
+
} else {
//FATAL ERROR
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h 2004-09-22 11:36:25 UTC (rev 7829)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h 2004-09-22 11:45:16 UTC (rev 7830)
@@ -78,6 +78,7 @@
long encodeRGB24toYV12(unsigned char* inBuf, long inNumBytes);
long encodeRGB32toYV12(unsigned char* inBuf, long inNumBytes);
long encodeUYVYToYV12(unsigned char* inBuf, long inNumBytes);
+ long encodeYVYUToYV12(unsigned char* inBuf, long inNumBytes);
//
// bool fillTheoraInfo(theora_info* outTheora, sTheoraFormatBlock* inTheoraFormatBlock);
//
Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractVideoEncoder/AbstractVideoEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractVideoEncoder/AbstractVideoEncodeInputPin.cpp 2004-09-22 11:36:25 UTC (rev 7829)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractVideoEncoder/AbstractVideoEncodeInputPin.cpp 2004-09-22 11:45:16 UTC (rev 7830)
@@ -124,6 +124,7 @@
( inMediaType->subtype == MEDIASUBTYPE_YV12 ||
inMediaType->subtype == MEDIASUBTYPE_YUY2 ||
inMediaType->subtype == MEDIASUBTYPE_UYVY ||
+ inMediaType->subtype == MEDIASUBTYPE_YVYU ||
inMediaType->subtype == MEDIASUBTYPE_AYUV ||
inMediaType->subtype == MEDIASUBTYPE_RGB32 ||
inMediaType->subtype == MEDIASUBTYPE_RGB24
@@ -164,6 +165,7 @@
if ( inMediaType->subtype == MEDIASUBTYPE_YV12 ||
inMediaType->subtype == MEDIASUBTYPE_YUY2 ||
inMediaType->subtype == MEDIASUBTYPE_UYVY ||
+ inMediaType->subtype == MEDIASUBTYPE_YVYU ||
inMediaType->subtype == MEDIASUBTYPE_AYUV ||
inMediaType->subtype == MEDIASUBTYPE_RGB32 ||
inMediaType->subtype == MEDIASUBTYPE_RGB24
@@ -194,19 +196,29 @@
case 1:
outMediaType->SetType(&MEDIATYPE_Video);
outMediaType->SetSubtype(&MEDIASUBTYPE_YUY2);
+ return S_OK;
case 2:
outMediaType->SetType(&MEDIATYPE_Video);
outMediaType->SetSubtype(&MEDIASUBTYPE_RGB32);
+ return S_OK;
case 3:
outMediaType->SetType(&MEDIATYPE_Video);
outMediaType->SetSubtype(&MEDIASUBTYPE_RGB24);
+ return S_OK;
case 4:
outMediaType->SetType(&MEDIATYPE_Video);
outMediaType->SetSubtype(&MEDIASUBTYPE_AYUV);
+ return S_OK;
case 5:
outMediaType->SetType(&MEDIATYPE_Video);
outMediaType->SetSubtype(&MEDIASUBTYPE_UYVY);
+ return S_OK;
+ case 6:
+ outMediaType->SetType(&MEDIATYPE_Video);
+ outMediaType->SetSubtype(&MEDIASUBTYPE_YVYU);
+ return S_OK;
+
default:
return VFW_S_NO_MORE_ITEMS;
}
More information about the commits
mailing list