[Scummvm-cvs-logs] SF.net SVN: scummvm:[52955] scummvm/trunk/graphics/video/codecs/indeo3.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Sep 30 17:03:52 CEST 2010


Revision: 52955
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52955&view=rev
Author:   drmccoy
Date:     2010-09-30 15:03:51 +0000 (Thu, 30 Sep 2010)

Log Message:
-----------
VIDEO: Interpolate U and V values

Modified Paths:
--------------
    scummvm/trunk/graphics/video/codecs/indeo3.cpp

Modified: scummvm/trunk/graphics/video/codecs/indeo3.cpp
===================================================================
--- scummvm/trunk/graphics/video/codecs/indeo3.cpp	2010-09-30 13:05:40 UTC (rev 52954)
+++ scummvm/trunk/graphics/video/codecs/indeo3.cpp	2010-09-30 15:03:51 UTC (rev 52955)
@@ -270,6 +270,11 @@
 	const byte *srcV = _cur_frame->Vbuf;
 	byte *dest = (byte *)_surface->pixels;
 
+	const byte *srcUP = srcU;
+	const byte *srcVP = srcV;
+	const byte *srcUN = srcU + chromaWidth;
+	const byte *srcVN = srcV + chromaWidth;
+
 	uint32 scaleWidth  = _surface->w / fWidth;
 	uint32 scaleHeight = _surface->h / fHeight;
 
@@ -278,10 +283,39 @@
 
 		for (uint32 sH = 0; sH < scaleHeight; sH++) {
 			for (uint32 x = 0; x < fWidth; x++) {
-				const byte cY = srcY[x];
-				const byte cU = srcU[x >> 2];
-				const byte cV = srcV[x >> 2];
+				uint32 xP = MAX<int32>((x >> 2) - 1, 0);
+				uint32 xN = MIN<int32>((x >> 2) + 1, chromaWidth - 1);
 
+				byte cY = srcY[x];
+				byte cU = srcU[x >> 2];
+				byte cV = srcV[x >> 2];
+
+				if        (((x % 4) == 0) && ((y % 4) == 0)) {
+					cU = (((uint32) cU) + ((uint32) srcUP[xP])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVP[xP])) / 2;
+				} else if (((x % 4) == 3) && ((y % 4) == 0)) {
+					cU = (((uint32) cU) + ((uint32) srcUP[xN])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVP[xN])) / 2;
+				} else if (((x % 4) == 0) && ((y % 4) == 3)) {
+					cU = (((uint32) cU) + ((uint32) srcUN[xP])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVN[xP])) / 2;
+				} else if (((x % 4) == 3) && ((y % 4) == 3)) {
+					cU = (((uint32) cU) + ((uint32) srcUN[xN])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVN[xN])) / 2;
+				} else if ( (x % 4) == 0) {
+					cU = (((uint32) cU) + ((uint32) srcU[xP])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcV[xP])) / 2;
+				} else if ( (x % 4) == 3) {
+					cU = (((uint32) cU) + ((uint32) srcU[xN])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcV[xN])) / 2;
+				} else if ( (y % 4) == 0) {
+					cU = (((uint32) cU) + ((uint32) srcUP[x >> 2])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVP[x >> 2])) / 2;
+				} else if ( (y % 4) == 3) {
+					cU = (((uint32) cU) + ((uint32) srcUN[x >> 2])) / 2;
+					cV = (((uint32) cV) + ((uint32) srcVN[x >> 2])) / 2;
+				}
+
 				byte r = 0, g = 0, b = 0;
 				YUV2RGB(cY, cU, cV, r, g, b);
 
@@ -303,6 +337,15 @@
 		if ((y & 3) == 3) {
 			srcU += chromaWidth;
 			srcV += chromaWidth;
+
+			if (y > 0) {
+				srcUP += chromaWidth;
+				srcVP += chromaWidth;
+			}
+			if (y < (fHeight - 4)) {
+				srcUN += chromaWidth;
+				srcVN += chromaWidth;
+			}
 		}
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list