// Generate random coefficients in the range [-15..15].
void gen_random_coeffs(int16_t* dst, size_t len)
// Generate random coefficients in the range [-15..15].
void gen_random_coeffs(int16_t* dst, size_t len)
// Test that the input is pretty close to the reference for random inputs.
// (If the reference funtion is given in, this becomes a simple test of its
// determinism.)
// Test that the input is pretty close to the reference for random inputs.
// (If the reference funtion is given in, this becomes a simple test of its
// determinism.)
{
int16_t coeff[DCTSIZE2];
uint32_t quant[DCTSIZE2];
uint8_t output[DCTSIZE2];
uint8_t reference[DCTSIZE2];
{
int16_t coeff[DCTSIZE2];
uint32_t quant[DCTSIZE2];
uint8_t output[DCTSIZE2];
uint8_t reference[DCTSIZE2];
// Unit quantization (ie., no scaling).
for (unsigned i = 0; i < DCTSIZE2; ++i) {
quant[i] = 1;
}
// Unit quantization (ie., no scaling).
for (unsigned i = 0; i < DCTSIZE2; ++i) {
quant[i] = 1;
}
for (unsigned i = 0; i < 1000; ++i) {
gen_random_coeffs(coeff, DCTSIZE2);
for (unsigned i = 0; i < 1000; ++i) {
gen_random_coeffs(coeff, DCTSIZE2);
- (*idct)(coeff, quant, output);
- (idct_reference)(coeff, quant, reference);
+ (*idct)(coeff, userdata, output);
+ (idct_reference)(coeff, userdata_reference, reference);
{
int16_t coeff[DCTSIZE2] = { 0 };
uint32_t quant[DCTSIZE2];
uint8_t output[DCTSIZE2];
{
int16_t coeff[DCTSIZE2] = { 0 };
uint32_t quant[DCTSIZE2];
uint8_t output[DCTSIZE2];
// Unit quantization (ie., no scaling).
for (unsigned i = 0; i < DCTSIZE2; ++i) {
quant[i] = 1;
}
// Unit quantization (ie., no scaling).
for (unsigned i = 0; i < DCTSIZE2; ++i) {
quant[i] = 1;
}
}
double diff = stop_benchmark_timer();
printf("%u runs in %.2f CPU seconds = %.2f IDCTs/sec\n",
num_runs, diff, num_runs / diff);
}
double diff = stop_benchmark_timer();
printf("%u runs in %.2f CPU seconds = %.2f IDCTs/sec\n",
num_runs, diff, num_runs / diff);