[Sumover-dev] [svn commit] r4367 - vic/branches/mpeg4/video
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Tue Jan 27 06:44:34 GMT 2009
Author: douglask
Date: Tue Jan 27 06:44:16 2009
New Revision: 4367
Modified:
vic/branches/mpeg4/video/grabber-win32DS.cpp
vic/branches/mpeg4/video/grabber.cpp
vic/branches/mpeg4/video/yuv_convert.cpp
Log:
planarYUYV420_to_planarYUYV42() wasn't copying the V data.
Fixed stupid typo where a '=' was meant to be '==' in grabber-win32DS.cpp. With modification in the 'if' conditional, correct yuv conversion functions are now being invoked.
Gray borders used for padding were introducing visual bleading along the padding border edges. Now using black borders.
Modified: vic/branches/mpeg4/video/grabber-win32DS.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-win32DS.cpp (original)
+++ vic/branches/mpeg4/video/grabber-win32DS.cpp Tue Jan 27 06:44:16 2009
@@ -336,7 +336,7 @@
ZeroMemory(&mt_, sizeof(AM_MEDIA_TYPE));
mt_.majortype = MEDIATYPE_Video;
- if (cformat_ = CF_422) {
+ if (cformat_ == CF_422) {
if (have_YUY2_) {
mt_.subtype = MEDIASUBTYPE_YUY2; // Packed YUV 422
} else if (have_UYVY_) {
@@ -344,7 +344,7 @@
} else if (have_I420_) {
mt_.subtype = MEDIASUBTYPE_I420; // Planar YUV 420
} else {
- mt_.subtype = MEDIASUBTYPE_YUY2;
+ mt_.subtype = MEDIASUBTYPE_UYVY;
}
} else {
if (have_I420_) {
@@ -354,7 +354,7 @@
} else if (have_UYVY_) {
mt_.subtype = MEDIASUBTYPE_UYVY; // Packed YUV 422
} else {
- mt_.subtype = MEDIASUBTYPE_YUY2;
+ mt_.subtype = MEDIASUBTYPE_UYVY;
}
}
@@ -694,7 +694,7 @@
else if (have_UYVY_)
packedUYVY422_to_planarYUYV420((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
else
- packedYUYV422_to_planarYUYV420((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
+ packedUYVY422_to_planarYUYV420((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
break;
case CF_422:
@@ -705,7 +705,7 @@
else if (have_I420_)
planarYUYV420_to_planarYUYV422((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
else
- packedYUYV422_to_planarYUYV422((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
+ packedUYVY422_to_planarYUYV422((char *)frame_, outw_, outh_, (char *)last_frame_, inw_, inh_);
break;
}
Modified: vic/branches/mpeg4/video/grabber.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber.cpp (original)
+++ vic/branches/mpeg4/video/grabber.cpp Tue Jan 27 06:44:16 2009
@@ -409,9 +409,12 @@
outh_ = h;
framesize_ = w * h;
- int n = 2 * framesize_ + 2 * GRABBER_VPAD * w;
- framebase_ = new u_char[n];
- memset(framebase_, 0x80, n);
+ int ny = framesize_ + GRABBER_VPAD * w; // Y size
+ int nuv = ny; // U + V size
+ framebase_ = new u_char[ny + nuv];
+ /* initialize to black */
+ memset(framebase_, 0, ny);
+ memset(framebase_ + ny, 0x80, nuv);
frame_ = framebase_ + GRABBER_VPAD * w;
crinit(w, h);
@@ -434,10 +437,12 @@
int s = w * h;
framesize_ = s;
- int n = s + (s >> 1) + 2 * GRABBER_VPAD * outw_;
- framebase_ = new u_char[n];
- /* initialize to gray */
- memset(framebase_, 0x80, n);
+ int ny = s + GRABBER_VPAD * outw_; // Y size
+ int nuv = (s >> 1) + GRABBER_VPAD * outw_; // U + V size
+ framebase_ = new u_char[ny + nuv];
+ /* initialize to black */
+ memset(framebase_, 0, ny);
+ memset(framebase_ + ny, 0x80, nuv);;
frame_ = framebase_ + GRABBER_VPAD * outw_;
crinit(w, h);
@@ -507,10 +512,12 @@
}
int s = outw_ * outh_;
framesize_ = s;
- int n = s + (s >> 1) + 2 * GRABBER_VPAD * outw_;
- framebase_ = new u_char[n];
- /* initialize to gray */
- memset(framebase_, 0x80, n);
+ int ny = s + GRABBER_VPAD * outw_; // Y size
+ int nuv = (s >> 1) + GRABBER_VPAD * outw_; //U + V size
+ framebase_ = new u_char[ny + nuv];
+ /* initialize to black */
+ memset(framebase_, 0, ny);
+ memset(framebase_ + ny, 0x80, nuv);
frame_ = framebase_ + GRABBER_VPAD * outw_;
crinit(outw_, outh_);
Modified: vic/branches/mpeg4/video/yuv_convert.cpp
==============================================================================
--- vic/branches/mpeg4/video/yuv_convert.cpp (original)
+++ vic/branches/mpeg4/video/yuv_convert.cpp Tue Jan 27 06:44:16 2009
@@ -399,7 +399,7 @@
srca += ((srcWidth * upClip) >> 2);
if (leftPad != 0 || rightPad != 0) { // if padding necessary on destination
- for (i = 0; i < rows; i += 2) {
+ for (i = 0; i < (rows << 1); i += 2) {
// source information is every-other row, so double each line
dest += (leftPad >> 1);
memcpy(dest, srca, (srcWidth >> 1));
@@ -412,7 +412,7 @@
srca += (srcWidth >> 1);
}
} else { // if clipping necessary on source
- for (i = 0; i < rows; i += 2) {
+ for (i = 0; i < (rows << 1); i += 2) {
srca += (leftClip >> 1);
// source information is every-other row, so double each line
@@ -438,7 +438,7 @@
srca += ((srcWidth * upClip) >> 2);
if (leftPad != 0 || rightPad != 0) { // if padding necessary on destination
- for (i = 0; i < rows; i += 2) {
+ for (i = 0; i < (rows << 1); i += 2) {
// source information is every-other row, so double each line
dest += (leftPad >> 1);
memcpy(dest, srca, (srcWidth >> 1));
@@ -451,7 +451,7 @@
srca += (srcWidth >> 1);
}
} else { // if clipping necessary on source
- for (i = 0; i < rows; i += 2) {
+ for (i = 0; i < (rows << 1); i += 2) {
srca += (leftClip >> 1);
// source information is every-other row, so double each line
@@ -471,7 +471,7 @@
srca += destHeight * destWidth;
// copy u and v information, doubling each row
- for (int i = 0; i < destHeight; i += 2) {
+ for (int i = 0; i < (destHeight << 1); i += 2) {
memcpy(dest, srca, (size_t) (destWidth >> 1)); // 1st copy to dest
dest += destWidth >> 1;
memcpy(dest, srca, (size_t) (destWidth >> 1)); // 2nd copy to dest
More information about the Sumover-dev
mailing list