Commit cf18fe4e authored by Monty Montgomery's avatar Monty Montgomery Committed by Christopher Montgomery

Add CONFIG_DAALA_DCT8 experiment.

This experiment replaces the 8-point Type-II DCT and 8-point Type-IV DST
 scaling vp9 transforms with the 8-point orthonormal Daala transforms.
These have reduced complexity and are perfect reconstruction at the cost
 of a slightly worse coding performance.
This is because the Daala transforms expect the input to be shifted by 4
 bits but the output scale of the vp9 transforms is only 3 bits.

subset-1:

monty-square-baseline-subset1 ->
  monty-square-dct8-subset1@2017-07-17T21:37:44.281Z

  PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
0.0019 | -0.0011 | -0.0585 |  -0.0111 | 0.0305 |  0.0317 |     0.0187

objective-1-fast:

monty-square-baseline-o1f ->
  monty-square-dct8-o1f@2017-07-17T21:37:15.735Z

  PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
0.0285 |  0.0129 | -0.5080 |   0.0529 | 0.0345 |  0.0441 |     0.0054

Change-Id: I2b775495398fb717204a295397c3c5e3ca938183
parent 67dda51a
......@@ -14,7 +14,7 @@
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/inv_txfm.h"
#if CONFIG_DAALA_DCT4
#if CONFIG_DAALA_DCT4 || CONFIG_DAALA_DCT8
#include "av1/common/daala_tx.h"
#endif
......@@ -172,6 +172,18 @@ void aom_idct4x4_1_add_c(const tran_low_t *input, uint8_t *dest,
}
}
#if CONFIG_DAALA_DCT8
void aom_idct8_c(const tran_low_t *input, tran_low_t *output) {
int i;
od_coeff x[8];
od_coeff y[8];
for (i = 0; i < 8; i++) y[i] = (od_coeff)input[i];
od_bin_idct8(x, 1, y);
for (i = 0; i < 8; i++) output[i] = (tran_low_t)x[i];
}
#else
void aom_idct8_c(const tran_low_t *input, tran_low_t *output) {
tran_low_t step1[8], step2[8];
tran_high_t temp1, temp2;
......@@ -225,6 +237,7 @@ void aom_idct8_c(const tran_low_t *input, tran_low_t *output) {
output[6] = WRAPLOW(step1[1] - step1[6]);
output[7] = WRAPLOW(step1[0] - step1[7]);
}
#endif
void aom_idct8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride) {
tran_low_t out[8 * 8];
......@@ -300,6 +313,18 @@ void aom_iadst4_c(const tran_low_t *input, tran_low_t *output) {
output[3] = WRAPLOW(dct_const_round_shift(s0 + s1 - s3));
}
#if CONFIG_DAALA_DCT8
void aom_iadst8_c(const tran_low_t *input, tran_low_t *output) {
int i;
od_coeff x[8];
od_coeff y[8];
for (i = 0; i < 8; i++) y[i] = (od_coeff)input[i];
od_bin_idst8(x, 1, y);
for (i = 0; i < 8; i++) output[i] = (tran_low_t)x[i];
}
#else
void aom_iadst8_c(const tran_low_t *input, tran_low_t *output) {
int s0, s1, s2, s3, s4, s5, s6, s7;
......@@ -377,6 +402,8 @@ void aom_iadst8_c(const tran_low_t *input, tran_low_t *output) {
output[7] = WRAPLOW(-x1);
}
#endif
void aom_idct8x8_12_add_c(const tran_low_t *input, uint8_t *dest, int stride) {
tran_low_t out[8 * 8] = { 0 };
tran_low_t *outptr = out;
......
This diff is collapsed.
......@@ -5,5 +5,9 @@
void od_bin_fdct4(od_coeff y[4], const od_coeff *x, int xstride);
void od_bin_idct4(od_coeff *x, int xstride, const od_coeff y[4]);
void od_bin_fdct8(od_coeff y[8], const od_coeff *x, int xstride);
void od_bin_idct8(od_coeff *x, int xstride, const od_coeff y[8]);
void od_bin_fdst8(od_coeff y[8], const od_coeff *x, int xstride);
void od_bin_idst8(od_coeff *x, int xstride, const od_coeff y[8]);
#endif
......@@ -47,7 +47,13 @@ static void iidtx4_c(const tran_low_t *input, tran_low_t *output) {
static void iidtx8_c(const tran_low_t *input, tran_low_t *output) {
int i;
for (i = 0; i < 8; ++i) output[i] = input[i] * 2;
for (i = 0; i < 8; ++i) {
#if CONFIG_DAALA_DCT8
output[i] = input[i];
#else
output[i] = input[i] * 2;
#endif
}
}
static void iidtx16_c(const tran_low_t *input, tran_low_t *output) {
......@@ -1142,12 +1148,18 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
// inverse transform row vectors
for (i = 0; i < 8; ++i) {
#if CONFIG_DAALA_DCT8
tran_low_t temp_in[8];
for (j = 0; j < 8; j++) temp_in[j] = input[j] * 2;
IHT_8[tx_type].rows(temp_in, out[i]);
#else
#if CONFIG_LGT
if (use_lgt_row)
ilgt8(input, out[i], lgtmtx_row[i]);
else
#endif
IHT_8[tx_type].rows(input, out[i]);
#endif
input += 8;
}
......@@ -1177,7 +1189,11 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (j = 0; j < 8; ++j) {
int d = i * stride + j;
int s = j * outstride + i;
#if CONFIG_DAALA_DCT8
dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 4));
#else
dest[d] = clip_pixel_add(dest[d], ROUND_POWER_OF_TWO(outp[s], 5));
#endif
}
}
}
......@@ -1397,6 +1413,7 @@ void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
aom_iwht4x4_1_add(input, dest, stride);
}
#if !CONFIG_DAALA_DCT8
static void idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
const TxfmParam *txfm_param) {
// If dc is 1, then input[0] is the reconstructed value, do not need
......@@ -1421,6 +1438,7 @@ static void idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
else
aom_idct8x8_64_add(input, dest, stride);
}
#endif
static void idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride,
const TxfmParam *txfm_param) {
......@@ -1664,7 +1682,11 @@ static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride,
const TxfmParam *txfm_param) {
const TX_TYPE tx_type = txfm_param->tx_type;
switch (tx_type) {
#if !CONFIG_DAALA_DCT8
case DCT_DCT: idct8x8_add(input, dest, stride, txfm_param); break;
#else
case DCT_DCT:
#endif
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
......
......@@ -21,7 +21,7 @@
#include "av1/common/av1_fwd_txfm1d.h"
#include "av1/common/av1_fwd_txfm1d_cfg.h"
#include "av1/common/idct.h"
#if CONFIG_DAALA_DCT4
#if CONFIG_DAALA_DCT4 || CONFIG_DAALA_DCT8
#include "av1/common/daala_tx.h"
#endif
......@@ -91,6 +91,18 @@ static void fdct4(const tran_low_t *input, tran_low_t *output) {
}
#endif
#if CONFIG_DAALA_DCT8
static void fdct8(const tran_low_t *input, tran_low_t *output) {
int i;
od_coeff x[8];
od_coeff y[8];
for (i = 0; i < 8; i++) x[i] = (od_coeff)input[i];
od_bin_fdct8(y, x, 1);
for (i = 0; i < 8; i++) output[i] = (tran_low_t)y[i];
}
#else
static void fdct8(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
tran_low_t step[8];
......@@ -168,6 +180,7 @@ static void fdct8(const tran_low_t *input, tran_low_t *output) {
range_check(output, 8, 16);
}
#endif
static void fdct16(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
......@@ -783,6 +796,18 @@ static void fadst4(const tran_low_t *input, tran_low_t *output) {
output[3] = (tran_low_t)fdct_round_shift(s3);
}
#if CONFIG_DAALA_DCT8
static void fadst8(const tran_low_t *input, tran_low_t *output) {
int i;
od_coeff x[8];
od_coeff y[8];
for (i = 0; i < 8; i++) x[i] = (od_coeff)input[i];
od_bin_fdst8(y, x, 1);
for (i = 0; i < 8; i++) output[i] = (tran_low_t)y[i];
}
#else
static void fadst8(const tran_low_t *input, tran_low_t *output) {
tran_high_t s0, s1, s2, s3, s4, s5, s6, s7;
......@@ -853,6 +878,7 @@ static void fadst8(const tran_low_t *input, tran_low_t *output) {
output[6] = (tran_low_t)x5;
output[7] = (tran_low_t)-x1;
}
#endif
static void fadst16(const tran_low_t *input, tran_low_t *output) {
tran_high_t s0, s1, s2, s3, s4, s5, s6, s7, s8;
......@@ -1120,7 +1146,13 @@ static void fidtx4(const tran_low_t *input, tran_low_t *output) {
static void fidtx8(const tran_low_t *input, tran_low_t *output) {
int i;
for (i = 0; i < 8; ++i) output[i] = input[i] * 2;
for (i = 0; i < 8; ++i) {
#if CONFIG_DAALA_DCT8
output[i] = input[i];
#else
output[i] = input[i] * 2;
#endif
}
}
static void fidtx16(const tran_low_t *input, tran_low_t *output) {
......@@ -2133,9 +2165,13 @@ void av1_fht8x8_c(const int16_t *input, tran_low_t *output, int stride,
#if CONFIG_DCT_ONLY
assert(tx_type == DCT_DCT);
#endif
#if !CONFIG_DAALA_DCT8
if (tx_type == DCT_DCT) {
aom_fdct8x8_c(input, output, stride);
} else {
return;
}
#endif
{
static const transform_2d FHT[] = {
{ fdct8, fdct8 }, // DCT_DCT
{ fadst8, fdct8 }, // ADST_DCT
......@@ -2175,7 +2211,11 @@ void av1_fht8x8_c(const int16_t *input, tran_low_t *output, int stride,
// Columns
for (i = 0; i < 8; ++i) {
#if CONFIG_DAALA_DCT8
for (j = 0; j < 8; ++j) temp_in[j] = input[j * stride + i] * 16;
#else
for (j = 0; j < 8; ++j) temp_in[j] = input[j * stride + i] * 4;
#endif
#if CONFIG_LGT
if (use_lgt_col)
flgt8(temp_in, temp_out, lgtmtx_col[i]);
......@@ -2194,8 +2234,13 @@ void av1_fht8x8_c(const int16_t *input, tran_low_t *output, int stride,
else
#endif
ht.rows(temp_in, temp_out);
#if CONFIG_DAALA_DCT8
for (j = 0; j < 8; ++j)
output[j + i * 8] = (temp_out[j] + (temp_out[j] < 0)) >> 1;
#else
for (j = 0; j < 8; ++j)
output[j + i * 8] = (temp_out[j] + (temp_out[j] < 0)) >> 1;
#endif
}
}
}
......
......@@ -170,6 +170,7 @@ set(CONFIG_VAR_TX_NO_TX_MODE 0 CACHE NUMBER "Internal flag.")
set(CONFIG_ANALYZER 0 CACHE NUMBER "Internal flag.")
set(CONFIG_DCT_ONLY 0 CACHE NUMBER "Internal flag.")
set(CONFIG_DAALA_DCT4 0 CACHE NUMBER "Internal flag.")
set(CONFIG_DAALA_DCT8 0 CACHE NUMBER "Internal flag.")
set(CONFIG_GF_GROUPS 0 CACHE NUMBER "Internal flag.")
set(CONFIG_MRC_TX 0 CACHE NUMBER "Internal flag.")
set(CONFIG_INTER_STATS_ONLY 0 CACHE NUMBER "Internal flag.")
......
......@@ -243,6 +243,34 @@ if (CONFIG_VAR_TX_NO_TX_MODE AND NOT CONFIG_VAR_TX)
set(CONFIG_VAR_TX_NO_TX_MODE 0)
endif()
if (CONFIG_DAALA_DCT8)
if (HAVE_MMX)
message(WARNING
"--- Disabled HAVE_MMX, required for CONFIG_DAALA_DCT8.")
set(HAVE_MMX 0)
endif()
if (CONFIG_RECT_TX)
message(WARNING
"--- Disabled CONFIG_RECT_TX, required for CONFIG_DAALA_DCT8.")
set(CONFIG_RECT_TX 0)
endif()
if (CONFIG_VAR_TX)
message(WARNING
"--- Disabled CONFIG_VAR_TX, required for CONFIG_DAALA_DCT8.")
set(CONFIG_VAR_TX 0)
endif()
if (CONFIG_LGT)
message(WARNING
"--- Disabled CONFIG_LGT, required for CONFIG_DAALA_DCT8.")
set(CONFIG_LGT 0)
endif()
if (NOT CONFIG_LOWBITDEPTH)
message(WARNING
"--- Enabled CONFIG_LOWBITDEPTH, required for CONFIG_DAALA_DCT8.")
set(CONFIG_LOWBITDEPTH 1)
endif()
endif()
if (NOT MSVC)
aom_push_var(CMAKE_REQUIRED_LIBRARIES "m")
aom_check_c_compiles("fenv_check"
......
......@@ -294,6 +294,7 @@ EXPERIMENT_LIST="
xiphrc
dct_only
daala_dct4
daala_dct8
cb4x4
chroma_2x2
chroma_sub8x8
......@@ -573,6 +574,13 @@ post_process_cmdline() {
disable_feature lgt
enable_feature lowbitdepth
fi
if enabled daala_dct8; then
disable_feature mmx
disable_feature rect_tx
disable_feature var_tx
disable_feature lgt
enable_feature lowbitdepth
fi
if enabled var_tx_no_tx_mode && ! enabled var_tx; then
log_echo "var_tx_no_tx_mode requires var_tx, so disabling var_tx_no_tx_mode"
disable_feature var_tx_no_tx_mode
......
......@@ -23,7 +23,7 @@
#define CONFIG_COEFFICIENT_RANGE_CHECKING 1
#define AV1_DCT_GTEST
#include "av1/encoder/dct.c"
#if CONFIG_DAALA_DCT4
#if CONFIG_DAALA_DCT4 || CONFIG_DAALA_DCT8
#include "av1/common/daala_tx.c"
#endif
......
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