Changeset 52c1de9 for tests


Ignore:
Timestamp:
Aug 22, 2018, 3:56:50 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
49b19d4
Parents:
3beacb3
Message:

tests/src/spectral/test-dct.c: check reconstruction works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/spectral/test-dct.c

    r3beacb3 r52c1de9  
    1 #include <aubio.h>
     1#include <math.h>
     2#include "aubio.h"
     3#include "utils_tests.h"
    24
    35int main (void)
     
    57  int return_code = 0;
    68  uint_t win_s = 32; // window size
    7   uint_t i, n_iters = 10; // number of iterations
     9  uint_t i, j, n_iters = 10; // number of iterations
    810  // create dct object
    911  aubio_dct_t * dct = new_aubio_dct(win_s);
     
    1113  fvec_t * in = new_fvec (win_s); // input buffer
    1214  fvec_t * dctout = new_fvec (win_s); // output buffer
     15  fvec_t * out = new_fvec (win_s); // input buffer
    1316
    1417  if (!dct || !in || !dctout) {
     
    2023  for (i = 0; i < n_iters; i++) {
    2124    aubio_dct_do (dct, in, dctout);
    22     aubio_dct_rdo (dct, dctout, in);
     25    aubio_dct_rdo (dct, dctout, out);
     26    for (j = 0; j < in->length; j++) {
     27      if (fabsf(in->data[j] - out->data[j]) > 10.e-4) {
     28        fprintf(stderr, "dct reconstruction failed\n");
     29      }
     30    }
    2331  }
     32
     33  fvec_print(in);
    2434  fvec_print(dctout);
    25   fvec_print(in);
     35  fvec_print(out);
     36
    2637  del_fvec(dctout);
    2738  del_fvec(in);
     39  del_fvec(out);
     40  del_aubio_dct(dct);
    2841
    29   del_aubio_dct(dct);
    3042  return return_code;
    3143}
Note: See TracChangeset for help on using the changeset viewer.