Mercurial > hg > audiodb
diff dump.cpp @ 256:4dcb09f5fe85
Commit patch deprecating the --size argument, replacing it with
--ntracks, --datadims and --datasize.
These names are not ideal, but will serve for now.
author | mas01cr |
---|---|
date | Wed, 16 Apr 2008 09:59:43 +0000 |
parents | 2cc06e5b05a5 |
children | b9eff6896943 |
line wrap: on
line diff
--- a/dump.cpp Sat Apr 12 13:28:30 2008 +0000 +++ b/dump.cpp Wed Apr 16 09:59:43 2008 +0000 @@ -62,7 +62,7 @@ double *data_buffer; size_t data_buffer_size; for(unsigned k = 0; k < dbH->numFiles; k++) { - fprintf(kLFile, "%s\n", fileTable + k*O2_FILETABLESIZE); + fprintf(kLFile, "%s\n", fileTable + k*O2_FILETABLE_ENTRY_SIZE); snprintf(fName, 256, "%05d.features", k); if ((ffd = open(fName, O_CREAT|O_RDWR|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0) { error("error creating feature file", fName, "open"); @@ -130,7 +130,7 @@ } pos += trackTable[k]; - std::cout << fileTable+k*O2_FILETABLESIZE << " " << trackTable[k] << std::endl; + std::cout << fileTable+k*O2_FILETABLE_ENTRY_SIZE << " " << trackTable[k] << std::endl; } FILE *scriptFile; @@ -142,7 +142,12 @@ \n\ if [ -z \"${AUDIODB}\" ]; then echo set AUDIODB variable; exit 1; fi\n\ if [ -z \"$1\" ]; then echo usage: $0 newdb; exit 1; fi\n\n\ -\"${AUDIODB}\" -d \"$1\" -N --size=%d\n", (int) (dbH->dbSize / 1000000)); +\"${AUDIODB}\" -d \"$1\" -N --datasize=%d --ntracks=%d --datadim=%d\n", + (int) ((dbH->timesTableOffset - dbH->dataOffset) / (1024*1024)), + // fileTable entries (char[256]) are bigger than trackTable + // (int), so the granularity of page aligning is finer. + (int) ((dbH->trackTableOffset - dbH->fileTableOffset) / O2_FILETABLE_ENTRY_SIZE), + (int) ceil(((double) (dbH->timesTableOffset - dbH->dataOffset)) / ((double) (dbH->dbSize - dbH->l2normTableOffset)))); if(dbH->flags & O2_FLAG_L2NORM) { fprintf(scriptFile, "\"${AUDIODB}\" -d \"$1\" -L\n"); }