[xiph-commits] r6999 -
illiminable at dactyl.lonelymoon.com
illiminable
Mon Jul 5 12:48:40 PDT 2004
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder
Message-ID: <20040705194840.5BF9F9AAAB at dactyl.lonelymoon.com>
Author: illiminable
Date: Mon Jul 5 12:48:40 2004
New Revision: 6999
Modified:
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
Log:
* Now supports downsampling from YUY2 (4:2:2) to YV12 (4:2:0)... can keep this in until the encoder can succesfully encode from other input formats.
* Still major problems with theora in WMP9&10, but will run in WMP8 and below and in other directshow players like BSPlayer, Media Player Classic etc.
* Did some testing with these other Media players and they can successfully play files using my filters.
* Noticed Media Player classic classifies .ogg as "Ogg Vorbis Audio File" but if it's pointed to a theora .ogg the filters will still work.
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-07-05 19:37:00 UTC (rev 6998)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp 2004-07-05 19:47:53 UTC (rev 6999)
@@ -307,21 +307,52 @@
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
- // which are the average of the 2 samples that were present in the block.
- for (int i = 0; i < inNumBytes; i+=8) {
- for (int j = 0; j < 4; j++) {
- locYUpto[j] = locSourceUptoPtr[2 * j];
+
+
+ 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++) {
+ *(locYUpto++) = *(locSourceUptoPtr++);
+ *(locUUpto++) = *(locSourceUptoPtr++);
+ *(locYUpto++) = *(locSourceUptoPtr++);
+ *(locVUpto++) = *(locSourceUptoPtr++);
}
- locYUpto += 4;
+
- *locUUpto = (((short) locSourceUptoPtr[1]) + ((short) locSourceUptoPtr[5])) / 2;
- locUUpto++;
+ //***Drop line method
+ for (int j = 0; j < mWidth / 2; j++) {
+ //Ignore the second line
+ *(locYUpto++) = *(locSourceUptoPtr++);
+ locSourceUptoPtr++;
+ *(locYUpto++) = *(locSourceUptoPtr++);
+ locSourceUptoPtr++;
+ }
+ //***
- *locVUpto = (((short) locSourceUptoPtr[3]) + ((short) locSourceUptoPtr[7])) / 2;
- locVUpto++;
+ //*** 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;
}
//PURE VIRTUALS
@@ -349,7 +380,12 @@
}
}
- encodeYV12ToYV12(inBuf, inNumBytes);
+ if (mPinInputType.subtype == MEDIASUBTYPE_YUY2) {
+ encodeYUY2ToYV12(inBuf, inNumBytes);
+ } else {
+ //Should be more specifc.
+ encodeYV12ToYV12(inBuf, inNumBytes);
+ }
StampedOggPacket* locPacket = mTheoraEncoder.encodeTheora(&mYUV);
More information about the commits
mailing list