Moved libresample to SRC directory
Moved GBA filters to SRC directory Removed unneeded sound interpolation class file
This commit is contained in:
parent
3fbb21a027
commit
21bc37c5fc
20
VBA.vcproj
20
VBA.vcproj
|
@ -1635,23 +1635,15 @@
|
||||||
Name="Resample"
|
Name="Resample"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\libresample-0.1.3\src\filterkit.c"
|
RelativePath=".\src\libresample-0.1.3\src\filterkit.c"
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\libresample-0.1.3\src\resample.c"
|
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\libresample-0.1.3\src\resamplesubs.c"
|
RelativePath=".\src\libresample-0.1.3\src\resample.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\libresample-0.1.3\src\resamplesubs.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|
|
@ -11,190 +11,190 @@ extern u16 systemColorMap16[0x10000];
|
||||||
extern u32 systemColorMap32[0x10000];
|
extern u32 systemColorMap32[0x10000];
|
||||||
|
|
||||||
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
||||||
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
|
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
|
||||||
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
||||||
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0};
|
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0};
|
||||||
|
|
||||||
// output R G B
|
// output R G B
|
||||||
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red
|
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red
|
||||||
8, 16, 8, // green
|
8, 16, 8, // green
|
||||||
0, 8, 16};// blue
|
0, 8, 16};// blue
|
||||||
|
|
||||||
inline void swap(short & a, short & b)
|
inline void swap(short & a, short & b)
|
||||||
{
|
{
|
||||||
short temp = a;
|
short temp = a;
|
||||||
a = b;
|
a = b;
|
||||||
b = temp;
|
b = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbafilter_pal(u16 * buf, int count)
|
void gbafilter_pal(u16 * buf, int count)
|
||||||
{
|
{
|
||||||
short temp[3 * 3], s;
|
short temp[3 * 3], s;
|
||||||
unsigned pix;
|
unsigned pix;
|
||||||
u8 red, green, blue;
|
u8 red, green, blue;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
pix = *buf;
|
pix = *buf;
|
||||||
|
|
||||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||||
temp[3] = s * influence[3];
|
temp[3] = s * influence[3];
|
||||||
temp[4] = s * influence[4];
|
temp[4] = s * influence[4];
|
||||||
temp[5] = s * influence[5];
|
temp[5] = s * influence[5];
|
||||||
|
|
||||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||||
temp[0] = s * influence[0];
|
temp[0] = s * influence[0];
|
||||||
temp[1] = s * influence[1];
|
temp[1] = s * influence[1];
|
||||||
temp[2] = s * influence[2];
|
temp[2] = s * influence[2];
|
||||||
|
|
||||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||||
temp[6] = s * influence[6];
|
temp[6] = s * influence[6];
|
||||||
temp[7] = s * influence[7];
|
temp[7] = s * influence[7];
|
||||||
temp[8] = s * influence[8];
|
temp[8] = s * influence[8];
|
||||||
|
|
||||||
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
||||||
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
||||||
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
||||||
temp[3] <<= 1;
|
temp[3] <<= 1;
|
||||||
temp[0] <<= 2;
|
temp[0] <<= 2;
|
||||||
temp[0] += temp[3] + temp[6];
|
temp[0] += temp[3] + temp[6];
|
||||||
|
|
||||||
red = ((int(temp[0]) * 160) >> 17) + 4;
|
red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||||
if (red > 31) red = 31;
|
if (red > 31) red = 31;
|
||||||
|
|
||||||
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
||||||
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
||||||
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
||||||
temp[5] <<= 1;
|
temp[5] <<= 1;
|
||||||
temp[2] <<= 2;
|
temp[2] <<= 2;
|
||||||
temp[2] += temp[5] + temp[8];
|
temp[2] += temp[5] + temp[8];
|
||||||
|
|
||||||
blue = ((int(temp[2]) * 160) >> 17) + 4;
|
blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||||
if (blue > 31) blue = 31;
|
if (blue > 31) blue = 31;
|
||||||
|
|
||||||
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
||||||
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
||||||
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
||||||
temp[4] <<= 1;
|
temp[4] <<= 1;
|
||||||
temp[1] <<= 2;
|
temp[1] <<= 2;
|
||||||
temp[1] += temp[4] + temp[7];
|
temp[1] += temp[4] + temp[7];
|
||||||
|
|
||||||
green = ((int(temp[1]) * 160) >> 17) + 4;
|
green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||||
if (green > 31) green = 31;
|
if (green > 31) green = 31;
|
||||||
|
|
||||||
pix = red << systemRedShift;
|
pix = red << systemRedShift;
|
||||||
pix += green << systemGreenShift;
|
pix += green << systemGreenShift;
|
||||||
pix += blue << systemBlueShift;
|
pix += blue << systemBlueShift;
|
||||||
|
|
||||||
*buf++ = pix;
|
*buf++ = pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbafilter_pal32(u32 * buf, int count)
|
void gbafilter_pal32(u32 * buf, int count)
|
||||||
{
|
{
|
||||||
short temp[3 * 3], s;
|
short temp[3 * 3], s;
|
||||||
unsigned pix;
|
unsigned pix;
|
||||||
u8 red, green, blue;
|
u8 red, green, blue;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
pix = *buf;
|
pix = *buf;
|
||||||
|
|
||||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||||
temp[3] = s * influence[3];
|
temp[3] = s * influence[3];
|
||||||
temp[4] = s * influence[4];
|
temp[4] = s * influence[4];
|
||||||
temp[5] = s * influence[5];
|
temp[5] = s * influence[5];
|
||||||
|
|
||||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||||
temp[0] = s * influence[0];
|
temp[0] = s * influence[0];
|
||||||
temp[1] = s * influence[1];
|
temp[1] = s * influence[1];
|
||||||
temp[2] = s * influence[2];
|
temp[2] = s * influence[2];
|
||||||
|
|
||||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||||
temp[6] = s * influence[6];
|
temp[6] = s * influence[6];
|
||||||
temp[7] = s * influence[7];
|
temp[7] = s * influence[7];
|
||||||
temp[8] = s * influence[8];
|
temp[8] = s * influence[8];
|
||||||
|
|
||||||
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
||||||
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
||||||
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
||||||
temp[3] <<= 1;
|
temp[3] <<= 1;
|
||||||
temp[0] <<= 2;
|
temp[0] <<= 2;
|
||||||
temp[0] += temp[3] + temp[6];
|
temp[0] += temp[3] + temp[6];
|
||||||
|
|
||||||
//red = ((int(temp[0]) * 160) >> 17) + 4;
|
//red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||||
red = ((int(temp[0]) * 160) >> 14) + 32;
|
red = ((int(temp[0]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
||||||
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
||||||
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
||||||
temp[5] <<= 1;
|
temp[5] <<= 1;
|
||||||
temp[2] <<= 2;
|
temp[2] <<= 2;
|
||||||
temp[2] += temp[5] + temp[8];
|
temp[2] += temp[5] + temp[8];
|
||||||
|
|
||||||
//blue = ((int(temp[2]) * 160) >> 17) + 4;
|
//blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||||
blue = ((int(temp[2]) * 160) >> 14) + 32;
|
blue = ((int(temp[2]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
||||||
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
||||||
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
||||||
temp[4] <<= 1;
|
temp[4] <<= 1;
|
||||||
temp[1] <<= 2;
|
temp[1] <<= 2;
|
||||||
temp[1] += temp[4] + temp[7];
|
temp[1] += temp[4] + temp[7];
|
||||||
|
|
||||||
//green = ((int(temp[1]) * 160) >> 17) + 4;
|
//green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||||
green = ((int(temp[1]) * 160) >> 14) + 32;
|
green = ((int(temp[1]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
//pix = red << redshift;
|
//pix = red << redshift;
|
||||||
//pix += green << greenshift;
|
//pix += green << greenshift;
|
||||||
//pix += blue << blueshift;
|
//pix += blue << blueshift;
|
||||||
|
|
||||||
pix = red << (systemRedShift - 3);
|
pix = red << (systemRedShift - 3);
|
||||||
pix += green << (systemGreenShift - 3);
|
pix += green << (systemGreenShift - 3);
|
||||||
pix += blue << (systemBlueShift - 3);
|
pix += blue << (systemBlueShift - 3);
|
||||||
|
|
||||||
*buf++ = pix;
|
*buf++ = pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for palette mode to work with the three spoony filters in 32bpp depth
|
// for palette mode to work with the three spoony filters in 32bpp depth
|
||||||
|
|
||||||
void gbafilter_pad(u8 * buf, int count)
|
void gbafilter_pad(u8 * buf, int count)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
u8 r;
|
u8 r;
|
||||||
u8 g;
|
u8 g;
|
||||||
u8 b;
|
u8 b;
|
||||||
u8 a;
|
u8 a;
|
||||||
} part;
|
} part;
|
||||||
unsigned whole;
|
unsigned whole;
|
||||||
}
|
}
|
||||||
mask;
|
mask;
|
||||||
|
|
||||||
mask.whole = 0x1f << systemRedShift;
|
mask.whole = 0x1f << systemRedShift;
|
||||||
mask.whole += 0x1f << systemGreenShift;
|
mask.whole += 0x1f << systemGreenShift;
|
||||||
mask.whole += 0x1f << systemBlueShift;
|
mask.whole += 0x1f << systemBlueShift;
|
||||||
|
|
||||||
switch (systemColorDepth)
|
switch (systemColorDepth)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24:
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*buf++ &= mask.part.r;
|
*buf++ &= mask.part.r;
|
||||||
*buf++ &= mask.part.g;
|
*buf++ &= mask.part.g;
|
||||||
*buf++ &= mask.part.b;
|
*buf++ &= mask.part.b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*((u32*)buf) &= mask.whole;
|
*((u32*)buf) &= mask.whole;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -208,7 +208,7 @@ void UpdateSystemColorMaps(int lcd)
|
||||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||||
}
|
}
|
||||||
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
|
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
|
@ -219,7 +219,7 @@ void UpdateSystemColorMaps(int lcd)
|
||||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||||
}
|
}
|
||||||
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
|
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "../libresample-0.1.3/include/libresample.h"
|
#include "libresample-0.1.3/include/libresample.h"
|
||||||
#include "snd_interp.h"
|
#include "snd_interp.h"
|
||||||
|
|
||||||
// this was once borrowed from libmodplug, and was also used to generate the FIR coefficient
|
// this was once borrowed from libmodplug, and was also used to generate the FIR coefficient
|
||||||
|
|
Loading…
Reference in New Issue