add some code
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_blackman.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_blackman_f32(float *window, int len)
|
||||
{
|
||||
const float a0 = 0.42;
|
||||
const float a1 = 0.5;
|
||||
const float a2 = 0.08;
|
||||
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = a0 - a1 * cosf(i * 2 * M_PI * len_mult) + a2 * cosf(i * 4 * M_PI * len_mult);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_blackman_H_
|
||||
#define _dsps_wind_blackman_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Blackman window
|
||||
*
|
||||
* The function generates Blackman window for plpha = 0.16.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_blackman_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_blackman_H_
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_blackman_harris.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_blackman_harris_f32(float *window, int len)
|
||||
{
|
||||
const float a0 = 0.35875;
|
||||
const float a1 = 0.48829;
|
||||
const float a2 = 0.14128;
|
||||
const float a3 = 0.01168;
|
||||
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = a0
|
||||
- a1 * cosf(i * 2 * M_PI * len_mult)
|
||||
+ a2 * cosf(i * 4 * M_PI * len_mult)
|
||||
- a3 * cosf(i * 6 * M_PI * len_mult);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_blackman_harris_H_
|
||||
#define _dsps_wind_blackman_harris_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Blackman-Harris window
|
||||
*
|
||||
* The function generates Blackman-Harris window.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_blackman_harris_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_blackman_harris_H_
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_blackman_nuttall.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_blackman_nuttall_f32(float *window, int len)
|
||||
{
|
||||
const float a0 = 0.3635819;
|
||||
const float a1 = 0.4891775;
|
||||
const float a2 = 0.1365995;
|
||||
const float a3 = 0.0106411;
|
||||
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = a0
|
||||
- a1 * cosf(i * 2 * M_PI * len_mult)
|
||||
+ a2 * cosf(i * 4 * M_PI * len_mult)
|
||||
- a3 * cosf(i * 6 * M_PI * len_mult);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_blackman_nuttall_H_
|
||||
#define _dsps_wind_blackman_nuttall_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Blackman-Nuttall window
|
||||
*
|
||||
* The function generates Blackman-Nuttall window.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_blackman_nuttall_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_blackman_nuttall_H_
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_flat_top.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_flat_top_f32(float *window, int len)
|
||||
{
|
||||
const float a0 = 0.21557895;
|
||||
const float a1 = 0.41663158;
|
||||
const float a2 = 0.277263158;
|
||||
const float a3 = 0.083578947;
|
||||
const float a4 = 0.006947368;
|
||||
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = a0
|
||||
- a1 * cosf(i * 2 * M_PI * len_mult)
|
||||
+ a2 * cosf(i * 4 * M_PI * len_mult)
|
||||
- a3 * cosf(i * 6 * M_PI * len_mult)
|
||||
+ a4 * cosf(i * 8 * M_PI * len_mult);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_flat_top_H_
|
||||
#define _dsps_wind_flat_top_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Flat-Top window
|
||||
*
|
||||
* The function generates Flat-Top window.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_flat_top_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_flat_top_H_
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_hann.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_hann_f32(float *window, int len)
|
||||
{
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = 0.5 * (1 - cosf(i * 2 * M_PI * len_mult));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_hann_H_
|
||||
#define _dsps_wind_hann_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hann window
|
||||
*
|
||||
* The function generates Hann window.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_hann_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_hann_H_
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_H_
|
||||
#define _dsps_wind_H_
|
||||
|
||||
#include "dsps_wind_hann.h"
|
||||
#include "dsps_wind_blackman.h"
|
||||
#include "dsps_wind_blackman_harris.h"
|
||||
#include "dsps_wind_blackman_nuttall.h"
|
||||
#include "dsps_wind_nuttall.h"
|
||||
#include "dsps_wind_flat_top.h"
|
||||
|
||||
#endif // _dsps_wind_H_
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dsps_wind_nuttall.h"
|
||||
#include <math.h>
|
||||
|
||||
void dsps_wind_nuttall_f32(float *window, int len)
|
||||
{
|
||||
const float a0 = 0.355768;
|
||||
const float a1 = 0.487396;
|
||||
const float a2 = 0.144232;
|
||||
const float a3 = 0.012604;
|
||||
|
||||
float len_mult = 1 / (float)(len - 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
window[i] = a0
|
||||
- a1 * cosf(i * 2 * M_PI * len_mult)
|
||||
+ a2 * cosf(i * 4 * M_PI * len_mult)
|
||||
- a3 * cosf(i * 6 * M_PI * len_mult);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef _dsps_wind_nuttall_H_
|
||||
#define _dsps_wind_nuttall_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Nuttall window
|
||||
*
|
||||
* The function generates Nuttall window.
|
||||
*
|
||||
* @param window: buffer to store window array.
|
||||
* @param len: length of the window array
|
||||
*
|
||||
*/
|
||||
void dsps_wind_nuttall_f32(float *window, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _dsps_wind_nuttall_H_
|
||||
@@ -0,0 +1,119 @@
|
||||
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
#include "unity.h"
|
||||
#include "dsp_platform.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "esp_dsp.h"
|
||||
#include "dsps_wind.h"
|
||||
|
||||
static const int length = 1024;
|
||||
|
||||
// This test check if the window is symmetric
|
||||
TEST_CASE("dsps_wind_hann_f32: test Hann window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_hann_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
|
||||
TEST_CASE("dsps_wind_blackman_f32: test Blackman window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_blackman_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
|
||||
TEST_CASE("dsps_wind_blackman_harris_f32: test Blackman-Hariss window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_blackman_harris_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
|
||||
TEST_CASE("dsps_wind_blackman_nuttall_f32: test Blackman-Nuttall window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_blackman_nuttall_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
|
||||
TEST_CASE("dsps_wind_nuttall_f32: test Nuttall window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_nuttall_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
|
||||
TEST_CASE("dsps_wind_flat_top_f32: test Flat-Top window for symmetry", "[dsps]")
|
||||
{
|
||||
float *data = (float *)malloc(length * sizeof(float));
|
||||
dsps_wind_flat_top_f32(data, length);
|
||||
float hann_diff = 0;
|
||||
for (int i = 0 ; i < length / 2 ; i++) {
|
||||
hann_diff += fabs(data[i] - data[length - 1 - i]);
|
||||
}
|
||||
|
||||
if (hann_diff > 0) {
|
||||
TEST_ASSERT_EQUAL(0, hann_diff);
|
||||
}
|
||||
dsps_view(data, length, 64, 10, 0, 1, '.');
|
||||
free(data);
|
||||
}
|
||||
Reference in New Issue
Block a user