Commit a99068da authored by Erik Faye-Lund's avatar Erik Faye-Lund
Browse files

prefix period and delta luts with pimp_ for namespacing


Signed-off-by: default avatarErik Faye-Lund <kusmabite@gmail.com>
parent f2de02f0
......@@ -46,14 +46,14 @@ def gen_amiga_delta_lut():
def dump_linear_lut(filename):
linear_delta_lut = gen_linear_delta_lut()
f = open(filename, 'w')
print_lut_to_file(f, 'linear_delta_lut', linear_delta_lut)
print_lut_to_file(f, 'pimp_linear_delta_lut', linear_delta_lut)
f.close()
def dump_amiga_lut(filename):
amiga_delta_lut = gen_amiga_delta_lut()
f = open(filename, 'w')
f.write('#define AMIGA_DELTA_LUT_LOG2_SIZE %d\n' % (AMIGA_DELTA_LUT_LOG2_SIZE))
print_lut_to_file(f, 'amiga_delta_lut', amiga_delta_lut)
print_lut_to_file(f, 'pimp_amiga_delta_lut', amiga_delta_lut)
f.close()
dump_linear_lut('src/linear_delta_lut.h')
......
#define AMIGA_DELTA_LUT_LOG2_SIZE 7
const u16 amiga_delta_lut[65] =
const u16 pimp_amiga_delta_lut[65] =
{
55928, 55067, 54233, 53423, 52638, 51875, 51134, 50414, 49713, 49032, 48370, 47725,
47097, 46485, 45889, 45308, 44742, 44190, 43651, 43125, 42611, 42110, 41621, 41142,
......
const u16 amiga_period_lut[] =
const u16 pimp_amiga_period_lut[] =
{
/* this is for negative fine-tunes... */
907,900,894,887,881,875,868,862, /* B-0 */
......
const u16 linear_delta_lut[768] =
const u16 pimp_linear_delta_lut[768] =
{
16726, 16741, 16756, 16771, 16786, 16802, 16817, 16832, 16847, 16862, 16878, 16893,
16908, 16923, 16939, 16954, 16969, 16985, 17000, 17015, 17031, 17046, 17061, 17077,
......
......@@ -49,7 +49,7 @@ unsigned pimp_get_linear_delta(unsigned int period, unsigned int delta_scale)
unsigned p = (12 * 16 * 4 * 14) - period;
unsigned octave = p / (12 * 16 * 4);
unsigned octave_period = p % (12 * 16 * 4);
unsigned delta = linear_delta_lut[octave_period] << octave;
unsigned delta = pimp_linear_delta_lut[octave_period] << octave;
/* BEHOLD: the expression of the devil (this compiles to one arm-instruction) */
delta = ((long long)delta * (delta_scale >> 3) + (1ULL << 31)) >> 32;
......@@ -74,17 +74,17 @@ unsigned pimp_get_amiga_period(int note, int fine_tune)
{
unsigned int octave = index / (12 * 8);
unsigned int octave_index = index % (12 * 8);
return (((u32)amiga_period_lut[octave_index]) * 4) << (5 - octave);
return (((u32)pimp_amiga_period_lut[octave_index]) * 4) << (5 - octave);
}
if (index >= ARRAY_SIZE(amiga_period_lut) + 12 * 8 * 5)
if (index >= ARRAY_SIZE(pimp_amiga_period_lut) + 12 * 8 * 5)
{
unsigned int octave = index / (12 * 8);
unsigned int octave_index = index % (12 * 8);
return (((u32)amiga_period_lut[octave_index]) * 4) >> (octave - 5);
return (((u32)pimp_amiga_period_lut[octave_index]) * 4) >> (octave - 5);
}
return ((u32)amiga_period_lut[index - (12 * 8 * 5)]) * 4;
return ((u32)pimp_amiga_period_lut[index - (12 * 8 * 5)]) * 4;
}
#include "amiga_delta_lut.h"
......@@ -100,8 +100,8 @@ unsigned pimp_get_amiga_delta(unsigned int period, unsigned int delta_scale)
p >>= AMIGA_DELTA_LUT_FRAC_BITS;
/* interpolate table-entries for better result */
d1 = amiga_delta_lut[p - (AMIGA_DELTA_LUT_SIZE / 2)]; /* (8363 * 1712) / float(p) */
d2 = amiga_delta_lut[p + 1 - (AMIGA_DELTA_LUT_SIZE / 2)]; /* (8363 * 1712) / float(p + 1) */
d1 = pimp_amiga_delta_lut[p - (AMIGA_DELTA_LUT_SIZE / 2)]; /* (8363 * 1712) / float(p) */
d2 = pimp_amiga_delta_lut[p + 1 - (AMIGA_DELTA_LUT_SIZE / 2)]; /* (8363 * 1712) / float(p + 1) */
delta = (d1 << AMIGA_DELTA_LUT_FRAC_BITS) + (d2 - d1) * p_frac;
if (shamt > AMIGA_DELTA_LUT_FRAC_BITS) delta <<= shamt - AMIGA_DELTA_LUT_FRAC_BITS;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment