update libaom to rev 76574b6c09515d6687ebfa9760319e521f5abeb3 (without moz.build and aom_ports/aom_once.h)

This commit is contained in:
Roy Tam 2019-04-19 13:08:28 +08:00
commit ef35212f8b
128 changed files with 9426 additions and 4984 deletions

View file

@ -20,9 +20,9 @@ const uint32_t kSizeTestNumValues = 6;
const uint32_t kSizeTestExpectedSizes[kSizeTestNumValues] = {
1, 1, 2, 3, 4, 5
};
const uint64_t kSizeTestInputs[kSizeTestNumValues] = {
0, 0x7f, 0x3fff, 0x1fffff, 0xffffff, 0x10000000
};
const uint64_t kSizeTestInputs[kSizeTestNumValues] = { 0, 0x7f,
0x3fff, 0x1fffff,
0xffffff, 0x10000000 };
const uint8_t kOutOfRangeLeb128Value[5] = { 0x80, 0x80, 0x80, 0x80,
0x10 }; // UINT32_MAX + 1

View file

@ -24,20 +24,20 @@ namespace {
// Sequence Header OBUs vs Sequence Header OBUs with the
// reduced_still_image_flag set).
//
const uint8_t kAnnexBFullSequenceHeaderObu[] = {
0x0c, 0x08, 0x00, 0x00, 0x00, 0x04, 0x45, 0x7e, 0x3e, 0xff, 0xfc, 0xc0, 0x20
};
const uint8_t kAnnexBFullSequenceHeaderObu[] = { 0x0c, 0x08, 0x00, 0x00, 0x00,
0x04, 0x45, 0x7e, 0x3e, 0xff,
0xfc, 0xc0, 0x20 };
const uint8_t kAnnexBReducedStillImageSequenceHeaderObu[] = {
0x08, 0x08, 0x18, 0x22, 0x2b, 0xf1, 0xfe, 0xc0, 0x20
};
const uint8_t kLobfFullSequenceHeaderObu[] = {
0x0a, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x45, 0x7e, 0x3e, 0xff, 0xfc, 0xc0, 0x20
};
const uint8_t kLobfFullSequenceHeaderObu[] = { 0x0a, 0x0b, 0x00, 0x00, 0x00,
0x04, 0x45, 0x7e, 0x3e, 0xff,
0xfc, 0xc0, 0x20 };
const uint8_t kLobfReducedStillImageSequenceHeaderObu[] = {
0x0a, 0x07, 0x18, 0x22, 0x2b, 0xf1, 0xfe, 0xc0, 0x20
};
const uint8_t kLobfReducedStillImageSequenceHeaderObu[] = { 0x0a, 0x07, 0x18,
0x22, 0x2b, 0xf1,
0xfe, 0xc0, 0x20 };
const uint8_t kAv1cAllZero[] = { 0, 0, 0, 0 };

View file

@ -16,6 +16,8 @@
#include "av1/common/av1_inv_txfm1d.h"
#include "av1/encoder/av1_fwd_txfm1d.h"
typedef TX_SIZE TxSize;
using libaom_test::ACMRandom;
using libaom_test::input_base;
@ -77,7 +79,7 @@ TEST(av1_inv_txfm1d, InvAccuracyCheck) {
ASSERT_EQ(NELEMENTS(inv_txfm_func_ls), TX_SIZES);
for (int k = 0; k < count_test_block; ++k) {
// choose a random transform to test
const TX_SIZE tx_size = static_cast<TX_SIZE>(rnd.Rand8() % TX_SIZES);
const TxSize tx_size = static_cast<TxSize>(rnd.Rand8() % TX_SIZES);
const int tx_size_pix = txfm_size_ls[tx_size];
const TxfmFunc inv_txfm_func = inv_txfm_func_ls[tx_size][0];
@ -88,9 +90,11 @@ TEST(av1_inv_txfm1d, InvAccuracyCheck) {
memset(input + 32, 0, 32 * sizeof(input[0]));
int32_t ref_output[64];
memset(ref_output, 0, sizeof(ref_output));
reference_idct_1d_int(input, ref_output, tx_size_pix);
int32_t output[64];
memset(output, 0, sizeof(output));
inv_txfm_func(input, output, cos_bit, range_bit);
for (int i = 0; i < tx_size_pix; ++i) {

View file

@ -36,11 +36,33 @@ using ::testing::Values;
using std::vector;
typedef TX_TYPE TxType;
typedef TX_SIZE TxSize;
namespace {
static const char *tx_type_name[] = {
"DCT_DCT",
"ADST_DCT",
"DCT_ADST",
"ADST_ADST",
"FLIPADST_DCT",
"DCT_FLIPADST",
"FLIPADST_FLIPADST",
"ADST_FLIPADST",
"FLIPADST_ADST",
"IDTX",
"V_DCT",
"H_DCT",
"V_ADST",
"H_ADST",
"V_FLIPADST",
"H_FLIPADST",
};
// AV1InvTxfm2dParam argument list:
// tx_type_, tx_size_, max_error_, max_avg_error_
typedef ::testing::tuple<TX_TYPE, TX_SIZE, int, double> AV1InvTxfm2dParam;
typedef ::testing::tuple<TxType, TxSize, int, double> AV1InvTxfm2dParam;
class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
public:
@ -86,7 +108,7 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
}
double ref_coeffs[64 * 64] = { 0 };
ASSERT_LE(txfm2d_size, NELEMENTS(ref_coeffs));
ASSERT_EQ(tx_type_, DCT_DCT);
ASSERT_EQ(tx_type_, static_cast<TxType>(DCT_DCT));
libaom_test::reference_hybrid_2d(ref_input, ref_coeffs, tx_type_,
tx_size_);
DECLARE_ALIGNED(16, int32_t, ref_coeffs_int[64 * 64]) = { 0 };
@ -139,8 +161,8 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
int max_error_;
double max_avg_error_;
TX_TYPE tx_type_;
TX_SIZE tx_size_;
TxType tx_type_;
TxSize tx_size_;
};
static int max_error_ls[TX_SIZES_ALL] = {
@ -193,8 +215,8 @@ vector<AV1InvTxfm2dParam> GetInvTxfm2dParamList() {
const int max_error = max_error_ls[s];
const double avg_error = avg_error_ls[s];
for (int t = 0; t < TX_TYPES; ++t) {
const TX_TYPE tx_type = static_cast<TX_TYPE>(t);
const TX_SIZE tx_size = static_cast<TX_SIZE>(s);
const TxType tx_type = static_cast<TxType>(t);
const TxSize tx_size = static_cast<TxSize>(s);
if (libaom_test::IsTxSizeTypeValid(tx_size, tx_type)) {
param_list.push_back(
AV1InvTxfm2dParam(tx_type, tx_size, max_error, avg_error));
@ -216,18 +238,18 @@ TEST(AV1InvTxfm2d, CfgTest) {
int8_t high_range = libaom_test::high_range_arr[bd_idx];
for (int tx_size = 0; tx_size < TX_SIZES_ALL; ++tx_size) {
for (int tx_type = 0; tx_type < TX_TYPES; ++tx_type) {
if (libaom_test::IsTxSizeTypeValid(static_cast<TX_SIZE>(tx_size),
static_cast<TX_TYPE>(tx_type)) ==
if (libaom_test::IsTxSizeTypeValid(static_cast<TxSize>(tx_size),
static_cast<TxType>(tx_type)) ==
false) {
continue;
}
TXFM_2D_FLIP_CFG cfg;
av1_get_inv_txfm_cfg(static_cast<TX_TYPE>(tx_type),
static_cast<TX_SIZE>(tx_size), &cfg);
av1_get_inv_txfm_cfg(static_cast<TxType>(tx_type),
static_cast<TxSize>(tx_size), &cfg);
int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
av1_gen_inv_stage_range(stage_range_col, stage_range_row, &cfg,
(TX_SIZE)tx_size, bd);
static_cast<TxSize>(tx_size), bd);
libaom_test::txfm_stage_range_check(stage_range_col, cfg.stage_num_col,
cfg.cos_bit_col, low_range,
high_range);
@ -243,14 +265,15 @@ typedef ::testing::tuple<const LbdInvTxfm2dFunc> AV1LbdInvTxfm2dParam;
class AV1LbdInvTxfm2d : public ::testing::TestWithParam<AV1LbdInvTxfm2dParam> {
public:
virtual void SetUp() { target_func_ = GET_PARAM(0); }
void RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size, int run_times);
void RunAV1InvTxfm2dTest(TxType tx_type, TxSize tx_size, int run_times,
int gt_int16 = 0);
private:
LbdInvTxfm2dFunc target_func_;
};
void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size,
int run_times) {
void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TxType tx_type, TxSize tx_size,
int run_times, int gt_int16) {
FwdTxfm2dFunc fwd_func_ = libaom_test::fwd_txfm_func_ls[tx_size];
InvTxfm2dFunc ref_func_ = libaom_test::inv_txfm_func_ls[tx_size];
if (fwd_func_ == NULL || ref_func_ == NULL || target_func_ == NULL) {
@ -275,6 +298,7 @@ void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size,
const int16_t eobmax = rows_nonezero * cols_nonezero;
ACMRandom rnd(ACMRandom::DeterministicSeed());
int randTimes = run_times == 1 ? (eobmax + 500) : 1;
for (int cnt = 0; cnt < randTimes; ++cnt) {
const int16_t max_in = (1 << (bd)) - 1;
for (int r = 0; r < BLK_WIDTH; ++r) {
@ -291,7 +315,9 @@ void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size,
for (int i = eob; i < eobmax; i++) {
inv_input[scan[i]] = 0;
}
if (gt_int16) {
inv_input[scan[eob - 1]] = ((int32_t)INT16_MAX * 100 / 141);
}
aom_usec_timer timer;
aom_usec_timer_start(&timer);
for (int i = 0; i < run_times; ++i) {
@ -313,10 +339,13 @@ void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size,
for (int r = 0; r < rows; ++r) {
for (int c = 0; c < cols; ++c) {
uint8_t ref_value = static_cast<uint8_t>(ref_output[r * stride + c]);
if (ref_value != output[r * stride + c]) {
printf(" ");
}
ASSERT_EQ(ref_value, output[r * stride + c])
<< "[" << r << "," << c << "] " << cnt
<< " tx_size: " << static_cast<int>(tx_size)
<< " tx_type: " << tx_type << " eob " << eob;
<< " tx_type: " << tx_type_name[tx_type] << " eob " << eob;
}
}
}
@ -325,21 +354,34 @@ void AV1LbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size,
TEST_P(AV1LbdInvTxfm2d, match) {
for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) {
for (int i = 0; i < (int)TX_TYPES; ++i) {
if (libaom_test::IsTxSizeTypeValid(static_cast<TX_SIZE>(j),
static_cast<TX_TYPE>(i))) {
RunAV1InvTxfm2dTest(static_cast<TX_TYPE>(i), static_cast<TX_SIZE>(j),
1);
if (libaom_test::IsTxSizeTypeValid(static_cast<TxSize>(j),
static_cast<TxType>(i))) {
RunAV1InvTxfm2dTest(static_cast<TxType>(i), static_cast<TxSize>(j), 1);
}
}
}
}
TEST_P(AV1LbdInvTxfm2d, gt_int16) {
static const TxType types[] = { DCT_DCT, ADST_DCT, FLIPADST_DCT, IDTX,
V_DCT, H_DCT, H_ADST, H_FLIPADST };
for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) {
const TxSize sz = static_cast<TxSize>(j);
for (uint8_t i = 0; i < sizeof(types) / sizeof(types[0]); ++i) {
const TxType tp = types[i];
if (libaom_test::IsTxSizeTypeValid(sz, tp)) {
RunAV1InvTxfm2dTest(tp, sz, 1, 1);
}
}
}
}
TEST_P(AV1LbdInvTxfm2d, DISABLED_Speed) {
for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) {
for (int j = 1; j < (int)(TX_SIZES_ALL); ++j) {
for (int i = 0; i < (int)TX_TYPES; ++i) {
if (libaom_test::IsTxSizeTypeValid(static_cast<TX_SIZE>(j),
static_cast<TX_TYPE>(i))) {
RunAV1InvTxfm2dTest(static_cast<TX_TYPE>(i), static_cast<TX_SIZE>(j),
if (libaom_test::IsTxSizeTypeValid(static_cast<TxSize>(j),
static_cast<TxType>(i))) {
RunAV1InvTxfm2dTest(static_cast<TxType>(i), static_cast<TxSize>(j),
10000000);
}
}
@ -357,22 +399,24 @@ INSTANTIATE_TEST_CASE_P(SSSE3, AV1LbdInvTxfm2d,
#if HAVE_AVX2
extern "C" void av1_lowbd_inv_txfm2d_add_avx2(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size,
TxType tx_type, TxSize tx_size,
int eob);
INSTANTIATE_TEST_CASE_P(AVX2, AV1LbdInvTxfm2d,
::testing::Values(av1_lowbd_inv_txfm2d_add_avx2));
#endif // HAVE_AVX2
#if HAVE_NEON
extern "C" void av1_lowbd_inv_txfm2d_add_neon(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size,
int eob);
INSTANTIATE_TEST_CASE_P(NEON, AV1LbdInvTxfm2d,
::testing::Values(av1_lowbd_inv_txfm2d_add_neon));
#endif // HAVE_NEON
// TODO(yunqing): Re-enable this unit test for NEON version after the functions
// are fixed.
// #if HAVE_NEON
// extern "C" void av1_lowbd_inv_txfm2d_add_neon(const int32_t *input,
// uint8_t *output, int stride,
// TX_TYPE tx_type,
// TX_SIZE tx_size,
// int eob);
//
// INSTANTIATE_TEST_CASE_P(NEON, AV1LbdInvTxfm2d,
// ::testing::Values(av1_lowbd_inv_txfm2d_add_neon));
// #endif // HAVE_NEON
} // namespace

View file

@ -24,30 +24,37 @@ using libaom_test::ACMRandom;
#define NUM_ITERATIONS (100)
#define NUM_ITERATIONS_SPEED (INT16_MAX)
#define ALL_CFL_TX_SIZES(function) \
make_tuple(TX_4X4, &function), make_tuple(TX_4X8, &function), \
make_tuple(TX_4X16, &function), make_tuple(TX_8X4, &function), \
make_tuple(TX_8X8, &function), make_tuple(TX_8X16, &function), \
make_tuple(TX_8X32, &function), make_tuple(TX_16X4, &function), \
make_tuple(TX_16X8, &function), make_tuple(TX_16X16, &function), \
make_tuple(TX_16X32, &function), make_tuple(TX_32X8, &function), \
make_tuple(TX_32X16, &function), make_tuple(TX_32X32, &function)
#define ALL_CFL_TX_SIZES(function) \
make_tuple(static_cast<TX_SIZE>(TX_4X4), &function), \
make_tuple(static_cast<TX_SIZE>(TX_4X8), &function), \
make_tuple(static_cast<TX_SIZE>(TX_4X16), &function), \
make_tuple(static_cast<TX_SIZE>(TX_8X4), &function), \
make_tuple(static_cast<TX_SIZE>(TX_8X8), &function), \
make_tuple(static_cast<TX_SIZE>(TX_8X16), &function), \
make_tuple(static_cast<TX_SIZE>(TX_8X32), &function), \
make_tuple(static_cast<TX_SIZE>(TX_16X4), &function), \
make_tuple(static_cast<TX_SIZE>(TX_16X8), &function), \
make_tuple(static_cast<TX_SIZE>(TX_16X16), &function), \
make_tuple(static_cast<TX_SIZE>(TX_16X32), &function), \
make_tuple(static_cast<TX_SIZE>(TX_32X8), &function), \
make_tuple(static_cast<TX_SIZE>(TX_32X16), &function), \
make_tuple(static_cast<TX_SIZE>(TX_32X32), &function)
#define ALL_CFL_TX_SIZES_SUBSAMPLE(fun420, fun422, fun444) \
make_tuple(TX_4X4, &fun420, &fun422, &fun444), \
make_tuple(TX_4X8, &fun420, &fun422, &fun444), \
make_tuple(TX_4X16, &fun420, &fun422, &fun444), \
make_tuple(TX_8X4, &fun420, &fun422, &fun444), \
make_tuple(TX_8X8, &fun420, &fun422, &fun444), \
make_tuple(TX_8X16, &fun420, &fun422, &fun444), \
make_tuple(TX_8X32, &fun420, &fun422, &fun444), \
make_tuple(TX_16X4, &fun420, &fun422, &fun444), \
make_tuple(TX_16X8, &fun420, &fun422, &fun444), \
make_tuple(TX_16X16, &fun420, &fun422, &fun444), \
make_tuple(TX_16X32, &fun420, &fun422, &fun444), \
make_tuple(TX_32X8, &fun420, &fun422, &fun444), \
make_tuple(TX_32X16, &fun420, &fun422, &fun444), \
make_tuple(TX_32X32, &fun420, &fun422, &fun444)
#define ALL_CFL_TX_SIZES_SUBSAMPLE(fun420, fun422, fun444) \
make_tuple(static_cast<TX_SIZE>(TX_4X4), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_4X8), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_4X16), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_8X4), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_8X8), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_8X16), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_8X32), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_16X4), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_16X8), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_16X16), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_16X32), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_32X8), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_32X16), &fun420, &fun422, &fun444), \
make_tuple(static_cast<TX_SIZE>(TX_32X32), &fun420, &fun422, &fun444)
namespace {

View file

@ -805,9 +805,9 @@ const ConvolveFunctions convolve10_c(wrap_convolve_copy_c_10,
const ConvolveFunctions convolve12_c(wrap_convolve_copy_c_12,
wrap_convolve8_horiz_c_12,
wrap_convolve8_vert_c_12, 12);
const ConvolveParam kArrayConvolve_c[] = {
ALL_SIZES(convolve8_c), ALL_SIZES(convolve10_c), ALL_SIZES(convolve12_c)
};
const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c),
ALL_SIZES(convolve10_c),
ALL_SIZES(convolve12_c) };
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));

View file

@ -127,15 +127,15 @@ TEST_P(AV1CornerMatchTest, DISABLED_Speed) { RunCheckOutput(100000); }
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
SSE4_1, AV1CornerMatchTest,
::testing::Values(make_tuple(0, compute_cross_correlation_sse4_1),
make_tuple(1, compute_cross_correlation_sse4_1)));
::testing::Values(make_tuple(0, &compute_cross_correlation_sse4_1),
make_tuple(1, &compute_cross_correlation_sse4_1)));
#endif
#if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(
AVX2, AV1CornerMatchTest,
::testing::Values(make_tuple(0, compute_cross_correlation_avx2),
make_tuple(1, compute_cross_correlation_avx2)));
::testing::Values(make_tuple(0, &compute_cross_correlation_avx2),
make_tuple(1, &compute_cross_correlation_avx2)));
#endif
} // namespace AV1CornerMatch

View file

@ -365,11 +365,9 @@ INSTANTIATE_TEST_CASE_P(
::testing::Values(DrPredFunc<DrPred>(&z1_wrapper<av1_dr_prediction_z1_c>,
&z1_wrapper<av1_dr_prediction_z1_avx2>,
AOM_BITS_8, kZ1Start),
/* TODO(niva213@gmail.com): Re-enable this test after
fixing valgrind issue: https://crbug.com/aomedia/2316
DrPredFunc<DrPred>(&z2_wrapper<av1_dr_prediction_z2_c>,
&z2_wrapper<av1_dr_prediction_z2_avx2>,
AOM_BITS_8, kZ2Start), */
AOM_BITS_8, kZ2Start),
DrPredFunc<DrPred>(&z3_wrapper<av1_dr_prediction_z3_c>,
&z3_wrapper<av1_dr_prediction_z3_avx2>,
AOM_BITS_8, kZ3Start)));

View file

@ -31,7 +31,7 @@ static void generate_kernels(ACMRandom *rnd, InterpKernel hkernel,
hkernel[2] = hkernel[4] =
WIENER_FILT_TAP2_MINV +
rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
hkernel[3] = -(hkernel[0] + hkernel[1] + hkernel[2]);
hkernel[3] = -2 * (hkernel[0] + hkernel[1] + hkernel[2]);
hkernel[7] = 0;
vkernel[0] = vkernel[6] =
@ -43,7 +43,7 @@ static void generate_kernels(ACMRandom *rnd, InterpKernel hkernel,
vkernel[2] = vkernel[4] =
WIENER_FILT_TAP2_MINV +
rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
vkernel[3] = -(vkernel[0] + vkernel[1] + vkernel[2]);
vkernel[3] = -2 * (vkernel[0] + vkernel[1] + vkernel[2]);
vkernel[7] = 0;
}

View file

@ -63,7 +63,7 @@ void highbd_quan64x64_wrapper(QUAN_PARAM_LIST) {
HBD_QUAN_FUNC;
}
enum { TYPE_B, TYPE_DC, TYPE_FP } UENUM1BYTE(QuantType);
enum QuantType { TYPE_B, TYPE_DC, TYPE_FP };
using ::testing::tuple;
typedef tuple<QuantizeFunc, QuantizeFunc, TX_SIZE, QuantType, aom_bit_depth_t>
@ -296,6 +296,8 @@ TEST_P(QuantizeTest, DISABLED_Speed) {
aom_usec_timer timer, simd_timer;
int rows = tx_size_high[tx_size_];
int cols = tx_size_wide[tx_size_];
rows = AOMMIN(32, rows);
cols = AOMMIN(32, cols);
for (int cnt = 0; cnt <= rows; cnt++) {
FillCoeffRandomRows(cnt * cols);
@ -325,57 +327,63 @@ using ::testing::make_tuple;
#if HAVE_AVX2
const QuantizeParam kQParamArrayAvx2[] = {
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_16X16, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_4X16, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_16X4, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_32X8, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2, TX_8X32, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, TX_32X32,
TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, TX_16X64,
TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2, TX_64X16,
TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_64x64_c, &av1_quantize_fp_64x64_avx2, TX_64X64,
TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
static_cast<TX_SIZE>(TX_4X16), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
static_cast<TX_SIZE>(TX_16X4), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
static_cast<TX_SIZE>(TX_32X8), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
static_cast<TX_SIZE>(TX_8X32), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2,
static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2,
static_cast<TX_SIZE>(TX_16X64), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_32x32_c, &av1_quantize_fp_32x32_avx2,
static_cast<TX_SIZE>(TX_64X16), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_64x64_c, &av1_quantize_fp_64x64_avx2,
static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_8),
make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, TX_16X16,
TYPE_FP, AOM_BITS_8),
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, TX_16X16,
TYPE_FP, AOM_BITS_10),
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_10),
make_tuple(&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>, TX_16X16,
TYPE_FP, AOM_BITS_12),
&highbd_quan16x16_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_12),
make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, TX_32X32,
TYPE_FP, AOM_BITS_8),
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_8),
make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, TX_32X32,
TYPE_FP, AOM_BITS_10),
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_10),
make_tuple(&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>, TX_32X32,
TYPE_FP, AOM_BITS_12),
&highbd_quan32x32_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_32X32), TYPE_FP, AOM_BITS_12),
make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, TX_64X64,
TYPE_FP, AOM_BITS_8),
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_8),
make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, TX_64X64,
TYPE_FP, AOM_BITS_10),
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_10),
make_tuple(&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_c>,
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>, TX_64X64,
TYPE_FP, AOM_BITS_12),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16,
TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16,
TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2, TX_16X16,
TYPE_B, AOM_BITS_12),
&highbd_quan64x64_wrapper<av1_highbd_quantize_fp_avx2>,
static_cast<TX_SIZE>(TX_64X64), TYPE_FP, AOM_BITS_12),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_avx2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2,
static_cast<TX_SIZE>(TX_8X8), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_avx2,
static_cast<TX_SIZE>(TX_4X4), TYPE_B, AOM_BITS_8)
};
INSTANTIATE_TEST_CASE_P(AVX2, QuantizeTest,
@ -384,48 +392,60 @@ INSTANTIATE_TEST_CASE_P(AVX2, QuantizeTest,
#if HAVE_SSE2
const QuantizeParam kQParamArraySSE2[] = {
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_16X16, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_4X16, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_16X4, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_8X32, TYPE_FP,
AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_32X8, TYPE_FP,
AOM_BITS_8),
make_tuple(&aom_quantize_b_c, &aom_quantize_b_sse2, TX_16X16, TYPE_B,
AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, TX_16X16,
TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, TX_16X16,
TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2, TX_16X16,
TYPE_B, AOM_BITS_12),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
static_cast<TX_SIZE>(TX_4X16), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
static_cast<TX_SIZE>(TX_16X4), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
static_cast<TX_SIZE>(TX_8X32), TYPE_FP, AOM_BITS_8),
make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
static_cast<TX_SIZE>(TX_32X8), TYPE_FP, AOM_BITS_8),
make_tuple(&aom_quantize_b_c, &aom_quantize_b_sse2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_c, &aom_highbd_quantize_b_sse2,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_12),
make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2,
TX_32X32, TYPE_B, AOM_BITS_8),
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2,
TX_32X32, TYPE_B, AOM_BITS_10),
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_32x32_c, &aom_highbd_quantize_b_32x32_sse2,
TX_32X32, TYPE_B, AOM_BITS_12),
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12),
make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2,
TX_64X64, TYPE_B, AOM_BITS_8),
static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8),
make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2,
TX_64X64, TYPE_B, AOM_BITS_10),
static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_10),
make_tuple(&aom_highbd_quantize_b_64x64_c, &aom_highbd_quantize_b_64x64_sse2,
TX_64X64, TYPE_B, AOM_BITS_12),
static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_12),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2,
TX_16X16, TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2, TX_8X8,
TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2, TX_4X4,
TYPE_B, AOM_BITS_8),
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2,
static_cast<TX_SIZE>(TX_8X8), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_adaptive_c, &aom_quantize_b_adaptive_sse2,
static_cast<TX_SIZE>(TX_4X4), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_adaptive_c,
&aom_quantize_b_32x32_adaptive_sse2, TX_32X16, TYPE_B, AOM_BITS_8),
&aom_quantize_b_32x32_adaptive_sse2,
static_cast<TX_SIZE>(TX_32X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_adaptive_c,
&aom_quantize_b_32x32_adaptive_sse2, TX_16X32, TYPE_B, AOM_BITS_8),
&aom_quantize_b_32x32_adaptive_sse2,
static_cast<TX_SIZE>(TX_16X32), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_adaptive_c,
&aom_quantize_b_32x32_adaptive_sse2, TX_32X32, TYPE_B, AOM_BITS_8)
&aom_quantize_b_32x32_adaptive_sse2,
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_64x64_adaptive_c,
&aom_quantize_b_64x64_adaptive_sse2,
static_cast<TX_SIZE>(TX_32X64), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_64x64_adaptive_c,
&aom_quantize_b_64x64_adaptive_sse2,
static_cast<TX_SIZE>(TX_64X32), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_64x64_adaptive_c,
&aom_quantize_b_64x64_adaptive_sse2,
static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8)
};
INSTANTIATE_TEST_CASE_P(SSE2, QuantizeTest,
@ -435,25 +455,24 @@ INSTANTIATE_TEST_CASE_P(SSE2, QuantizeTest,
#if HAVE_SSSE3 && ARCH_X86_64
INSTANTIATE_TEST_CASE_P(
SSSE3, QuantizeTest,
::testing::Values(make_tuple(&aom_quantize_b_c, &aom_quantize_b_ssse3,
TX_16X16, TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_c,
&aom_quantize_b_32x32_ssse3, TX_32X32, TYPE_B,
AOM_BITS_8),
make_tuple(&aom_quantize_b_64x64_c,
&aom_quantize_b_64x64_ssse3, TX_64X64, TYPE_B,
AOM_BITS_8)));
::testing::Values(
make_tuple(&aom_quantize_b_c, &aom_quantize_b_ssse3,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_ssse3,
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_64x64_c, &aom_quantize_b_64x64_ssse3,
static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8)));
#endif // HAVE_SSSE3 && ARCH_X86_64
#if HAVE_AVX && ARCH_X86_64
INSTANTIATE_TEST_CASE_P(
AVX, QuantizeTest,
::testing::Values(make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx,
TX_16X16, TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_c,
&aom_quantize_b_32x32_avx, TX_32X32, TYPE_B,
AOM_BITS_8)));
::testing::Values(
make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx,
static_cast<TX_SIZE>(TX_16X16), TYPE_B, AOM_BITS_8),
make_tuple(&aom_quantize_b_32x32_c, &aom_quantize_b_32x32_avx,
static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_8)));
#endif // HAVE_AVX && ARCH_X86_64
} // namespace

View file

@ -26,7 +26,7 @@ const int kBitrate = 500;
// List of psnr thresholds for speed settings 0-8
const double kPsnrThreshold[9] = { 36.9, 36.9, 36.85, 36.8, 36.6,
36.4, 36.0, 35.5, 35.0 };
36.3, 36.0, 35.3, 35.0 };
typedef struct {
const char *filename;

View file

@ -469,11 +469,8 @@ typedef struct {
fptr simd;
} mapping;
#define MAP(name) \
{ \
#name, reinterpret_cast < fptr > (c_##name), \
reinterpret_cast < fptr > (name) \
}
#define MAP(name) \
{ #name, reinterpret_cast < fptr>(c_##name), reinterpret_cast < fptr>(name) }
const mapping m[] = { MAP(v64_sad_u8),
MAP(v64_ssd_u8),

View file

@ -79,7 +79,8 @@ list(APPEND AOM_UNIT_TEST_ENCODER_SOURCES
"${AOM_ROOT}/test/scalability_test.cc"
"${AOM_ROOT}/test/y4m_test.cc"
"${AOM_ROOT}/test/y4m_video_source.h"
"${AOM_ROOT}/test/yuv_video_source.h")
"${AOM_ROOT}/test/yuv_video_source.h"
"${AOM_ROOT}/test/time_stamp_test.cc")
list(APPEND AOM_DECODE_PERF_TEST_SOURCES "${AOM_ROOT}/test/decode_perf_test.cc")
list(APPEND AOM_ENCODE_PERF_TEST_SOURCES "${AOM_ROOT}/test/encode_perf_test.cc")

105
third_party/aom/test/time_stamp_test.cc vendored Normal file
View file

@ -0,0 +1,105 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
// Test AOM timestamp handling
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/util.h"
#include "test/video_source.h"
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
namespace {
const int kVideoSourceWidth = 320;
const int kVideoSourceHeight = 240;
const int kFramesToEncode = 3;
// A video source that exposes functions to set the timebase, framerate and
// starting pts.
class DummyTimebaseVideoSource : public ::libaom_test::DummyVideoSource {
public:
// Parameters num and den set the timebase for the video source.
DummyTimebaseVideoSource(int num, int den)
: framerate_numerator_(30), framerate_denominator_(1), starting_pts_(0) {
SetSize(kVideoSourceWidth, kVideoSourceHeight);
set_limit(kFramesToEncode);
timebase_.num = num;
timebase_.den = den;
}
void SetFramerate(int numerator, int denominator) {
framerate_numerator_ = numerator;
framerate_denominator_ = denominator;
}
// Returns one frames duration in timebase units as a double.
double FrameDuration() const {
return (static_cast<double>(timebase_.den) / timebase_.num) /
(static_cast<double>(framerate_numerator_) / framerate_denominator_);
}
virtual aom_codec_pts_t pts() const {
return static_cast<aom_codec_pts_t>(frame_ * FrameDuration() +
starting_pts_ + 0.5);
}
virtual unsigned long duration() const {
return static_cast<unsigned long>(FrameDuration() + 0.5);
}
virtual aom_rational_t timebase() const { return timebase_; }
void set_starting_pts(int64_t starting_pts) { starting_pts_ = starting_pts; }
private:
aom_rational_t timebase_;
int framerate_numerator_;
int framerate_denominator_;
int64_t starting_pts_;
};
class TimestampTest
: public ::libaom_test::EncoderTest,
public ::libaom_test::CodecTestWithParam<libaom_test::TestMode> {
protected:
TimestampTest() : EncoderTest(GET_PARAM(0)) {}
virtual ~TimestampTest() {}
virtual void SetUp() {
InitializeConfig();
SetMode(GET_PARAM(1));
}
};
// Tests encoding in millisecond timebase.
TEST_P(TimestampTest, EncodeFrames) {
DummyTimebaseVideoSource video(1, 1000);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
TEST_P(TimestampTest, TestMicrosecondTimebase) {
// Set the timebase to microseconds.
DummyTimebaseVideoSource video(1, 1000000);
video.set_limit(1);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
TEST_P(TimestampTest, TestAv1Rollover) {
DummyTimebaseVideoSource video(1, 1000);
video.set_starting_pts(922337170351ll);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
AV1_INSTANTIATE_TEST_CASE(TimestampTest,
::testing::Values(::libaom_test::kTwoPassGood));
} // namespace

View file

@ -74,9 +74,9 @@ int GetModIndex(int sum_dist, int index, int rounding, int strength,
template <>
int GetModIndex<uint8_t>(int sum_dist, int index, int rounding, int strength,
int filter_weight) {
unsigned int index_mult[14] = {
0, 0, 0, 0, 49152, 39322, 32768, 28087, 24576, 21846, 19661, 17874, 0, 15124
};
unsigned int index_mult[14] = { 0, 0, 0, 0, 49152,
39322, 32768, 28087, 24576, 21846,
19661, 17874, 0, 15124 };
assert(index >= 0 && index <= 13);
assert(index_mult[index] != 0);