GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — rnlms/tester.c at master · lexa/rnlms Expand file tree/ Copy pathtester.cMore file actions executable file ·114 lines (85 loc) · 2.92 KB / Copy pathtester.cFile metadata and controlsexecutable file ·114 lines (85 loc) · 2.92 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 #include "tester.h" void testAlgo(rnlms_data_hnd filterStruct, const char *far__filename, const char *near__filename, const char *err_filename, const char *output_filename) { FILE *far__file = NULL, *near__file = NULL, *err_file = NULL; if (NULL == (far__file = fopen(far__filename, "rb"))) { fprintf(stderr, "can't open file\n"); return; } if (NULL == (near__file = fopen(near__filename, "rb"))) { fclose(far__file); fprintf(stderr, "can't open file\n"); return; } if (NULL == (err_file = fopen(err_filename, "wb"))) { fclose(far__file); fclose(near__file); fprintf(stderr, "can't open file\n"); return; } while(!feof(far__file) && !feof(near__file)) { size_t readedNums, t1, t2; int16_t far_arr[FRAME_SIZE]; int16_t near_arr[FRAME_SIZE]; int16_t err_arr[FRAME_SIZE]; /*читает один блок*/ if (FRAME_SIZE != (t1 = fread(far_arr, sizeof(int16_t), FRAME_SIZE, far__file))) { //fprintf(stderr, "warning, readed less then FRAME_SIZE(from far__file)"); break; } if (FRAME_SIZE != (t2 = fread(near_arr, sizeof(int16_t), FRAME_SIZE, near__file))) { //fprintf(stderr, "warning, readed less then FRAME_SIZE(from near__file)"); break; } readedNums = MIN (t1,t2); // printf("one block readed\n"); rnlms_process(filterStruct, far_arr, near_arr, err_arr, readedNums); // printf("one block processed\n"); /* /\*сохраняет обработанные данные*\/ */ if (fwrite(err_arr, sizeof(int16_t), readedNums, err_file) != readedNums) { fprintf(stderr, "can't write to file\n"); return; } } fclose(far__file); fclose(near__file); fclose(err_file); } int main() { size_t P = 300; rnlms_data_hnd filterStruct = malloc(sizeof_rnlms(P, FILTER_LEN)); assert(NULL != filterStruct); rnlms_init(filterStruct, 1.0, 0.00000001, P, FILTER_LEN, -75); // rnlms_set_options(filterStruct, OPT_INHIBIT_ADAPTATION); testAlgo(filterStruct, \ "g165/echo_30_128.dat", \ "g165/filtered_noise_30.dat", \ "error.dat", \ "output.dat" ); /* testAlgo(rnlms_func, filterStruct, \ */ /* "torvalds-says-linux.pcm", \ */ /* "torvalds-says-linux_echo.pcm", \ */ /* "error.dat", \ */ /* "output.dat" */ /* ); */ /* testAlgo(rnlms_func, filterStruct, \ */ /* "noise_two_levels.pcm", \ */ /* "noise_two_levels_echo.pcm", \ */ /* "error.dat", \ */ /* "output.dat" */ /* ); */ free(filterStruct); printf("exit successfull"); return (EXIT_SUCCESS); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |