166 printf(
"input quantize=");
167 if (scanf(
"%d", &q) != 1) {
168 fprintf(stderr,
"bad number\n");
174 16, 11, 10, 16, 24, 40, 51, 61,
175 12, 12, 14, 19, 26, 58, 60, 55,
176 14, 13, 16, 24, 40, 57, 69, 56,
177 14, 17, 22, 29, 51, 87, 80, 62,
178 18, 22, 37, 56, 68, 109, 103, 77,
179 24, 35, 55, 64, 81, 104, 113, 92,
180 49, 64, 78, 87, 103, 121, 120, 101,
181 72, 92, 95, 98, 112, 100, 103, 99
184 for (
int i = 0; i <
N; i++) {
186 if (qTbl[i] == 0) qTbl[i] = 1;
193 for (
int i = 0; i <
N; i++) {
194 src[i] = rand() % 2048;
202 quantize2(dest2, src, qTbl);
203 for (
int i = 0; i <
N; i++) {
204 if (dest[i] != dest2[i]) {
205 printf(
"err[%d] %d %d\n", i, dest[i], dest2[i]);
209 const int count = 10000000;
213 for (
int i = 0; i <
count; i++) {
216 printf(
"time=%.1fsec\n", (clock() - begin) /
double(CLOCKS_PER_SEC));
219 for (
int i = 0; i <
count; i++) {
220 quantize2(dest, src, qTbl);
222 printf(
"time=%.1fsec\n", (clock() - begin) /
double(CLOCKS_PER_SEC));
223 }
catch (std::exception& e) {
224 printf(
"ERR:%s\n", e.what());
226 printf(
"unknown error\n");