diff options
| author | hrydgard <hrydgard@gmail.com> | 2008-08-14 21:34:39 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2008-08-14 21:34:39 +0000 |
| commit | b4d7ce0197a691a4f07bf7e88d04b7b82c9dbfad (patch) | |
| tree | a6d186ba09502e1960ca7817946b05e7aa1b955c /Source/Core/VideoCommon | |
| parent | 1aedd4891c327267f9c30bbdf71284d352f7aab7 (diff) | |
Some cleanup, extracted XFB convert code into VideoCommon, added non-activated support to gl plugin. + a minor bugfix with no effects seen so far in gl plugin :P
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@209 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/SConscript | 1 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/XFBConvert.cpp | 59 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/XFBConvert.h | 25 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VideoCommon.vcproj | 12 |
4 files changed, 97 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 415e17d5b5..a91f110e17 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -5,6 +5,7 @@ files = ["BPMemory.cpp", "LookUpTables.cpp", "TextureDecoder.cpp", "XFMemory.cpp", + "XFBConvert.cpp", ] env_common = env.Copy(CXXFLAGS = " -fPIC ") diff --git a/Source/Core/VideoCommon/Src/XFBConvert.cpp b/Source/Core/VideoCommon/Src/XFBConvert.cpp new file mode 100644 index 0000000000..3d9884f861 --- /dev/null +++ b/Source/Core/VideoCommon/Src/XFBConvert.cpp @@ -0,0 +1,59 @@ +// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#include "XFBConvert.h"
+#include "Common.h"
+
+// TODO: Convert this thing into wicked fast SSE2.
+
+namespace {
+
+int bound(int i)
+{
+ return (i>255)?255:((i<0)?0:i);
+}
+
+void yuv2rgb(int y, int u, int v, int &r, int &g, int &b)
+{
+ b = bound((76283*(y - 16) + 132252*(u - 128))>>16);
+ g = bound((76283*(y - 16) - 53281 *(v - 128) - 25624*(u - 128))>>16); //last one u?
+ r = bound((76283*(y - 16) + 104595*(v - 128))>>16);
+}
+
+} // namespace
+
+void ConvertXFB(u32 *dst, const u8* _pXFB, int width, int height)
+{
+ const unsigned char *src = _pXFB;
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++, src += 4)
+ {
+ int Y1 = src[0];
+ int U = src[1];
+ int Y2 = src[2];
+ int V = src[3];
+
+ int r, g, b;
+ yuv2rgb(Y1,U,V, r,g,b);
+ *dst++ = 0xFF000000 | (r<<16) | (g<<8) | (b);
+ yuv2rgb(Y2,U,V, r,g,b);
+ *dst++ = 0xFF000000 | (r<<16) | (g<<8) | (b);
+ }
+ }
+}
+
diff --git a/Source/Core/VideoCommon/Src/XFBConvert.h b/Source/Core/VideoCommon/Src/XFBConvert.h new file mode 100644 index 0000000000..cd0557be02 --- /dev/null +++ b/Source/Core/VideoCommon/Src/XFBConvert.h @@ -0,0 +1,25 @@ +// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _XFB_CONVERT
+#define _XFB_CONVERT
+
+#include "Common.h"
+
+void ConvertXFB(u32 *dst, const u8* _pXFB, int width, int height);
+
+#endif
diff --git a/Source/Core/VideoCommon/VideoCommon.vcproj b/Source/Core/VideoCommon/VideoCommon.vcproj index 94ea3e07ee..4e80ec97f8 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcproj +++ b/Source/Core/VideoCommon/VideoCommon.vcproj @@ -414,6 +414,10 @@ >
</File>
<File
+ RelativePath=".\Src\SConscript"
+ >
+ </File>
+ <File
RelativePath=".\Src\TextureDecoder.cpp"
>
</File>
@@ -422,6 +426,14 @@ >
</File>
<File
+ RelativePath=".\Src\XFBConvert.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\XFBConvert.h"
+ >
+ </File>
+ <File
RelativePath=".\Src\XFMemory.cpp"
>
</File>
|
