short_test_buff[0][i] = (rand() & PIXEL_MAX) - (rand() & PIXEL_MAX);
int_test_buff[0][i] = rand() % PIXEL_MAX;
int_idct_test_buff[0][i] = (rand() % (SHORT_MAX - SHORT_MIN)) - SHORT_MAX;
- int_denoise_test_buff1[0][i] = int_denoise_test_buff2[0][i] = (rand() & UNSIGNED_SHORT_MAX) - (rand() & UNSIGNED_SHORT_MAX);
+ short_denoise_test_buff1[0][i] = short_denoise_test_buff2[0][i] = (rand() & SHORT_MAX) - (rand() & SHORT_MAX);
short_test_buff[1][i] = -PIXEL_MAX;
int_test_buff[1][i] = -PIXEL_MAX;
int_idct_test_buff[1][i] = SHORT_MIN;
- int_denoise_test_buff1[1][i] = int_denoise_test_buff2[1][i] = -UNSIGNED_SHORT_MAX;
+ short_denoise_test_buff1[1][i] = short_denoise_test_buff2[1][i] = -SHORT_MAX;
short_test_buff[2][i] = PIXEL_MAX;
int_test_buff[2][i] = PIXEL_MAX;
int_idct_test_buff[2][i] = SHORT_MAX;
- int_denoise_test_buff1[2][i] = int_denoise_test_buff2[2][i] = UNSIGNED_SHORT_MAX;
+ short_denoise_test_buff1[2][i] = short_denoise_test_buff2[2][i] = SHORT_MAX;
mbuf1[i] = rand() & PIXEL_MAX;
mbufdct[i] = (rand() & PIXEL_MAX) - (rand() & PIXEL_MAX);
bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, intptr_t width)
{
int j = 0;
- intptr_t cmp_size = sizeof(int) * width * width;
+ intptr_t cmp_size = sizeof(short) * width * width;
for (int i = 0; i < ITERS; i++)
{
int index = rand() % TEST_CASES;
- ref(short_test_buff[index] + j, mintbuf3, width);
- checked(opt, short_test_buff[index] + j, mintbuf4, width);
+ ref(short_test_buff[index] + j, mshortbuf2, width);
+ checked(opt, short_test_buff[index] + j, mshortbuf3, width);
- if (memcmp(mintbuf3, mintbuf4, cmp_size))
+ if (memcmp(mshortbuf2, mshortbuf3, cmp_size))
return false;
reportfail();
{
int index = rand() % TEST_CASES;
- ref(int_idct_test_buff[index] + j, mshortbuf2, width);
- checked(opt, int_idct_test_buff[index] + j, mshortbuf3, width);
+ ref(short_test_buff[index] + j, mshortbuf2, width);
+ checked(opt, short_test_buff[index] + j, mshortbuf3, width);
if (memcmp(mshortbuf2, mshortbuf3, cmp_size))
return false;
int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize;
int shift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift;
- ref(short_test_buff[index] + j, mintbuf3, width * height, scale, shift);
- checked(opt, short_test_buff[index] + j, mintbuf4, width * height, scale, shift);
+ ref(short_test_buff[index] + j, mshortbuf2, width * height, scale, shift);
+ checked(opt, short_test_buff[index] + j, mshortbuf3, width * height, scale, shift);
- if (memcmp(mintbuf3, mintbuf4, sizeof(int) * height * width))
+ if (memcmp(mshortbuf2, mshortbuf3, sizeof(int16_t) * height * width))
return false;
reportfail();
for (int i = 0; i < ITERS; i++)
{
+
+ memset(mshortbuf2, 0, MAX_TU_SIZE * sizeof(int16_t));
+ memset(mshortbuf3, 0, MAX_TU_SIZE * sizeof(int16_t));
+
int log2TrSize = (rand() % 4) + 2;
int width = (1 << log2TrSize);
int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize;
int shift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift;
- int cmp_size = sizeof(int) * height * width;
+ int cmp_size = sizeof(int16_t) * height * width;
int index1 = rand() % TEST_CASES;
- ref(short_test_buff[index1] + j, mintbuf3, mintbuf1, width * height, per, shift);
- checked(opt, short_test_buff[index1] + j, mintbuf4, mintbuf2, width * height, per, shift);
+ ref(short_test_buff[index1] + j, int_test_buff[index1] + j, mshortbuf2, width * height, per, shift);
+ checked(opt, short_test_buff[index1] + j, int_test_buff[index1] + j, mshortbuf3, width * height, per, shift);
- if (memcmp(mintbuf1, mintbuf2, cmp_size))
+ if (memcmp(mshortbuf2, mshortbuf3, cmp_size))
return false;
reportfail();
int index1 = rand() % TEST_CASES;
int index2 = rand() % TEST_CASES;
- refReturnValue = ref(int_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf1, mshortbuf2, bits, valueToAdd, numCoeff);
- optReturnValue = (uint32_t)checked(opt, int_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf3, mshortbuf3, bits, valueToAdd, numCoeff);
+ refReturnValue = ref(short_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf1, mshortbuf2, bits, valueToAdd, numCoeff);
+ optReturnValue = (uint32_t)checked(opt, short_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf3, mshortbuf3, bits, valueToAdd, numCoeff);
if (memcmp(mintbuf1, mintbuf3, cmp_size))
return false;
int index1 = rand() % TEST_CASES;
int index2 = rand() % TEST_CASES;
- refReturnValue = ref(int_test_buff[index1] + j, int_test_buff[index2] + j, mshortbuf2, bits, valueToAdd, numCoeff);
- optReturnValue = (uint32_t)checked(opt, int_test_buff[index1] + j, int_test_buff[index2] + j, mshortbuf3, bits, valueToAdd, numCoeff);
+ refReturnValue = ref(short_test_buff[index1] + j, int_test_buff[index2] + j, mshortbuf2, bits, valueToAdd, numCoeff);
+ optReturnValue = (uint32_t)checked(opt, short_test_buff[index1] + j, int_test_buff[index2] + j, mshortbuf3, bits, valueToAdd, numCoeff);
if (memcmp(mshortbuf2, mshortbuf3, cmp_size))
return false;
int log2TrSize = s + 2;
int num = 1 << (log2TrSize * 2);
int cmp_size = sizeof(int) * num;
+ int cmp_short = sizeof(short) * num;
for (int i = 0; i < ITERS; i++)
{
int index = rand() % TEST_CASES;
- ref(int_denoise_test_buff1[index] + j, mubuf1, mushortbuf1, num);
- checked(opt, int_denoise_test_buff2[index] + j, mubuf2, mushortbuf1, num);
+ ref(short_denoise_test_buff1[index] + j, mubuf1, mushortbuf1, num);
+ checked(opt, short_denoise_test_buff2[index] + j, mubuf2, mushortbuf1, num);
- if (memcmp(int_denoise_test_buff1[index] + j, int_denoise_test_buff2[index] + j, cmp_size))
+ if (memcmp(short_denoise_test_buff1[index] + j, short_denoise_test_buff2[index] + j, cmp_short))
return false;
if (memcmp(mubuf1, mubuf2, cmp_size))
if (opt.dct[value])
{
printf("%s\t", dctInfo[value].name);
- REPORT_SPEEDUP(opt.dct[value], ref.dct[value], mbuf1, mintbuf3, dctInfo[value].width);
+ REPORT_SPEEDUP(opt.dct[value], ref.dct[value], mbuf1, mshortbuf2, dctInfo[value].width);
}
}
if (opt.idct[value])
{
printf("%s\t", idctInfo[value].name);
- REPORT_SPEEDUP(opt.idct[value], ref.idct[value], mbufidct, mshortbuf2, idctInfo[value].width);
+ REPORT_SPEEDUP(opt.idct[value], ref.idct[value], mshortbuf3, mshortbuf2, idctInfo[value].width);
}
}
if (opt.dequant_normal)
{
printf("dequant_normal\t");
- REPORT_SPEEDUP(opt.dequant_normal, ref.dequant_normal, short_test_buff[0], mintbuf3, 32 * 32, 70, 1);
+ REPORT_SPEEDUP(opt.dequant_normal, ref.dequant_normal, short_test_buff[0], mshortbuf2, 32 * 32, 70, 1);
}
if (opt.dequant_scaling)
{
printf("dequant_scaling\t");
- REPORT_SPEEDUP(opt.dequant_scaling, ref.dequant_scaling, short_test_buff[0], mintbuf3, mintbuf4, 32 * 32, 5, 1);
+ REPORT_SPEEDUP(opt.dequant_scaling, ref.dequant_scaling, short_test_buff[0], mintbuf3, mshortbuf2, 32 * 32, 5, 1);
}
if (opt.quant)
{
printf("quant\t\t");
- REPORT_SPEEDUP(opt.quant, ref.quant, int_test_buff[0], int_test_buff[1], mintbuf3, mshortbuf2, 23, 23785, 32 * 32);
+ REPORT_SPEEDUP(opt.quant, ref.quant, short_test_buff[0], int_test_buff[1], mintbuf3, mshortbuf2, 23, 23785, 32 * 32);
}
if (opt.nquant)
{
printf("nquant\t\t");
- REPORT_SPEEDUP(opt.nquant, ref.nquant, int_test_buff[0], int_test_buff[1], mshortbuf2, 23, 23785, 32 * 32);
+ REPORT_SPEEDUP(opt.nquant, ref.nquant, short_test_buff[0], int_test_buff[1], mshortbuf2, 23, 23785, 32 * 32);
}
if (opt.count_nonzero)
if (opt.denoiseDct)
{
printf("denoiseDct\t");
- REPORT_SPEEDUP(opt.denoiseDct, ref.denoiseDct, int_denoise_test_buff1[0], mubuf1, mushortbuf1, 32 * 32);
+ REPORT_SPEEDUP(opt.denoiseDct, ref.denoiseDct, short_denoise_test_buff1[0], mubuf1, mushortbuf1, 32 * 32);
}
}