Commit eca75cb5 authored by Yaowu Xu's avatar Yaowu Xu

Add test for highbitdepth PSNR functions

Ported from libvpx/nextgenv2: 9fb593d0

Change-Id: I97b93ba5cb9e28a06a77ff05f6ba1cd046a86d22
parent 35afeab3
......@@ -244,7 +244,7 @@ void calc_highbd_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
aom_sse_to_psnr((double)total_samples, peak, (double)total_sse);
}
#else // !CONFIG_AOM_HIGHBITDEPTH
#endif
void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
PSNR_STATS *psnr) {
......@@ -279,4 +279,3 @@ void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
psnr->psnr[0] =
aom_sse_to_psnr((double)total_samples, peak, (double)total_sse);
}
#endif // CONFIG_AOM_HIGHBITDEPTH
......@@ -45,10 +45,10 @@ void calc_highbd_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
int64_t highbd_get_sse_shift(const uint8_t *a8, int a_stride, const uint8_t *b8,
int b_stride, int width, int height,
unsigned int input_shift);
#else
#endif
void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
PSNR_STATS *psnr);
#endif
int64_t highbd_get_sse(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, int width, int height);
#ifdef __cplusplus
......
......@@ -14,6 +14,7 @@
#include <new>
#include "./aom_config.h"
#include "aom_dsp/psnr.h"
#include "aom_dsp/ssim.h"
#include "aom_ports/mem.h"
#include "aom_ports/msvc.h"
......@@ -31,6 +32,20 @@ typedef double (*LBDMetricFunc)(const YV12_BUFFER_CONFIG *source,
typedef double (*HBDMetricFunc)(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest, uint32_t bd);
double compute_hbd_psnr(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest, uint32_t bit_depth) {
PSNR_STATS psnr;
calc_highbd_psnr(source, dest, &psnr, bit_depth, bit_depth);
return psnr.psnr[0];
}
double compute_psnr(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest) {
PSNR_STATS psnr;
calc_psnr(source, dest, &psnr);
return psnr.psnr[0];
}
double compute_hbd_psnrhvs(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest, uint32_t bit_depth) {
double tempy, tempu, tempv;
......@@ -193,4 +208,9 @@ INSTANTIATE_TEST_CASE_P(
10, kPhvs_thresh),
MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs,
12, kPhvs_thresh)));
INSTANTIATE_TEST_CASE_P(
PSNR, HBDMetricsTest,
::testing::Values(
MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 10, kPhvs_thresh),
MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 12, kPhvs_thresh)));
} // namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment