Delete orphan source files Change-Id: I444c33b67a1503a19d5cc9c0106be02005203fb6
diff --git a/test/active_map_refresh_test.cc b/test/active_map_refresh_test.cc deleted file mode 100644 index 954e3f2..0000000 --- a/test/active_map_refresh_test.cc +++ /dev/null
@@ -1,129 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#include <algorithm> -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" -#include "test/codec_factory.h" -#include "test/encode_test_driver.h" -#include "test/util.h" -#include "test/y4m_video_source.h" - -namespace { - -// Check if any pixel in a 16x16 macroblock varies between frames. -int CheckMb(const aom_image_t ¤t, const aom_image_t &previous, int mb_r, - int mb_c) { - for (int plane = 0; plane < 3; plane++) { - int r = 16 * mb_r; - int c0 = 16 * mb_c; - int r_top = std::min(r + 16, static_cast<int>(current.d_h)); - int c_top = std::min(c0 + 16, static_cast<int>(current.d_w)); - r = std::max(r, 0); - c0 = std::max(c0, 0); - if (plane > 0 && current.x_chroma_shift) { - c_top = (c_top + 1) >> 1; - c0 >>= 1; - } - if (plane > 0 && current.y_chroma_shift) { - r_top = (r_top + 1) >> 1; - r >>= 1; - } - for (; r < r_top; ++r) { - for (int c = c0; c < c_top; ++c) { - if (current.planes[plane][current.stride[plane] * r + c] != - previous.planes[plane][previous.stride[plane] * r + c]) - return 1; - } - } - } - return 0; -} - -void GenerateMap(int mb_rows, int mb_cols, const aom_image_t ¤t, - const aom_image_t &previous, uint8_t *map) { - for (int mb_r = 0; mb_r < mb_rows; ++mb_r) { - for (int mb_c = 0; mb_c < mb_cols; ++mb_c) { - map[mb_r * mb_cols + mb_c] = CheckMb(current, previous, mb_r, mb_c); - } - } -} - -const int kAqModeCyclicRefresh = 3; - -class ActiveMapRefreshTest - : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int>, - public ::libaom_test::EncoderTest { - protected: - ActiveMapRefreshTest() : EncoderTest(GET_PARAM(0)) {} - virtual ~ActiveMapRefreshTest() {} - - virtual void SetUp() { - InitializeConfig(); - SetMode(GET_PARAM(1)); - cpu_used_ = GET_PARAM(2); - } - - virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, - ::libaom_test::Encoder *encoder) { - ::libaom_test::Y4mVideoSource *y4m_video = - static_cast<libaom_test::Y4mVideoSource *>(video); - if (video->frame() == 1) { - encoder->Control(AOME_SET_CPUUSED, cpu_used_); - encoder->Control(AV1E_SET_AQ_MODE, kAqModeCyclicRefresh); - } else if (video->frame() >= 2 && video->img()) { - aom_image_t *current = video->img(); - aom_image_t *previous = y4m_holder_->img(); - ASSERT_TRUE(previous != NULL); - aom_active_map_t map = aom_active_map_t(); - const int width = static_cast<int>(current->d_w); - const int height = static_cast<int>(current->d_h); - const int mb_width = (width + 15) / 16; - const int mb_height = (height + 15) / 16; - uint8_t *active_map = new uint8_t[mb_width * mb_height]; - GenerateMap(mb_height, mb_width, *current, *previous, active_map); - map.cols = mb_width; - map.rows = mb_height; - map.active_map = active_map; - encoder->Control(AOME_SET_ACTIVEMAP, &map); - delete[] active_map; - } - if (video->img()) { - y4m_video->SwapBuffers(y4m_holder_); - } - } - - int cpu_used_; - ::libaom_test::Y4mVideoSource *y4m_holder_; -}; - -TEST_P(ActiveMapRefreshTest, Test) { - cfg_.g_lag_in_frames = 0; - cfg_.g_profile = 1; - cfg_.rc_target_bitrate = 600; - cfg_.rc_resize_mode = 0; - cfg_.rc_min_quantizer = 8; - cfg_.rc_max_quantizer = 30; - cfg_.g_pass = AOM_RC_ONE_PASS; - cfg_.rc_end_usage = AOM_CBR; - cfg_.kf_max_dist = 90000; - - ::libaom_test::Y4mVideoSource video("desktop_credits.y4m", 0, 10); - ::libaom_test::Y4mVideoSource video_holder("desktop_credits.y4m", 0, 10); - video_holder.Begin(); - y4m_holder_ = &video_holder; - - ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); -} - -AV1_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest, - ::testing::Values(::libaom_test::kRealTime), - ::testing::Range(5, 6)); -} // namespace
diff --git a/test/ans_codec_test.cc b/test/ans_codec_test.cc deleted file mode 100644 index 30531e6..0000000 --- a/test/ans_codec_test.cc +++ /dev/null
@@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" - -#include "test/codec_factory.h" -#include "test/encode_test_driver.h" -#include "test/util.h" -#include "test/y4m_video_source.h" -#include "aom_dsp/ans.h" -#include "av1/av1_dx_iface.c" - -// A note on ANS_MAX_SYMBOLS == 0: -// Fused gtest doesn't work with EXPECT_FATAL_FAILURE [1]. Just run with a -// single iteration and don't try to check the window size if we are unwindowed. -// [1] https://github.com/google/googletest/issues/356 - -namespace { - -const char kTestVideoName[] = "niklas_1280_720_30.y4m"; -const int kTestVideoFrames = 10; - -class AnsCodecTest : public ::libaom_test::CodecTestWithParam<int>, - public ::libaom_test::EncoderTest { - protected: - AnsCodecTest() - : EncoderTest(GET_PARAM(0)), ans_window_size_log2_(GET_PARAM(1)) {} - - virtual ~AnsCodecTest() {} - - virtual void SetUp() { - InitializeConfig(); - SetMode(::libaom_test::kOnePassGood); - cfg_.g_lag_in_frames = 25; - cfg_.rc_end_usage = AOM_CQ; - } - - virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, - ::libaom_test::Encoder *encoder) { - if (video->frame() == 1) { -#if ANS_MAX_SYMBOLS - encoder->Control(AV1E_SET_ANS_WINDOW_SIZE_LOG2, ans_window_size_log2_); -#endif - // Try to push a high symbol count through the codec - encoder->Control(AOME_SET_CQ_LEVEL, 8); - encoder->Control(AOME_SET_CPUUSED, 2); - encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); - encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); - encoder->Control(AOME_SET_ARNR_STRENGTH, 5); - encoder->Control(AV1E_SET_TILE_COLUMNS, 0); - encoder->Control(AV1E_SET_TILE_ROWS, 0); - } - } - - virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, - libaom_test::Decoder *decoder) { - aom_codec_ctx_t *const av1_decoder = decoder->GetDecoder(); -#if ANS_MAX_SYMBOLS - aom_codec_alg_priv_t *const priv = - reinterpret_cast<aom_codec_alg_priv_t *>(av1_decoder->priv); - FrameWorkerData *const worker_data = - reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1); - AV1_COMMON *const common = &worker_data->pbi->common; - - EXPECT_EQ(ans_window_size_log2_, common->ans_window_size_log2); -#endif - - EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError(); - return AOM_CODEC_OK == res_dec; - } - - private: - int ans_window_size_log2_; -}; - -TEST_P(AnsCodecTest, BitstreamParms) { - testing::internal::scoped_ptr<libaom_test::VideoSource> video( - new libaom_test::Y4mVideoSource(kTestVideoName, 0, kTestVideoFrames)); - ASSERT_TRUE(video.get() != NULL); - - ASSERT_NO_FATAL_FAILURE(RunLoop(video.get())); -} - -#if ANS_MAX_SYMBOLS -AV1_INSTANTIATE_TEST_CASE(AnsCodecTest, ::testing::Range(8, 24)); -#else -AV1_INSTANTIATE_TEST_CASE(AnsCodecTest, ::testing::Range(0, 1)); -#endif -} // namespace
diff --git a/test/block_error_test.cc b/test/block_error_test.cc deleted file mode 100644 index 8c5caaa..0000000 --- a/test/block_error_test.cc +++ /dev/null
@@ -1,127 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" - -#include "./aom_config.h" -#include "./av1_rtcd.h" - -#include "test/acm_random.h" -#include "test/clear_system_state.h" -#include "test/register_state_check.h" -#include "test/util.h" - -namespace { -using libaom_test::ACMRandom; - -typedef int64_t (*BlockErrorFunc)(const tran_low_t *coeff, - const tran_low_t *dqcoeff, intptr_t size, - int64_t *ssz); -typedef int64_t (*HbdBlockErrorFunc)(const tran_low_t *coeff, - const tran_low_t *dqcoeff, intptr_t size, - int64_t *ssz, int bd); - -typedef std::tr1::tuple<BlockErrorFunc, BlockErrorFunc, TX_SIZE, - aom_bit_depth_t> - BlockErrorParam; - -const int kTestNum = 10000; - -class BlockErrorTest : public ::testing::TestWithParam<BlockErrorParam> { - public: - BlockErrorTest() - : blk_err_ref_(GET_PARAM(0)), blk_err_(GET_PARAM(1)), - tx_size_(GET_PARAM(2)), bd_(GET_PARAM(3)) {} - - virtual ~BlockErrorTest() {} - - virtual void SetUp() { - const intptr_t block_size = getCoeffNum(); - coeff_ = reinterpret_cast<tran_low_t *>( - aom_memalign(16, 2 * block_size * sizeof(tran_low_t))); - } - - virtual void TearDown() { - aom_free(coeff_); - coeff_ = NULL; - libaom_test::ClearSystemState(); - } - - void BlockErrorRun(int testNum) { - int i; - int64_t error_ref, error; - int64_t sse_ref, sse; - const intptr_t block_size = getCoeffNum(); - tran_low_t *dqcoeff = coeff_ + block_size; - for (i = 0; i < testNum; ++i) { - FillRandomData(); - - error_ref = blk_err_ref_(coeff_, dqcoeff, block_size, &sse_ref); - ASM_REGISTER_STATE_CHECK(error = - blk_err_(coeff_, dqcoeff, block_size, &sse)); - - EXPECT_EQ(error_ref, error) << "Error doesn't match on test: " << i; - EXPECT_EQ(sse_ref, sse) << "SSE doesn't match on test: " << i; - } - } - - intptr_t getCoeffNum() { return av1_get_max_eob(tx_size_); } - - void FillRandomData() { - const intptr_t block_size = getCoeffNum(); - tran_low_t *dqcoeff = coeff_ + block_size; - intptr_t i; - int16_t margin = 512; - for (i = 0; i < block_size; ++i) { - coeff_[i] = GetRandomNumWithRange(INT16_MIN + margin, INT16_MAX - margin); - dqcoeff[i] = coeff_[i] + GetRandomDeltaWithRange(margin); - } - } - - void FillConstantData() { - const intptr_t block_size = getCoeffNum(); - tran_low_t *dqcoeff = coeff_ + block_size; - intptr_t i; - for (i = 0; i < block_size; ++i) { - coeff_[i] = 5; - dqcoeff[i] = 7; - } - } - - tran_low_t GetRandomNumWithRange(int16_t min, int16_t max) { - return clamp((int16_t)rnd_.Rand16(), min, max); - } - - tran_low_t GetRandomDeltaWithRange(int16_t delta) { - tran_low_t value = (int16_t)rnd_.Rand16(); - value %= delta; - return value; - } - - BlockErrorFunc blk_err_ref_; - BlockErrorFunc blk_err_; - TX_SIZE tx_size_; - aom_bit_depth_t bd_; - ACMRandom rnd_; - tran_low_t *coeff_; -}; - -TEST_P(BlockErrorTest, BitExact) { BlockErrorRun(kTestNum); } - -using std::tr1::make_tuple; - -#if HAVE_AVX2 -const BlockErrorParam kBlkErrParamArrayAvx2[] = { make_tuple( - &av1_block_error_c, &av1_block_error_avx2, TX_32X32, AOM_BITS_8) }; -INSTANTIATE_TEST_CASE_P(AVX2, BlockErrorTest, - ::testing::ValuesIn(kBlkErrParamArrayAvx2)); -#endif -} // namespace
diff --git a/test/encoder_parms_get_to_decoder.cc b/test/encoder_parms_get_to_decoder.cc deleted file mode 100644 index 5959d98..0000000 --- a/test/encoder_parms_get_to_decoder.cc +++ /dev/null
@@ -1,199 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" - -#include "test/codec_factory.h" -#include "test/encode_test_driver.h" -#include "test/util.h" -#include "test/y4m_video_source.h" -#include "av1/av1_dx_iface.c" - -namespace { - -const int kCpuUsed = 2; - -struct EncodePerfTestVideo { - const char *name; - uint32_t width; - uint32_t height; - uint32_t bitrate; - int frames; -}; - -const EncodePerfTestVideo kAV1EncodePerfTestVectors[] = { - { "niklas_1280_720_30.y4m", 1280, 720, 600, 10 }, -}; - -struct EncodeParameters { - int32_t tile_rows; - int32_t tile_cols; - int32_t lossless; - int32_t error_resilient; - int32_t frame_parallel; - aom_color_range_t color_range; - aom_color_primaries_t cp; - aom_transfer_characteristics_t tc; - aom_matrix_coefficients_t mc; - aom_chroma_sample_position_t csp; - int render_size[2]; - // TODO(JBB): quantizers / bitrate -}; - -const EncodeParameters kAV1EncodeParameterSet[] = { - { 0, - 0, - 1, - 0, - 0, - AOM_CR_FULL_RANGE, - AOM_CICP_CP_BT_2020, - AOM_CICP_TC_BT_2020_10_BIT, - AOM_CICP_MC_BT_2020_NCL, - AOM_CSP_COLOCATED, - { 0, 0 } }, - { 0, - 0, - 0, - 1, - 0, - AOM_CR_STUDIO_RANGE, - AOM_CICP_CP_BT_601, - AOM_CICP_TC_BT_601, - AOM_CICP_MC_BT_601, - AOM_CSP_VERTICAL, - { 0, 0 } }, - { 0, - 0, - 0, - 0, - 0, - AOM_CR_STUDIO_RANGE, - AOM_CICP_CP_BT_2020, - AOM_CICP_TC_SMPTE_2084, - AOM_CICP_MC_BT_2020_NCL, - AOM_CSP_COLOCATED, - { 0, 0 } }, - { 0, - 0, - 0, - 1, - 0, - AOM_CR_STUDIO_RANGE, - AOM_CICP_CP_BT_709, - AOM_CICP_TC_BT_709, - AOM_CICP_MC_BT_709, - AOM_CSP_VERTICAL, - { 0, 0 } }, - // TODO(JBB): Test profiles (requires more work). -}; - -class AvxEncoderParmsGetToDecoder - : public ::libaom_test::CodecTestWith2Params<EncodeParameters, - EncodePerfTestVideo>, - public ::libaom_test::EncoderTest, -{ - protected: - AvxEncoderParmsGetToDecoder() - : EncoderTest(GET_PARAM(0)), encode_parms(GET_PARAM(1)) {} - - virtual ~AvxEncoderParmsGetToDecoder() {} - - virtual void SetUp() { - InitializeConfig(); - SetMode(::libaom_test::kTwoPassGood); - cfg_.g_lag_in_frames = 25; - cfg_.g_error_resilient = encode_parms.error_resilient; - dec_cfg_.threads = 4; - test_video_ = GET_PARAM(2); - cfg_.rc_target_bitrate = test_video_.bitrate; - } - - virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, - ::libaom_test::Encoder *encoder) { - if (video->frame() == 1) { - encoder->Control(AV1E_SET_COLOR_PRIMARIES, encode_parms.cp); - encoder->Control(AV1E_SET_TRANSFER_CHARACTERISTICS, encode_parms.tc); - encoder->Control(AV1E_SET_MATRIX_COEFFICIENTS, encode_parms.mc); - encoder->Control(AV1E_SET_CHROMA_SAMPLE_POSITION, encode_parms.csp); - encoder->Control(AV1E_SET_COLOR_RANGE, encode_parms.color_range); - encoder->Control(AV1E_SET_LOSSLESS, encode_parms.lossless); - encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, - encode_parms.frame_parallel); - encoder->Control(AV1E_SET_TILE_ROWS, encode_parms.tile_rows); - encoder->Control(AV1E_SET_TILE_COLUMNS, encode_parms.tile_cols); - encoder->Control(AOME_SET_CPUUSED, kCpuUsed); - encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); - encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); - encoder->Control(AOME_SET_ARNR_STRENGTH, 5); - if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0) - encoder->Control(AV1E_SET_RENDER_SIZE, encode_parms.render_size); - } - } - - virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, - libaom_test::Decoder *decoder) { - aom_codec_ctx_t *const av1_decoder = decoder->GetDecoder(); - aom_codec_alg_priv_t *const priv = - reinterpret_cast<aom_codec_alg_priv_t *>(av1_decoder->priv); - FrameWorkerData *const worker_data = - reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1); - AV1_COMMON *const common = &worker_data->pbi->common; - - if (encode_parms.lossless) { - EXPECT_EQ(0, common->base_qindex); - EXPECT_EQ(0, common->y_dc_delta_q); - EXPECT_EQ(0, common->u_dc_delta_q); - EXPECT_EQ(0, common->u_ac_delta_q); - EXPECT_EQ(0, common->v_dc_delta_q); - EXPECT_EQ(0, common->v_ac_delta_q); - EXPECT_EQ(ONLY_4X4, common->tx_mode); - } - EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode); - if (encode_parms.error_resilient) { - EXPECT_EQ(0, common->use_prev_frame_mvs); - } - EXPECT_EQ(encode_parms.color_range, common->color_range); - EXPECT_EQ(encode_parms.cp, common->color_primaries); - EXPECT_EQ(encode_parms.tc, common->transfer_characteristics); - EXPECT_EQ(encode_parms.mc, common->matrix_coefficients); - EXPECT_EQ(encode_parms.csp, common->chroma_sample_position); - if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0) { - EXPECT_EQ(encode_parms.render_size[0], common->render_width); - EXPECT_EQ(encode_parms.render_size[1], common->render_height); - } - EXPECT_EQ(encode_parms.tile_cols, common->log2_tile_cols); - EXPECT_EQ(encode_parms.tile_rows, common->log2_tile_rows); - - EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError(); - return AOM_CODEC_OK == res_dec; - } - - EncodePerfTestVideo test_video_; - - private: - EncodeParameters encode_parms; -}; - -TEST_P(AvxEncoderParmsGetToDecoder, BitstreamParms) { - init_flags_ = AOM_CODEC_USE_PSNR; - - testing::internal::scoped_ptr<libaom_test::VideoSource> video( - new libaom_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames)); - ASSERT_TRUE(video.get() != NULL); - - ASSERT_NO_FATAL_FAILURE(RunLoop(video.get())); -} - -AV1_INSTANTIATE_TEST_CASE(AvxEncoderParmsGetToDecoder, - ::testing::ValuesIn(kAV1EncodeParameterSet), - ::testing::ValuesIn(kAV1EncodePerfTestVectors)); -} // namespace
diff --git a/test/level_test.cc b/test/level_test.cc deleted file mode 100644 index 12f3918..0000000 --- a/test/level_test.cc +++ /dev/null
@@ -1,117 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" -#include "test/codec_factory.h" -#include "test/encode_test_driver.h" -#include "test/i420_video_source.h" -#include "test/util.h" - -namespace { -class LevelTest - : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int>, - public ::libaom_test::EncoderTest { - protected: - LevelTest() - : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), - cpu_used_(GET_PARAM(2)), min_gf_internal_(24), target_level_(0), - level_(0) {} - virtual ~LevelTest() {} - - virtual void SetUp() { - InitializeConfig(); - SetMode(encoding_mode_); - if (encoding_mode_ != ::libaom_test::kRealTime) { - cfg_.g_lag_in_frames = 25; - cfg_.rc_end_usage = AOM_VBR; - } else { - cfg_.g_lag_in_frames = 0; - cfg_.rc_end_usage = AOM_CBR; - } - cfg_.rc_2pass_vbr_minsection_pct = 5; - cfg_.rc_2pass_vbr_maxsection_pct = 2000; - cfg_.rc_target_bitrate = 400; - cfg_.rc_max_quantizer = 63; - cfg_.rc_min_quantizer = 0; - } - - virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, - ::libaom_test::Encoder *encoder) { - if (video->frame() == 0) { - encoder->Control(AOME_SET_CPUUSED, cpu_used_); - encoder->Control(AV1E_SET_TARGET_LEVEL, target_level_); - encoder->Control(AV1E_SET_MIN_GF_INTERVAL, min_gf_internal_); - if (encoding_mode_ != ::libaom_test::kRealTime) { - encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); - encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); - encoder->Control(AOME_SET_ARNR_STRENGTH, 5); - } - } - encoder->Control(AV1E_GET_LEVEL, &level_); - ASSERT_LE(level_, 51); - ASSERT_GE(level_, 0); - } - - ::libaom_test::TestMode encoding_mode_; - int cpu_used_; - int min_gf_internal_; - int target_level_; - int level_; -}; - -// Test for keeping level stats only -TEST_P(LevelTest, TestTargetLevel0) { - ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, - 40); - target_level_ = 0; - min_gf_internal_ = 4; - ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - ASSERT_EQ(11, level_); - - cfg_.rc_target_bitrate = 1600; - ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - ASSERT_EQ(20, level_); -} - -// Test for level control being turned off -TEST_P(LevelTest, TestTargetLevel255) { - ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, - 30); - target_level_ = 255; - ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); -} - -TEST_P(LevelTest, TestTargetLevelApi) { - ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, 1); - static const aom_codec_iface_t *codec = &aom_codec_av1_cx_algo; - aom_codec_ctx_t enc; - aom_codec_enc_cfg_t cfg; - EXPECT_EQ(AOM_CODEC_OK, aom_codec_enc_config_default(codec, &cfg, 0)); - EXPECT_EQ(AOM_CODEC_OK, aom_codec_enc_init(&enc, codec, &cfg, 0)); - for (int level = 0; level <= 256; ++level) { - if (level == 10 || level == 11 || level == 20 || level == 21 || - level == 30 || level == 31 || level == 40 || level == 41 || - level == 50 || level == 51 || level == 52 || level == 60 || - level == 61 || level == 62 || level == 0 || level == 255) - EXPECT_EQ(AOM_CODEC_OK, - aom_codec_control(&enc, AV1E_SET_TARGET_LEVEL, level)); - else - EXPECT_EQ(AOM_CODEC_INVALID_PARAM, - aom_codec_control(&enc, AV1E_SET_TARGET_LEVEL, level)); - } - EXPECT_EQ(AOM_CODEC_OK, aom_codec_destroy(&enc)); -} - -AV1_INSTANTIATE_TEST_CASE(LevelTest, - ::testing::Values(::libaom_test::kTwoPassGood, - ::libaom_test::kOnePassGood), - ::testing::Range(0, 9)); -} // namespace
diff --git a/test/realtime_test.cc b/test/realtime_test.cc deleted file mode 100644 index 11d2a32..0000000 --- a/test/realtime_test.cc +++ /dev/null
@@ -1,63 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#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 = 2; - -class RealtimeTest - : public ::libaom_test::CodecTestWithParam<libaom_test::TestMode>, - public ::libaom_test::EncoderTest { - protected: - RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {} - virtual ~RealtimeTest() {} - - virtual void SetUp() { - InitializeConfig(); - cfg_.g_lag_in_frames = 0; - SetMode(::libaom_test::kRealTime); - } - - virtual void BeginPassHook(unsigned int /*pass*/) { - // TODO(tomfinegan): We're changing the pass value here to make sure - // we get frames when real time mode is combined with |g_pass| set to - // AOM_RC_FIRST_PASS. This is necessary because EncoderTest::RunLoop() sets - // the pass value based on the mode passed into EncoderTest::SetMode(), - // which overrides the one specified in SetUp() above. - cfg_.g_pass = AOM_RC_FIRST_PASS; - } - virtual void FramePktHook(const aom_codec_cx_pkt_t * /*pkt*/) { - frame_packets_++; - } - - int frame_packets_; -}; - -TEST_P(RealtimeTest, RealtimeFirstPassProducesFrames) { - ::libaom_test::RandomVideoSource video; - video.SetSize(kVideoSourceWidth, kVideoSourceHeight); - video.set_limit(kFramesToEncode); - ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - EXPECT_EQ(kFramesToEncode, frame_packets_); -} - -AV1_INSTANTIATE_TEST_CASE(RealtimeTest, - ::testing::Values(::libaom_test::kRealTime)); - -} // namespace
diff --git a/test/user_priv_test.cc b/test/user_priv_test.cc deleted file mode 100644 index 3aeb8b1..0000000 --- a/test/user_priv_test.cc +++ /dev/null
@@ -1,102 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -#include <cstdio> -#include <cstdlib> -#include <string> -#include "third_party/googletest/src/googletest/include/gtest/gtest.h" -#include "./aom_config.h" -#include "test/acm_random.h" -#include "test/codec_factory.h" -#include "test/decode_test_driver.h" -#include "test/ivf_video_source.h" -#include "test/md5_helper.h" -#include "test/util.h" -#if CONFIG_WEBM_IO -#include "test/webm_video_source.h" -#endif -#include "aom_mem/aom_mem.h" -#include "aom/aom.h" - -namespace { - -using libaom_test::ACMRandom; -using std::string; - -#if CONFIG_WEBM_IO - -void CheckUserPrivateData(void *user_priv, int *target) { - // actual pointer value should be the same as expected. - EXPECT_EQ(reinterpret_cast<void *>(target), user_priv) - << "user_priv pointer value does not match."; -} - -// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and -// compares the user_priv from return img with the original user_priv to see if -// they match. Both the pointer values and the values inside the addresses -// should match. -string DecodeFile(const string &filename) { - ACMRandom rnd(ACMRandom::DeterministicSeed()); - libaom_test::WebMVideoSource video(filename); - video.Init(); - - aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); - cfg.allow_lowbitdepth = 1; - libaom_test::AV1Decoder decoder(cfg, 0); - - libaom_test::MD5 md5; - int frame_num = 0; - for (video.Begin(); !::testing::Test::HasFailure() && video.cxdata(); - video.Next()) { - void *user_priv = reinterpret_cast<void *>(&frame_num); - const aom_codec_err_t res = - decoder.DecodeFrame(video.cxdata(), video.frame_size(), - (frame_num == 0) ? NULL : user_priv); - if (res != AOM_CODEC_OK) { - EXPECT_EQ(AOM_CODEC_OK, res) << decoder.DecodeError(); - break; - } - libaom_test::DxDataIterator dec_iter = decoder.GetDxData(); - const aom_image_t *img = NULL; - - // Get decompressed data. - while ((img = dec_iter.Next())) { - if (frame_num == 0) { - CheckUserPrivateData(img->user_priv, NULL); - } else { - CheckUserPrivateData(img->user_priv, &frame_num); - - // Also test ctrl_get_reference api. - struct av1_ref_frame ref; - // Randomly fetch a reference frame. - ref.idx = rnd.Rand8() % 3; - decoder.Control(AV1_GET_REFERENCE, &ref); - - CheckUserPrivateData(ref.img.user_priv, NULL); - } - md5.Add(img); - } - - frame_num++; - } - return string(md5.Get()); -} - -TEST(UserPrivTest, VideoDecode) { - // no tiles or frame parallel; this exercises the decoding to test the - // user_priv. - EXPECT_STREQ("b35a1b707b28e82be025d960aba039bc", - DecodeFile("av10-2-03-size-226x226.webm").c_str()); -} - -#endif // CONFIG_WEBM_IO - -} // namespace