C99 Restrict keyword does not exist in C++ (yet anyway). MSVC inline assembly should not be floating around by itself. Checking a define for MMX is stupid, but I won't worry about it right now. Link code is severly MSVC only and should be cleaned or moved.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@62 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
Nach 2007-11-14 09:16:23 +00:00
parent f188d0727f
commit bc661af3b9
7 changed files with 381 additions and 362 deletions

View File

@ -16,6 +16,7 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Util.h"
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
extern "C"

View File

@ -42,7 +42,7 @@
* This effect is a rewritten implementation of the hq4x effect made by Maxim Stepin
*/
void hq4x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, interp_uint16* restrict dst2, interp_uint16* restrict dst3, const interp_uint16* restrict src0, const interp_uint16* restrict src1, const interp_uint16* restrict src2, unsigned count)
void hq4x_16_def(interp_uint16* dst0, interp_uint16* dst1, interp_uint16* dst2, interp_uint16* dst3, const interp_uint16* src0, const interp_uint16* src1, const interp_uint16* src2, unsigned count)
{
unsigned i;
@ -126,7 +126,7 @@ void hq4x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, int
}
}
void hq4x_32_def(interp_uint32* restrict dst0, interp_uint32* restrict dst1, interp_uint32* restrict dst2, interp_uint32* restrict dst3, const interp_uint32* restrict src0, const interp_uint32* restrict src1, const interp_uint32* restrict src2, unsigned count)
void hq4x_32_def(interp_uint32* dst0, interp_uint32* dst1, interp_uint32* dst2, interp_uint32* dst3, const interp_uint32* src0, const interp_uint32* src1, const interp_uint32* src2, unsigned count)
{
unsigned i;

View File

@ -17,15 +17,16 @@
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "hq_shared32.h"
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
const unsigned __int64 reg_blank = 0x0000000000000000;
const unsigned __int64 const7 = 0x0000000700070007;
const unsigned __int64 treshold = 0x0000000000300706;
const uint64_t reg_blank = UINT64_C(0x0000000000000000);
const uint64_t const7 = UINT64_C(0x0000000700070007);
const uint64_t treshold = UINT64_C(0x0000000000300706);
void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2)
{
//*((int*)pc) = (c1*3+c2)/4;
#ifdef _MSC_VER
#ifdef MMX
__asm
{
@ -52,12 +53,14 @@ void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2)
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1*3+c2)/4;
#endif
}
void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
{
//*((int*)pc) = (c1*2+c2+c3)/4;
#ifdef _MSC_VER
#ifdef MMX
__asm
{
@ -84,14 +87,14 @@ void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1*2+c2+c3)/4;
#endif
}
void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2)
{
//*((int*)pc) = (c1*7+c2)/8;
//*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) +
// (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
#ifdef _MSC_VER
#ifdef MMX
__asm
{
@ -121,14 +124,16 @@ void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2)
mov [eax], ecx
}
#endif
#else
*((int*)pc) = (c1*7+c2)/8;
*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) +
(((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
#endif
}
void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
{
//*((int*)pc) = (c1*2+(c2+c3)*7)/16;
//*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) +
// (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4;
#ifdef _MSC_VER
#ifdef MMX
__asm
{
@ -183,12 +188,16 @@ void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int
mov [ebx], eax
}
#endif
#else
*((int*)pc) = (c1*2+(c2+c3)*7)/16;
*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) +
(((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4;
#endif
}
void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2)
{
//*((int*)pc) = (c1+c2)/2;
#ifdef _MSC_VER
#ifdef MMX
__asm
{
@ -210,6 +219,9 @@ void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2)
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1+c2)/2;
#endif
}

View File

@ -31,6 +31,12 @@
#ifndef __INTERP_H
#define __INTERP_H
#define __STDC_CONSTANT_MACROS
#include <stdint.h>
typedef uint16_t interp_uint16;
typedef uint32_t interp_uint32;
/***************************************************************************/
/* Basic types */

View File

@ -41,7 +41,7 @@
* This effect is derived from the hq3x effect made by Maxim Stepin
*/
void lq3x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, interp_uint16* restrict dst2, const interp_uint16* restrict src0, const interp_uint16* restrict src1, const interp_uint16* restrict src2, unsigned count)
void lq3x_16_def(interp_uint16* dst0, interp_uint16* dst1, interp_uint16* dst2, const interp_uint16* src0, const interp_uint16* src1, const interp_uint16* src2, unsigned count)
{
unsigned i;
@ -124,7 +124,7 @@ void lq3x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, int
}
}
void lq3x_32_def(interp_uint32* restrict dst0, interp_uint32* restrict dst1, interp_uint32* restrict dst2, const interp_uint32* restrict src0, const interp_uint32* restrict src1, const interp_uint32* restrict src2, unsigned count)
void lq3x_32_def(interp_uint32* dst0, interp_uint32* dst1, interp_uint32* dst2, const interp_uint32* src0, const interp_uint32* src1, const interp_uint32* src2, unsigned count)
{
unsigned i;

View File

@ -42,7 +42,7 @@
* This effect is derived from the hq4x effect made by Maxim Stepin
*/
void lq4x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, interp_uint16* restrict dst2, interp_uint16* restrict dst3, const interp_uint16* restrict src0, const interp_uint16* restrict src1, const interp_uint16* restrict src2, unsigned count)
void lq4x_16_def(interp_uint16* dst0, interp_uint16* dst1, interp_uint16* dst2, interp_uint16* dst3, const interp_uint16* src0, const interp_uint16* src1, const interp_uint16* src2, unsigned count)
{
unsigned i;
@ -126,7 +126,7 @@ void lq4x_16_def(interp_uint16* restrict dst0, interp_uint16* restrict dst1, int
}
}
void lq4x_32_def(interp_uint32* restrict dst0, interp_uint32* restrict dst1, interp_uint32* restrict dst2, interp_uint32* restrict dst3, const interp_uint32* restrict src0, const interp_uint32* restrict src1, const interp_uint32* restrict src2, unsigned count)
void lq4x_32_def(interp_uint32* dst0, interp_uint32* dst1, interp_uint32* dst2, interp_uint32* dst3, const interp_uint32* src0, const interp_uint32* src1, const interp_uint32* src2, unsigned count)
{
unsigned i;