commit : denoise lib first iteration

This commit is contained in:
Rafat Hussain 2017-08-07 06:40:11 +05:30
parent d29e08d06b
commit 4b80222408
5 changed files with 82 additions and 13 deletions

16
denoise/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(SOURCE_FILES denoise.c
)
set(HEADER_FILES denoise.h
)
add_library(denoiselib STATIC ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(denoiselib wavelib)
set_property(TARGET denoiselib PROPERTY FOLDER "lib")
target_include_directories(denoiselib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -1,7 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "../header/wavelib.h"
#include "denoise.h"
int compare_double(const void* a, const void* b)
{
@ -144,12 +142,3 @@ void visushrink(double *signal,int N,char *wname,char *method,char *ext,char *th
wave_free(wave);
wt_free(wt);
}
int main(void)
{
double x[10] = { 1123.78,234,40,-34,-56.89,98,0.2,23.9,-1236.3,3.14};
printf("Mad %g \n",mad(x,10));
}

28
denoise/denoise.h Normal file
View File

@ -0,0 +1,28 @@
/*
Copyright (c) 2017, Rafat Hussain
*/
#ifndef DENOISE_H_
#define DENOISE_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "../header/wavelib.h"
#ifdef __cplusplus
extern "C" {
#endif
void visushrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
double mad(double *x, int N);
#ifdef __cplusplus
}
#endif
#endif /* DENOISE_H_ */

24
header/denoise.h Normal file
View File

@ -0,0 +1,24 @@
/*
Copyright (c) 2017, Rafat Hussain
*/
#ifndef DENOISE_H_
#define DENOISE_H_
#include "wavelib.h"
#ifdef __cplusplus
extern "C" {
#endif
void visushrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
double mad(double *x, int N);
#ifdef __cplusplus
}
#endif
#endif /* DENOISE_H_ */

12
test/denoisetest.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "../header/denoise.h"
int main() {
double x[10] = {1.2,4.3,-0.7,90,4.7,123.5,-9.5,-100,0.0,89};
printf("%g \n",mad(x,10));
return 0;
}