remove: Rcos and hann

This commit is contained in:
liuyihui 2023-04-24 23:37:57 +08:00
parent dc40229644
commit d9dfcc39ec

View File

@ -1,28 +1,20 @@
#include "derivative.h"
#include "fft/fft.h" #include "fft/fft.h"
#include "fft/table.h" #include "fft/table.h"
#include "math.h" #include "math.h"
#include "sstv.h" #include "sstv.h"
#include "stdio.h" #include "stdio.h"
static q15_t buffer[MN];
static q15_t data[N]; static q15_t data[N];
static q15_t buffer[MN];
static q15_t* pData = &data[0]; static q15_t* pData = &data[0];
static q15_t img[1843202];
static q15_t* pImg = &img[0];
static uint8_t colorBuf[960]; static uint8_t colorBuf[960];
static const float32_t color_re = (float32_t)(FREQ_RANGE) / (COLOR_SCALE - 1); static const float32_t color_re = (float32_t)(FREQ_RANGE) / (COLOR_SCALE - 1);
#define fre2lum(fre) (uint8_t)((fre - FREQ_BLACK) / color_re) #define fre2lum(fre) (uint8_t)((fre - FREQ_BLACK) / color_re)
// #define Rcos(x, N) (0.5 - 0.5 * cos(2.0 * PI * x / (N - 1.0))) static q15_t img[1843202];
static q15_t* pImg = &img[0];
// static q15_t hann(uint16_t x, uint16_t len) {
// q31_t v = round(Rcos(x, len) * 32768);
// if (v > 32767) v = 32767;
// if (v < -32768) v = -32768;
// return (q15_t)v;
// }
void init() { void init() {
FILE* fp; FILE* fp;
fp = fopen("temp/data.txt", "r"); fp = fopen("temp/data.txt", "r");
@ -45,7 +37,6 @@ static uint16_t find_peak(uint16_t L, uint16_t R) {
static void hanning(uint16_t len) { static void hanning(uint16_t len) {
for (uint16_t i = len; i < N; i++) data[i] = 0; for (uint16_t i = len; i < N; i++) data[i] = 0;
// for (uint16_t i = 0; i < len; i++) data[i] = ((q31_t)data[i] * hann(i, len)) >> 15;
if (len == 160) if (len == 160)
for (uint16_t i = 0; i < len; i++) data[i] = ((q31_t)data[i] * hanning_160[i]) >> 15; for (uint16_t i = 0; i < len; i++) data[i] = ((q31_t)data[i] * hanning_160[i]) >> 15;
else else