Mercurial > hg > audiodb
diff l2norm.cpp @ 426:4a22a0bdf9a9 api-inversion
Deal with audioDB::UnitNorm
Deal with it by removing it completely, that is. New inline function
audiodb_l2norm_buffer(), replacing the three instances of that
functionality dotted throughout the code.
author | mas01cr |
---|---|
date | Wed, 24 Dec 2008 10:55:20 +0000 |
parents | d7e590d58c85 |
children |
line wrap: on
line diff
--- a/l2norm.cpp Wed Dec 24 10:55:16 2008 +0000 +++ b/l2norm.cpp Wed Dec 24 10:55:20 2008 +0000 @@ -6,7 +6,6 @@ static int audiodb_l2norm_existing(adb_t *adb) { double *data_buffer, *l2norm_buffer; - double *dp, *lp; adb_header_t *header = adb->header; size_t data_buffer_size = ALIGN_PAGE_UP(header->length); size_t nvectors = header->length / (sizeof(double) * header->dim); @@ -19,18 +18,7 @@ if(!l2norm_buffer) { goto error; } - - dp = data_buffer; - lp = l2norm_buffer; - for(size_t i = 0; i < nvectors; i++) { - *lp = 0; - for(unsigned int k = 0; k < header->dim; k++) { - *lp += (*dp)*(*dp); - dp++; - } - lp++; - } - + audiodb_l2norm_buffer(data_buffer, header->dim, nvectors, l2norm_buffer); if(lseek(adb->fd, adb->header->l2normTableOffset, SEEK_SET) == (off_t) -1) { goto error; }