Got hq4x to semi-usable state.
This commit is contained in:
parent
8dee572c9d
commit
8ab8165e6b
4 changed files with 20 additions and 18 deletions
|
|
@ -178,9 +178,9 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
int prevline, nextline;
|
int prevline, nextline;
|
||||||
Uint16 w[10];
|
Uint16 w[10];
|
||||||
Uint8 a;
|
Uint8 a;
|
||||||
Uint32 YUV1, YUV2;
|
|
||||||
int pattern;
|
int pattern;
|
||||||
int flag;
|
int flag;
|
||||||
|
Uint32 YUV1, YUV2;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
10
src/hqxx.c
10
src/hqxx.c
|
|
@ -181,7 +181,9 @@ void InitLUTs(Uint32 * RGBtoYUV)
|
||||||
Y = (r + g + b) >> 2;
|
Y = (r + g + b) >> 2;
|
||||||
u = 128 + ((r - b) >> 2);
|
u = 128 + ((r - b) >> 2);
|
||||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||||
RGBtoYUV[(i << 11) + (j << 5) + k] = (Y << 16) + (u << 8) + v;
|
RGBtoYUV[(i << 11) + (j << 5) + k] = (((Y & 0xF8) << 8) |
|
||||||
|
((u & 0xFE) << 3) |
|
||||||
|
(v >> 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -208,11 +210,15 @@ inline void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint
|
||||||
{
|
{
|
||||||
Uint32 c;
|
Uint32 c;
|
||||||
|
|
||||||
|
/* FIXME? */
|
||||||
|
|
||||||
// c = (c1 * 2 + c2 + c3) >> 2;
|
// c = (c1 * 2 + c2 + c3) >> 2;
|
||||||
|
|
||||||
c = ((((c1 & 0x07E0) * 2 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 2)) +
|
c = ((((c1 & 0x07E0) * 2 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 2)) +
|
||||||
(((c1 & 0xF81F) * 2 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 2)))
|
(((c1 & 0xF81F) * 2 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 2)))
|
||||||
>> 2;
|
>> 2;
|
||||||
|
|
||||||
|
|
||||||
hqxx_putpixel(dest, x, y, c, alpha);
|
hqxx_putpixel(dest, x, y, c, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,7 +252,7 @@ inline void Interp4(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint
|
||||||
|
|
||||||
c = ((((c1 & 0x07E0) * 2 +
|
c = ((((c1 & 0x07E0) * 2 +
|
||||||
((c2 & 0x07E0) +
|
((c2 & 0x07E0) +
|
||||||
(c3 & 0x07E0)) * 7) & 0x07E00) +
|
(c3 & 0x07E0)) * 7) & 0x7E00) +
|
||||||
(((c1 & 0xF81F) * 2 +
|
(((c1 & 0xF81F) * 2 +
|
||||||
((c2 & 0xF81F) +
|
((c2 & 0xF81F) +
|
||||||
(c3 & 0xF81F)) * 7) & 0xF81F0)) >> 4;
|
(c3 & 0xF81F)) * 7) & 0xF81F0)) >> 4;
|
||||||
|
|
|
||||||
22
src/hqxx.h
22
src/hqxx.h
|
|
@ -27,21 +27,17 @@
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
#define Ymask 0x00FF0000
|
#define Ymask 0xF800
|
||||||
#define Umask 0x0000FF00
|
#define Umask 0x07E0
|
||||||
#define Vmask 0x000000FF
|
#define Vmask 0x001F
|
||||||
|
|
||||||
//#define Ymask 0xF800
|
//trY in 32 = 0x00300000
|
||||||
//#define Umask 0x07E0
|
//trU in 32 = 0x00000700
|
||||||
//#define Vmask 0x001F
|
//trV in 32 = 0x00000006
|
||||||
|
|
||||||
#define trY 0x00300000
|
#define trY 0x3000
|
||||||
#define trU 0x00000700
|
#define trU 0x00C0
|
||||||
#define trV 0x00000006
|
#define trV 0x0006
|
||||||
|
|
||||||
//#define trY 0x3000
|
|
||||||
//#define trU 0x00C0
|
|
||||||
//#define trV 0x0006
|
|
||||||
|
|
||||||
|
|
||||||
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha);
|
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
/* #define USE_HWSURFACE */
|
/* #define USE_HWSURFACE */
|
||||||
|
|
||||||
|
|
||||||
/* #define USE_HQ4X */
|
#define USE_HQ4X
|
||||||
|
|
||||||
|
|
||||||
/* Disable fancy cursors in fullscreen mode, to avoid SDL bug: */
|
/* Disable fancy cursors in fullscreen mode, to avoid SDL bug: */
|
||||||
|
|
@ -3007,7 +3007,7 @@ void stamp_draw(int x, int y)
|
||||||
|
|
||||||
/* Shrink or grow it! */
|
/* Shrink or grow it! */
|
||||||
|
|
||||||
#ifdef HQ4X
|
#ifdef USE_HQ4X
|
||||||
if (state_stamps[cur_stamp]->size == 400)
|
if (state_stamps[cur_stamp]->size == 400)
|
||||||
{
|
{
|
||||||
/* Use high quality 4x filter! */
|
/* Use high quality 4x filter! */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue