diff --git a/apps/SOURCES b/apps/SOURCES
index 26e53d1..ce99ece 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -170,6 +170,9 @@ codec_thread.c
 playback.c
 codecs.c
 dsp.c
+#ifdef DSP_USE_SINC_RESAMPLING
+sinc.c
+#endif
 #ifndef HAVE_HARDWARE_BEEP
 beep.c
 #endif
diff --git a/apps/dsp.c b/apps/dsp.c
index 3cff191..79fc1b5 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -33,6 +33,9 @@
 #include "buffer.h"
 #include "fixedpoint.h"
 #include "fracmul.h"
+#ifdef DSP_USE_SINC_RESAMPLING
+#include "sinc.h"
+#endif
 
 /* Define LOGF_ENABLE to enable logf output in this file */
 /*#define LOGF_ENABLE*/
@@ -73,6 +76,22 @@ enum
  * NOTE: Any assembly routines that use these structures must be updated
  * if current data members are moved or changed.
  */
+
+#ifdef DSP_USE_SINC_RESAMPLING
+#define FILTER_SIZE 15
+#define FILTER_DELAY 7
+
+struct resample_data
+{
+    uint32_t increment;			    /* 00h */
+    uint32_t current;			    /* 04h */
+    uint32_t sinc_inc;			    /* 08h */
+    uint32_t buf_fill;			    /* 0ch */
+    int32_t sample_buf[2][FILTER_SIZE];
+    int32_t resample_buf[2][FILTER_SIZE*2];
+    int32_t sinc[15][256];
+};
+#else
 struct resample_data
 {
     uint32_t delta;                     /* 00h */
@@ -80,6 +99,7 @@ struct resample_data
     int32_t last_sample[2];             /* 08h */
                                         /* 10h */
 };
+#endif
 
 /* This is for passing needed data to assembly dsp routines. If another
  * dsp parameter needs to be passed, add to the end of the structure
@@ -632,6 +652,301 @@ static void sample_output_new_format(struct dsp_config *dsp)
     dsp->output_samples = sample_output_functions[out];
 }
 
+#ifdef DSP_USE_SINC_RESAMPLING
+
+static inline int32_t sinc_upsample(const int32_t *src, uint32_t current)
+{
+    int32_t sinc_val;
+    int32_t samp;
+    uint32_t current_int = current >> 16;
+    uint32_t current_frac = (current >> 8) & 0xff;
+
+    /* todo: linear interpolation between sinc values (doubles the amount of MULs) */
+    sinc_val = sinc[14][current_frac];
+    samp = (src[current_int-7]>>12)*sinc_val;
+
+    sinc_val = sinc[13][current_frac];
+    samp += (src[current_int-6]>>12)*sinc_val;
+
+    sinc_val = sinc[12][current_frac];
+    samp += (src[current_int-5]>>12)*sinc_val;
+
+    sinc_val = sinc[11][current_frac];
+    samp += (src[current_int-4]>>12)*sinc_val;
+
+    sinc_val = sinc[10][current_frac];
+    samp += (src[current_int-3]>>12)*sinc_val;
+
+    sinc_val = sinc[9][current_frac];
+    samp += (src[current_int-2]>>12)*sinc_val;
+
+    sinc_val = sinc[8][current_frac];
+    samp += (src[current_int-1]>>12)*sinc_val;
+
+    sinc_val = sinc[7][current_frac];
+    samp += (src[current_int-0]>>12)*sinc_val;
+
+    sinc_val = sinc[6][current_frac];
+    samp += (src[current_int+1]>>12)*sinc_val;
+
+    sinc_val = sinc[5][current_frac];
+    samp += (src[current_int+2]>>12)*sinc_val;
+
+    sinc_val = sinc[4][current_frac];
+    samp += (src[current_int+3]>>12)*sinc_val;
+
+    sinc_val = sinc[3][current_frac];
+    samp += (src[current_int+4]>>12)*sinc_val;
+
+    sinc_val = sinc[2][current_frac];
+    samp += (src[current_int+5]>>12)*sinc_val;
+
+    sinc_val = sinc[1][current_frac];
+    samp += (src[current_int+6]>>12)*sinc_val;
+
+    sinc_val = sinc[0][current_frac];
+    samp += (src[current_int+7]>>12)*sinc_val;
+
+    return (samp >> 4);
+}
+
+static inline int32_t sinc_downsample(const int32_t *src, uint32_t current, uint32_t sinc_increment, int32_t sinc[16][256])
+{
+    uint32_t sinc_current;
+    int32_t samp;
+    uint32_t current_int = current >> 16;
+
+    sinc_current = ((sinc_increment * (current & 0xffff))>>16) + ((uint32_t)7<<16);
+    sinc_current -= sinc_increment * 7;
+
+    /* todo: linear interpolation between sinc values */
+    samp = (src[current_int+7]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+6]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+5]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+4]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+3]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+2]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int+1]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current>>16]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-1]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-2]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-3]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-4]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-5]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-6]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    sinc_current += sinc_increment;
+    samp += (src[current_int-7]>>12)*sinc[sinc_current>>16][(sinc_current>>8) & 0xff];
+
+    return (samp >> 4);
+}
+
+static int dsp_downsample(int count, struct dsp_data *data,
+                          const int32_t *src[], int32_t *dst[])
+{
+    uint32_t inc = data->resample_data.increment;
+    uint32_t cur = data->resample_data.current;
+    int32_t *d = dst[0];
+    int i;
+
+    for(i = 0; i<data->num_channels; i++) {
+        cur = data->resample_data.current;
+        d = dst[i];
+
+        while((cur>>16) < (unsigned)count - FILTER_DELAY) {
+            int32_t sample = sinc_downsample(src[i], cur, data->resample_data.sinc_inc, data->resample_data.sinc);
+            // should never happen, but maybe because of rounding etc. it does:
+            if(sample > 32767<<12) sample = 32767<<12;
+            else if (sample < -32768<<12) sample = -32768<<12;
+            *d++ = sample;
+            cur += inc;
+        }
+    }
+
+    data->resample_data.current = cur;
+
+    return d - dst[data->num_channels-1];
+}
+
+
+static int dsp_upsample(int count, struct dsp_data *data,
+                        const int32_t *src[], int32_t *dst[])
+{
+    uint32_t inc = data->resample_data.increment;
+    uint32_t cur = data->resample_data.current;
+    int32_t *d = dst[0];
+    int i;
+
+    for(i = 0; i<data->num_channels; i++) {
+        cur = data->resample_data.current;
+        d = dst[i];
+
+        while((cur>>16) < (unsigned)count - FILTER_DELAY) {
+            int32_t sample = sinc_upsample(src[i], cur);
+            // should never happen, but maybe because of rounding etc. it does:
+            if(sample > 32767<<12) sample = 32767<<12;
+            else if (sample < -32768<<12) sample = -32768<<12;
+            *d++ = sample;
+            cur += inc;
+        }
+    }
+
+    data->resample_data.current = cur;
+
+    return d - dst[data->num_channels-1];
+}
+
+static void resampler_new_delta(struct dsp_config *dsp)
+{
+    int i, k;
+    dsp->data.resample_data.increment = (uint32_t)
+        dsp->frequency * 65536LL / NATIVE_FREQUENCY;
+
+    if (dsp->frequency == NATIVE_FREQUENCY)
+    {
+        /* NOTE: If fully glitch-free transistions from no resampling to
+           resampling are desired, last_sample history should be maintained
+           even when not resampling. */
+        dsp->resample = NULL;
+        memset(dsp->data.resample_data.resample_buf, 0, sizeof(dsp->data.resample_data.resample_buf));
+        dsp->data.resample_data.buf_fill = 0; /* fixme: initialize to 0 on startup */
+        dsp->data.resample_data.current = FILTER_SIZE<<16; /* fixme: initialize on startup */
+    } else if (dsp->frequency < NATIVE_FREQUENCY) {
+        dsp->resample = dsp_upsample;
+    } else {
+        dsp->resample = dsp_downsample;
+        dsp->data.resample_data.sinc_inc = (uint32_t)
+            NATIVE_FREQUENCY * 65536LL / dsp->frequency;
+        /* we have to scale the sinc's amplitude by downsampling rate,
+         * which is the same as the sinc_increment */
+        for (i=0; i<15; i++) {
+            for(k=0; k<256; k++) {
+            /* we need to reduce increment to 17.15, because sinc's max is 1.0
+             * and it is signed */
+            dsp->data.resample_data.sinc[i][k] =
+                (sinc[i][k] * (int32_t)(dsp->data.resample_data.sinc_inc>>1)) >> 15;
+            }
+        }
+    }
+}
+
+/* Resample count stereo samples. Returns number of stereo samples
+ * for further processing.
+ * count must be >= 15
+ */
+static inline int resample_core(struct dsp_config *dsp, unsigned count, int32_t *src[], int32_t *dst[])
+{
+    struct resample_data *rsdata = &dsp->data.resample_data;
+    int32_t *sb_src[2] =
+    {
+        &rsdata->resample_buf[0][0],
+        &rsdata->resample_buf[1][0],
+    };
+    int cnt;
+
+    memcpy(&rsdata->resample_buf[0][FILTER_SIZE], src[0], FILTER_SIZE  * sizeof(int32_t));
+    if (dsp->data.num_channels >  1)
+        memcpy(&rsdata->resample_buf[1][FILTER_SIZE], src[1], FILTER_SIZE * sizeof(int32_t));
+
+    cnt = dsp->resample(FILTER_SIZE*2, &dsp->data, (const int32_t **)sb_src, dst);
+
+    rsdata->current -= (FILTER_SIZE << 16);
+
+    if((rsdata->current >> 16) < count) {
+        int32_t *add_dst[2];
+        add_dst[0] = dst[0] + cnt;
+        add_dst[1] = dst[1] + cnt;
+        cnt += dsp->resample((int)count, &dsp->data, (const int32_t **)src, add_dst);
+    }
+
+    memcpy(rsdata->resample_buf[0], &src[0][count - FILTER_SIZE], FILTER_SIZE * sizeof(int32_t));
+    memcpy(rsdata->resample_buf[1], &src[dsp->data.num_channels - 1][count - FILTER_SIZE], FILTER_SIZE * sizeof(int32_t));
+
+    rsdata->current -= ((count - FILTER_SIZE) << 16);
+
+    return cnt;
+}
+
+/* Resample count stereo samples. Updates the src array, if resampling is
+ * done, to refer to the resampled data. Returns number of stereo samples
+ * for further processing.
+ */
+static inline int resample(struct dsp_config *dsp, int count, int32_t *src[])
+{
+    int32_t *dst[2] =
+    {
+        &resample_buf[RESAMPLE_BUF_LEFT_CHANNEL],
+        &resample_buf[RESAMPLE_BUF_RIGHT_CHANNEL],
+    };
+    struct resample_data *rsdata = &dsp->data.resample_data;
+    int res = 0;
+
+    if(rsdata->buf_fill || count < FILTER_SIZE) {
+        unsigned size = (count - rsdata->buf_fill > FILTER_SIZE)? FILTER_SIZE - rsdata->buf_fill : (unsigned)count;
+        memcpy(&rsdata->sample_buf[0][rsdata->buf_fill], src[0], size * sizeof(int32_t));
+        memcpy(&rsdata->sample_buf[1][rsdata->buf_fill], src[dsp->data.num_channels - 1], size * sizeof(int32_t));
+        rsdata->buf_fill += size;
+        count -= size;
+        src[0] += size;
+        src[1] += size;
+    }
+
+    if(rsdata->buf_fill == FILTER_SIZE) {
+        int32_t *buf_src[2] =
+        {
+            rsdata->sample_buf[0],
+            rsdata->sample_buf[1],
+        };
+        res = resample_core(dsp, FILTER_SIZE, buf_src, dst);
+        rsdata->buf_fill = 0;
+    }
+
+    if(count > FILTER_SIZE) {
+        int32_t *add_dst[2];
+        add_dst[0] = dst[0] + res;
+        add_dst[1] = dst[1] + res;
+        res += resample_core(dsp, (unsigned)count, src, add_dst);
+    } else if(count) {
+        /* assert(rsdata->buf_fill == 0); */
+        memcpy(rsdata->sample_buf[0], src[0], count * sizeof(int32_t));
+        memcpy(rsdata->sample_buf[1], src[dsp->data.num_channels - 1], count * sizeof(int32_t));
+        rsdata->buf_fill = count;
+    }
+
+    src[0] = dst[0];
+    src[1] = dst[dsp->data.num_channels - 1];
+
+    return res;
+}
+
+#else /* DSP_USE_SINC_RESAMPLING */
+
 /**
  * Linear interpolation resampling that introduces a one sample delay because
  * of our inability to look into the future at the end of a frame.
@@ -762,6 +1077,8 @@ static inline int resample(struct dsp_config *dsp, int count, int32_t *src[])
     return count;
 }
 
+#endif /* DSP_USE_SINC_RESAMPLING */
+
 static void dither_init(struct dsp_config *dsp)
 {
     memset(dither_data, 0, sizeof (dither_data));
@@ -1337,8 +1654,13 @@ int dsp_input_count(struct dsp_config *dsp, int count)
         /* Use the real resampling delta =
          * dsp->frequency * 65536 / NATIVE_FREQUENCY, and
          * round towards zero to avoid buffer overflows. */
+#ifdef DSP_USE_SINC_RESAMPLING
+	count = (int)(((unsigned long)count *
+                      dsp->data.resample_data.increment) >> 16);
+#else
         count = (int)(((unsigned long)count *
                       dsp->data.resample_data.delta) >> 16);
+#endif
     }
 
 #ifdef HAVE_PITCHSCREEN
@@ -1380,6 +1702,9 @@ intptr_t dsp_configure(struct dsp_config *dsp, int setting, intptr_t value)
 
     case DSP_SET_FREQUENCY:
         memset(&dsp->data.resample_data, 0, sizeof (dsp->data.resample_data));
+#ifdef DSP_USE_SINC_RESAMPLING
+        dsp->data.resample_data.current = FILTER_SIZE<<16;
+#endif
         /* Fall through!!! */
     case DSP_SWITCH_FREQUENCY:
         dsp->codec_frequency = (value == 0) ? NATIVE_FREQUENCY : value;
@@ -1464,6 +1789,9 @@ intptr_t dsp_configure(struct dsp_config *dsp, int setting, intptr_t value)
     case DSP_FLUSH:
         memset(&dsp->data.resample_data, 0,
                sizeof (dsp->data.resample_data));
+#ifdef DSP_USE_SINC_RESAMPLING
+        dsp->data.resample_data.current = FILTER_SIZE<<16;
+#endif
         resampler_new_delta(dsp);
         dither_init(dsp);
 #ifdef HAVE_PITCHSCREEN
diff --git a/apps/dsp_arm.S b/apps/dsp_arm.S
index 7e36074..6d130f7 100644
--- a/apps/dsp_arm.S
+++ b/apps/dsp_arm.S
@@ -397,6 +397,8 @@ apply_crossfeed:
  * int dsp_downsample(int count, struct dsp_data *data,
  *                    in32_t *src[], int32_t *dst[])
  */
+
+#ifdef DSP_HAVE_ASM_RESAMPLING
     .section    .text
     .global     dsp_downsample
 dsp_downsample:
@@ -513,6 +515,8 @@ dsp_upsample:
     ldmpc   regs=r4-r11             @ ... and we're out
     .size       dsp_upsample, .-dsp_upsample
 
+#endif
+
 /****************************************************************************
  *  void dsp_apply_gain(int count, struct dsp_data *data, int32_t *buf[])
  */
diff --git a/apps/dsp_asm.h b/apps/dsp_asm.h
index 7bf1837..c455a11 100644
--- a/apps/dsp_asm.h
+++ b/apps/dsp_asm.h
@@ -27,7 +27,6 @@
 /* Set the appropriate #defines based on CPU or whatever matters */
 #if defined(CPU_ARM)
 #define DSP_HAVE_ASM_APPLY_GAIN
-#define DSP_HAVE_ASM_RESAMPLING
 #define DSP_HAVE_ASM_CROSSFEED
 #define DSP_HAVE_ASM_SOUND_CHAN_MONO
 #define DSP_HAVE_ASM_SOUND_CHAN_CUSTOM
@@ -36,7 +35,6 @@
 #define DSP_HAVE_ASM_SAMPLE_OUTPUT_STEREO
 #elif defined (CPU_COLDFIRE)
 #define DSP_HAVE_ASM_APPLY_GAIN
-#define DSP_HAVE_ASM_RESAMPLING
 #define DSP_HAVE_ASM_CROSSFEED
 #define DSP_HAVE_ASM_SOUND_CHAN_MONO
 #define DSP_HAVE_ASM_SOUND_CHAN_CUSTOM
@@ -45,6 +43,10 @@
 #define DSP_HAVE_ASM_SAMPLE_OUTPUT_STEREO
 #endif /* CPU_COLDFIRE */
 
+#if (defined (CPU_ARM) || defined(CPU_COLDFIRE)) && !defined(DSP_USE_SINC_RESAMPLING)
+#define DSP_HAVE_ASM_RESAMPLING
+#endif
+
 /* Declare prototypes based upon what's #defined above */
 #ifdef DSP_HAVE_ASM_CROSSFEED
 void apply_crossfeed(int count, int32_t *buf[]);
diff --git a/apps/sinc.c b/apps/sinc.c
new file mode 100644
index 0000000..7641ba1
--- /dev/null
+++ b/apps/sinc.c
@@ -0,0 +1,499 @@
+#include <inttypes.h>
+
+int32_t sinc[15][256] = {
+    {0, 4, 8, 13, 17, 21, 26, 30,
+     34, 39, 43, 48, 52, 57, 61, 66,
+     70, 75, 79, 84, 88, 93, 98, 102,
+     107, 111, 116, 121, 125, 130, 135, 139,
+     144, 149, 154, 158, 163, 168, 172, 177,
+     182, 187, 191, 196, 201, 205, 210, 215,
+     220, 224, 229, 234, 238, 243, 248, 252,
+     257, 262, 266, 271, 275, 280, 284, 289,
+     293, 298, 302, 307, 311, 316, 320, 324,
+     329, 333, 337, 342, 346, 350, 354, 358,
+     362, 366, 371, 375, 378, 382, 386, 390,
+     394, 398, 401, 405, 409, 412, 416, 420,
+     423, 426, 430, 433, 436, 440, 443, 446,
+     449, 452, 455, 458, 461, 464, 466, 469,
+     472, 474, 477, 479, 482, 484, 486, 489,
+     491, 493, 495, 497, 499, 500, 502, 504,
+     505, 507, 508, 510, 511, 512, 513, 515,
+     516, 517, 517, 518, 519, 519, 520, 520,
+     521, 521, 521, 521, 522, 521, 521, 521,
+     521, 520, 520, 519, 519, 518, 517, 516,
+     515, 514, 513, 512, 511, 509, 508, 506,
+     504, 502, 501, 499, 496, 494, 492, 490,
+     487, 485, 482, 479, 476, 474, 471, 467,
+     464, 461, 457, 454, 450, 447, 443, 439,
+     435, 431, 427, 423, 418, 414, 409, 405,
+     400, 395, 390, 385, 380, 375, 370, 364,
+     359, 353, 348, 342, 336, 330, 324, 318,
+     312, 306, 299, 293, 286, 280, 273, 266,
+     260, 253, 246, 238, 231, 224, 217, 209,
+     202, 194, 186, 179, 171, 163, 155, 147,
+     139, 131, 122, 114, 106, 97, 89, 80,
+     71, 63, 54, 45, 36, 27, 18, 9
+     },
+    {0, -9, -18, -28, -37, -46, -56, -65,
+     -75, -84, -94, -104, -113, -123, -133, -143,
+     -153, -163, -172, -182, -192, -202, -212, -223,
+     -233, -243, -253, -263, -273, -283, -293, -304,
+     -314, -324, -334, -345, -355, -365, -375, -386,
+     -396, -406, -416, -427, -437, -447, -457, -467,
+     -477, -488, -498, -508, -518, -528, -538, -548,
+     -558, -568, -578, -588, -598, -607, -617, -627,
+     -636, -646, -656, -665, -675, -684, -693, -703,
+     -712, -721, -730, -739, -748, -757, -766, -775,
+     -784, -792, -801, -809, -818, -826, -834, -842,
+     -850, -858, -866, -874, -881, -889, -896, -904,
+     -911, -918, -925, -932, -939, -946, -952, -959,
+     -965, -971, -978, -984, -989, -995, -1001, -1006,
+     -1012, -1017, -1022, -1027, -1032, -1036, -1041, -1045,
+     -1050, -1054, -1058, -1062, -1065, -1069, -1072, -1075,
+     -1078, -1081, -1084, -1087, -1089, -1091, -1094, -1096,
+     -1097, -1099, -1100, -1102, -1103, -1104, -1104, -1105,
+     -1106, -1106, -1106, -1106, -1105, -1105, -1104, -1104,
+     -1103, -1101, -1100, -1098, -1097, -1095, -1093, -1090,
+     -1088, -1085, -1082, -1079, -1076, -1073, -1069, -1065,
+     -1061, -1057, -1053, -1048, -1043, -1038, -1033, -1028,
+     -1022, -1017, -1011, -1005, -998, -992, -985, -978,
+     -971, -964, -957, -949, -941, -933, -925, -916,
+     -908, -899, -890, -881, -871, -862, -852, -842,
+     -832, -822, -811, -800, -789, -778, -767, -756,
+     -744, -732, -720, -708, -696, -683, -671, -658,
+     -645, -632, -618, -605, -591, -577, -563, -549,
+     -535, -520, -505, -491, -476, -460, -445, -430,
+     -414, -398, -382, -366, -350, -334, -317, -301,
+     -284, -267, -250, -233, -216, -199, -181, -163,
+     -146, -128, -110, -92, -74, -55, -37, -19
+     },
+    {0, 19, 37, 56, 75, 94, 113, 133,
+     152, 171, 191, 210, 230, 249, 269, 289,
+     309, 328, 348, 368, 388, 408, 428, 448,
+     469, 489, 509, 529, 549, 570, 590, 610,
+     630, 651, 671, 691, 711, 732, 752, 772,
+     792, 812, 833, 853, 873, 893, 913, 933,
+     953, 972, 992, 1012, 1032, 1051, 1071, 1090,
+     1110, 1129, 1148, 1167, 1187, 1206, 1224, 1243,
+     1262, 1280, 1299, 1317, 1335, 1354, 1371, 1389,
+     1407, 1425, 1442, 1459, 1477, 1494, 1510, 1527,
+     1544, 1560, 1576, 1592, 1608, 1624, 1639, 1655,
+     1670, 1685, 1700, 1714, 1728, 1743, 1757, 1770,
+     1784, 1797, 1810, 1823, 1836, 1848, 1860, 1872,
+     1884, 1896, 1907, 1918, 1929, 1939, 1949, 1959,
+     1969, 1978, 1988, 1996, 2005, 2013, 2022, 2029,
+     2037, 2044, 2051, 2058, 2064, 2070, 2076, 2081,
+     2087, 2091, 2096, 2100, 2104, 2108, 2111, 2114,
+     2117, 2119, 2121, 2123, 2124, 2125, 2126, 2126,
+     2126, 2126, 2126, 2125, 2123, 2122, 2120, 2117,
+     2115, 2112, 2108, 2105, 2101, 2096, 2091, 2086,
+     2081, 2075, 2069, 2062, 2055, 2048, 2041, 2033,
+     2024, 2016, 2007, 1997, 1987, 1977, 1967, 1956,
+     1945, 1933, 1921, 1909, 1896, 1883, 1870, 1856,
+     1842, 1828, 1813, 1798, 1783, 1767, 1751, 1734,
+     1717, 1700, 1682, 1664, 1646, 1628, 1609, 1589,
+     1570, 1550, 1529, 1509, 1488, 1466, 1445, 1423,
+     1400, 1378, 1355, 1332, 1308, 1284, 1260, 1235,
+     1211, 1185, 1160, 1134, 1108, 1082, 1055, 1028,
+     1001, 974, 946, 918, 889, 861, 832, 803,
+     773, 744, 714, 684, 653, 623, 592, 561,
+     529, 498, 466, 434, 402, 369, 337, 304,
+     271, 238, 204, 171, 137, 103, 69, 34
+     },
+    {0, -35, -69, -104, -139, -175, -210, -245,
+     -281, -317, -353, -389, -425, -461, -497, -533,
+     -570, -606, -643, -679, -716, -753, -789, -826,
+     -863, -900, -937, -974, -1011, -1048, -1085, -1122,
+     -1159, -1196, -1232, -1269, -1306, -1343, -1380, -1417,
+     -1453, -1490, -1526, -1563, -1599, -1636, -1672, -1708,
+     -1744, -1780, -1816, -1851, -1887, -1922, -1957, -1992,
+     -2027, -2062, -2097, -2131, -2166, -2200, -2234, -2267,
+     -2301, -2334, -2367, -2400, -2433, -2465, -2497, -2529,
+     -2561, -2592, -2623, -2654, -2685, -2715, -2745, -2775,
+     -2804, -2833, -2862, -2890, -2919, -2946, -2974, -3001,
+     -3028, -3054, -3080, -3106, -3131, -3156, -3181, -3205,
+     -3229, -3252, -3275, -3298, -3320, -3342, -3363, -3384,
+     -3404, -3424, -3444, -3463, -3482, -3500, -3518, -3535,
+     -3552, -3568, -3584, -3599, -3614, -3629, -3642, -3656,
+     -3669, -3681, -3693, -3704, -3715, -3725, -3735, -3744,
+     -3752, -3760, -3768, -3775, -3781, -3787, -3792, -3797,
+     -3801, -3804, -3807, -3810, -3812, -3813, -3813, -3813,
+     -3813, -3812, -3810, -3807, -3804, -3801, -3797, -3792,
+     -3786, -3780, -3774, -3766, -3759, -3750, -3741, -3731,
+     -3721, -3710, -3698, -3686, -3673, -3659, -3645, -3630,
+     -3615, -3599, -3582, -3565, -3547, -3528, -3509, -3489,
+     -3469, -3448, -3426, -3404, -3381, -3357, -3333, -3308,
+     -3282, -3256, -3230, -3202, -3174, -3146, -3116, -3087,
+     -3056, -3025, -2993, -2961, -2928, -2895, -2861, -2826,
+     -2791, -2755, -2718, -2681, -2644, -2605, -2567, -2527,
+     -2487, -2447, -2406, -2364, -2322, -2279, -2236, -2192,
+     -2148, -2103, -2058, -2012, -1966, -1919, -1871, -1823,
+     -1775, -1726, -1677, -1627, -1576, -1525, -1474, -1422,
+     -1370, -1318, -1265, -1211, -1157, -1103, -1048, -993,
+     -937, -881, -825, -768, -711, -654, -596, -538,
+     -479, -421, -361, -302, -242, -182, -122, -61
+     },
+    {0, 61, 123, 184, 246, 309, 371, 434,
+     497, 560, 623, 686, 750, 814, 878, 942,
+     1006, 1070, 1135, 1200, 1264, 1329, 1394, 1459,
+     1524, 1589, 1654, 1719, 1784, 1849, 1915, 1980,
+     2045, 2110, 2175, 2240, 2305, 2370, 2435, 2500,
+     2564, 2629, 2693, 2758, 2822, 2886, 2949, 3013,
+     3077, 3140, 3203, 3266, 3328, 3391, 3453, 3515,
+     3577, 3638, 3699, 3760, 3820, 3880, 3940, 3999,
+     4059, 4117, 4176, 4234, 4291, 4348, 4405, 4461,
+     4517, 4573, 4628, 4682, 4736, 4790, 4843, 4895,
+     4947, 4999, 5050, 5100, 5150, 5199, 5248, 5296,
+     5343, 5390, 5436, 5482, 5526, 5571, 5614, 5657,
+     5699, 5741, 5782, 5822, 5861, 5900, 5938, 5975,
+     6012, 6047, 6082, 6116, 6150, 6182, 6214, 6245,
+     6275, 6304, 6332, 6360, 6387, 6412, 6437, 6461,
+     6485, 6507, 6528, 6549, 6568, 6587, 6604, 6621,
+     6637, 6652, 6665, 6678, 6690, 6701, 6711, 6720,
+     6728, 6735, 6740, 6745, 6749, 6752, 6754, 6755,
+     6754, 6753, 6751, 6747, 6743, 6737, 6730, 6723,
+     6714, 6704, 6693, 6681, 6668, 6653, 6638, 6622,
+     6604, 6585, 6566, 6545, 6523, 6500, 6475, 6450,
+     6424, 6396, 6367, 6338, 6307, 6275, 6241, 6207,
+     6172, 6135, 6097, 6058, 6019, 5977, 5935, 5892,
+     5848, 5802, 5755, 5708, 5659, 5609, 5558, 5505,
+     5452, 5398, 5342, 5286, 5228, 5169, 5109, 5048,
+     4986, 4923, 4859, 4794, 4727, 4660, 4592, 4522,
+     4452, 4380, 4308, 4234, 4160, 4084, 4008, 3930,
+     3851, 3772, 3691, 3610, 3528, 3444, 3360, 3275,
+     3188, 3101, 3013, 2924, 2835, 2744, 2652, 2560,
+     2467, 2373, 2278, 2182, 2085, 1988, 1890, 1791,
+     1691, 1591, 1489, 1387, 1285, 1181, 1077, 972,
+     867, 761, 654, 546, 438, 330, 220, 110
+     },
+    {0, -111, -223, -335, -447, -560, -674, -788,
+     -903, -1018, -1133, -1249, -1365, -1482, -1599, -1716,
+     -1834, -1952, -2070, -2189, -2307, -2427, -2546, -2666,
+     -2785, -2905, -3026, -3146, -3266, -3387, -3508, -3629,
+     -3750, -3870, -3991, -4112, -4233, -4354, -4475, -4596,
+     -4717, -4838, -4958, -5079, -5199, -5320, -5440, -5559,
+     -5679, -5798, -5917, -6036, -6155, -6273, -6391, -6509,
+     -6626, -6742, -6859, -6975, -7090, -7205, -7320, -7434,
+     -7547, -7660, -7773, -7885, -7996, -8106, -8216, -8326,
+     -8434, -8542, -8649, -8756, -8861, -8966, -9070, -9174,
+     -9276, -9378, -9478, -9578, -9677, -9775, -9872, -9968,
+     -10063, -10157, -10250, -10342, -10432, -10522, -10611, -10698,
+     -10785, -10870, -10954, -11036, -11118, -11198, -11277, -11355,
+     -11431, -11506, -11580, -11653, -11724, -11793, -11861, -11928,
+     -11993, -12057, -12120, -12181, -12240, -12298, -12354, -12409,
+     -12462, -12513, -12563, -12611, -12658, -12702, -12746, -12787,
+     -12827, -12865, -12901, -12935, -12968, -12999, -13028, -13055,
+     -13081, -13104, -13126, -13145, -13163, -13179, -13193, -13205,
+     -13215, -13223, -13229, -13233, -13235, -13235, -13233, -13229,
+     -13223, -13214, -13204, -13192, -13177, -13160, -13141, -13120,
+     -13097, -13072, -13044, -13015, -12983, -12948, -12912, -12873,
+     -12832, -12789, -12744, -12696, -12646, -12594, -12540, -12483,
+     -12424, -12362, -12298, -12232, -12164, -12093, -12020, -11944,
+     -11867, -11786, -11704, -11619, -11531, -11442, -11349, -11255,
+     -11158, -11059, -10957, -10853, -10746, -10637, -10526, -10412,
+     -10296, -10177, -10056, -9933, -9807, -9678, -9548, -9415,
+     -9279, -9141, -9001, -8858, -8712, -8565, -8415, -8262,
+     -8107, -7950, -7790, -7628, -7464, -7297, -7127, -6956,
+     -6782, -6605, -6427, -6245, -6062, -5876, -5688, -5497,
+     -5304, -5109, -4912, -4712, -4510, -4306, -4099, -3890,
+     -3679, -3465, -3250, -3032, -2811, -2589, -2364, -2138,
+     -1909, -1678, -1444, -1209, -971, -732, -490, -246
+     },
+    {0, 248, 498, 750, 1004, 1261, 1519, 1779,
+     2041, 2305, 2571, 2839, 3109, 3381, 3654, 3929,
+     4207, 4486, 4767, 5049, 5334, 5620, 5908, 6197,
+     6489, 6782, 7076, 7372, 7670, 7970, 8271, 8573,
+     8877, 9183, 9490, 9798, 10108, 10420, 10732, 11046,
+     11362, 11679, 11997, 12316, 12637, 12959, 13282, 13606,
+     13932, 14258, 14586, 14915, 15244, 15575, 15907, 16240,
+     16574, 16909, 17244, 17581, 17918, 18257, 18596, 18936,
+     19276, 19618, 19960, 20302, 20646, 20990, 21334, 21680,
+     22025, 22371, 22718, 23065, 23413, 23761, 24109, 24458,
+     24807, 25156, 25505, 25855, 26205, 26555, 26905, 27256,
+     27606, 27957, 28307, 28658, 29008, 29358, 29709, 30059,
+     30409, 30759, 31108, 31458, 31807, 32156, 32504, 32852,
+     33200, 33547, 33894, 34241, 34586, 34932, 35276, 35621,
+     35964, 36307, 36649, 36990, 37331, 37671, 38010, 38348,
+     38686, 39022, 39358, 39692, 40026, 40359, 40690, 41021,
+     41350, 41678, 42005, 42331, 42656, 42979, 43301, 43622,
+     43942, 44260, 44577, 44892, 45206, 45518, 45829, 46138,
+     46446, 46752, 47057, 47360, 47661, 47961, 48258, 48555,
+     48849, 49141, 49432, 49721, 50008, 50293, 50576, 50857,
+     51136, 51413, 51688, 51961, 52232, 52500, 52767, 53031,
+     53294, 53554, 53812, 54067, 54320, 54571, 54820, 55066,
+     55310, 55551, 55790, 56027, 56261, 56493, 56722, 56949,
+     57173, 57394, 57613, 57829, 58043, 58254, 58462, 58668,
+     58870, 59071, 59268, 59463, 59654, 59843, 60030, 60213,
+     60394, 60571, 60746, 60918, 61087, 61253, 61416, 61576,
+     61733, 61887, 62038, 62186, 62331, 62473, 62611, 62747,
+     62880, 63009, 63136, 63259, 63379, 63496, 63610, 63721,
+     63828, 63932, 64033, 64131, 64226, 64317, 64405, 64490,
+     64572, 64650, 64725, 64797, 64865, 64930, 64992, 65051,
+     65106, 65158, 65207, 65252, 65294, 65332, 65368, 65400,
+     65428, 65453, 65475, 65494, 65509, 65521, 65529, 65534
+     },
+    {65536, 65534, 65529, 65521, 65509, 65494, 65476, 65454,
+     65429, 65400, 65368, 65333, 65295, 65253, 65208, 65159,
+     65107, 65052, 64994, 64932, 64867, 64798, 64727, 64652,
+     64573, 64492, 64407, 64319, 64228, 64133, 64035, 63934,
+     63830, 63723, 63612, 63499, 63382, 63262, 63138, 63012,
+     62883, 62750, 62614, 62476, 62334, 62189, 62041, 61890,
+     61736, 61579, 61419, 61256, 61090, 60921, 60749, 60575,
+     60397, 60217, 60033, 59847, 59658, 59467, 59272, 59075,
+     58875, 58672, 58466, 58258, 58047, 57833, 57617, 57398,
+     57177, 56953, 56726, 56497, 56266, 56032, 55795, 55556,
+     55315, 55071, 54825, 54576, 54325, 54072, 53817, 53559,
+     53299, 53037, 52772, 52506, 52237, 51966, 51693, 51418,
+     51141, 50862, 50581, 50298, 50013, 49726, 49437, 49147,
+     48854, 48560, 48264, 47966, 47667, 47365, 47063, 46758,
+     46452, 46144, 45835, 45524, 45211, 44898, 44582, 44266,
+     43947, 43628, 43307, 42985, 42662, 42337, 42011, 41684,
+     41356, 41026, 40696, 40364, 40032, 39698, 39364, 39028,
+     38691, 38354, 38016, 37677, 37337, 36996, 36655, 36313,
+     35970, 35626, 35282, 34937, 34592, 34246, 33900, 33553,
+     33205, 32858, 32510, 32161, 31812, 31463, 31114, 30764,
+     30414, 30064, 29714, 29364, 29013, 28663, 28312, 27962,
+     27611, 27261, 26910, 26560, 26210, 25860, 25510, 25161,
+     24811, 24462, 24114, 23765, 23417, 23070, 22723, 22376,
+     22030, 21684, 21339, 20994, 20650, 20307, 19964, 19622,
+     19280, 18940, 18600, 18261, 17922, 17585, 17248, 16912,
+     16578, 16244, 15911, 15579, 15248, 14918, 14589, 14261,
+     13935, 13609, 13285, 12962, 12640, 12319, 12000, 11681,
+     11365, 11049, 10735, 10422, 10111, 9801, 9492, 9185,
+     8879, 8575, 8273, 7972, 7672, 7374, 7078, 6783,
+     6490, 6199, 5909, 5621, 5335, 5051, 4768, 4487,
+     4208, 3931, 3655, 3381, 3110, 2840, 2572, 2306,
+     2042, 1779, 1519, 1261, 1005, 750, 498, 248
+     },
+    {0, -246, -490, -732, -972, -1209, -1445, -1678,
+     -1909, -2138, -2365, -2590, -2812, -3032, -3250, -3466,
+     -3680, -3891, -4100, -4307, -4511, -4713, -4913, -5111,
+     -5306, -5499, -5690, -5878, -6064, -6247, -6429, -6607,
+     -6784, -6958, -7130, -7299, -7466, -7631, -7793, -7953,
+     -8110, -8265, -8417, -8568, -8715, -8861, -9004, -9144,
+     -9282, -9418, -9551, -9682, -9810, -9936, -10060, -10181,
+     -10299, -10416, -10530, -10641, -10750, -10857, -10961, -11063,
+     -11162, -11259, -11353, -11446, -11535, -11623, -11708, -11791,
+     -11871, -11949, -12024, -12097, -12168, -12237, -12303, -12367,
+     -12428, -12487, -12544, -12599, -12651, -12701, -12749, -12794,
+     -12837, -12878, -12917, -12953, -12988, -13020, -13049, -13077,
+     -13102, -13125, -13147, -13165, -13182, -13197, -13209, -13220,
+     -13228, -13234, -13238, -13240, -13240, -13238, -13234, -13228,
+     -13220, -13210, -13198, -13184, -13169, -13151, -13131, -13110,
+     -13086, -13061, -13033, -13004, -12974, -12941, -12906, -12870,
+     -12832, -12793, -12751, -12708, -12663, -12617, -12568, -12518,
+     -12467, -12414, -12359, -12303, -12245, -12186, -12125, -12063,
+     -11999, -11933, -11867, -11798, -11729, -11658, -11585, -11512,
+     -11436, -11360, -11282, -11203, -11123, -11041, -10959, -10875,
+     -10790, -10703, -10616, -10527, -10437, -10347, -10255, -10162,
+     -10068, -9973, -9877, -9780, -9682, -9583, -9483, -9382,
+     -9281, -9178, -9075, -8971, -8866, -8760, -8654, -8546,
+     -8438, -8330, -8220, -8110, -8000, -7889, -7777, -7664,
+     -7551, -7438, -7324, -7209, -7094, -6978, -6862, -6746,
+     -6629, -6512, -6394, -6276, -6158, -6039, -5921, -5801,
+     -5682, -5562, -5442, -5322, -5202, -5082, -4961, -4840,
+     -4720, -4599, -4478, -4357, -4236, -4115, -3994, -3873,
+     -3752, -3631, -3510, -3389, -3268, -3148, -3027, -2907,
+     -2787, -2667, -2547, -2428, -2309, -2190, -2071, -1953,
+     -1835, -1717, -1600, -1482, -1366, -1250, -1134, -1018,
+     -903, -788, -674, -561, -448, -335, -223, -111
+     },
+    {0, 111, 220, 330, 439, 547, 654, 761,
+     867, 973, 1078, 1182, 1285, 1388, 1490, 1591,
+     1692, 1792, 1891, 1989, 2087, 2183, 2279, 2374,
+     2468, 2562, 2654, 2746, 2836, 2926, 3015, 3103,
+     3190, 3277, 3362, 3446, 3530, 3612, 3694, 3774,
+     3854, 3932, 4010, 4087, 4162, 4237, 4311, 4383,
+     4455, 4525, 4595, 4663, 4730, 4797, 4862, 4926,
+     4989, 5051, 5112, 5172, 5231, 5289, 5346, 5401,
+     5456, 5509, 5561, 5612, 5662, 5711, 5759, 5806,
+     5851, 5896, 5939, 5981, 6023, 6063, 6101, 6139,
+     6176, 6211, 6246, 6279, 6311, 6342, 6372, 6400,
+     6428, 6455, 6480, 6504, 6527, 6549, 6570, 6590,
+     6609, 6626, 6643, 6658, 6672, 6686, 6698, 6709,
+     6719, 6727, 6735, 6742, 6747, 6752, 6755, 6758,
+     6759, 6759, 6759, 6757, 6754, 6750, 6745, 6739,
+     6733, 6725, 6716, 6706, 6695, 6683, 6670, 6656,
+     6642, 6626, 6609, 6592, 6573, 6553, 6533, 6512,
+     6489, 6466, 6442, 6417, 6391, 6365, 6337, 6309,
+     6280, 6250, 6219, 6187, 6154, 6121, 6087, 6052,
+     6016, 5980, 5943, 5905, 5866, 5827, 5786, 5746,
+     5704, 5662, 5619, 5575, 5531, 5486, 5440, 5394,
+     5347, 5300, 5252, 5203, 5154, 5104, 5054, 5003,
+     4951, 4899, 4847, 4794, 4740, 4686, 4631, 4576,
+     4521, 4465, 4409, 4352, 4295, 4237, 4179, 4121,
+     4062, 4003, 3943, 3883, 3823, 3763, 3702, 3641,
+     3579, 3518, 3456, 3394, 3331, 3269, 3206, 3143,
+     3079, 3016, 2952, 2888, 2824, 2760, 2696, 2631,
+     2567, 2502, 2437, 2372, 2307, 2242, 2177, 2112,
+     2047, 1982, 1916, 1851, 1786, 1721, 1655, 1590,
+     1525, 1460, 1395, 1330, 1265, 1201, 1136, 1071,
+     1007, 943, 879, 815, 751, 687, 624, 560,
+     497, 434, 371, 309, 247, 185, 123, 61
+     },
+    {0, -61, -122, -182, -242, -302, -362, -421,
+     -480, -538, -597, -654, -712, -769, -826, -882,
+     -938, -994, -1049, -1104, -1158, -1212, -1266, -1319,
+     -1372, -1424, -1476, -1527, -1578, -1628, -1678, -1728,
+     -1777, -1825, -1873, -1920, -1967, -2014, -2060, -2105,
+     -2150, -2194, -2238, -2282, -2324, -2367, -2408, -2449,
+     -2490, -2530, -2569, -2608, -2646, -2684, -2721, -2757,
+     -2793, -2829, -2863, -2898, -2931, -2964, -2996, -3028,
+     -3059, -3090, -3119, -3149, -3177, -3205, -3233, -3260,
+     -3286, -3311, -3336, -3361, -3384, -3407, -3430, -3451,
+     -3473, -3493, -3513, -3532, -3551, -3569, -3586, -3603,
+     -3619, -3634, -3649, -3663, -3677, -3690, -3702, -3714,
+     -3725, -3735, -3745, -3754, -3763, -3770, -3778, -3784,
+     -3790, -3796, -3801, -3805, -3809, -3812, -3814, -3816,
+     -3817, -3817, -3817, -3817, -3816, -3814, -3812, -3809,
+     -3805, -3801, -3796, -3791, -3785, -3779, -3772, -3764,
+     -3756, -3748, -3739, -3729, -3719, -3708, -3697, -3685,
+     -3673, -3660, -3646, -3633, -3618, -3603, -3588, -3572,
+     -3556, -3539, -3522, -3504, -3486, -3467, -3448, -3428,
+     -3408, -3388, -3367, -3346, -3324, -3302, -3279, -3256,
+     -3233, -3209, -3184, -3160, -3135, -3110, -3084, -3058,
+     -3031, -3004, -2977, -2950, -2922, -2894, -2865, -2836,
+     -2807, -2778, -2748, -2718, -2688, -2657, -2626, -2595,
+     -2564, -2532, -2500, -2468, -2435, -2403, -2370, -2337,
+     -2303, -2270, -2236, -2202, -2168, -2134, -2099, -2065,
+     -2030, -1995, -1960, -1924, -1889, -1853, -1818, -1782,
+     -1746, -1710, -1674, -1638, -1601, -1565, -1528, -1492,
+     -1455, -1418, -1382, -1345, -1308, -1271, -1234, -1197,
+     -1160, -1123, -1086, -1049, -1012, -975, -938, -901,
+     -864, -827, -790, -754, -717, -680, -643, -607,
+     -570, -534, -498, -461, -425, -389, -353, -317,
+     -281, -246, -210, -175, -140, -104, -69, -35
+     },
+    {0, 35, 69, 103, 137, 171, 205, 238,
+     271, 304, 337, 370, 402, 435, 467, 499,
+     530, 562, 593, 624, 654, 685, 715, 745,
+     775, 804, 833, 862, 891, 919, 947, 975,
+     1002, 1030, 1057, 1083, 1110, 1136, 1162, 1187,
+     1212, 1237, 1262, 1286, 1310, 1333, 1357, 1380,
+     1402, 1425, 1447, 1468, 1490, 1511, 1531, 1552,
+     1572, 1591, 1611, 1630, 1648, 1667, 1685, 1702,
+     1720, 1737, 1753, 1769, 1785, 1801, 1816, 1831,
+     1845, 1859, 1873, 1886, 1899, 1912, 1924, 1936,
+     1948, 1959, 1970, 1980, 1990, 2000, 2009, 2019,
+     2027, 2036, 2044, 2051, 2058, 2065, 2072, 2078,
+     2084, 2089, 2094, 2099, 2104, 2108, 2111, 2115,
+     2118, 2121, 2123, 2125, 2126, 2128, 2129, 2129,
+     2130, 2130, 2129, 2129, 2127, 2126, 2124, 2122,
+     2120, 2117, 2114, 2111, 2107, 2103, 2099, 2095,
+     2090, 2085, 2079, 2073, 2067, 2061, 2054, 2047,
+     2040, 2033, 2025, 2017, 2008, 2000, 1991, 1981,
+     1972, 1962, 1952, 1942, 1932, 1921, 1910, 1899,
+     1887, 1875, 1863, 1851, 1839, 1826, 1813, 1800,
+     1787, 1773, 1759, 1745, 1731, 1717, 1702, 1688,
+     1673, 1657, 1642, 1626, 1611, 1595, 1579, 1563,
+     1546, 1530, 1513, 1496, 1479, 1462, 1444, 1427,
+     1409, 1392, 1374, 1356, 1338, 1319, 1301, 1283,
+     1264, 1245, 1226, 1208, 1189, 1169, 1150, 1131,
+     1112, 1092, 1073, 1053, 1033, 1014, 994, 974,
+     954, 934, 914, 894, 874, 854, 834, 814,
+     794, 773, 753, 733, 713, 692, 672, 652,
+     631, 611, 591, 571, 550, 530, 510, 490,
+     469, 449, 429, 409, 389, 369, 349, 329,
+     309, 289, 269, 250, 230, 211, 191, 172,
+     152, 133, 114, 94, 75, 56, 38, 19
+     },
+    {0, -19, -37, -56, -74, -92, -110, -128,
+     -146, -164, -181, -199, -216, -234, -251, -268,
+     -285, -301, -318, -335, -351, -367, -383, -399,
+     -415, -430, -446, -461, -476, -491, -506, -521,
+     -536, -550, -564, -578, -592, -606, -619, -633,
+     -646, -659, -672, -685, -697, -710, -722, -734,
+     -746, -757, -769, -780, -791, -802, -813, -823,
+     -833, -844, -854, -863, -873, -882, -892, -901,
+     -909, -918, -927, -935, -943, -951, -958, -966,
+     -973, -980, -987, -994, -1000, -1007, -1013, -1019,
+     -1024, -1030, -1035, -1041, -1045, -1050, -1055, -1059,
+     -1063, -1067, -1071, -1075, -1078, -1082, -1085, -1087,
+     -1090, -1093, -1095, -1097, -1099, -1101, -1102, -1104,
+     -1105, -1106, -1107, -1107, -1108, -1108, -1108, -1108,
+     -1108, -1107, -1107, -1106, -1105, -1104, -1103, -1101,
+     -1100, -1098, -1096, -1094, -1091, -1089, -1086, -1084,
+     -1081, -1078, -1074, -1071, -1067, -1064, -1060, -1056,
+     -1052, -1048, -1043, -1039, -1034, -1029, -1024, -1019,
+     -1014, -1008, -1003, -997, -991, -986, -980, -973,
+     -967, -961, -954, -948, -941, -934, -927, -920,
+     -913, -906, -898, -891, -883, -876, -868, -860,
+     -852, -844, -836, -828, -819, -811, -802, -794,
+     -785, -776, -768, -759, -750, -741, -732, -723,
+     -714, -704, -695, -686, -676, -667, -657, -648,
+     -638, -628, -618, -609, -599, -589, -579, -569,
+     -559, -549, -539, -529, -519, -509, -499, -489,
+     -479, -468, -458, -448, -438, -427, -417, -407,
+     -397, -386, -376, -366, -356, -345, -335, -325,
+     -315, -304, -294, -284, -274, -264, -253, -243,
+     -233, -223, -213, -203, -193, -183, -173, -163,
+     -153, -143, -133, -124, -114, -104, -94, -85,
+     -75, -66, -56, -47, -37, -28, -18, -9
+     },
+    {0, 9, 18, 27, 36, 45, 54, 63,
+     72, 80, 89, 97, 106, 114, 123, 131,
+     139, 147, 155, 163, 171, 179, 187, 195,
+     202, 210, 217, 224, 232, 239, 246, 253,
+     260, 267, 274, 281, 287, 294, 300, 306,
+     313, 319, 325, 331, 337, 343, 349, 354,
+     360, 365, 371, 376, 381, 386, 391, 396,
+     401, 406, 410, 415, 419, 424, 428, 432,
+     436, 440, 444, 448, 452, 455, 459, 462,
+     465, 469, 472, 475, 478, 480, 483, 486,
+     488, 491, 493, 496, 498, 500, 502, 504,
+     505, 507, 509, 510, 512, 513, 514, 516,
+     517, 518, 519, 519, 520, 521, 521, 522,
+     522, 522, 523, 523, 523, 523, 523, 522,
+     522, 522, 521, 521, 520, 519, 519, 518,
+     517, 516, 515, 514, 512, 511, 510, 508,
+     507, 505, 503, 502, 500, 498, 496, 494,
+     492, 490, 488, 485, 483, 481, 478, 476,
+     473, 470, 468, 465, 462, 459, 456, 453,
+     450, 447, 444, 441, 438, 434, 431, 428,
+     424, 421, 417, 413, 410, 406, 402, 399,
+     395, 391, 387, 383, 379, 375, 371, 367,
+     363, 359, 355, 351, 347, 342, 338, 334,
+     330, 325, 321, 316, 312, 308, 303, 299,
+     294, 290, 285, 281, 276, 271, 267, 262,
+     258, 253, 248, 244, 239, 234, 230, 225,
+     220, 215, 211, 206, 201, 197, 192, 187,
+     182, 178, 173, 168, 163, 159, 154, 149,
+     145, 140, 135, 130, 126, 121, 116, 112,
+     107, 102, 98, 93, 89, 84, 79, 75,
+     70, 66, 61, 57, 52, 48, 43, 39,
+     34, 30, 26, 21, 17, 13, 8, 4
+     },
+    {0, -4, -8, -13, -17, -21, -25, -29,
+     -33, -37, -41, -45, -49, -53, -56, -60,
+     -64, -68, -71, -75, -79, -82, -86, -90,
+     -93, -97, -100, -103, -107, -110, -113, -117,
+     -120, -123, -126, -130, -133, -136, -139, -142,
+     -145, -148, -150, -153, -156, -159, -161, -164,
+     -167, -169, -172, -174, -177, -179, -182, -184,
+     -186, -189, -191, -193, -195, -197, -199, -201,
+     -203, -205, -207, -209, -211, -213, -215, -216,
+     -218, -220, -221, -223, -224, -226, -227, -228,
+     -230, -231, -232, -233, -235, -236, -237, -238,
+     -239, -240, -241, -242, -243, -243, -244, -245,
+     -246, -246, -247, -247, -248, -248, -249, -249,
+     -250, -250, -250, -250, -251, -251, -251, -251,
+     -251, -251, -251, -251, -251, -251, -251, -251,
+     -250, -250, -250, -250, -249, -249, -248, -248,
+     -247, -247, -246, -246, -245, -244, -244, -243,
+     -242, -242, -241, -240, -239, -238, -237, -236,
+     -235, -234, -233, -232, -231, -230, -228, -227,
+     -226, -225, -223, -222, -221, -219, -218, -217,
+     -215, -214, -212, -211, -209, -207, -206, -204,
+     -203, -201, -199, -197, -196, -194, -192, -190,
+     -188, -187, -185, -183, -181, -179, -177, -175,
+     -173, -171, -169, -167, -165, -163, -161, -159,
+     -157, -154, -152, -150, -148, -146, -144, -141,
+     -139, -137, -135, -132, -130, -128, -125, -123,
+     -121, -118, -116, -113, -111, -109, -106, -104,
+     -101, -99, -97, -94, -92, -89, -87, -84,
+     -82, -79, -77, -74, -72, -69, -67, -64,
+     -62, -59, -56, -54, -51, -49, -46, -44,
+     -41, -39, -36, -33, -31, -28, -26, -23,
+     -21, -18, -15, -13, -10, -8, -5, -3
+     }
+};
diff --git a/apps/sinc.h b/apps/sinc.h
new file mode 100644
index 0000000..ebb2fcd
--- /dev/null
+++ b/apps/sinc.h
@@ -0,0 +1,6 @@
+#ifndef _SINC_H
+#define _SINC_H
+
+extern int32_t sinc[15][256];
+
+#endif
diff --git a/tools/generate_sinc.m b/tools/generate_sinc.m
new file mode 100644
index 0000000..647a255
--- /dev/null
+++ b/tools/generate_sinc.m
@@ -0,0 +1,25 @@
+fid = fopen('sinc.c','w');
+
+sincv = (-7:1/256:+8-1/256);
+sincv = sinc(sincv);
+ham = hamming(1793*2+256*2)';
+sincv = sincv .* ham(257:size(ham)(2)-2);
+%sincv(3841+1:3841+256) = 0;
+fprintf(fid, "int32_t sinc[15][256] = {\n");
+
+for i = 0:14
+	fprintf(fid, "    {");
+	for j = 1:256
+		fprintf(fid, "%d", round(sincv(i*256 + j) * 65536));
+		if ( j != 256) fprintf(fid, ", "); endif;
+		if ( mod(j, 8) == 0 ) fprintf (fid, "\n     "); endif;
+	endfor
+	if ( i != 14)
+		fprintf(fid, "},\n");
+	else
+		fprintf(fid, "}\n");
+	endif;
+endfor
+fprintf(fid, "};\n");
+
+fclose(fid);
