Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Michael Barr <b@rr-dav.id.au>2018-11-21 17:20:47 +0300
committerDavid Michael Barr <b@rr-dav.id.au>2018-11-23 18:59:49 +0300
commit0e3c21979b5e2e6e7e49968b1377e38220c58774 (patch)
tree23d8a356719e7ebcdd218c446130fcf5f36a20ce
parent6af37afa94abac4f002c80bb1bdb794f21cf21ff (diff)
checkasm: Add unit tests for chroma-from-luma subsampling
-rw-r--r--tests/checkasm/ipred.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/checkasm/ipred.c b/tests/checkasm/ipred.c
index f1168c9..531e5f3 100644
--- a/tests/checkasm/ipred.c
+++ b/tests/checkasm/ipred.c
@@ -46,6 +46,8 @@ static const char *const intra_pred_mode_names[N_IMPL_INTRA_PRED_MODES] = {
[FILTER_PRED] = "filter"
};
+static const char *const cfl_ac_names[3] = { "420", "422", "444" };
+
static const char *const cfl_pred_mode_names[DC_128_PRED + 1] = {
[DC_PRED] = "cfl",
[DC_128_PRED] = "cfl_128",
@@ -101,6 +103,42 @@ static void check_intra_pred(Dav1dIntraPredDSPContext *const c) {
report("intra_pred");
}
+static void check_cfl_ac(Dav1dIntraPredDSPContext *const c) {
+ ALIGN_STK_32(int16_t, c_dst, 32 * 32,);
+ ALIGN_STK_32(int16_t, a_dst, 32 * 32,);
+ ALIGN_STK_32(pixel, luma, 32 * 32,);
+
+ declare_func(void, int16_t *ac, const pixel *y, ptrdiff_t stride,
+ int w_pad, int h_pad, int cw, int ch);
+
+ for (int layout = 1; layout <= DAV1D_PIXEL_LAYOUT_I444; layout++) {
+ const int ss_ver = layout == DAV1D_PIXEL_LAYOUT_I420;
+ const int ss_hor = layout != DAV1D_PIXEL_LAYOUT_I444;
+ for (int w = 4; w <= (32 >> ss_hor); w <<= 1)
+ if (check_func(c->cfl_ac[layout - 1], "cfl_ac_%s_w%d_%dbpc",
+ cfl_ac_names[layout - 1], w, BITDEPTH))
+ {
+ for (int h = imax(w / 4, 4); h <= imin(w * 4, (32 >> ss_ver)); h <<= 1) {
+ const ptrdiff_t stride = 32 * sizeof(pixel);
+ const int w_pad = rand() & ((w >> 2) - 1);
+ const int h_pad = rand() & ((h >> 2) - 1);
+
+ for (int y = 0; y < (h << ss_ver); y++)
+ for (int x = 0; x < (w << ss_hor); x++)
+ luma[y * 32 + x] = rand() & ((1 << BITDEPTH) - 1);
+
+ call_ref(c_dst, luma, stride, w_pad, h_pad, w, h);
+ call_new(a_dst, luma, stride, w_pad, h_pad, w, h);
+ if (memcmp(c_dst, a_dst, w * h * sizeof(*c_dst)))
+ fail();
+
+ bench_new(a_dst, luma, stride, 0, 0, w, h);
+ }
+ }
+ }
+ report("cfl_ac");
+}
+
static void check_cfl_pred(Dav1dIntraPredDSPContext *const c) {
ALIGN_STK_32(pixel, c_dst, 32 * 32,);
ALIGN_STK_32(pixel, a_dst, 32 * 32,);
@@ -179,6 +217,7 @@ void bitfn(checkasm_check_ipred)(void) {
bitfn(dav1d_intra_pred_dsp_init)(&c);
check_intra_pred(&c);
+ check_cfl_ac(&c);
check_cfl_pred(&c);
check_pal_pred(&c);
}