aboutsummaryrefslogtreecommitdiff
path: root/graphics/video/codecs
diff options
context:
space:
mode:
authorSven Hesse2010-09-30 15:03:51 +0000
committerSven Hesse2010-09-30 15:03:51 +0000
commit6bbfac77aff11292ec9fb538ebdc38283053e748 (patch)
treea9f3a30127db3d62b0bf21688a4a7f8c640574b9 /graphics/video/codecs
parentce074116969869f9d79de2b08b771c623e6377e8 (diff)
downloadscummvm-rg350-6bbfac77aff11292ec9fb538ebdc38283053e748.tar.gz
scummvm-rg350-6bbfac77aff11292ec9fb538ebdc38283053e748.tar.bz2
scummvm-rg350-6bbfac77aff11292ec9fb538ebdc38283053e748.zip
VIDEO: Interpolate U and V values
svn-id: r52955
Diffstat (limited to 'graphics/video/codecs')
-rw-r--r--graphics/video/codecs/indeo3.cpp49
1 files changed, 46 insertions, 3 deletions
diff --git a/graphics/video/codecs/indeo3.cpp b/graphics/video/codecs/indeo3.cpp
index c4a6baba55..630ebaa81d 100644
--- a/graphics/video/codecs/indeo3.cpp
+++ b/graphics/video/codecs/indeo3.cpp
@@ -270,6 +270,11 @@ Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) {
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,9 +283,38 @@ Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) {
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 @@ Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) {
if ((y & 3) == 3) {
srcU += chromaWidth;
srcV += chromaWidth;
+
+ if (y > 0) {
+ srcUP += chromaWidth;
+ srcVP += chromaWidth;
+ }
+ if (y < (fHeight - 4)) {
+ srcUN += chromaWidth;
+ srcVN += chromaWidth;
+ }
}
}