More vp8/vp9 clean up
Change-Id: I8101de20e873c19d03c7fd2977bc22003e395807
This commit is contained in:
		@@ -168,12 +168,6 @@ endif
 | 
				
			|||||||
define rtcd_dep_template
 | 
					define rtcd_dep_template
 | 
				
			||||||
rtcd_dep_template_SRCS := $(addprefix $(LOCAL_PATH)/, $(LOCAL_SRC_FILES))
 | 
					rtcd_dep_template_SRCS := $(addprefix $(LOCAL_PATH)/, $(LOCAL_SRC_FILES))
 | 
				
			||||||
rtcd_dep_template_SRCS := $$(rtcd_dep_template_SRCS:.neon=)
 | 
					rtcd_dep_template_SRCS := $$(rtcd_dep_template_SRCS:.neon=)
 | 
				
			||||||
ifeq ($(CONFIG_VP8), yes)
 | 
					 | 
				
			||||||
$$(rtcd_dep_template_SRCS): vp8_rtcd.h
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP9), yes)
 | 
					 | 
				
			||||||
$$(rtcd_dep_template_SRCS): vp9_rtcd.h
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP10), yes)
 | 
					ifeq ($(CONFIG_VP10), yes)
 | 
				
			||||||
$$(rtcd_dep_template_SRCS): vp10_rtcd.h
 | 
					$$(rtcd_dep_template_SRCS): vp10_rtcd.h
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -320,14 +320,7 @@ EOF
 | 
				
			|||||||
  print <<EOF;
 | 
					  print <<EOF;
 | 
				
			||||||
#if HAVE_DSPR2
 | 
					#if HAVE_DSPR2
 | 
				
			||||||
void vpx_dsputil_static_init();
 | 
					void vpx_dsputil_static_init();
 | 
				
			||||||
#if CONFIG_VP8
 | 
					 | 
				
			||||||
void dsputil_static_init();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
vpx_dsputil_static_init();
 | 
					vpx_dsputil_static_init();
 | 
				
			||||||
#if CONFIG_VP8
 | 
					 | 
				
			||||||
dsputil_static_init();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								examples.mk
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								examples.mk
									
									
									
									
									
								
							@@ -246,13 +246,9 @@ endif
 | 
				
			|||||||
# We should not link to math library (libm) on RVCT
 | 
					# We should not link to math library (libm) on RVCT
 | 
				
			||||||
# when building for bare-metal targets
 | 
					# when building for bare-metal targets
 | 
				
			||||||
ifeq ($(CONFIG_OS_SUPPORT), yes)
 | 
					ifeq ($(CONFIG_OS_SUPPORT), yes)
 | 
				
			||||||
CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
 | 
					 | 
				
			||||||
CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
 | 
					 | 
				
			||||||
CODEC_EXTRA_LIBS-$(CONFIG_VP10)        += m
 | 
					CODEC_EXTRA_LIBS-$(CONFIG_VP10)        += m
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    ifeq ($(CONFIG_GCC), yes)
 | 
					    ifeq ($(CONFIG_GCC), yes)
 | 
				
			||||||
    CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
 | 
					 | 
				
			||||||
    CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
 | 
					 | 
				
			||||||
    CODEC_EXTRA_LIBS-$(CONFIG_VP10)        += m
 | 
					    CODEC_EXTRA_LIBS-$(CONFIG_VP10)        += m
 | 
				
			||||||
    endif
 | 
					    endif
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
@@ -270,10 +266,8 @@ ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
 | 
				
			|||||||
    INC_PATH-yes := $(SRC_PATH_BARE)/../include
 | 
					    INC_PATH-yes := $(SRC_PATH_BARE)/../include
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    LIB_PATH-yes                     += $(if $(BUILD_PFX),$(BUILD_PFX),.)
 | 
					    LIB_PATH-yes                     += $(if $(BUILD_PFX),$(BUILD_PFX),.)
 | 
				
			||||||
    INC_PATH-$(CONFIG_VP8_DECODER)   += $(SRC_PATH_BARE)/vp8
 | 
					    INC_PATH-$(CONFIG_VP10_DECODER)   += $(SRC_PATH_BARE)/vp10
 | 
				
			||||||
    INC_PATH-$(CONFIG_VP8_ENCODER)   += $(SRC_PATH_BARE)/vp8
 | 
					    INC_PATH-$(CONFIG_VP10_ENCODER)   += $(SRC_PATH_BARE)/vp10
 | 
				
			||||||
    INC_PATH-$(CONFIG_VP9_DECODER)   += $(SRC_PATH_BARE)/vp9
 | 
					 | 
				
			||||||
    INC_PATH-$(CONFIG_VP9_ENCODER)   += $(SRC_PATH_BARE)/vp9
 | 
					 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
 | 
					INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
 | 
				
			||||||
LIB_PATH := $(call enabled,LIB_PATH)
 | 
					LIB_PATH := $(call enabled,LIB_PATH)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,9 +126,6 @@ TEST_P(ActiveMapRefreshTest, Test) {
 | 
				
			|||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime),
 | 
					 | 
				
			||||||
                          ::testing::Range(5, 6));
 | 
					 | 
				
			||||||
#if CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
 | 
				
			||||||
                           ::testing::Values(::libvpx_test::kRealTime),
 | 
					                           ::testing::Values(::libvpx_test::kRealTime),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,10 +92,6 @@ TEST_P(ActiveMapTestLarge, Test) {
 | 
				
			|||||||
  DoTest();
 | 
					  DoTest();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime),
 | 
					 | 
				
			||||||
                          ::testing::Range(0, 9));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(ActiveMapTestLarge,
 | 
					VP10_INSTANTIATE_TEST_CASE(ActiveMapTestLarge,
 | 
				
			||||||
                           ::testing::Values(::libvpx_test::kRealTime),
 | 
					                           ::testing::Values(::libvpx_test::kRealTime),
 | 
				
			||||||
                           ::testing::Range(0, 5));
 | 
					                           ::testing::Range(0, 5));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,62 +14,6 @@
 | 
				
			|||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP8_ENCODER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// lookahead range: [kLookAheadMin, kLookAheadMax).
 | 
					 | 
				
			||||||
const int kLookAheadMin = 5;
 | 
					 | 
				
			||||||
const int kLookAheadMax = 26;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class AltRefTest : public ::libvpx_test::EncoderTest,
 | 
					 | 
				
			||||||
    public ::libvpx_test::CodecTestWithParam<int> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
 | 
					 | 
				
			||||||
  virtual ~AltRefTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    InitializeConfig();
 | 
					 | 
				
			||||||
    SetMode(libvpx_test::kTwoPassGood);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void BeginPassHook(unsigned int pass) {
 | 
					 | 
				
			||||||
    altref_count_ = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
 | 
					 | 
				
			||||||
                                  libvpx_test::Encoder *encoder) {
 | 
					 | 
				
			||||||
    if (video->frame() == 1) {
 | 
					 | 
				
			||||||
      encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
 | 
					 | 
				
			||||||
      encoder->Control(VP8E_SET_CPUUSED, 3);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
 | 
					 | 
				
			||||||
    if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int altref_count() const { return altref_count_; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  int altref_count_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(AltRefTest, MonotonicTimestamps) {
 | 
					 | 
				
			||||||
  const vpx_rational timebase = { 33333333, 1000000000 };
 | 
					 | 
				
			||||||
  cfg_.g_timebase = timebase;
 | 
					 | 
				
			||||||
  cfg_.rc_target_bitrate = 1000;
 | 
					 | 
				
			||||||
  cfg_.g_lag_in_frames = GET_PARAM(1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
 | 
					 | 
				
			||||||
                                     timebase.den, timebase.num, 0, 30);
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
  EXPECT_GE(altref_count(), 1);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(AltRefTest,
 | 
					 | 
				
			||||||
                          ::testing::Range(kLookAheadMin, kLookAheadMax));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP8_ENCODER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class AltRefForcedKeyTestLarge
 | 
					class AltRefForcedKeyTestLarge
 | 
				
			||||||
    : public ::libvpx_test::EncoderTest,
 | 
					    : public ::libvpx_test::EncoderTest,
 | 
				
			||||||
      public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
 | 
					      public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
 | 
				
			||||||
@@ -152,16 +96,6 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    AltRefForcedKeyTestLarge,
 | 
					 | 
				
			||||||
    ::testing::Values(::libvpx_test::kOnePassGood),
 | 
					 | 
				
			||||||
    ::testing::Range(0, 9));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    AltRefForcedKeyTestLarge,
 | 
					 | 
				
			||||||
    ::testing::Values(::libvpx_test::kOnePassGood),
 | 
					 | 
				
			||||||
    ::testing::Range(0, 9));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
    AltRefForcedKeyTestLarge,
 | 
					    AltRefForcedKeyTestLarge,
 | 
				
			||||||
    ::testing::Values(::libvpx_test::kOnePassGood),
 | 
					    ::testing::Values(::libvpx_test::kOnePassGood),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -90,10 +90,6 @@ TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ3) {
 | 
				
			|||||||
  DoTest(3);
 | 
					  DoTest(3);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime,
 | 
					 | 
				
			||||||
                                            ::libvpx_test::kOnePassGood),
 | 
					 | 
				
			||||||
                          ::testing::Range(3, 9));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(AqSegmentTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(AqSegmentTest,
 | 
				
			||||||
                           ::testing::Values(::libvpx_test::kRealTime,
 | 
					                           ::testing::Values(::libvpx_test::kRealTime,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,9 +78,6 @@ TEST_P(BordersTest, TestLowBitrate) {
 | 
				
			|||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
 | 
					 | 
				
			||||||
    ::libvpx_test::kTwoPassGood));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
 | 
					VP10_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
 | 
				
			||||||
    ::libvpx_test::kTwoPassGood));
 | 
					    ::libvpx_test::kTwoPassGood));
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,189 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/decode_test_driver.h"
 | 
					 | 
				
			||||||
#include "test/md5_helper.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
#include "test/webm_video_source.h"
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const int kLegacyByteAlignment = 0;
 | 
					 | 
				
			||||||
const int kLegacyYPlaneByteAlignment = 32;
 | 
					 | 
				
			||||||
const int kNumPlanesToCheck = 3;
 | 
					 | 
				
			||||||
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
 | 
					 | 
				
			||||||
const char kVP9Md5File[] = "vp90-2-02-size-lf-1920x1080.webm.md5";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct ByteAlignmentTestParam {
 | 
					 | 
				
			||||||
  int byte_alignment;
 | 
					 | 
				
			||||||
  vpx_codec_err_t expected_value;
 | 
					 | 
				
			||||||
  bool decode_remaining;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const ByteAlignmentTestParam kBaTestParams[] = {
 | 
					 | 
				
			||||||
  {kLegacyByteAlignment, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {32, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {64, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {128, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {256, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {512, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {1024, VPX_CODEC_OK, true},
 | 
					 | 
				
			||||||
  {1, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
  {-2, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
  {4, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
  {16, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
  {255, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
  {2048, VPX_CODEC_INVALID_PARAM, false},
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Class for testing byte alignment of reference buffers.
 | 
					 | 
				
			||||||
class ByteAlignmentTest
 | 
					 | 
				
			||||||
    : public ::testing::TestWithParam<ByteAlignmentTestParam> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  ByteAlignmentTest()
 | 
					 | 
				
			||||||
      : video_(NULL),
 | 
					 | 
				
			||||||
        decoder_(NULL),
 | 
					 | 
				
			||||||
        md5_file_(NULL) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(video_ != NULL);
 | 
					 | 
				
			||||||
    video_->Init();
 | 
					 | 
				
			||||||
    video_->Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
    decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(decoder_ != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    OpenMd5File(kVP9Md5File);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() {
 | 
					 | 
				
			||||||
    if (md5_file_ != NULL)
 | 
					 | 
				
			||||||
      fclose(md5_file_);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    delete decoder_;
 | 
					 | 
				
			||||||
    delete video_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void SetByteAlignment(int byte_alignment, vpx_codec_err_t expected_value) {
 | 
					 | 
				
			||||||
    decoder_->Control(VP9_SET_BYTE_ALIGNMENT, byte_alignment, expected_value);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeOneFrame(int byte_alignment_to_check) {
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
    CheckDecodedFrames(byte_alignment_to_check);
 | 
					 | 
				
			||||||
    if (res == VPX_CODEC_OK)
 | 
					 | 
				
			||||||
      video_->Next();
 | 
					 | 
				
			||||||
    return res;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) {
 | 
					 | 
				
			||||||
    for (; video_->cxdata() != NULL; video_->Next()) {
 | 
					 | 
				
			||||||
      const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
          decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
      if (res != VPX_CODEC_OK)
 | 
					 | 
				
			||||||
        return res;
 | 
					 | 
				
			||||||
      CheckDecodedFrames(byte_alignment_to_check);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return VPX_CODEC_OK;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  // Check if |data| is aligned to |byte_alignment_to_check|.
 | 
					 | 
				
			||||||
  // |byte_alignment_to_check| must be a power of 2.
 | 
					 | 
				
			||||||
  void CheckByteAlignment(const uint8_t *data, int byte_alignment_to_check) {
 | 
					 | 
				
			||||||
    ASSERT_EQ(0u, reinterpret_cast<size_t>(data) % byte_alignment_to_check);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Iterate through the planes of the decoded frames and check for
 | 
					 | 
				
			||||||
  // alignment based off |byte_alignment_to_check|.
 | 
					 | 
				
			||||||
  void CheckDecodedFrames(int byte_alignment_to_check) {
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Get decompressed data
 | 
					 | 
				
			||||||
    while ((img = dec_iter.Next()) != NULL) {
 | 
					 | 
				
			||||||
      if (byte_alignment_to_check == kLegacyByteAlignment) {
 | 
					 | 
				
			||||||
        CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        for (int i = 0; i < kNumPlanesToCheck; ++i) {
 | 
					 | 
				
			||||||
          CheckByteAlignment(img->planes[i], byte_alignment_to_check);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      CheckMd5(*img);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // TODO(fgalligan): Move the MD5 testing code into another class.
 | 
					 | 
				
			||||||
  void OpenMd5File(const std::string &md5_file_name_) {
 | 
					 | 
				
			||||||
    md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
 | 
					 | 
				
			||||||
        << md5_file_name_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void CheckMd5(const vpx_image_t &img) {
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL);
 | 
					 | 
				
			||||||
    char expected_md5[33];
 | 
					 | 
				
			||||||
    char junk[128];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Read correct md5 checksums.
 | 
					 | 
				
			||||||
    const int res = fscanf(md5_file_, "%s  %s", expected_md5, junk);
 | 
					 | 
				
			||||||
    ASSERT_NE(EOF, res) << "Read md5 data failed";
 | 
					 | 
				
			||||||
    expected_md5[32] = '\0';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ::libvpx_test::MD5 md5_res;
 | 
					 | 
				
			||||||
    md5_res.Add(&img);
 | 
					 | 
				
			||||||
    const char *const actual_md5 = md5_res.Get();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check md5 match.
 | 
					 | 
				
			||||||
    ASSERT_STREQ(expected_md5, actual_md5) << "MD5 checksums don't match";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource *video_;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder *decoder_;
 | 
					 | 
				
			||||||
  FILE *md5_file_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ByteAlignmentTest, SwitchByteAlignment) {
 | 
					 | 
				
			||||||
  const int num_elements = 14;
 | 
					 | 
				
			||||||
  const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
 | 
					 | 
				
			||||||
                                  0, 1024, 32, 512, 64, 256, 128 };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < num_elements; ++i) {
 | 
					 | 
				
			||||||
    SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);
 | 
					 | 
				
			||||||
    ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame(byte_alignments[i]));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  SetByteAlignment(byte_alignments[0], VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(byte_alignments[0]));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(ByteAlignmentTest, TestAlignment) {
 | 
					 | 
				
			||||||
  const ByteAlignmentTestParam t = GetParam();
 | 
					 | 
				
			||||||
  SetByteAlignment(t.byte_alignment, t.expected_value);
 | 
					 | 
				
			||||||
  if (t.decode_remaining)
 | 
					 | 
				
			||||||
    ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(t.byte_alignment));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(Alignments, ByteAlignmentTest,
 | 
					 | 
				
			||||||
                        ::testing::ValuesIn(kBaTestParams));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -13,10 +13,10 @@
 | 
				
			|||||||
#include "./vpx_config.h"
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
#include "vpx/vpx_decoder.h"
 | 
					#include "vpx/vpx_decoder.h"
 | 
				
			||||||
#include "vpx/vpx_encoder.h"
 | 
					#include "vpx/vpx_encoder.h"
 | 
				
			||||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
 | 
					#if CONFIG_VP10_ENCODER
 | 
				
			||||||
#include "vpx/vp8cx.h"
 | 
					#include "vpx/vp8cx.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER || CONFIG_VP10_DECODER
 | 
					#if CONFIG_VP10_DECODER
 | 
				
			||||||
#include "vpx/vp8dx.h"
 | 
					#include "vpx/vp8dx.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -68,191 +68,6 @@ class CodecTestWith3Params : public ::testing::TestWithParam<
 | 
				
			|||||||
    std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
 | 
					    std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * VP8 Codec Definitions
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if CONFIG_VP8
 | 
					 | 
				
			||||||
class VP8Decoder : public Decoder {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP8Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
 | 
					 | 
				
			||||||
      : Decoder(cfg, deadline) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  VP8Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
 | 
					 | 
				
			||||||
             unsigned long deadline)  // NOLINT
 | 
					 | 
				
			||||||
      : Decoder(cfg, flag, deadline) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual vpx_codec_iface_t* CodecInterface() const {
 | 
					 | 
				
			||||||
#if CONFIG_VP8_DECODER
 | 
					 | 
				
			||||||
    return &vpx_codec_vp8_dx_algo;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP8Encoder : public Encoder {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP8Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
 | 
					 | 
				
			||||||
             const unsigned long init_flags, TwopassStatsStore *stats)
 | 
					 | 
				
			||||||
      : Encoder(cfg, deadline, init_flags, stats) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual vpx_codec_iface_t* CodecInterface() const {
 | 
					 | 
				
			||||||
#if CONFIG_VP8_ENCODER
 | 
					 | 
				
			||||||
    return &vpx_codec_vp8_cx_algo;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP8CodecFactory : public CodecFactory {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP8CodecFactory() : CodecFactory() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 unsigned long deadline) const {
 | 
					 | 
				
			||||||
    return CreateDecoder(cfg, 0, deadline);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 const vpx_codec_flags_t flags,
 | 
					 | 
				
			||||||
                                 unsigned long deadline) const {  // NOLINT
 | 
					 | 
				
			||||||
#if CONFIG_VP8_DECODER
 | 
					 | 
				
			||||||
    return new VP8Decoder(cfg, flags, deadline);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 unsigned long deadline,
 | 
					 | 
				
			||||||
                                 const unsigned long init_flags,
 | 
					 | 
				
			||||||
                                 TwopassStatsStore *stats) const {
 | 
					 | 
				
			||||||
#if CONFIG_VP8_ENCODER
 | 
					 | 
				
			||||||
    return new VP8Encoder(cfg, deadline, init_flags, stats);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
 | 
					 | 
				
			||||||
                                               int usage) const {
 | 
					 | 
				
			||||||
#if CONFIG_VP8_ENCODER
 | 
					 | 
				
			||||||
    return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return VPX_CODEC_INCAPABLE;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const libvpx_test::VP8CodecFactory kVP8;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)\
 | 
					 | 
				
			||||||
  INSTANTIATE_TEST_CASE_P(VP8, test, \
 | 
					 | 
				
			||||||
      ::testing::Combine( \
 | 
					 | 
				
			||||||
          ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
 | 
					 | 
				
			||||||
              &libvpx_test::kVP8)), \
 | 
					 | 
				
			||||||
          __VA_ARGS__))
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * VP9 Codec Definitions
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if CONFIG_VP9
 | 
					 | 
				
			||||||
class VP9Decoder : public Decoder {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP9Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
 | 
					 | 
				
			||||||
      : Decoder(cfg, deadline) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  VP9Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
 | 
					 | 
				
			||||||
             unsigned long deadline)  // NOLINT
 | 
					 | 
				
			||||||
      : Decoder(cfg, flag, deadline) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual vpx_codec_iface_t* CodecInterface() const {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_DECODER
 | 
					 | 
				
			||||||
    return &vpx_codec_vp9_dx_algo;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP9Encoder : public Encoder {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP9Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
 | 
					 | 
				
			||||||
             const unsigned long init_flags, TwopassStatsStore *stats)
 | 
					 | 
				
			||||||
      : Encoder(cfg, deadline, init_flags, stats) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual vpx_codec_iface_t* CodecInterface() const {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_ENCODER
 | 
					 | 
				
			||||||
    return &vpx_codec_vp9_cx_algo;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP9CodecFactory : public CodecFactory {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  VP9CodecFactory() : CodecFactory() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 unsigned long deadline) const {
 | 
					 | 
				
			||||||
    return CreateDecoder(cfg, 0, deadline);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 const vpx_codec_flags_t flags,
 | 
					 | 
				
			||||||
                                 unsigned long deadline) const {  // NOLINT
 | 
					 | 
				
			||||||
#if CONFIG_VP9_DECODER
 | 
					 | 
				
			||||||
    return new VP9Decoder(cfg, flags, deadline);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
 | 
					 | 
				
			||||||
                                 unsigned long deadline,
 | 
					 | 
				
			||||||
                                 const unsigned long init_flags,
 | 
					 | 
				
			||||||
                                 TwopassStatsStore *stats) const {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_ENCODER
 | 
					 | 
				
			||||||
    return new VP9Encoder(cfg, deadline, init_flags, stats);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
 | 
					 | 
				
			||||||
                                               int usage) const {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_ENCODER
 | 
					 | 
				
			||||||
    return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
 | 
					 | 
				
			||||||
#elif CONFIG_VP10_ENCODER
 | 
					 | 
				
			||||||
    return vpx_codec_enc_config_default(&vpx_codec_vp10_cx_algo, cfg, usage);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    return VPX_CODEC_INCAPABLE;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const libvpx_test::VP9CodecFactory kVP9;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)\
 | 
					 | 
				
			||||||
  INSTANTIATE_TEST_CASE_P(VP9, test, \
 | 
					 | 
				
			||||||
      ::testing::Combine( \
 | 
					 | 
				
			||||||
          ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
 | 
					 | 
				
			||||||
               &libvpx_test::kVP9)), \
 | 
					 | 
				
			||||||
          __VA_ARGS__))
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP9
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * VP10 Codec Definitions
 | 
					 * VP10 Codec Definitions
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,60 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/encode_test_driver.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#include "test/video_source.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class ConfigTest : public ::libvpx_test::EncoderTest,
 | 
					 | 
				
			||||||
    public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  ConfigTest() : EncoderTest(GET_PARAM(0)),
 | 
					 | 
				
			||||||
                 frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
 | 
					 | 
				
			||||||
  virtual ~ConfigTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    InitializeConfig();
 | 
					 | 
				
			||||||
    SetMode(GET_PARAM(1));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void BeginPassHook(unsigned int /*pass*/) {
 | 
					 | 
				
			||||||
    frame_count_in_ = 0;
 | 
					 | 
				
			||||||
    frame_count_out_ = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
 | 
					 | 
				
			||||||
    ++frame_count_in_;
 | 
					 | 
				
			||||||
    abort_ |= (frame_count_in_ >= frame_count_max_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
 | 
					 | 
				
			||||||
    ++frame_count_out_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  unsigned int frame_count_in_;
 | 
					 | 
				
			||||||
  unsigned int frame_count_out_;
 | 
					 | 
				
			||||||
  unsigned int frame_count_max_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(ConfigTest, LagIsDisabled) {
 | 
					 | 
				
			||||||
  frame_count_max_ = 2;
 | 
					 | 
				
			||||||
  cfg_.g_lag_in_frames = 15;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::DummyVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(frame_count_in_, frame_count_out_);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -153,12 +153,6 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
 | 
				
			|||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    CpuSpeedTest,
 | 
					 | 
				
			||||||
    ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
 | 
					 | 
				
			||||||
                      ::libvpx_test::kRealTime),
 | 
					 | 
				
			||||||
    ::testing::Range(0, 9));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
    CpuSpeedTest,
 | 
					    CpuSpeedTest,
 | 
				
			||||||
    ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
 | 
					    ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										134
									
								
								test/cq_test.cc
									
									
									
									
									
								
							
							
						
						
									
										134
									
								
								test/cq_test.cc
									
									
									
									
									
								
							@@ -1,134 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#include <cmath>
 | 
					 | 
				
			||||||
#include <map>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/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 {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// CQ level range: [kCQLevelMin, kCQLevelMax).
 | 
					 | 
				
			||||||
const int kCQLevelMin = 4;
 | 
					 | 
				
			||||||
const int kCQLevelMax = 63;
 | 
					 | 
				
			||||||
const int kCQLevelStep = 8;
 | 
					 | 
				
			||||||
const unsigned int kCQTargetBitrate = 2000;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class CQTest : public ::libvpx_test::EncoderTest,
 | 
					 | 
				
			||||||
    public ::libvpx_test::CodecTestWithParam<int> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  // maps the cqlevel to the bitrate produced.
 | 
					 | 
				
			||||||
  typedef std::map<int, uint32_t> BitrateMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static void SetUpTestCase() {
 | 
					 | 
				
			||||||
    bitrates_.clear();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static void TearDownTestCase() {
 | 
					 | 
				
			||||||
    ASSERT_TRUE(!HasFailure())
 | 
					 | 
				
			||||||
        << "skipping bitrate validation due to earlier failure.";
 | 
					 | 
				
			||||||
    uint32_t prev_actual_bitrate = kCQTargetBitrate;
 | 
					 | 
				
			||||||
    for (BitrateMap::const_iterator iter = bitrates_.begin();
 | 
					 | 
				
			||||||
         iter != bitrates_.end(); ++iter) {
 | 
					 | 
				
			||||||
      const uint32_t cq_actual_bitrate = iter->second;
 | 
					 | 
				
			||||||
      EXPECT_LE(cq_actual_bitrate, prev_actual_bitrate)
 | 
					 | 
				
			||||||
          << "cq_level: " << iter->first
 | 
					 | 
				
			||||||
          << ", bitrate should decrease with increase in CQ level.";
 | 
					 | 
				
			||||||
      prev_actual_bitrate = cq_actual_bitrate;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  CQTest() : EncoderTest(GET_PARAM(0)), cq_level_(GET_PARAM(1)) {
 | 
					 | 
				
			||||||
    init_flags_ = VPX_CODEC_USE_PSNR;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual ~CQTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    InitializeConfig();
 | 
					 | 
				
			||||||
    SetMode(libvpx_test::kTwoPassGood);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void BeginPassHook(unsigned int /*pass*/) {
 | 
					 | 
				
			||||||
    file_size_ = 0;
 | 
					 | 
				
			||||||
    psnr_ = 0.0;
 | 
					 | 
				
			||||||
    n_frames_ = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
 | 
					 | 
				
			||||||
                                  libvpx_test::Encoder *encoder) {
 | 
					 | 
				
			||||||
    if (video->frame() == 1) {
 | 
					 | 
				
			||||||
      if (cfg_.rc_end_usage == VPX_CQ) {
 | 
					 | 
				
			||||||
        encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      encoder->Control(VP8E_SET_CPUUSED, 3);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
 | 
					 | 
				
			||||||
    psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
 | 
					 | 
				
			||||||
    n_frames_++;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
 | 
					 | 
				
			||||||
    file_size_ += pkt->data.frame.sz;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  double GetLinearPSNROverBitrate() const {
 | 
					 | 
				
			||||||
    double avg_psnr = log10(psnr_ / n_frames_) * 10.0;
 | 
					 | 
				
			||||||
    return pow(10.0, avg_psnr / 10.0) / file_size_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int cq_level() const { return cq_level_; }
 | 
					 | 
				
			||||||
  size_t file_size() const { return file_size_; }
 | 
					 | 
				
			||||||
  int n_frames() const { return n_frames_; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static BitrateMap bitrates_;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  int cq_level_;
 | 
					 | 
				
			||||||
  size_t file_size_;
 | 
					 | 
				
			||||||
  double psnr_;
 | 
					 | 
				
			||||||
  int n_frames_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CQTest::BitrateMap CQTest::bitrates_;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
 | 
					 | 
				
			||||||
  const vpx_rational timebase = { 33333333, 1000000000 };
 | 
					 | 
				
			||||||
  cfg_.g_timebase = timebase;
 | 
					 | 
				
			||||||
  cfg_.rc_target_bitrate = kCQTargetBitrate;
 | 
					 | 
				
			||||||
  cfg_.g_lag_in_frames = 25;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  cfg_.rc_end_usage = VPX_CQ;
 | 
					 | 
				
			||||||
  libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
 | 
					 | 
				
			||||||
                                     timebase.den, timebase.num, 0, 30);
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
  const double cq_psnr_lin = GetLinearPSNROverBitrate();
 | 
					 | 
				
			||||||
  const unsigned int cq_actual_bitrate =
 | 
					 | 
				
			||||||
      static_cast<unsigned int>(file_size()) * 8 * 30 / (n_frames() * 1000);
 | 
					 | 
				
			||||||
  EXPECT_LE(cq_actual_bitrate, kCQTargetBitrate);
 | 
					 | 
				
			||||||
  bitrates_[cq_level()] = cq_actual_bitrate;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // try targeting the approximate same bitrate with VBR mode
 | 
					 | 
				
			||||||
  cfg_.rc_end_usage = VPX_VBR;
 | 
					 | 
				
			||||||
  cfg_.rc_target_bitrate = cq_actual_bitrate;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
  const double vbr_psnr_lin = GetLinearPSNROverBitrate();
 | 
					 | 
				
			||||||
  EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(CQTest,
 | 
					 | 
				
			||||||
                          ::testing::Range(kCQLevelMin, kCQLevelMax,
 | 
					 | 
				
			||||||
                                           kCQLevelStep));
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1145,12 +1145,13 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers4threads) {
 | 
				
			|||||||
  EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
 | 
					  EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES);
 | 
					VP10_INSTANTIATE_TEST_CASE(DatarateTestVP9Large,
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kOnePassGood,
 | 
					                          ::testing::Values(::libvpx_test::kOnePassGood,
 | 
				
			||||||
                                            ::libvpx_test::kRealTime),
 | 
					                                            ::libvpx_test::kRealTime),
 | 
				
			||||||
                          ::testing::Range(2, 9));
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvc,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime),
 | 
					 | 
				
			||||||
                          ::testing::Range(5, 9));
 | 
					                          ::testing::Range(5, 9));
 | 
				
			||||||
 | 
					/* VP10 does not support multiple layers yet.
 | 
				
			||||||
 | 
					VP10_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvc,
 | 
				
			||||||
 | 
					                           ::testing::Values(::libvpx_test::kRealTime),
 | 
				
			||||||
 | 
					                           ::testing::Range(5, 8));
 | 
				
			||||||
 | 
					                           */
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,11 +14,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					#include "./vpx_dsp_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
 | 
					#include "vp10/common/scan.h"
 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					#include "vpx/vpx_codec.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
#include "vpx_ports/mem.h"
 | 
					#include "vpx_ports/mem.h"
 | 
				
			||||||
@@ -247,12 +250,12 @@ void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
					void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
				
			||||||
                  int tx_type) {
 | 
					                  int tx_type) {
 | 
				
			||||||
  vp9_fht16x16_c(in, out, stride, tx_type);
 | 
					  vp10_fht16x16_c(in, out, stride, tx_type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
 | 
					void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
 | 
				
			||||||
                  int tx_type) {
 | 
					                  int tx_type) {
 | 
				
			||||||
  vp9_iht16x16_256_add_c(in, dest, stride, tx_type);
 | 
					  vp10_iht16x16_256_add_c(in, dest, stride, tx_type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					#if CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
@@ -265,21 +268,21 @@ void idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
 | 
					void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
 | 
				
			||||||
                      int /*tx_type*/) {
 | 
					                      int tx_type) {
 | 
				
			||||||
  idct16x16_10(in, out, stride);
 | 
					  idct16x16_10(in, out, stride);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
 | 
					void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
 | 
				
			||||||
                      int /*tx_type*/) {
 | 
					                      int tx_type) {
 | 
				
			||||||
  idct16x16_12(in, out, stride);
 | 
					  idct16x16_12(in, out, stride);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10);
 | 
					  vp10_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
 | 
					  vp10_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2
 | 
					#if HAVE_SSE2
 | 
				
			||||||
@@ -559,7 +562,7 @@ class Trans16x16TestBase {
 | 
				
			|||||||
    ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					    ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
				
			||||||
    const int count_test_block = 10000;
 | 
					    const int count_test_block = 10000;
 | 
				
			||||||
    const int eob = 10;
 | 
					    const int eob = 10;
 | 
				
			||||||
    const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
 | 
					    const int16_t *scan = vp10_default_scan_orders[TX_16X16].scan;
 | 
				
			||||||
    DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
 | 
					    DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
 | 
				
			||||||
    DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
 | 
					    DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
 | 
				
			||||||
    DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
 | 
					    DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
 | 
				
			||||||
@@ -767,7 +770,7 @@ class InvTrans16x16DCT
 | 
				
			|||||||
  virtual void TearDown() { libvpx_test::ClearSystemState(); }
 | 
					  virtual void TearDown() { libvpx_test::ClearSystemState(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 protected:
 | 
					 protected:
 | 
				
			||||||
  void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
 | 
					  void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {}
 | 
				
			||||||
  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
 | 
					  void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
 | 
				
			||||||
    inv_txfm_(out, dst, stride);
 | 
					    inv_txfm_(out, dst, stride);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -862,18 +865,18 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans16x16HT,
 | 
					    C, Trans16x16HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 3, VPX_BITS_8)));
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, PartialTrans16x16Test,
 | 
					    C, PartialTrans16x16Test,
 | 
				
			||||||
    ::testing::Values(make_tuple(&vpx_highbd_fdct16x16_1_c, VPX_BITS_8),
 | 
					    ::testing::Values(make_tuple(&vpx_highbd_fdct16x16_1_c, VPX_BITS_8),
 | 
				
			||||||
@@ -883,10 +886,10 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans16x16HT,
 | 
					    C, Trans16x16HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 3, VPX_BITS_8)));
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(C, PartialTrans16x16Test,
 | 
					INSTANTIATE_TEST_CASE_P(C, PartialTrans16x16Test,
 | 
				
			||||||
                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_c,
 | 
					                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_c,
 | 
				
			||||||
                                                     VPX_BITS_8)));
 | 
					                                                     VPX_BITS_8)));
 | 
				
			||||||
@@ -909,13 +912,13 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, Trans16x16HT,
 | 
					    SSE2, Trans16x16HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,
 | 
					        make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 0,
 | 
				
			||||||
                   VPX_BITS_8),
 | 
					                   VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,
 | 
					        make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 1,
 | 
				
			||||||
                   VPX_BITS_8),
 | 
					                   VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,
 | 
					        make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 2,
 | 
				
			||||||
                   VPX_BITS_8),
 | 
					                   VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,
 | 
					        make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 3,
 | 
				
			||||||
                   VPX_BITS_8)));
 | 
					                   VPX_BITS_8)));
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
 | 
					INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
 | 
				
			||||||
                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
 | 
					                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
 | 
				
			||||||
@@ -939,10 +942,13 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, Trans16x16HT,
 | 
					    SSE2, Trans16x16HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_sse2,
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
					                   &vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_sse2,
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 3,
 | 
					                   &vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht16x16_sse2,
 | 
				
			||||||
 | 
					                   &vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_c, 3,
 | 
				
			||||||
                   VPX_BITS_8)));
 | 
					                   VPX_BITS_8)));
 | 
				
			||||||
// Optimizations take effect at a threshold of 3155, so we use a value close to
 | 
					// Optimizations take effect at a threshold of 3155, so we use a value close to
 | 
				
			||||||
// that to test both branches.
 | 
					// that to test both branches.
 | 
				
			||||||
@@ -971,11 +977,14 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    MSA, Trans16x16HT,
 | 
					    MSA, Trans16x16HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_msa,
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 1, VPX_BITS_8),
 | 
					                   &vp10_iht16x16_256_add_msa, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht16x16_msa,
 | 
				
			||||||
        make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 3,
 | 
					                   &vp10_iht16x16_256_add_msa, 1, VPX_BITS_8),
 | 
				
			||||||
                   VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht16x16_msa,
 | 
				
			||||||
 | 
					                   &vp10_iht16x16_256_add_msa, 2, VPX_BITS_8),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht16x16_msa,
 | 
				
			||||||
 | 
					                   &vp10_iht16x16_256_add_msa, 3, VPX_BITS_8)));
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(MSA, PartialTrans16x16Test,
 | 
					INSTANTIATE_TEST_CASE_P(MSA, PartialTrans16x16Test,
 | 
				
			||||||
                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_msa,
 | 
					                        ::testing::Values(make_tuple(&vpx_fdct16x16_1_msa,
 | 
				
			||||||
                                                     VPX_BITS_8)));
 | 
					                                                     VPX_BITS_8)));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,12 +14,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "./vpx_config.h"
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					#include "./vpx_dsp_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					#include "vpx/vpx_codec.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
#include "vpx_ports/mem.h"
 | 
					#include "vpx_ports/mem.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,12 +21,6 @@ namespace {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TEST(DecodeAPI, InvalidParams) {
 | 
					TEST(DecodeAPI, InvalidParams) {
 | 
				
			||||||
  static const vpx_codec_iface_t *kCodecs[] = {
 | 
					  static const vpx_codec_iface_t *kCodecs[] = {
 | 
				
			||||||
#if CONFIG_VP8_DECODER
 | 
					 | 
				
			||||||
    &vpx_codec_vp8_dx_algo,
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if CONFIG_VP9_DECODER
 | 
					 | 
				
			||||||
    &vpx_codec_vp9_dx_algo,
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if CONFIG_VP10_DECODER
 | 
					#if CONFIG_VP10_DECODER
 | 
				
			||||||
    &vpx_codec_vp10_dx_algo,
 | 
					    &vpx_codec_vp10_dx_algo,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -268,6 +268,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
 | 
				
			|||||||
  printf("}\n");
 | 
					  printf("}\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
  VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood));
 | 
					  VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood));
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -197,6 +197,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
    VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime));
 | 
					    VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime));
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@
 | 
				
			|||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "./vpx_config.h"
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
 | 
					#if CONFIG_VP10_ENCODER
 | 
				
			||||||
#include "vpx/vp8cx.h"
 | 
					#include "vpx/vp8cx.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include "vpx/vpx_encoder.h"
 | 
					#include "vpx/vpx_encoder.h"
 | 
				
			||||||
@@ -143,7 +143,7 @@ class Encoder {
 | 
				
			|||||||
    const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
 | 
					    const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
 | 
				
			||||||
    ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
 | 
					    ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
 | 
					#if CONFIG_VP10_ENCODER
 | 
				
			||||||
  void Control(int ctrl_id, vpx_active_map_t *arg) {
 | 
					  void Control(int ctrl_id, vpx_active_map_t *arg) {
 | 
				
			||||||
    const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
 | 
					    const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
 | 
				
			||||||
    ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
 | 
					    ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -201,11 +201,6 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
 | 
				
			|||||||
  delete(video);
 | 
					  delete(video);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    EndToEndTestLarge,
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kEncodingModeVectors),
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kTestVectors),
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kCpuUsedVectors));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
    EndToEndTestLarge,
 | 
					    EndToEndTestLarge,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -591,12 +591,6 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
 | 
					 | 
				
			||||||
                          ::testing::Values(true));
 | 
					 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls,
 | 
					 | 
				
			||||||
                          ONE_PASS_TEST_MODES);
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
 | 
					 | 
				
			||||||
                          ::testing::Values(true));
 | 
					 | 
				
			||||||
// SVC-related tests don't run for VP10 since SVC is not supported.
 | 
					// SVC-related tests don't run for VP10 since SVC is not supported.
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
 | 
					VP10_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
 | 
				
			||||||
                           ::testing::Values(false));
 | 
					                           ::testing::Values(false));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,493 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "./vpx_config.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/test_vectors.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
#include "test/webm_video_source.h"
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const int kVideoNameParam = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct ExternalFrameBuffer {
 | 
					 | 
				
			||||||
  uint8_t *data;
 | 
					 | 
				
			||||||
  size_t size;
 | 
					 | 
				
			||||||
  int in_use;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Class to manipulate a list of external frame buffers.
 | 
					 | 
				
			||||||
class ExternalFrameBufferList {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  ExternalFrameBufferList()
 | 
					 | 
				
			||||||
      : num_buffers_(0),
 | 
					 | 
				
			||||||
        ext_fb_list_(NULL) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual ~ExternalFrameBufferList() {
 | 
					 | 
				
			||||||
    for (int i = 0; i < num_buffers_; ++i) {
 | 
					 | 
				
			||||||
      delete [] ext_fb_list_[i].data;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    delete [] ext_fb_list_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Creates the list to hold the external buffers. Returns true on success.
 | 
					 | 
				
			||||||
  bool CreateBufferList(int num_buffers) {
 | 
					 | 
				
			||||||
    if (num_buffers < 0)
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    num_buffers_ = num_buffers;
 | 
					 | 
				
			||||||
    ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
 | 
					 | 
				
			||||||
    EXPECT_TRUE(ext_fb_list_ != NULL);
 | 
					 | 
				
			||||||
    memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_);
 | 
					 | 
				
			||||||
    return true;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Searches the frame buffer list for a free frame buffer. Makes sure
 | 
					 | 
				
			||||||
  // that the frame buffer is at least |min_size| in bytes. Marks that the
 | 
					 | 
				
			||||||
  // frame buffer is in use by libvpx. Finally sets |fb| to point to the
 | 
					 | 
				
			||||||
  // external frame buffer. Returns < 0 on an error.
 | 
					 | 
				
			||||||
  int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    EXPECT_TRUE(fb != NULL);
 | 
					 | 
				
			||||||
    const int idx = FindFreeBufferIndex();
 | 
					 | 
				
			||||||
    if (idx == num_buffers_)
 | 
					 | 
				
			||||||
      return -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (ext_fb_list_[idx].size < min_size) {
 | 
					 | 
				
			||||||
      delete [] ext_fb_list_[idx].data;
 | 
					 | 
				
			||||||
      ext_fb_list_[idx].data = new uint8_t[min_size];
 | 
					 | 
				
			||||||
      memset(ext_fb_list_[idx].data, 0, min_size);
 | 
					 | 
				
			||||||
      ext_fb_list_[idx].size = min_size;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SetFrameBuffer(idx, fb);
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Test function that will not allocate any data for the frame buffer.
 | 
					 | 
				
			||||||
  // Returns < 0 on an error.
 | 
					 | 
				
			||||||
  int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    EXPECT_TRUE(fb != NULL);
 | 
					 | 
				
			||||||
    const int idx = FindFreeBufferIndex();
 | 
					 | 
				
			||||||
    if (idx == num_buffers_)
 | 
					 | 
				
			||||||
      return -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (ext_fb_list_[idx].size < min_size) {
 | 
					 | 
				
			||||||
      delete [] ext_fb_list_[idx].data;
 | 
					 | 
				
			||||||
      ext_fb_list_[idx].data = NULL;
 | 
					 | 
				
			||||||
      ext_fb_list_[idx].size = min_size;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SetFrameBuffer(idx, fb);
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Marks the external frame buffer that |fb| is pointing to as free.
 | 
					 | 
				
			||||||
  // Returns < 0 on an error.
 | 
					 | 
				
			||||||
  int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    if (fb == NULL) {
 | 
					 | 
				
			||||||
      EXPECT_TRUE(fb != NULL);
 | 
					 | 
				
			||||||
      return -1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    ExternalFrameBuffer *const ext_fb =
 | 
					 | 
				
			||||||
        reinterpret_cast<ExternalFrameBuffer*>(fb->priv);
 | 
					 | 
				
			||||||
    if (ext_fb == NULL) {
 | 
					 | 
				
			||||||
      EXPECT_TRUE(ext_fb != NULL);
 | 
					 | 
				
			||||||
      return -1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    EXPECT_EQ(1, ext_fb->in_use);
 | 
					 | 
				
			||||||
    ext_fb->in_use = 0;
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Checks that the ximage data is contained within the external frame buffer
 | 
					 | 
				
			||||||
  // private data passed back in the ximage.
 | 
					 | 
				
			||||||
  void CheckXImageFrameBuffer(const vpx_image_t *img) {
 | 
					 | 
				
			||||||
    if (img->fb_priv != NULL) {
 | 
					 | 
				
			||||||
      const struct ExternalFrameBuffer *const ext_fb =
 | 
					 | 
				
			||||||
          reinterpret_cast<ExternalFrameBuffer*>(img->fb_priv);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ASSERT_TRUE(img->planes[0] >= ext_fb->data &&
 | 
					 | 
				
			||||||
                  img->planes[0] < (ext_fb->data + ext_fb->size));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  // Returns the index of the first free frame buffer. Returns |num_buffers_|
 | 
					 | 
				
			||||||
  // if there are no free frame buffers.
 | 
					 | 
				
			||||||
  int FindFreeBufferIndex() {
 | 
					 | 
				
			||||||
    int i;
 | 
					 | 
				
			||||||
    // Find a free frame buffer.
 | 
					 | 
				
			||||||
    for (i = 0; i < num_buffers_; ++i) {
 | 
					 | 
				
			||||||
      if (!ext_fb_list_[i].in_use)
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return i;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Sets |fb| to an external frame buffer. idx is the index into the frame
 | 
					 | 
				
			||||||
  // buffer list.
 | 
					 | 
				
			||||||
  void SetFrameBuffer(int idx, vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    ASSERT_TRUE(fb != NULL);
 | 
					 | 
				
			||||||
    fb->data = ext_fb_list_[idx].data;
 | 
					 | 
				
			||||||
    fb->size = ext_fb_list_[idx].size;
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, ext_fb_list_[idx].in_use);
 | 
					 | 
				
			||||||
    ext_fb_list_[idx].in_use = 1;
 | 
					 | 
				
			||||||
    fb->priv = &ext_fb_list_[idx];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int num_buffers_;
 | 
					 | 
				
			||||||
  ExternalFrameBuffer *ext_fb_list_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Callback used by libvpx to request the application to return a frame
 | 
					 | 
				
			||||||
// buffer of at least |min_size| in bytes.
 | 
					 | 
				
			||||||
int get_vp9_frame_buffer(void *user_priv, size_t min_size,
 | 
					 | 
				
			||||||
                         vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
  ExternalFrameBufferList *const fb_list =
 | 
					 | 
				
			||||||
      reinterpret_cast<ExternalFrameBufferList*>(user_priv);
 | 
					 | 
				
			||||||
  return fb_list->GetFreeFrameBuffer(min_size, fb);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Callback used by libvpx to tell the application that |fb| is not needed
 | 
					 | 
				
			||||||
// anymore.
 | 
					 | 
				
			||||||
int release_vp9_frame_buffer(void *user_priv,
 | 
					 | 
				
			||||||
                             vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
  ExternalFrameBufferList *const fb_list =
 | 
					 | 
				
			||||||
      reinterpret_cast<ExternalFrameBufferList*>(user_priv);
 | 
					 | 
				
			||||||
  return fb_list->ReturnFrameBuffer(fb);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Callback will not allocate data for frame buffer.
 | 
					 | 
				
			||||||
int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,
 | 
					 | 
				
			||||||
                              vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
  ExternalFrameBufferList *const fb_list =
 | 
					 | 
				
			||||||
      reinterpret_cast<ExternalFrameBufferList*>(user_priv);
 | 
					 | 
				
			||||||
  return fb_list->GetZeroFrameBuffer(min_size, fb);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Callback will allocate one less byte than |min_size|.
 | 
					 | 
				
			||||||
int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size,
 | 
					 | 
				
			||||||
                                       vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
  ExternalFrameBufferList *const fb_list =
 | 
					 | 
				
			||||||
      reinterpret_cast<ExternalFrameBufferList*>(user_priv);
 | 
					 | 
				
			||||||
  return fb_list->GetFreeFrameBuffer(min_size - 1, fb);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Callback will not release the external frame buffer.
 | 
					 | 
				
			||||||
int do_not_release_vp9_frame_buffer(void *user_priv,
 | 
					 | 
				
			||||||
                                    vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
  (void)user_priv;
 | 
					 | 
				
			||||||
  (void)fb;
 | 
					 | 
				
			||||||
  return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Class for testing passing in external frame buffers to libvpx.
 | 
					 | 
				
			||||||
class ExternalFrameBufferMD5Test
 | 
					 | 
				
			||||||
    : public ::libvpx_test::DecoderTest,
 | 
					 | 
				
			||||||
      public ::libvpx_test::CodecTestWithParam<const char*> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  ExternalFrameBufferMD5Test()
 | 
					 | 
				
			||||||
      : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
 | 
					 | 
				
			||||||
        md5_file_(NULL),
 | 
					 | 
				
			||||||
        num_buffers_(0) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual ~ExternalFrameBufferMD5Test() {
 | 
					 | 
				
			||||||
    if (md5_file_ != NULL)
 | 
					 | 
				
			||||||
      fclose(md5_file_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PreDecodeFrameHook(
 | 
					 | 
				
			||||||
      const libvpx_test::CompressedVideoSource &video,
 | 
					 | 
				
			||||||
      libvpx_test::Decoder *decoder) {
 | 
					 | 
				
			||||||
    if (num_buffers_ > 0 && video.frame_number() == 0) {
 | 
					 | 
				
			||||||
      // Have libvpx use frame buffers we create.
 | 
					 | 
				
			||||||
      ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
 | 
					 | 
				
			||||||
      ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
                decoder->SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                    GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void OpenMD5File(const std::string &md5_file_name_) {
 | 
					 | 
				
			||||||
    md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
 | 
					 | 
				
			||||||
        << md5_file_name_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void DecompressedFrameHook(const vpx_image_t &img,
 | 
					 | 
				
			||||||
                                     const unsigned int frame_number) {
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL);
 | 
					 | 
				
			||||||
    char expected_md5[33];
 | 
					 | 
				
			||||||
    char junk[128];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Read correct md5 checksums.
 | 
					 | 
				
			||||||
    const int res = fscanf(md5_file_, "%s  %s", expected_md5, junk);
 | 
					 | 
				
			||||||
    ASSERT_NE(EOF, res) << "Read md5 data failed";
 | 
					 | 
				
			||||||
    expected_md5[32] = '\0';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ::libvpx_test::MD5 md5_res;
 | 
					 | 
				
			||||||
    md5_res.Add(&img);
 | 
					 | 
				
			||||||
    const char *const actual_md5 = md5_res.Get();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check md5 match.
 | 
					 | 
				
			||||||
    ASSERT_STREQ(expected_md5, actual_md5)
 | 
					 | 
				
			||||||
        << "Md5 checksums don't match: frame number = " << frame_number;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Callback to get a free external frame buffer. Return value < 0 is an
 | 
					 | 
				
			||||||
  // error.
 | 
					 | 
				
			||||||
  static int GetVP9FrameBuffer(void *user_priv, size_t min_size,
 | 
					 | 
				
			||||||
                               vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    ExternalFrameBufferMD5Test *const md5Test =
 | 
					 | 
				
			||||||
        reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
 | 
					 | 
				
			||||||
    return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Callback to release an external frame buffer. Return value < 0 is an
 | 
					 | 
				
			||||||
  // error.
 | 
					 | 
				
			||||||
  static int ReleaseVP9FrameBuffer(void *user_priv,
 | 
					 | 
				
			||||||
                                   vpx_codec_frame_buffer_t *fb) {
 | 
					 | 
				
			||||||
    ExternalFrameBufferMD5Test *const md5Test =
 | 
					 | 
				
			||||||
        reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
 | 
					 | 
				
			||||||
    return md5Test->fb_list_.ReturnFrameBuffer(fb);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void set_num_buffers(int num_buffers) { num_buffers_ = num_buffers; }
 | 
					 | 
				
			||||||
  int num_buffers() const { return num_buffers_; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  FILE *md5_file_;
 | 
					 | 
				
			||||||
  int num_buffers_;
 | 
					 | 
				
			||||||
  ExternalFrameBufferList fb_list_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Class for testing passing in external frame buffers to libvpx.
 | 
					 | 
				
			||||||
class ExternalFrameBufferTest : public ::testing::Test {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  ExternalFrameBufferTest()
 | 
					 | 
				
			||||||
      : video_(NULL),
 | 
					 | 
				
			||||||
        decoder_(NULL),
 | 
					 | 
				
			||||||
        num_buffers_(0) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(video_ != NULL);
 | 
					 | 
				
			||||||
    video_->Init();
 | 
					 | 
				
			||||||
    video_->Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
    decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(decoder_ != NULL);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() {
 | 
					 | 
				
			||||||
    delete decoder_;
 | 
					 | 
				
			||||||
    delete video_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Passes the external frame buffer information to libvpx.
 | 
					 | 
				
			||||||
  vpx_codec_err_t SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
      int num_buffers,
 | 
					 | 
				
			||||||
      vpx_get_frame_buffer_cb_fn_t cb_get,
 | 
					 | 
				
			||||||
      vpx_release_frame_buffer_cb_fn_t cb_release) {
 | 
					 | 
				
			||||||
    if (num_buffers > 0) {
 | 
					 | 
				
			||||||
      num_buffers_ = num_buffers;
 | 
					 | 
				
			||||||
      EXPECT_TRUE(fb_list_.CreateBufferList(num_buffers_));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return decoder_->SetFrameBufferFunctions(cb_get, cb_release, &fb_list_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeOneFrame() {
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
    CheckDecodedFrames();
 | 
					 | 
				
			||||||
    if (res == VPX_CODEC_OK)
 | 
					 | 
				
			||||||
      video_->Next();
 | 
					 | 
				
			||||||
    return res;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeRemainingFrames() {
 | 
					 | 
				
			||||||
    for (; video_->cxdata() != NULL; video_->Next()) {
 | 
					 | 
				
			||||||
      const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
          decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
      if (res != VPX_CODEC_OK)
 | 
					 | 
				
			||||||
        return res;
 | 
					 | 
				
			||||||
      CheckDecodedFrames();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return VPX_CODEC_OK;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  void CheckDecodedFrames() {
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Get decompressed data
 | 
					 | 
				
			||||||
    while ((img = dec_iter.Next()) != NULL) {
 | 
					 | 
				
			||||||
      fb_list_.CheckXImageFrameBuffer(img);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource *video_;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder *decoder_;
 | 
					 | 
				
			||||||
  int num_buffers_;
 | 
					 | 
				
			||||||
  ExternalFrameBufferList fb_list_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// This test runs through the set of test vectors, and decodes them.
 | 
					 | 
				
			||||||
// Libvpx will call into the application to allocate a frame buffer when
 | 
					 | 
				
			||||||
// needed. The md5 checksums are computed for each frame in the video file.
 | 
					 | 
				
			||||||
// If md5 checksums match the correct md5 data, then the test is passed.
 | 
					 | 
				
			||||||
// Otherwise, the test failed.
 | 
					 | 
				
			||||||
TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
 | 
					 | 
				
			||||||
  const std::string filename = GET_PARAM(kVideoNameParam);
 | 
					 | 
				
			||||||
  libvpx_test::CompressedVideoSource *video = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
 | 
					 | 
				
			||||||
  // #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
 | 
					 | 
				
			||||||
  const int jitter_buffers = 4;
 | 
					 | 
				
			||||||
  const int num_buffers =
 | 
					 | 
				
			||||||
      VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
 | 
					 | 
				
			||||||
  set_num_buffers(num_buffers);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_VP8_DECODER
 | 
					 | 
				
			||||||
  // Tell compiler we are not using kVP8TestVectors.
 | 
					 | 
				
			||||||
  (void)libvpx_test::kVP8TestVectors;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Open compressed video file.
 | 
					 | 
				
			||||||
  if (filename.substr(filename.length() - 3, 3) == "ivf") {
 | 
					 | 
				
			||||||
    video = new libvpx_test::IVFVideoSource(filename);
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
    video = new libvpx_test::WebMVideoSource(filename);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
 | 
					 | 
				
			||||||
            filename.c_str());
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  ASSERT_TRUE(video != NULL);
 | 
					 | 
				
			||||||
  video->Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Construct md5 file name.
 | 
					 | 
				
			||||||
  const std::string md5_filename = filename + ".md5";
 | 
					 | 
				
			||||||
  OpenMD5File(md5_filename);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Decode frame, and check the md5 matching.
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(video));
 | 
					 | 
				
			||||||
  delete video;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, MinFrameBuffers) {
 | 
					 | 
				
			||||||
  // Minimum number of external frame buffers for VP9 is
 | 
					 | 
				
			||||||
  // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
 | 
					 | 
				
			||||||
  // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
 | 
					 | 
				
			||||||
  // #VPX_MAXIMUM_WORK_BUFFERS + eight jitter buffers.
 | 
					 | 
				
			||||||
  const int jitter_buffers = 8;
 | 
					 | 
				
			||||||
  const int num_buffers =
 | 
					 | 
				
			||||||
      VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
 | 
					 | 
				
			||||||
  // Minimum number of external frame buffers for VP9 is
 | 
					 | 
				
			||||||
  // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. Most files will
 | 
					 | 
				
			||||||
  // only use 5 frame buffers at one time.
 | 
					 | 
				
			||||||
  const int num_buffers = 2;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, NoRelease) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
 | 
					 | 
				
			||||||
                                    do_not_release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, NullRealloc) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(num_buffers, get_vp9_zero_frame_buffer,
 | 
					 | 
				
			||||||
                                    release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                num_buffers, get_vp9_one_less_byte_frame_buffer,
 | 
					 | 
				
			||||||
                release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, NullGetFunction) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(num_buffers, NULL,
 | 
					 | 
				
			||||||
                                    release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, NULL));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
 | 
					 | 
				
			||||||
  const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_ERROR,
 | 
					 | 
				
			||||||
            SetFrameBufferFunctions(
 | 
					 | 
				
			||||||
                num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test,
 | 
					 | 
				
			||||||
                          ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
 | 
					 | 
				
			||||||
                                              libvpx_test::kVP9TestVectors +
 | 
					 | 
				
			||||||
                                              libvpx_test::kNumVP9TestVectors));
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -14,12 +14,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					#include "./vpx_dsp_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/transform_test_base.h"
 | 
					#include "test/transform_test_base.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					#include "vpx/vpx_codec.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
#include "vpx_ports/mem.h"
 | 
					#include "vpx_ports/mem.h"
 | 
				
			||||||
@@ -44,12 +46,12 @@ void fdct4x4_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fht4x4_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
 | 
					void fht4x4_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_fht4x4_c(in, out, stride, tx_type);
 | 
					  vp10_fht4x4_c(in, out, stride, tx_type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fwht4x4_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
					void fwht4x4_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
				
			||||||
                 int /*tx_type*/) {
 | 
					                 int /*tx_type*/) {
 | 
				
			||||||
  vp9_fwht4x4_c(in, out, stride);
 | 
					  vp10_fwht4x4_c(in, out, stride);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					#if CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
@@ -62,11 +64,11 @@ void idct4x4_12(const tran_low_t *in, uint8_t *out, int stride) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht4x4_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht4x4_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 10);
 | 
					  vp10_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 10);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht4x4_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht4x4_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 12);
 | 
					  vp10_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 12);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iwht4x4_10(const tran_low_t *in, uint8_t *out, int stride) {
 | 
					void iwht4x4_10(const tran_low_t *in, uint8_t *out, int stride) {
 | 
				
			||||||
@@ -247,40 +249,40 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans4x4HT,
 | 
					    C, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 0, VPX_BITS_10, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 0, VPX_BITS_10, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 1, VPX_BITS_10, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 1, VPX_BITS_10, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 2, VPX_BITS_10, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 2, VPX_BITS_10, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 3, VPX_BITS_10, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 3, VPX_BITS_10, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 0, VPX_BITS_12, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 0, VPX_BITS_12, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 1, VPX_BITS_12, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 1, VPX_BITS_12, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 2, VPX_BITS_12, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 2, VPX_BITS_12, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 3, VPX_BITS_12, 16),
 | 
					        make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 3, VPX_BITS_12, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 1, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 2, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8, 16)));
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 3, VPX_BITS_8, 16)));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans4x4HT,
 | 
					    C, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 1, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 2, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8, 16)));
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 3, VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
					#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					#if CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans4x4WHT,
 | 
					    C, Trans4x4WHT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_10, 0, VPX_BITS_10, 16),
 | 
					        make_tuple(&vp10_highbd_fwht4x4_c, &iwht4x4_10, 0, VPX_BITS_10, 16),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12, 16),
 | 
					        make_tuple(&vp10_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12, 16),
 | 
				
			||||||
        make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8, 16)));
 | 
					        make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8, 16)));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, Trans4x4WHT,
 | 
					    C, Trans4x4WHT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8, 16)));
 | 
					        make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
					#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -295,18 +297,24 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    NEON, Trans4x4HT,
 | 
					    NEON, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon,
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1, VPX_BITS_8, 16),
 | 
					                   0, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon,
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3, VPX_BITS_8, 16)));
 | 
					                   1, VPX_BITS_8, 16),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon,
 | 
				
			||||||
 | 
					                   2, VPX_BITS_8, 16),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon,
 | 
				
			||||||
 | 
					                   3, VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, Trans4x4WHT,
 | 
					    SSE2, Trans4x4WHT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fwht4x4_sse2, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_c,
 | 
				
			||||||
        make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_sse2, 0, VPX_BITS_8, 16)));
 | 
					                   0, VPX_BITS_8, 16),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_sse2,
 | 
				
			||||||
 | 
					                   0, VPX_BITS_8, 16)));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -318,13 +326,13 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, Trans4x4HT,
 | 
					    SSE2, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0,
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 0,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1,
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 1,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2,
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 2,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3,
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 3,
 | 
				
			||||||
                   VPX_BITS_8, 16)));
 | 
					                   VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -346,10 +354,14 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, Trans4x4HT,
 | 
					    SSE2, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c,
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8, 16),
 | 
					                   0, VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8, 16),
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c,
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8, 16)));
 | 
					                   1, VPX_BITS_8, 16),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c,
 | 
				
			||||||
 | 
					                   2, VPX_BITS_8, 16),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c,
 | 
				
			||||||
 | 
					                   3, VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -361,13 +373,13 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    MSA, Trans4x4HT,
 | 
					    MSA, Trans4x4HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 0,
 | 
					        make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 0,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 1,
 | 
					        make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 1,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 2,
 | 
					        make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 2,
 | 
				
			||||||
                   VPX_BITS_8, 16),
 | 
					                   VPX_BITS_8, 16),
 | 
				
			||||||
        make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 3,
 | 
					        make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 3,
 | 
				
			||||||
                   VPX_BITS_8, 16)));
 | 
					                   VPX_BITS_8, 16)));
 | 
				
			||||||
#endif  // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,11 +14,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					#include "./vpx_dsp_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
 | 
					#include "vp10/common/scan.h"
 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					#include "vpx/vpx_codec.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
#include "vpx_ports/mem.h"
 | 
					#include "vpx_ports/mem.h"
 | 
				
			||||||
@@ -85,7 +88,7 @@ void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
 | 
					void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_fht8x8_c(in, out, stride, tx_type);
 | 
					  vp10_fht8x8_c(in, out, stride, tx_type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					#if CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
@@ -98,11 +101,11 @@ void idct8x8_12(const tran_low_t *in, uint8_t *out, int stride) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10);
 | 
					  vp10_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
					void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
 | 
				
			||||||
  vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
 | 
					  vp10_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2
 | 
					#if HAVE_SSE2
 | 
				
			||||||
@@ -475,7 +478,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
 | 
				
			|||||||
    DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
 | 
					    DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
 | 
				
			||||||
    DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
 | 
					    DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    const int16_t *scan = vp9_default_scan_orders[TX_8X8].scan;
 | 
					    const int16_t *scan = vp10_default_scan_orders[TX_8X8].scan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (int i = 0; i < count_test_block; ++i) {
 | 
					    for (int i = 0; i < count_test_block; ++i) {
 | 
				
			||||||
      for (int j = 0; j < kNumCoeffs; ++j) {
 | 
					      for (int j = 0; j < kNumCoeffs; ++j) {
 | 
				
			||||||
@@ -671,26 +674,26 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, FwdTrans8x8HT,
 | 
					    C, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 0, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 0, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 1, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 1, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 2, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 2, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 3, VPX_BITS_10),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 3, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 0, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 0, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 1, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 1, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 2, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 2, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 3, VPX_BITS_12),
 | 
					        make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 3, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    C, FwdTrans8x8HT,
 | 
					    C, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
				
			||||||
#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
					#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -705,10 +708,10 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    NEON, FwdTrans8x8HT,
 | 
					    NEON, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 3, VPX_BITS_8)));
 | 
				
			||||||
#endif  // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -720,10 +723,14 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, FwdTrans8x8HT,
 | 
					    SSE2, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2,
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1, VPX_BITS_8),
 | 
					                   0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2,
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3, VPX_BITS_8)));
 | 
					                   1, VPX_BITS_8),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2,
 | 
				
			||||||
 | 
					                   2, VPX_BITS_8),
 | 
				
			||||||
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2,
 | 
				
			||||||
 | 
					                   3, VPX_BITS_8)));
 | 
				
			||||||
#endif  // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
@@ -743,10 +750,10 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, FwdTrans8x8HT,
 | 
					    SSE2, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Optimizations take effect at a threshold of 6201, so we use a value close to
 | 
					// Optimizations take effect at a threshold of 6201, so we use a value close to
 | 
				
			||||||
// that to test both branches.
 | 
					// that to test both branches.
 | 
				
			||||||
@@ -780,9 +787,9 @@ INSTANTIATE_TEST_CASE_P(
 | 
				
			|||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    MSA, FwdTrans8x8HT,
 | 
					    MSA, FwdTrans8x8HT,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 0, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 1, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 1, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 2, VPX_BITS_8),
 | 
					        make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 2, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 3, VPX_BITS_8)));
 | 
					        make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 3, VPX_BITS_8)));
 | 
				
			||||||
#endif  // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
					#endif  // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ class VP9FrameSizeTestsLarge
 | 
				
			|||||||
    : public ::libvpx_test::EncoderTest,
 | 
					    : public ::libvpx_test::EncoderTest,
 | 
				
			||||||
      public ::testing::Test {
 | 
					      public ::testing::Test {
 | 
				
			||||||
 protected:
 | 
					 protected:
 | 
				
			||||||
  VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP9),
 | 
					  VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP10),
 | 
				
			||||||
                             expected_res_(VPX_CODEC_OK) {}
 | 
					                             expected_res_(VPX_CODEC_OK) {}
 | 
				
			||||||
  virtual ~VP9FrameSizeTestsLarge() {}
 | 
					  virtual ~VP9FrameSizeTestsLarge() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,182 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstdio>
 | 
					 | 
				
			||||||
#include <cstdlib>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/decode_test_driver.h"
 | 
					 | 
				
			||||||
#include "test/ivf_video_source.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
#include "test/webm_video_source.h"
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct DecodeParam {
 | 
					 | 
				
			||||||
  int threads;
 | 
					 | 
				
			||||||
  const char *filename;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
 | 
					 | 
				
			||||||
  return os << "threads: " << dp.threads << " file: " << dp.filename;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class InvalidFileTest
 | 
					 | 
				
			||||||
    : public ::libvpx_test::DecoderTest,
 | 
					 | 
				
			||||||
      public ::libvpx_test::CodecTestWithParam<DecodeParam> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual ~InvalidFileTest() {
 | 
					 | 
				
			||||||
    if (res_file_ != NULL)
 | 
					 | 
				
			||||||
      fclose(res_file_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void OpenResFile(const std::string &res_file_name_) {
 | 
					 | 
				
			||||||
    res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(res_file_ != NULL) << "Result file open failed. Filename: "
 | 
					 | 
				
			||||||
        << res_file_name_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual bool HandleDecodeResult(
 | 
					 | 
				
			||||||
      const vpx_codec_err_t res_dec,
 | 
					 | 
				
			||||||
      const libvpx_test::CompressedVideoSource &video,
 | 
					 | 
				
			||||||
      libvpx_test::Decoder *decoder) {
 | 
					 | 
				
			||||||
    EXPECT_TRUE(res_file_ != NULL);
 | 
					 | 
				
			||||||
    int expected_res_dec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Read integer result.
 | 
					 | 
				
			||||||
    const int res = fscanf(res_file_, "%d", &expected_res_dec);
 | 
					 | 
				
			||||||
    EXPECT_NE(res, EOF) << "Read result data failed";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check results match.
 | 
					 | 
				
			||||||
    const DecodeParam input = GET_PARAM(1);
 | 
					 | 
				
			||||||
    if (input.threads > 1) {
 | 
					 | 
				
			||||||
      // The serial decode check is too strict for tile-threaded decoding as
 | 
					 | 
				
			||||||
      // there is no guarantee on the decode order nor which specific error
 | 
					 | 
				
			||||||
      // will take precedence. Currently a tile-level error is not forwarded so
 | 
					 | 
				
			||||||
      // the frame will simply be marked corrupt.
 | 
					 | 
				
			||||||
      EXPECT_TRUE(res_dec == expected_res_dec ||
 | 
					 | 
				
			||||||
                  res_dec == VPX_CODEC_CORRUPT_FRAME)
 | 
					 | 
				
			||||||
          << "Results don't match: frame number = " << video.frame_number()
 | 
					 | 
				
			||||||
          << ". (" << decoder->DecodeError() << "). Expected: "
 | 
					 | 
				
			||||||
          << expected_res_dec << " or " << VPX_CODEC_CORRUPT_FRAME;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      EXPECT_EQ(expected_res_dec, res_dec)
 | 
					 | 
				
			||||||
          << "Results don't match: frame number = " << video.frame_number()
 | 
					 | 
				
			||||||
          << ". (" << decoder->DecodeError() << ")";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return !HasFailure();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void RunTest() {
 | 
					 | 
				
			||||||
    const DecodeParam input = GET_PARAM(1);
 | 
					 | 
				
			||||||
    libvpx_test::CompressedVideoSource *video = NULL;
 | 
					 | 
				
			||||||
    vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
    cfg.threads = input.threads;
 | 
					 | 
				
			||||||
    const std::string filename = input.filename;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Open compressed video file.
 | 
					 | 
				
			||||||
    if (filename.substr(filename.length() - 3, 3) == "ivf") {
 | 
					 | 
				
			||||||
      video = new libvpx_test::IVFVideoSource(filename);
 | 
					 | 
				
			||||||
    } else if (filename.substr(filename.length() - 4, 4) == "webm") {
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
      video = new libvpx_test::WebMVideoSource(filename);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
      fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
 | 
					 | 
				
			||||||
              filename.c_str());
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    video->Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Construct result file name. The file holds a list of expected integer
 | 
					 | 
				
			||||||
    // results, one for each decoded frame.  Any result that doesn't match
 | 
					 | 
				
			||||||
    // the files list will cause a test failure.
 | 
					 | 
				
			||||||
    const std::string res_filename = filename + ".res";
 | 
					 | 
				
			||||||
    OpenResFile(res_filename);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Decode frame, and check the md5 matching.
 | 
					 | 
				
			||||||
    ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
 | 
					 | 
				
			||||||
    delete video;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  FILE *res_file_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(InvalidFileTest, ReturnCode) {
 | 
					 | 
				
			||||||
  RunTest();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const DecodeParam kVP9InvalidFileTests[] = {
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-02-v2.webm"},
 | 
					 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf"},
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-03-v3.webm"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp91-2-mixedrefcsp-444to420.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,
 | 
					 | 
				
			||||||
                          ::testing::ValuesIn(kVP9InvalidFileTests));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// This class will include test vectors that are expected to fail
 | 
					 | 
				
			||||||
// peek. However they are still expected to have no fatal failures.
 | 
					 | 
				
			||||||
class InvalidFileInvalidPeekTest : public InvalidFileTest {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  InvalidFileInvalidPeekTest() : InvalidFileTest() {}
 | 
					 | 
				
			||||||
  virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
 | 
					 | 
				
			||||||
                                libvpx_test::CompressedVideoSource* /*video*/,
 | 
					 | 
				
			||||||
                                const vpx_codec_err_t /*res_peek*/) {}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) {
 | 
					 | 
				
			||||||
  RunTest();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
 | 
					 | 
				
			||||||
  {1, "invalid-vp90-01-v3.webm"},
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
 | 
					 | 
				
			||||||
                          ::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
 | 
					 | 
				
			||||||
  {4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm"},
 | 
					 | 
				
			||||||
  {4, "invalid-"
 | 
					 | 
				
			||||||
      "vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {4, "invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf"},
 | 
					 | 
				
			||||||
  {2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf"},
 | 
					 | 
				
			||||||
  {4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf"},
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    VP9MultiThreaded, InvalidFileTest,
 | 
					 | 
				
			||||||
    ::testing::Combine(
 | 
					 | 
				
			||||||
        ::testing::Values(
 | 
					 | 
				
			||||||
            static_cast<const libvpx_test::CodecFactory*>(&libvpx_test::kVP9)),
 | 
					 | 
				
			||||||
        ::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,145 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#include <climits>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/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 KeyframeTest : public ::libvpx_test::EncoderTest,
 | 
					 | 
				
			||||||
    public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
 | 
					 | 
				
			||||||
  virtual ~KeyframeTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    InitializeConfig();
 | 
					 | 
				
			||||||
    SetMode(GET_PARAM(1));
 | 
					 | 
				
			||||||
    kf_count_ = 0;
 | 
					 | 
				
			||||||
    kf_count_max_ = INT_MAX;
 | 
					 | 
				
			||||||
    kf_do_force_kf_ = false;
 | 
					 | 
				
			||||||
    set_cpu_used_ = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
 | 
					 | 
				
			||||||
                                  ::libvpx_test::Encoder *encoder) {
 | 
					 | 
				
			||||||
    if (kf_do_force_kf_)
 | 
					 | 
				
			||||||
      frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
 | 
					 | 
				
			||||||
    if (set_cpu_used_ && video->frame() == 1)
 | 
					 | 
				
			||||||
      encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
 | 
					 | 
				
			||||||
    if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
 | 
					 | 
				
			||||||
      kf_pts_list_.push_back(pkt->data.frame.pts);
 | 
					 | 
				
			||||||
      kf_count_++;
 | 
					 | 
				
			||||||
      abort_ |= kf_count_ > kf_count_max_;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  bool kf_do_force_kf_;
 | 
					 | 
				
			||||||
  int kf_count_;
 | 
					 | 
				
			||||||
  int kf_count_max_;
 | 
					 | 
				
			||||||
  std::vector<vpx_codec_pts_t> kf_pts_list_;
 | 
					 | 
				
			||||||
  int set_cpu_used_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(KeyframeTest, TestRandomVideoSource) {
 | 
					 | 
				
			||||||
  // Validate that encoding the RandomVideoSource produces multiple keyframes.
 | 
					 | 
				
			||||||
  // This validates the results of the TestDisableKeyframes test.
 | 
					 | 
				
			||||||
  kf_count_max_ = 2;  // early exit successful tests.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ::libvpx_test::RandomVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // In realtime mode - auto placed keyframes are exceedingly rare,  don't
 | 
					 | 
				
			||||||
  // bother with this check   if(GetParam() > 0)
 | 
					 | 
				
			||||||
  if (GET_PARAM(1) > 0)
 | 
					 | 
				
			||||||
    EXPECT_GT(kf_count_, 1);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(KeyframeTest, TestDisableKeyframes) {
 | 
					 | 
				
			||||||
  cfg_.kf_mode = VPX_KF_DISABLED;
 | 
					 | 
				
			||||||
  kf_count_max_ = 1;  // early exit failed tests.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ::libvpx_test::RandomVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(1, kf_count_);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(KeyframeTest, TestForceKeyframe) {
 | 
					 | 
				
			||||||
  cfg_.kf_mode = VPX_KF_DISABLED;
 | 
					 | 
				
			||||||
  kf_do_force_kf_ = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ::libvpx_test::DummyVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // verify that every third frame is a keyframe.
 | 
					 | 
				
			||||||
  for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
 | 
					 | 
				
			||||||
       iter != kf_pts_list_.end(); ++iter) {
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, *iter % 3) << "Unexpected keyframe at frame " << *iter;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(KeyframeTest, TestKeyframeMaxDistance) {
 | 
					 | 
				
			||||||
  cfg_.kf_max_dist = 25;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ::libvpx_test::DummyVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // verify that keyframe interval matches kf_max_dist
 | 
					 | 
				
			||||||
  for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
 | 
					 | 
				
			||||||
       iter != kf_pts_list_.end(); ++iter) {
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, *iter % 25) << "Unexpected keyframe at frame " << *iter;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(KeyframeTest, TestAutoKeyframe) {
 | 
					 | 
				
			||||||
  cfg_.kf_mode = VPX_KF_AUTO;
 | 
					 | 
				
			||||||
  kf_do_force_kf_ = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Force a deterministic speed step in Real Time mode, as the faster modes
 | 
					 | 
				
			||||||
  // may not produce a keyframe like we expect. This is necessary when running
 | 
					 | 
				
			||||||
  // on very slow environments (like Valgrind). The step -11 was determined
 | 
					 | 
				
			||||||
  // experimentally as the fastest mode that still throws the keyframe.
 | 
					 | 
				
			||||||
  if (deadline_ == VPX_DL_REALTIME)
 | 
					 | 
				
			||||||
    set_cpu_used_ = -11;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
 | 
					 | 
				
			||||||
  // I check only the first 40 frames to make sure there's a keyframe at frame
 | 
					 | 
				
			||||||
  // 0 and 30.
 | 
					 | 
				
			||||||
  ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
 | 
					 | 
				
			||||||
                                       30, 1, 0, 40);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // In realtime mode - auto placed keyframes are exceedingly rare,  don't
 | 
					 | 
				
			||||||
  // bother with this check
 | 
					 | 
				
			||||||
  if (GET_PARAM(1) > 0)
 | 
					 | 
				
			||||||
    EXPECT_EQ(2u, kf_pts_list_.size()) << " Not the right number of keyframes ";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Verify that keyframes match the file keyframes in the file.
 | 
					 | 
				
			||||||
  for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
 | 
					 | 
				
			||||||
       iter != kf_pts_list_.end(); ++iter) {
 | 
					 | 
				
			||||||
    if (deadline_ == VPX_DL_REALTIME && *iter > 0)
 | 
					 | 
				
			||||||
      EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
 | 
					 | 
				
			||||||
        << *iter;
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(KeyframeTest, ALL_TEST_MODES);
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -20,8 +20,8 @@
 | 
				
			|||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
#include "vp9/common/vp9_entropy.h"
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
#include "vp9/common/vp9_loopfilter.h"
 | 
					#include "vp10/common/loopfilter.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					using libvpx_test::ACMRandom;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,11 +14,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					#include "./vpx_dsp_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/blockd.h"
 | 
				
			||||||
 | 
					#include "vp10/common/scan.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					using libvpx_test::ACMRandom;
 | 
				
			||||||
@@ -112,7 +115,7 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
 | 
				
			|||||||
      // quantization with maximum allowed step sizes
 | 
					      // quantization with maximum allowed step sizes
 | 
				
			||||||
      test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
 | 
					      test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
 | 
				
			||||||
      for (int j = 1; j < last_nonzero_; ++j)
 | 
					      for (int j = 1; j < last_nonzero_; ++j)
 | 
				
			||||||
        test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]]
 | 
					        test_coef_block1[vp10_default_scan_orders[tx_size_].scan[j]]
 | 
				
			||||||
                         = (output_ref_block[j] / 1828) * 1828;
 | 
					                         = (output_ref_block[j] / 1828) * 1828;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -174,7 +177,7 @@ TEST_P(PartialIDctTest, ResultsMatch) {
 | 
				
			|||||||
        max_energy_leftover = 0;
 | 
					        max_energy_leftover = 0;
 | 
				
			||||||
        coef = 0;
 | 
					        coef = 0;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] = coef;
 | 
					      test_coef_block1[vp10_default_scan_orders[tx_size_].scan[j]] = coef;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memcpy(test_coef_block2, test_coef_block1,
 | 
					    memcpy(test_coef_block2, test_coef_block1,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,118 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef void (*PostProcFunc)(unsigned char *src_ptr,
 | 
					 | 
				
			||||||
                             unsigned char *dst_ptr,
 | 
					 | 
				
			||||||
                             int src_pixels_per_line,
 | 
					 | 
				
			||||||
                             int dst_pixels_per_line,
 | 
					 | 
				
			||||||
                             int cols,
 | 
					 | 
				
			||||||
                             unsigned char *flimit,
 | 
					 | 
				
			||||||
                             int size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VPxPostProcessingFilterTest
 | 
					 | 
				
			||||||
    : public ::testing::TestWithParam<PostProcFunc> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual void TearDown() {
 | 
					 | 
				
			||||||
    libvpx_test::ClearSystemState();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Test routine for the VPx post-processing function
 | 
					 | 
				
			||||||
// vpx_post_proc_down_and_across_mb_row_c.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
 | 
					 | 
				
			||||||
  // Size of the underlying data block that will be filtered.
 | 
					 | 
				
			||||||
  const int block_width  = 16;
 | 
					 | 
				
			||||||
  const int block_height = 16;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // 5-tap filter needs 2 padding rows above and below the block in the input.
 | 
					 | 
				
			||||||
  const int input_width = block_width;
 | 
					 | 
				
			||||||
  const int input_height = block_height + 4;
 | 
					 | 
				
			||||||
  const int input_stride = input_width;
 | 
					 | 
				
			||||||
  const int input_size = input_width * input_height;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Filter extends output block by 8 samples at left and right edges.
 | 
					 | 
				
			||||||
  const int output_width = block_width + 16;
 | 
					 | 
				
			||||||
  const int output_height = block_height;
 | 
					 | 
				
			||||||
  const int output_stride = output_width;
 | 
					 | 
				
			||||||
  const int output_size = output_width * output_height;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  uint8_t *const src_image =
 | 
					 | 
				
			||||||
      reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));
 | 
					 | 
				
			||||||
  uint8_t *const dst_image =
 | 
					 | 
				
			||||||
      reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Pointers to top-left pixel of block in the input and output images.
 | 
					 | 
				
			||||||
  uint8_t *const src_image_ptr = src_image + (input_stride << 1);
 | 
					 | 
				
			||||||
  uint8_t *const dst_image_ptr = dst_image + 8;
 | 
					 | 
				
			||||||
  uint8_t *const flimits =
 | 
					 | 
				
			||||||
      reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
 | 
					 | 
				
			||||||
  (void)memset(flimits, 255, block_width);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Initialize pixels in the input:
 | 
					 | 
				
			||||||
  //   block pixels to value 1,
 | 
					 | 
				
			||||||
  //   border pixels to value 10.
 | 
					 | 
				
			||||||
  (void)memset(src_image, 10, input_size);
 | 
					 | 
				
			||||||
  uint8_t *pixel_ptr = src_image_ptr;
 | 
					 | 
				
			||||||
  for (int i = 0; i < block_height; ++i) {
 | 
					 | 
				
			||||||
    for (int j = 0; j < block_width; ++j) {
 | 
					 | 
				
			||||||
      pixel_ptr[j] = 1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    pixel_ptr += input_stride;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Initialize pixels in the output to 99.
 | 
					 | 
				
			||||||
  (void)memset(dst_image, 99, output_size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ASM_REGISTER_STATE_CHECK(
 | 
					 | 
				
			||||||
      GetParam()(src_image_ptr, dst_image_ptr, input_stride,
 | 
					 | 
				
			||||||
                 output_stride, block_width, flimits, 16));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static const uint8_t expected_data[block_height] = {
 | 
					 | 
				
			||||||
    4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  pixel_ptr = dst_image_ptr;
 | 
					 | 
				
			||||||
  for (int i = 0; i < block_height; ++i) {
 | 
					 | 
				
			||||||
    for (int j = 0; j < block_width; ++j) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(expected_data[i], pixel_ptr[j])
 | 
					 | 
				
			||||||
          << "VPxPostProcessingFilterTest failed with invalid filter output";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    pixel_ptr += output_stride;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_free(src_image);
 | 
					 | 
				
			||||||
  vpx_free(dst_image);
 | 
					 | 
				
			||||||
  vpx_free(flimits);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(C, VPxPostProcessingFilterTest,
 | 
					 | 
				
			||||||
    ::testing::Values(vpx_post_proc_down_and_across_mb_row_c));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if HAVE_SSE2
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(SSE2, VPxPostProcessingFilterTest,
 | 
					 | 
				
			||||||
    ::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if HAVE_MSA
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(MSA, VPxPostProcessingFilterTest,
 | 
					 | 
				
			||||||
    ::testing::Values(vpx_post_proc_down_and_across_mb_row_msa));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -87,8 +87,8 @@ class RegisterStateCheck {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}  // namespace libvpx_test
 | 
					}  // namespace libvpx_test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP9) \
 | 
					#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP10) \
 | 
				
			||||||
      && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
 | 
					      && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
// Save the d8-d15 registers into store.
 | 
					// Save the d8-d15 registers into store.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -722,14 +722,13 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) {
 | 
				
			|||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
 | 
					VP10_INSTANTIATE_TEST_CASE(ResizeTest,
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ResizeTest,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime));
 | 
					                          ::testing::Values(::libvpx_test::kRealTime));
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(ResizeInternalTest,
 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kOnePassBest));
 | 
					                          ::testing::Values(::libvpx_test::kOnePassBest));
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime),
 | 
					                          ::testing::Values(::libvpx_test::kRealTime),
 | 
				
			||||||
                          ::testing::Range(5, 9));
 | 
					                          ::testing::Range(5, 9));
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(ResizeCspTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(ResizeCspTest,
 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime));
 | 
					                          ::testing::Values(::libvpx_test::kRealTime));
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										184
									
								
								test/set_roi.cc
									
									
									
									
									
								
							
							
						
						
									
										184
									
								
								test/set_roi.cc
									
									
									
									
									
								
							@@ -1,184 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stddef.h>
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <sys/types.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "vp8/encoder/onyx_int.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP8RoiMapTest, ParameterCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
 | 
					 | 
				
			||||||
  int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
 | 
					 | 
				
			||||||
  unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const int internalq_trans[] = {
 | 
					 | 
				
			||||||
    0,   1,  2,  3,  4,  5,  7,  8,
 | 
					 | 
				
			||||||
    9,  10, 12, 13, 15, 17, 18, 19,
 | 
					 | 
				
			||||||
    20,  21, 23, 24, 25, 26, 27, 28,
 | 
					 | 
				
			||||||
    29,  30, 31, 33, 35, 37, 39, 41,
 | 
					 | 
				
			||||||
    43,  45, 47, 49, 51, 53, 55, 57,
 | 
					 | 
				
			||||||
    59,  61, 64, 67, 70, 73, 76, 79,
 | 
					 | 
				
			||||||
    82,  85, 88, 91, 94, 97, 100, 103,
 | 
					 | 
				
			||||||
    106, 109, 112, 115, 118, 121, 124, 127,
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Initialize elements of cpi with valid defaults.
 | 
					 | 
				
			||||||
  VP8_COMP cpi;
 | 
					 | 
				
			||||||
  cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
 | 
					 | 
				
			||||||
  cpi.cyclic_refresh_mode_enabled = 0;
 | 
					 | 
				
			||||||
  cpi.mb.e_mbd.segmentation_enabled = 0;
 | 
					 | 
				
			||||||
  cpi.mb.e_mbd.update_mb_segmentation_map = 0;
 | 
					 | 
				
			||||||
  cpi.mb.e_mbd.update_mb_segmentation_data = 0;
 | 
					 | 
				
			||||||
  cpi.common.mb_rows = 240 >> 4;
 | 
					 | 
				
			||||||
  cpi.common.mb_cols = 320 >> 4;
 | 
					 | 
				
			||||||
  const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols);
 | 
					 | 
				
			||||||
  memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Segment map
 | 
					 | 
				
			||||||
  cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Allocate memory for the source memory map.
 | 
					 | 
				
			||||||
  unsigned char *roi_map =
 | 
					 | 
				
			||||||
    reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
 | 
					 | 
				
			||||||
  memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
 | 
					 | 
				
			||||||
  memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
 | 
					 | 
				
			||||||
  memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Do a test call with valid parameters.
 | 
					 | 
				
			||||||
  int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
 | 
					 | 
				
			||||||
                                  cpi.common.mb_cols, delta_q, delta_lf,
 | 
					 | 
				
			||||||
                                  threshold);
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, roi_retval)
 | 
					 | 
				
			||||||
        << "vp8_set_roimap roi failed with default test parameters";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Check that the values in the cpi structure get set as expected.
 | 
					 | 
				
			||||||
  if (roi_retval == 0) {
 | 
					 | 
				
			||||||
    // Check that the segment map got set.
 | 
					 | 
				
			||||||
    const int mapcompare = memcmp(roi_map, cpi.segmentation_map, mbs);
 | 
					 | 
				
			||||||
    EXPECT_EQ(0, mapcompare) << "segment map error";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check the q deltas (note the need to translate into
 | 
					 | 
				
			||||||
    // the interanl range of 0-127.
 | 
					 | 
				
			||||||
    for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
 | 
					 | 
				
			||||||
      const int transq = internalq_trans[abs(delta_q[i])];
 | 
					 | 
				
			||||||
      if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
 | 
					 | 
				
			||||||
          EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
 | 
					 | 
				
			||||||
                    << "segment delta_q  error";
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check the loop filter deltas
 | 
					 | 
				
			||||||
    for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
 | 
					 | 
				
			||||||
      if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
 | 
					 | 
				
			||||||
        EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
 | 
					 | 
				
			||||||
                  << "segment delta_lf error";
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check the breakout thresholds
 | 
					 | 
				
			||||||
    for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
 | 
					 | 
				
			||||||
      unsigned int breakout =
 | 
					 | 
				
			||||||
        static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (threshold[i] != breakout) {
 | 
					 | 
				
			||||||
        EXPECT_EQ(threshold[i], breakout)
 | 
					 | 
				
			||||||
                  << "breakout threshold error";
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Segmentation, and segmentation update flages should be set.
 | 
					 | 
				
			||||||
    EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
 | 
					 | 
				
			||||||
              << "segmentation_enabled error";
 | 
					 | 
				
			||||||
    EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
 | 
					 | 
				
			||||||
              << "update_mb_segmentation_map error";
 | 
					 | 
				
			||||||
    EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
 | 
					 | 
				
			||||||
              << "update_mb_segmentation_data error";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Try a range of delta q and lf parameters (some legal, some not)
 | 
					 | 
				
			||||||
    for (int i = 0; i < 1000; ++i) {
 | 
					 | 
				
			||||||
      int rand_deltas[4];
 | 
					 | 
				
			||||||
      int deltas_valid;
 | 
					 | 
				
			||||||
      rand_deltas[0] = rnd(160) - 80;
 | 
					 | 
				
			||||||
      rand_deltas[1] = rnd(160) - 80;
 | 
					 | 
				
			||||||
      rand_deltas[2] = rnd(160) - 80;
 | 
					 | 
				
			||||||
      rand_deltas[3] = rnd(160) - 80;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
 | 
					 | 
				
			||||||
                      (abs(rand_deltas[1]) <= 63) &&
 | 
					 | 
				
			||||||
                      (abs(rand_deltas[2]) <= 63) &&
 | 
					 | 
				
			||||||
                      (abs(rand_deltas[3]) <= 63)) ? 0 : -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // Test with random delta q values.
 | 
					 | 
				
			||||||
      roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
 | 
					 | 
				
			||||||
                                  cpi.common.mb_cols, rand_deltas,
 | 
					 | 
				
			||||||
                                  delta_lf, threshold);
 | 
					 | 
				
			||||||
      EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // One delta_q error shown at a time
 | 
					 | 
				
			||||||
      if (deltas_valid != roi_retval)
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // Test with random loop filter values.
 | 
					 | 
				
			||||||
      roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
 | 
					 | 
				
			||||||
                                  cpi.common.mb_cols, delta_q,
 | 
					 | 
				
			||||||
                                  rand_deltas, threshold);
 | 
					 | 
				
			||||||
      EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // One delta loop filter error shown at a time
 | 
					 | 
				
			||||||
      if (deltas_valid != roi_retval)
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Test that we report and error if cyclic refresh is enabled.
 | 
					 | 
				
			||||||
    cpi.cyclic_refresh_mode_enabled = 1;
 | 
					 | 
				
			||||||
    roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
 | 
					 | 
				
			||||||
                                cpi.common.mb_cols, delta_q,
 | 
					 | 
				
			||||||
                                delta_lf, threshold);
 | 
					 | 
				
			||||||
    EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
 | 
					 | 
				
			||||||
    cpi.cyclic_refresh_mode_enabled = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Test invalid number of rows or colums.
 | 
					 | 
				
			||||||
    roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
 | 
					 | 
				
			||||||
                                cpi.common.mb_cols, delta_q,
 | 
					 | 
				
			||||||
                                delta_lf, threshold);
 | 
					 | 
				
			||||||
    EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
 | 
					 | 
				
			||||||
                                cpi.common.mb_cols - 1, delta_q,
 | 
					 | 
				
			||||||
                                delta_lf, threshold);
 | 
					 | 
				
			||||||
    EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Free allocated memory
 | 
					 | 
				
			||||||
  if (cpi.segmentation_map)
 | 
					 | 
				
			||||||
    vpx_free(cpi.segmentation_map);
 | 
					 | 
				
			||||||
  if (roi_map)
 | 
					 | 
				
			||||||
    vpx_free(roi_map);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,232 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef void (*SixtapPredictFunc)(uint8_t *src_ptr,
 | 
					 | 
				
			||||||
                                  int src_pixels_per_line,
 | 
					 | 
				
			||||||
                                  int xoffset,
 | 
					 | 
				
			||||||
                                  int yoffset,
 | 
					 | 
				
			||||||
                                  uint8_t *dst_ptr,
 | 
					 | 
				
			||||||
                                  int dst_pitch);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class SixtapPredictTest
 | 
					 | 
				
			||||||
    : public ::testing::TestWithParam<SixtapPredictParam> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  static void SetUpTestCase() {
 | 
					 | 
				
			||||||
    src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
 | 
					 | 
				
			||||||
    dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
 | 
					 | 
				
			||||||
    dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static void TearDownTestCase() {
 | 
					 | 
				
			||||||
    vpx_free(src_);
 | 
					 | 
				
			||||||
    src_ = NULL;
 | 
					 | 
				
			||||||
    vpx_free(dst_);
 | 
					 | 
				
			||||||
    dst_ = NULL;
 | 
					 | 
				
			||||||
    vpx_free(dst_c_);
 | 
					 | 
				
			||||||
    dst_c_ = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() {
 | 
					 | 
				
			||||||
    libvpx_test::ClearSystemState();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  // Make test arrays big enough for 16x16 functions. Six-tap filters
 | 
					 | 
				
			||||||
  // need 5 extra pixels outside of the macroblock.
 | 
					 | 
				
			||||||
  static const int kSrcStride = 21;
 | 
					 | 
				
			||||||
  static const int kDstStride = 16;
 | 
					 | 
				
			||||||
  static const int kDataAlignment = 16;
 | 
					 | 
				
			||||||
  static const int kSrcSize = kSrcStride * kSrcStride + 1;
 | 
					 | 
				
			||||||
  static const int kDstSize = kDstStride * kDstStride;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    width_ = GET_PARAM(0);
 | 
					 | 
				
			||||||
    height_ = GET_PARAM(1);
 | 
					 | 
				
			||||||
    sixtap_predict_ = GET_PARAM(2);
 | 
					 | 
				
			||||||
    memset(src_, 0, kSrcSize);
 | 
					 | 
				
			||||||
    memset(dst_, 0, kDstSize);
 | 
					 | 
				
			||||||
    memset(dst_c_, 0, kDstSize);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int width_;
 | 
					 | 
				
			||||||
  int height_;
 | 
					 | 
				
			||||||
  SixtapPredictFunc sixtap_predict_;
 | 
					 | 
				
			||||||
  // The src stores the macroblock we will filter on, and makes it 1 byte larger
 | 
					 | 
				
			||||||
  // in order to test unaligned access. The result is stored in dst and dst_c(c
 | 
					 | 
				
			||||||
  // reference code result).
 | 
					 | 
				
			||||||
  static uint8_t* src_;
 | 
					 | 
				
			||||||
  static uint8_t* dst_;
 | 
					 | 
				
			||||||
  static uint8_t* dst_c_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint8_t* SixtapPredictTest::src_ = NULL;
 | 
					 | 
				
			||||||
uint8_t* SixtapPredictTest::dst_ = NULL;
 | 
					 | 
				
			||||||
uint8_t* SixtapPredictTest::dst_c_ = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(SixtapPredictTest, TestWithPresetData) {
 | 
					 | 
				
			||||||
  // Test input
 | 
					 | 
				
			||||||
  static const uint8_t test_data[kSrcSize] = {
 | 
					 | 
				
			||||||
    216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,
 | 
					 | 
				
			||||||
    79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,
 | 
					 | 
				
			||||||
    48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,
 | 
					 | 
				
			||||||
    182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,
 | 
					 | 
				
			||||||
    148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,
 | 
					 | 
				
			||||||
    166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,
 | 
					 | 
				
			||||||
    167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,
 | 
					 | 
				
			||||||
    114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,
 | 
					 | 
				
			||||||
    182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,
 | 
					 | 
				
			||||||
    224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,
 | 
					 | 
				
			||||||
    148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,
 | 
					 | 
				
			||||||
    176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,
 | 
					 | 
				
			||||||
    64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,
 | 
					 | 
				
			||||||
    235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,
 | 
					 | 
				
			||||||
    148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,
 | 
					 | 
				
			||||||
    35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,
 | 
					 | 
				
			||||||
    209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,
 | 
					 | 
				
			||||||
    223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,
 | 
					 | 
				
			||||||
    24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,
 | 
					 | 
				
			||||||
    93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,
 | 
					 | 
				
			||||||
    49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
 | 
					 | 
				
			||||||
    135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,
 | 
					 | 
				
			||||||
    119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,
 | 
					 | 
				
			||||||
    93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,
 | 
					 | 
				
			||||||
    53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,
 | 
					 | 
				
			||||||
    198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52,
 | 
					 | 
				
			||||||
    134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202,
 | 
					 | 
				
			||||||
    75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Expected result
 | 
					 | 
				
			||||||
  static const uint8_t expected_dst[kDstSize] = {
 | 
					 | 
				
			||||||
    117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,
 | 
					 | 
				
			||||||
    105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,
 | 
					 | 
				
			||||||
    208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,
 | 
					 | 
				
			||||||
    159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,
 | 
					 | 
				
			||||||
    208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,
 | 
					 | 
				
			||||||
    100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,
 | 
					 | 
				
			||||||
    113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,
 | 
					 | 
				
			||||||
    255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,
 | 
					 | 
				
			||||||
    200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,
 | 
					 | 
				
			||||||
    76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,
 | 
					 | 
				
			||||||
    185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,
 | 
					 | 
				
			||||||
    161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,
 | 
					 | 
				
			||||||
    15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,
 | 
					 | 
				
			||||||
    84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,
 | 
					 | 
				
			||||||
    189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,
 | 
					 | 
				
			||||||
    224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,
 | 
					 | 
				
			||||||
    136, 85, 189, 46, 71, 200, 90
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  uint8_t *src = const_cast<uint8_t*>(test_data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ASM_REGISTER_STATE_CHECK(
 | 
					 | 
				
			||||||
      sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,
 | 
					 | 
				
			||||||
                      2, 2, dst_, kDstStride));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < height_; ++i)
 | 
					 | 
				
			||||||
    for (int j = 0; j < width_; ++j)
 | 
					 | 
				
			||||||
      ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j])
 | 
					 | 
				
			||||||
          << "i==" << (i * width_ + j);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(SixtapPredictTest, TestWithRandomData) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  for (int i = 0; i < kSrcSize; ++i)
 | 
					 | 
				
			||||||
    src_[i] = rnd.Rand8();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Run tests for all possible offsets.
 | 
					 | 
				
			||||||
  for (int xoffset = 0; xoffset < 8; ++xoffset) {
 | 
					 | 
				
			||||||
    for (int yoffset = 0; yoffset < 8; ++yoffset) {
 | 
					 | 
				
			||||||
      // Call c reference function.
 | 
					 | 
				
			||||||
      // Move start point to next pixel to test if the function reads
 | 
					 | 
				
			||||||
      // unaligned data correctly.
 | 
					 | 
				
			||||||
      vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
 | 
					 | 
				
			||||||
                                xoffset, yoffset, dst_c_, kDstStride);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // Run test.
 | 
					 | 
				
			||||||
      ASM_REGISTER_STATE_CHECK(
 | 
					 | 
				
			||||||
          sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
 | 
					 | 
				
			||||||
                          xoffset, yoffset, dst_, kDstStride));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      for (int i = 0; i < height_; ++i)
 | 
					 | 
				
			||||||
        for (int j = 0; j < width_; ++j)
 | 
					 | 
				
			||||||
          ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j])
 | 
					 | 
				
			||||||
              << "i==" << (i * width_ + j);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using std::tr1::make_tuple;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    C, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
 | 
					 | 
				
			||||||
        make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
 | 
					 | 
				
			||||||
#if HAVE_NEON
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    NEON, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if HAVE_MMX
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    MMX, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
 | 
					 | 
				
			||||||
        make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if HAVE_SSE2
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    SSE2, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if HAVE_SSSE3
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    SSSE3, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
 | 
					 | 
				
			||||||
        make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#if HAVE_MSA
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    MSA, SixtapPredictTest, ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
 | 
					 | 
				
			||||||
        make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
 | 
					 | 
				
			||||||
        make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
 | 
					 | 
				
			||||||
        make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -18,8 +18,6 @@
 | 
				
			|||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
#if CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
#include "vp10/common/blockd.h"
 | 
					#include "vp10/common/blockd.h"
 | 
				
			||||||
#elif CONFIG_VP9
 | 
					 | 
				
			||||||
#include "vp9/common/vp9_blockd.h"
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					#include "vpx_mem/vpx_mem.h"
 | 
				
			||||||
#include "vpx_ports/mem.h"
 | 
					#include "vpx_ports/mem.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,10 +121,6 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
 | 
				
			|||||||
#endif  // CONFIG_EXT_REFS
 | 
					#endif  // CONFIG_EXT_REFS
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
 | 
					 | 
				
			||||||
    ::testing::Values(::libvpx_test::kTwoPassGood),
 | 
					 | 
				
			||||||
    ::testing::Values(0), ::testing::Values(0), ::testing::Values(0)));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// The superframe index is currently mandatory with ANS due to the decoder
 | 
					// The superframe index is currently mandatory with ANS due to the decoder
 | 
				
			||||||
// starting at the end of the buffer.
 | 
					// starting at the end of the buffer.
 | 
				
			||||||
#if CONFIG_EXT_TILE
 | 
					#if CONFIG_EXT_TILE
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,10 +18,10 @@ LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_422.y4m
 | 
				
			|||||||
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_444.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_444.y4m
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_440.yuv
 | 
					LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_440.yuv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += desktop_credits.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += desktop_credits.y4m
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += niklas_1280_720_30.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += niklas_1280_720_30.y4m
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += rush_hour_444.y4m
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += screendata.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += screendata.y4m
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += desktop_credits.y4m
 | 
					LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += desktop_credits.y4m
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										102
									
								
								test/test.mk
									
									
									
									
									
								
							
							
						
						
									
										102
									
								
								test/test.mk
									
									
									
									
									
								
							@@ -26,26 +26,19 @@ LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += datarate_test.cc
 | 
				
			|||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += encode_api_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += encode_api_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += error_resilience_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += error_resilience_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += i420_video_source.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += i420_video_source.h
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += realtime_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += realtime_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += resize_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += resize_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += y4m_video_source.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += y4m_video_source.h
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += yuv_video_source.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += yuv_video_source.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += level_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += active_map_refresh_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += active_map_test.cc
 | 
				
			||||||
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += borders_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += byte_alignment_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += cpu_speed_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += frame_size_tests.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += invalid_file_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_lossless_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_ethread_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_frame_parallel_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += frame_size_tests.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_lossless_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ethread_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += level_test.cc
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += decode_test_driver.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += decode_test_driver.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += decode_test_driver.h
 | 
					LIBVPX_TEST_SRCS-yes                   += decode_test_driver.h
 | 
				
			||||||
@@ -69,7 +62,6 @@ LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += ../tools_common.h
 | 
				
			|||||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += ../webmdec.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += ../webmdec.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += ../webmdec.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += ../webmdec.h
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += webm_video_source.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += webm_video_source.h
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_skip_loopfilter_test.cc
 | 
					 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += decode_api_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += decode_api_test.cc
 | 
				
			||||||
@@ -77,13 +69,13 @@ LIBVPX_TEST_SRCS-$(CONFIG_DECODERS)    += test_vector_test.cc
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Currently we only support decoder perf tests for vp9. Also they read from WebM
 | 
					# Currently we only support decoder perf tests for vp9. Also they read from WebM
 | 
				
			||||||
# files, so WebM IO is required.
 | 
					# files, so WebM IO is required.
 | 
				
			||||||
ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP9_DECODER)$(CONFIG_WEBM_IO), \
 | 
					ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP10_DECODER)$(CONFIG_WEBM_IO), \
 | 
				
			||||||
      yesyesyes)
 | 
					      yesyesyes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += decode_perf_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += decode_perf_test.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# encode perf tests are vp9 only
 | 
					# encode perf tests are vp9 only
 | 
				
			||||||
ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_VP9_ENCODER), yesyes)
 | 
					ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_VP10_ENCODER), yesyes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes += encode_perf_test.cc
 | 
					LIBVPX_TEST_SRCS-yes += encode_perf_test.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,78 +94,47 @@ endif
 | 
				
			|||||||
##
 | 
					##
 | 
				
			||||||
ifeq ($(CONFIG_SHARED),)
 | 
					ifeq ($(CONFIG_SHARED),)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## VP8
 | 
					## VP10
 | 
				
			||||||
ifeq ($(CONFIG_VP8),yes)
 | 
					ifeq ($(CONFIG_VP10),yes)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# These tests require both the encoder and decoder to be built.
 | 
					# These tests require both the encoder and decoder to be built.
 | 
				
			||||||
ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
 | 
					ifeq ($(CONFIG_VP10_ENCODER)$(CONFIG_VP10_DECODER),yesyes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vp8_boolcoder_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vp8_fragments_test.cc
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC)    += add_noise_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC)    += pp_filter_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += vp8_decrypt_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += quantize_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += variance_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_fdct4x4_test.cc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += idct_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += sixtap_predict_test.cc
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vpx_scale_test.cc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_TEMPORAL_DENOISING),yesyes)
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp8_denoiser_sse2_test.cc
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
endif # VP8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## VP9
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP9),yes)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# These tests require both the encoder and decoder to be built.
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),yesyes)
 | 
					 | 
				
			||||||
# IDCT test currently depends on FDCT function
 | 
					# IDCT test currently depends on FDCT function
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += idct8x8_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += idct8x8_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += partial_idct_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += partial_idct_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += superframe_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += superframe_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += tile_independence_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += tile_independence_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vp9_boolcoder_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += vp9_boolcoder_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vp9_encoder_parms_get_to_decoder.cc
 | 
					#LIBVPX_TEST_SRCS-yes                   += vp9_encoder_parms_get_to_decoder.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#LIBVPX_TEST_SRCS-yes                   += convolve_test.cc
 | 
					#LIBVPX_TEST_SRCS-yes                   += convolve_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += lpf_8_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += lpf_8_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += vp9_intrapred_test.cc
 | 
					LIBVPX_TEST_SRCS-yes                   += vp9_intrapred_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_decrypt_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_VP10_DECODER) += vp9_thread_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_thread_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct16x16_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct32x32_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct32x32_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct4x4_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct8x8_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += hadamard_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += hadamard_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += minmax_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += minmax_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += variance_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_error_block_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_error_block_test.cc
 | 
					#LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_quantize_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_quantize_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += subtract_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += subtract_test.cc
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(CONFIG_VP9_ENCODER),yes)
 | 
					ifeq ($(CONFIG_VP10_ENCODER),yes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC) += svc_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC) += svc_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += blockiness_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += blockiness_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += consistency_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += consistency_test.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_TEMPORAL_DENOISING),yesyes)
 | 
					ifeq ($(CONFIG_VP10_ENCODER)$(CONFIG_VP10_TEMPORAL_DENOISING),yesyes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp9_denoiser_sse2_test.cc
 | 
					LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp9_denoiser_sse2_test.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_arf_freq_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp9_arf_freq_test.cc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
endif # VP9
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## VP10
 | 
					 | 
				
			||||||
ifeq ($(CONFIG_VP10),yes)
 | 
					 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_inv_txfm_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_inv_txfm_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_fht4x4_test.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_fht4x4_test.cc
 | 
				
			||||||
@@ -205,7 +166,8 @@ endif # CONFIG_VP9_HIGHBITDEPTH
 | 
				
			|||||||
endif # VP10
 | 
					endif # VP10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Multi-codec / unconditional whitebox tests.
 | 
					## Multi-codec / unconditional whitebox tests.
 | 
				
			||||||
ifeq ($(findstring yes,$(CONFIG_VP9_ENCODER)$(CONFIG_VP10_ENCODER)),yes)
 | 
					
 | 
				
			||||||
 | 
					ifeq ($(CONFIG_VP10_ENCODER),yes)
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes += avg_test.cc
 | 
					LIBVPX_TEST_SRCS-yes += avg_test.cc
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
ifeq ($(CONFIG_INTERNAL_STATS),yes)
 | 
					ifeq ($(CONFIG_INTERNAL_STATS),yes)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,12 +16,6 @@
 | 
				
			|||||||
#include "vpx_ports/x86.h"
 | 
					#include "vpx_ports/x86.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#if CONFIG_VP8
 | 
					 | 
				
			||||||
extern void vp8_rtcd();
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP8
 | 
					 | 
				
			||||||
#if CONFIG_VP9
 | 
					 | 
				
			||||||
extern void vp9_rtcd();
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP9
 | 
					 | 
				
			||||||
#if CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
extern void vp10_rtcd();
 | 
					extern void vp10_rtcd();
 | 
				
			||||||
#endif  // CONFIG_VP10
 | 
					#endif  // CONFIG_VP10
 | 
				
			||||||
@@ -66,12 +60,6 @@ int main(int argc, char **argv) {
 | 
				
			|||||||
// Shared library builds don't support whitebox tests
 | 
					// Shared library builds don't support whitebox tests
 | 
				
			||||||
// that exercise internal symbols.
 | 
					// that exercise internal symbols.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP8
 | 
					 | 
				
			||||||
  vp8_rtcd();
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP8
 | 
					 | 
				
			||||||
#if CONFIG_VP9
 | 
					 | 
				
			||||||
  vp9_rtcd();
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP9
 | 
					 | 
				
			||||||
#if CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
  vp10_rtcd();
 | 
					  vp10_rtcd();
 | 
				
			||||||
#endif  // CONFIG_VP10
 | 
					#endif  // CONFIG_VP10
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -132,10 +132,6 @@ TEST_P(TileIndependenceTestLarge, MD5Match) {
 | 
				
			|||||||
  DoTest();
 | 
					  DoTest();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1),
 | 
					 | 
				
			||||||
                                                ::testing::Values(0));
 | 
					 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1),
 | 
					 | 
				
			||||||
                                                     ::testing::Values(0));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_EXT_TILE
 | 
					#if CONFIG_EXT_TILE
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(1, 2, 32),
 | 
					VP10_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(1, 2, 32),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,116 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stddef.h>
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <sys/types.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "vp8/decoder/dboolhuff.h"
 | 
					 | 
				
			||||||
#include "vp8/encoder/boolhuff.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
const int num_tests = 10;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
 | 
					 | 
				
			||||||
// with whatever internal state the decryptor uses. For testing we'll just
 | 
					 | 
				
			||||||
// xor with a constant key, and decrypt_state will point to the start of
 | 
					 | 
				
			||||||
// the original buffer.
 | 
					 | 
				
			||||||
const uint8_t secret_key[16] = {
 | 
					 | 
				
			||||||
  0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
 | 
					 | 
				
			||||||
  0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void encrypt_buffer(uint8_t *buffer, size_t size) {
 | 
					 | 
				
			||||||
  for (size_t i = 0; i < size; ++i) {
 | 
					 | 
				
			||||||
    buffer[i] ^= secret_key[i & 15];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
 | 
					 | 
				
			||||||
                     uint8_t *output, int count) {
 | 
					 | 
				
			||||||
  const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state);
 | 
					 | 
				
			||||||
  for (int i = 0; i < count; i++) {
 | 
					 | 
				
			||||||
    output[i] = input[i] ^ secret_key[(offset + i) & 15];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP8, TestBitIO) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  for (int n = 0; n < num_tests; ++n) {
 | 
					 | 
				
			||||||
    for (int method = 0; method <= 7; ++method) {   // we generate various proba
 | 
					 | 
				
			||||||
      const int kBitsToTest = 1000;
 | 
					 | 
				
			||||||
      uint8_t probas[kBitsToTest];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      for (int i = 0; i < kBitsToTest; ++i) {
 | 
					 | 
				
			||||||
        const int parity = i & 1;
 | 
					 | 
				
			||||||
        probas[i] =
 | 
					 | 
				
			||||||
            (method == 0) ? 0 : (method == 1) ? 255 :
 | 
					 | 
				
			||||||
            (method == 2) ? 128 :
 | 
					 | 
				
			||||||
            (method == 3) ? rnd.Rand8() :
 | 
					 | 
				
			||||||
            (method == 4) ? (parity ? 0 : 255) :
 | 
					 | 
				
			||||||
            // alternate between low and high proba:
 | 
					 | 
				
			||||||
            (method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
 | 
					 | 
				
			||||||
            (method == 6) ?
 | 
					 | 
				
			||||||
                (parity ? rnd(64) : 255 - rnd(64)) :
 | 
					 | 
				
			||||||
                (parity ? rnd(32) : 255 - rnd(32));
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      for (int bit_method = 0; bit_method <= 3; ++bit_method) {
 | 
					 | 
				
			||||||
        const int random_seed = 6432;
 | 
					 | 
				
			||||||
        const int kBufferSize = 10000;
 | 
					 | 
				
			||||||
        ACMRandom bit_rnd(random_seed);
 | 
					 | 
				
			||||||
        BOOL_CODER bw;
 | 
					 | 
				
			||||||
        uint8_t bw_buffer[kBufferSize];
 | 
					 | 
				
			||||||
        vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
 | 
					 | 
				
			||||||
        for (int i = 0; i < kBitsToTest; ++i) {
 | 
					 | 
				
			||||||
          if (bit_method == 2) {
 | 
					 | 
				
			||||||
            bit = (i & 1);
 | 
					 | 
				
			||||||
          } else if (bit_method == 3) {
 | 
					 | 
				
			||||||
            bit = bit_rnd(2);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          vp8_encode_bool(&bw, bit, static_cast<int>(probas[i]));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        vp8_stop_encode(&bw);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        BOOL_DECODER br;
 | 
					 | 
				
			||||||
        encrypt_buffer(bw_buffer, kBufferSize);
 | 
					 | 
				
			||||||
        vp8dx_start_decode(&br, bw_buffer, kBufferSize,
 | 
					 | 
				
			||||||
                           test_decrypt_cb,
 | 
					 | 
				
			||||||
                           reinterpret_cast<void *>(bw_buffer));
 | 
					 | 
				
			||||||
        bit_rnd.Reset(random_seed);
 | 
					 | 
				
			||||||
        for (int i = 0; i < kBitsToTest; ++i) {
 | 
					 | 
				
			||||||
          if (bit_method == 2) {
 | 
					 | 
				
			||||||
            bit = (i & 1);
 | 
					 | 
				
			||||||
          } else if (bit_method == 3) {
 | 
					 | 
				
			||||||
            bit = bit_rnd(2);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
 | 
					 | 
				
			||||||
              << "pos: "<< i << " / " << kBitsToTest
 | 
					 | 
				
			||||||
              << " bit_method: " << bit_method
 | 
					 | 
				
			||||||
              << " method: " << method;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,71 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstdio>
 | 
					 | 
				
			||||||
#include <cstdlib>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/ivf_video_source.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
 | 
					 | 
				
			||||||
// with whatever internal state the decryptor uses. For testing we'll just
 | 
					 | 
				
			||||||
// xor with a constant key, and decrypt_state will point to the start of
 | 
					 | 
				
			||||||
// the original buffer.
 | 
					 | 
				
			||||||
const uint8_t test_key[16] = {
 | 
					 | 
				
			||||||
  0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
 | 
					 | 
				
			||||||
  0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
 | 
					 | 
				
			||||||
                    ptrdiff_t offset) {
 | 
					 | 
				
			||||||
  for (size_t i = 0; i < size; ++i) {
 | 
					 | 
				
			||||||
    dst[i] = src[i] ^ test_key[(offset + i) & 15];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
 | 
					 | 
				
			||||||
                     uint8_t *output, int count) {
 | 
					 | 
				
			||||||
  encrypt_buffer(input, output, count,
 | 
					 | 
				
			||||||
                 input - reinterpret_cast<uint8_t *>(decrypt_state));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace libvpx_test {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(TestDecrypt, DecryptWorksVp8) {
 | 
					 | 
				
			||||||
  libvpx_test::IVFVideoSource video("vp80-00-comprehensive-001.ivf");
 | 
					 | 
				
			||||||
  video.Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
  VP8Decoder decoder(dec_cfg, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  video.Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // no decryption
 | 
					 | 
				
			||||||
  vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // decrypt frame
 | 
					 | 
				
			||||||
  video.Next();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  std::vector<uint8_t> encrypted(video.frame_size());
 | 
					 | 
				
			||||||
  encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
 | 
					 | 
				
			||||||
  vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
 | 
					 | 
				
			||||||
  decoder.Control(VPXD_SET_DECRYPTOR, &di);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  res = decoder.DecodeFrame(&encrypted[0], encrypted.size());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace libvpx_test
 | 
					 | 
				
			||||||
@@ -1,116 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "vp8/encoder/denoising.h"
 | 
					 | 
				
			||||||
#include "vp8/common/reconinter.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const int kNumPixels = 16 * 16;
 | 
					 | 
				
			||||||
class VP8DenoiserTest : public ::testing::TestWithParam<int> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~VP8DenoiserTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    increase_denoising_ = GetParam();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() { libvpx_test::ClearSystemState(); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  int increase_denoising_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VP8DenoiserTest, BitexactCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  const int count_test_block = 4000;
 | 
					 | 
				
			||||||
  const int stride = 16;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Allocate the space for input and output,
 | 
					 | 
				
			||||||
  // where sig_block_c/_sse2 is the block to be denoised,
 | 
					 | 
				
			||||||
  // mc_avg_block is the denoised reference block,
 | 
					 | 
				
			||||||
  // avg_block_c is the denoised result from C code,
 | 
					 | 
				
			||||||
  // avg_block_sse2 is the denoised result from SSE2 code.
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint8_t, sig_block_c[kNumPixels]);
 | 
					 | 
				
			||||||
  // Since in VP8 denoiser, the source signal will be changed,
 | 
					 | 
				
			||||||
  // we need another copy of the source signal as the input of sse2 code.
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint8_t, sig_block_sse2[kNumPixels]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint8_t, mc_avg_block[kNumPixels]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint8_t, avg_block_c[kNumPixels]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint8_t, avg_block_sse2[kNumPixels]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < count_test_block; ++i) {
 | 
					 | 
				
			||||||
    // Generate random motion magnitude, 20% of which exceed the threshold.
 | 
					 | 
				
			||||||
    const int motion_magnitude_ran =
 | 
					 | 
				
			||||||
        rnd.Rand8() % static_cast<int>(MOTION_MAGNITUDE_THRESHOLD * 1.2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Initialize a test block with random number in range [0, 255].
 | 
					 | 
				
			||||||
    for (int j = 0; j < kNumPixels; ++j) {
 | 
					 | 
				
			||||||
      int temp = 0;
 | 
					 | 
				
			||||||
      sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
 | 
					 | 
				
			||||||
      // The pixels in mc_avg_block are generated by adding a random
 | 
					 | 
				
			||||||
      // number in range [-19, 19] to corresponding pixels in sig_block.
 | 
					 | 
				
			||||||
      temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) *
 | 
					 | 
				
			||||||
             (rnd.Rand8() % 20);
 | 
					 | 
				
			||||||
      // Clip.
 | 
					 | 
				
			||||||
      mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Test denosiser on Y component.
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_c(
 | 
					 | 
				
			||||||
        mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
 | 
					 | 
				
			||||||
        motion_magnitude_ran, increase_denoising_));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_sse2(
 | 
					 | 
				
			||||||
        mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
 | 
					 | 
				
			||||||
        motion_magnitude_ran, increase_denoising_));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check bitexactness.
 | 
					 | 
				
			||||||
    for (int h = 0; h < 16; ++h) {
 | 
					 | 
				
			||||||
      for (int w = 0; w < 16; ++w) {
 | 
					 | 
				
			||||||
        EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Test denoiser on UV component.
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_c(
 | 
					 | 
				
			||||||
        mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
 | 
					 | 
				
			||||||
        motion_magnitude_ran, increase_denoising_));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_sse2(
 | 
					 | 
				
			||||||
        mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
 | 
					 | 
				
			||||||
        motion_magnitude_ran, increase_denoising_));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check bitexactness.
 | 
					 | 
				
			||||||
    for (int h = 0; h < 16; ++h) {
 | 
					 | 
				
			||||||
      for (int w = 0; w < 16; ++w) {
 | 
					 | 
				
			||||||
        EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Test for all block size.
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(SSE2, VP8DenoiserTest, ::testing::Values(0, 1));
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,163 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stddef.h>
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <sys/types.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const int cospi8sqrt2minus1 = 20091;
 | 
					 | 
				
			||||||
const int sinpi8sqrt2 = 35468;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void reference_idct4x4(const int16_t *input, int16_t *output) {
 | 
					 | 
				
			||||||
  const int16_t *ip = input;
 | 
					 | 
				
			||||||
  int16_t *op = output;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < 4; ++i) {
 | 
					 | 
				
			||||||
    const int a1 = ip[0] + ip[8];
 | 
					 | 
				
			||||||
    const int b1 = ip[0] - ip[8];
 | 
					 | 
				
			||||||
    const int temp1 = (ip[4] * sinpi8sqrt2) >> 16;
 | 
					 | 
				
			||||||
    const int temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
 | 
					 | 
				
			||||||
    const int c1 = temp1 - temp2;
 | 
					 | 
				
			||||||
    const int temp3 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
 | 
					 | 
				
			||||||
    const int temp4 = (ip[12] * sinpi8sqrt2) >> 16;
 | 
					 | 
				
			||||||
    const int d1 = temp3 + temp4;
 | 
					 | 
				
			||||||
    op[0] = a1 + d1;
 | 
					 | 
				
			||||||
    op[12] = a1 - d1;
 | 
					 | 
				
			||||||
    op[4] = b1 + c1;
 | 
					 | 
				
			||||||
    op[8] = b1 - c1;
 | 
					 | 
				
			||||||
    ++ip;
 | 
					 | 
				
			||||||
    ++op;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  ip = output;
 | 
					 | 
				
			||||||
  op = output;
 | 
					 | 
				
			||||||
  for (int i = 0; i < 4; ++i) {
 | 
					 | 
				
			||||||
    const int a1 = ip[0] + ip[2];
 | 
					 | 
				
			||||||
    const int b1 = ip[0] - ip[2];
 | 
					 | 
				
			||||||
    const int temp1 = (ip[1] * sinpi8sqrt2) >> 16;
 | 
					 | 
				
			||||||
    const int temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
 | 
					 | 
				
			||||||
    const int c1 = temp1 - temp2;
 | 
					 | 
				
			||||||
    const int temp3 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
 | 
					 | 
				
			||||||
    const int temp4 = (ip[3] * sinpi8sqrt2) >> 16;
 | 
					 | 
				
			||||||
    const int d1 = temp3 + temp4;
 | 
					 | 
				
			||||||
    op[0] = (a1 + d1 + 4) >> 3;
 | 
					 | 
				
			||||||
    op[3] = (a1 - d1 + 4) >> 3;
 | 
					 | 
				
			||||||
    op[1] = (b1 + c1 + 4) >> 3;
 | 
					 | 
				
			||||||
    op[2] = (b1 - c1 + 4) >> 3;
 | 
					 | 
				
			||||||
    ip += 4;
 | 
					 | 
				
			||||||
    op += 4;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP8FdctTest, SignBiasCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  int16_t test_input_block[16];
 | 
					 | 
				
			||||||
  int16_t test_output_block[16];
 | 
					 | 
				
			||||||
  const int pitch = 8;
 | 
					 | 
				
			||||||
  int count_sign_block[16][2];
 | 
					 | 
				
			||||||
  const int count_test_block = 1000000;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  memset(count_sign_block, 0, sizeof(count_sign_block));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < count_test_block; ++i) {
 | 
					 | 
				
			||||||
    // Initialize a test block with input range [-255, 255].
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j)
 | 
					 | 
				
			||||||
      test_input_block[j] = rnd.Rand8() - rnd.Rand8();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j) {
 | 
					 | 
				
			||||||
      if (test_output_block[j] < 0)
 | 
					 | 
				
			||||||
        ++count_sign_block[j][0];
 | 
					 | 
				
			||||||
      else if (test_output_block[j] > 0)
 | 
					 | 
				
			||||||
        ++count_sign_block[j][1];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  bool bias_acceptable = true;
 | 
					 | 
				
			||||||
  for (int j = 0; j < 16; ++j)
 | 
					 | 
				
			||||||
    bias_acceptable = bias_acceptable &&
 | 
					 | 
				
			||||||
    (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(true, bias_acceptable)
 | 
					 | 
				
			||||||
    << "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  memset(count_sign_block, 0, sizeof(count_sign_block));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < count_test_block; ++i) {
 | 
					 | 
				
			||||||
    // Initialize a test block with input range [-15, 15].
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j)
 | 
					 | 
				
			||||||
      test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j) {
 | 
					 | 
				
			||||||
      if (test_output_block[j] < 0)
 | 
					 | 
				
			||||||
        ++count_sign_block[j][0];
 | 
					 | 
				
			||||||
      else if (test_output_block[j] > 0)
 | 
					 | 
				
			||||||
        ++count_sign_block[j][1];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  bias_acceptable = true;
 | 
					 | 
				
			||||||
  for (int j = 0; j < 16; ++j)
 | 
					 | 
				
			||||||
    bias_acceptable = bias_acceptable &&
 | 
					 | 
				
			||||||
    (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(true, bias_acceptable)
 | 
					 | 
				
			||||||
    << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP8FdctTest, RoundTripErrorCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  int max_error = 0;
 | 
					 | 
				
			||||||
  double total_error = 0;
 | 
					 | 
				
			||||||
  const int count_test_block = 1000000;
 | 
					 | 
				
			||||||
  for (int i = 0; i < count_test_block; ++i) {
 | 
					 | 
				
			||||||
    int16_t test_input_block[16];
 | 
					 | 
				
			||||||
    int16_t test_temp_block[16];
 | 
					 | 
				
			||||||
    int16_t test_output_block[16];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Initialize a test block with input range [-255, 255].
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j)
 | 
					 | 
				
			||||||
      test_input_block[j] = rnd.Rand8() - rnd.Rand8();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const int pitch = 8;
 | 
					 | 
				
			||||||
    vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
 | 
					 | 
				
			||||||
    reference_idct4x4(test_temp_block, test_output_block);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int j = 0; j < 16; ++j) {
 | 
					 | 
				
			||||||
      const int diff = test_input_block[j] - test_output_block[j];
 | 
					 | 
				
			||||||
      const int error = diff * diff;
 | 
					 | 
				
			||||||
      if (max_error < error)
 | 
					 | 
				
			||||||
        max_error = error;
 | 
					 | 
				
			||||||
      total_error += error;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_GE(1, max_error )
 | 
					 | 
				
			||||||
    << "Error: FDCT/IDCT has an individual roundtrip error > 1";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_GE(count_test_block, total_error)
 | 
					 | 
				
			||||||
    << "Error: FDCT/IDCT has average roundtrip error > 1 per block";
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,37 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/video_source.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP8FramgmentsTest
 | 
					 | 
				
			||||||
    : public ::libvpx_test::EncoderTest,
 | 
					 | 
				
			||||||
      public ::testing::Test {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}
 | 
					 | 
				
			||||||
  virtual ~VP8FramgmentsTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    const unsigned long init_flags =  // NOLINT(runtime/int)
 | 
					 | 
				
			||||||
        VPX_CODEC_USE_OUTPUT_PARTITION;
 | 
					 | 
				
			||||||
    InitializeConfig();
 | 
					 | 
				
			||||||
    SetMode(::libvpx_test::kRealTime);
 | 
					 | 
				
			||||||
    set_init_flags(init_flags);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_F(VP8FramgmentsTest, TestFragmentsEncodeDecode) {
 | 
					 | 
				
			||||||
  ::libvpx_test::RandomVideoSource video;
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -15,7 +15,7 @@
 | 
				
			|||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
#include "test/y4m_video_source.h"
 | 
					#include "test/y4m_video_source.h"
 | 
				
			||||||
#include "test/yuv_video_source.h"
 | 
					#include "test/yuv_video_source.h"
 | 
				
			||||||
#include "vp9/encoder/vp9_ratectrl.h"
 | 
					#include "vp10/encoder/ratectrl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -175,7 +175,7 @@ class ArfFreqTestLarge
 | 
				
			|||||||
    if (min_arf_requested_)
 | 
					    if (min_arf_requested_)
 | 
				
			||||||
      return min_arf_requested_;
 | 
					      return min_arf_requested_;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      return vp9_rc_get_default_min_gf_interval(
 | 
					      return vp10_rc_get_default_min_gf_interval(
 | 
				
			||||||
          test_video_param_.width, test_video_param_.height,
 | 
					          test_video_param_.width, test_video_param_.height,
 | 
				
			||||||
          (double)test_video_param_.framerate_num /
 | 
					          (double)test_video_param_.framerate_num /
 | 
				
			||||||
          test_video_param_.framerate_den);
 | 
					          test_video_param_.framerate_den);
 | 
				
			||||||
@@ -223,12 +223,6 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    ArfFreqTestLarge,
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kTestVectors),
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kEncodeVectors),
 | 
					 | 
				
			||||||
    ::testing::ValuesIn(kMinArfVectors));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH || CONFIG_EXT_REFS
 | 
					#if CONFIG_VP9_HIGHBITDEPTH || CONFIG_EXT_REFS
 | 
				
			||||||
#if CONFIG_VP10_ENCODER
 | 
					#if CONFIG_VP10_ENCODER
 | 
				
			||||||
// TODO(angiebird): 25-29 fail in high bitdepth mode.
 | 
					// TODO(angiebird): 25-29 fail in high bitdepth mode.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,71 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstdio>
 | 
					 | 
				
			||||||
#include <cstdlib>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/ivf_video_source.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
 | 
					 | 
				
			||||||
// with whatever internal state the decryptor uses. For testing we'll just
 | 
					 | 
				
			||||||
// xor with a constant key, and decrypt_state will point to the start of
 | 
					 | 
				
			||||||
// the original buffer.
 | 
					 | 
				
			||||||
const uint8_t test_key[16] = {
 | 
					 | 
				
			||||||
  0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
 | 
					 | 
				
			||||||
  0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
 | 
					 | 
				
			||||||
                    ptrdiff_t offset) {
 | 
					 | 
				
			||||||
  for (size_t i = 0; i < size; ++i) {
 | 
					 | 
				
			||||||
    dst[i] = src[i] ^ test_key[(offset + i) & 15];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
 | 
					 | 
				
			||||||
                     uint8_t *output, int count) {
 | 
					 | 
				
			||||||
  encrypt_buffer(input, output, count,
 | 
					 | 
				
			||||||
                 input - reinterpret_cast<uint8_t *>(decrypt_state));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace libvpx_test {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(TestDecrypt, DecryptWorksVp9) {
 | 
					 | 
				
			||||||
  libvpx_test::IVFVideoSource video("vp90-2-05-resize.ivf");
 | 
					 | 
				
			||||||
  video.Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
  VP9Decoder decoder(dec_cfg, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  video.Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // no decryption
 | 
					 | 
				
			||||||
  vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // decrypt frame
 | 
					 | 
				
			||||||
  video.Next();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  std::vector<uint8_t> encrypted(video.frame_size());
 | 
					 | 
				
			||||||
  encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
 | 
					 | 
				
			||||||
  vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
 | 
					 | 
				
			||||||
  decoder.Control(VPXD_SET_DECRYPTOR, &di);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  res = decoder.DecodeFrame(&encrypted[0], encrypted.size());
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace libvpx_test
 | 
					 | 
				
			||||||
@@ -20,9 +20,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "vpx_scale/yv12config.h"
 | 
					#include "vpx_scale/yv12config.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
#include "vp9/common/vp9_reconinter.h"
 | 
					#include "vp10/common/reconinter.h"
 | 
				
			||||||
#include "vp9/encoder/vp9_context_tree.h"
 | 
					#include "vp10/encoder/context_tree.h"
 | 
				
			||||||
#include "vp9/encoder/vp9_denoiser.h"
 | 
					#include "vp10/encoder/denoiser.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					using libvpx_test::ACMRandom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@
 | 
				
			|||||||
#include "test/encode_test_driver.h"
 | 
					#include "test/encode_test_driver.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
#include "test/y4m_video_source.h"
 | 
					#include "test/y4m_video_source.h"
 | 
				
			||||||
#include "vp9/vp9_dx_iface.h"
 | 
					#include "vp10/vp10_dx_iface.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -100,7 +100,7 @@ class VpxEncoderParmsGetToDecoder
 | 
				
			|||||||
        reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv);
 | 
					        reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv);
 | 
				
			||||||
    FrameWorkerData *const worker_data =
 | 
					    FrameWorkerData *const worker_data =
 | 
				
			||||||
        reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1);
 | 
					        reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1);
 | 
				
			||||||
    VP9_COMMON *const common = &worker_data->pbi->common;
 | 
					    VP10_COMMON *const common = &worker_data->pbi->common;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (encode_parms.lossless) {
 | 
					    if (encode_parms.lossless) {
 | 
				
			||||||
      EXPECT_EQ(0, common->base_qindex);
 | 
					      EXPECT_EQ(0, common->base_qindex);
 | 
				
			||||||
@@ -111,11 +111,7 @@ class VpxEncoderParmsGetToDecoder
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode);
 | 
					    EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode);
 | 
				
			||||||
    if (encode_parms.error_resilient) {
 | 
					    if (encode_parms.error_resilient) {
 | 
				
			||||||
      EXPECT_EQ(1, common->frame_parallel_decoding_mode);
 | 
					 | 
				
			||||||
      EXPECT_EQ(0, common->use_prev_frame_mvs);
 | 
					      EXPECT_EQ(0, common->use_prev_frame_mvs);
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      EXPECT_EQ(encode_parms.frame_parallel,
 | 
					 | 
				
			||||||
                common->frame_parallel_decoding_mode);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    EXPECT_EQ(encode_parms.color_range, common->color_range);
 | 
					    EXPECT_EQ(encode_parms.color_range, common->color_range);
 | 
				
			||||||
    EXPECT_EQ(encode_parms.cs, common->color_space);
 | 
					    EXPECT_EQ(encode_parms.cs, common->color_space);
 | 
				
			||||||
@@ -147,7 +143,7 @@ TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) {
 | 
				
			|||||||
  delete video;
 | 
					  delete video;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
 | 
					VP10_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
 | 
				
			||||||
                          ::testing::ValuesIn(kVP9EncodeParameterSet),
 | 
					                          ::testing::ValuesIn(kVP9EncodeParameterSet),
 | 
				
			||||||
                          ::testing::ValuesIn(kVP9EncodePerfTestVectors));
 | 
					                          ::testing::ValuesIn(kVP9EncodePerfTestVectors));
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,10 +15,12 @@
 | 
				
			|||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "./vpx_config.h"
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
 | 
					#include "./vp10_rtcd.h"
 | 
				
			||||||
#include "test/acm_random.h"
 | 
					#include "test/acm_random.h"
 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
 | 
					#include "vp10/common/entropy.h"
 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					#include "vpx/vpx_codec.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -158,51 +160,51 @@ TEST_P(ErrorBlockTest, ExtremeValues) {
 | 
				
			|||||||
#if HAVE_SSE2 || HAVE_AVX
 | 
					#if HAVE_SSE2 || HAVE_AVX
 | 
				
			||||||
using std::tr1::make_tuple;
 | 
					using std::tr1::make_tuple;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int64_t wrap_vp9_highbd_block_error_8bit_c(const tran_low_t *coeff,
 | 
					int64_t wrap_vp10_highbd_block_error_8bit_c(const tran_low_t *coeff,
 | 
				
			||||||
                                           const tran_low_t *dqcoeff,
 | 
					                                           const tran_low_t *dqcoeff,
 | 
				
			||||||
                                           intptr_t block_size,
 | 
					                                           intptr_t block_size,
 | 
				
			||||||
                                           int64_t *ssz, int bps) {
 | 
					                                           int64_t *ssz, int bps) {
 | 
				
			||||||
  EXPECT_EQ(8, bps);
 | 
					  EXPECT_EQ(8, bps);
 | 
				
			||||||
  return vp9_highbd_block_error_8bit_c(coeff, dqcoeff, block_size, ssz);
 | 
					  return vp10_highbd_block_error_8bit_c(coeff, dqcoeff, block_size, ssz);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif  // HAVE_SSE2 || HAVE_AVX
 | 
					#endif  // HAVE_SSE2 || HAVE_AVX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_SSE2
 | 
					#if HAVE_SSE2
 | 
				
			||||||
int64_t wrap_vp9_highbd_block_error_8bit_sse2(const tran_low_t *coeff,
 | 
					int64_t wrap_vp10_highbd_block_error_8bit_sse2(const tran_low_t *coeff,
 | 
				
			||||||
                                              const tran_low_t *dqcoeff,
 | 
					                                              const tran_low_t *dqcoeff,
 | 
				
			||||||
                                              intptr_t block_size,
 | 
					                                              intptr_t block_size,
 | 
				
			||||||
                                              int64_t *ssz, int bps) {
 | 
					                                              int64_t *ssz, int bps) {
 | 
				
			||||||
  EXPECT_EQ(8, bps);
 | 
					  EXPECT_EQ(8, bps);
 | 
				
			||||||
  return vp9_highbd_block_error_8bit_sse2(coeff, dqcoeff, block_size, ssz);
 | 
					  return vp10_highbd_block_error_8bit_sse2(coeff, dqcoeff, block_size, ssz);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    SSE2, ErrorBlockTest,
 | 
					    SSE2, ErrorBlockTest,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&vp9_highbd_block_error_sse2,
 | 
					        make_tuple(&vp10_highbd_block_error_sse2,
 | 
				
			||||||
                   &vp9_highbd_block_error_c, VPX_BITS_10),
 | 
					                   &vp10_highbd_block_error_c, VPX_BITS_10),
 | 
				
			||||||
        make_tuple(&vp9_highbd_block_error_sse2,
 | 
					        make_tuple(&vp10_highbd_block_error_sse2,
 | 
				
			||||||
                   &vp9_highbd_block_error_c, VPX_BITS_12),
 | 
					                   &vp10_highbd_block_error_c, VPX_BITS_12),
 | 
				
			||||||
        make_tuple(&vp9_highbd_block_error_sse2,
 | 
					        make_tuple(&vp10_highbd_block_error_sse2,
 | 
				
			||||||
                   &vp9_highbd_block_error_c, VPX_BITS_8),
 | 
					                   &vp10_highbd_block_error_c, VPX_BITS_8),
 | 
				
			||||||
        make_tuple(&wrap_vp9_highbd_block_error_8bit_sse2,
 | 
					        make_tuple(&wrap_vp10_highbd_block_error_8bit_sse2,
 | 
				
			||||||
                   &wrap_vp9_highbd_block_error_8bit_c, VPX_BITS_8)));
 | 
					                   &wrap_vp10_highbd_block_error_8bit_c, VPX_BITS_8)));
 | 
				
			||||||
#endif  // HAVE_SSE2
 | 
					#endif  // HAVE_SSE2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_AVX
 | 
					#if HAVE_AVX
 | 
				
			||||||
int64_t wrap_vp9_highbd_block_error_8bit_avx(const tran_low_t *coeff,
 | 
					int64_t wrap_vp10_highbd_block_error_8bit_avx(const tran_low_t *coeff,
 | 
				
			||||||
                                              const tran_low_t *dqcoeff,
 | 
					                                              const tran_low_t *dqcoeff,
 | 
				
			||||||
                                              intptr_t block_size,
 | 
					                                              intptr_t block_size,
 | 
				
			||||||
                                              int64_t *ssz, int bps) {
 | 
					                                              int64_t *ssz, int bps) {
 | 
				
			||||||
  EXPECT_EQ(8, bps);
 | 
					  EXPECT_EQ(8, bps);
 | 
				
			||||||
  return vp9_highbd_block_error_8bit_avx(coeff, dqcoeff, block_size, ssz);
 | 
					  return vp10_highbd_block_error_8bit_avx(coeff, dqcoeff, block_size, ssz);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					INSTANTIATE_TEST_CASE_P(
 | 
				
			||||||
    AVX, ErrorBlockTest,
 | 
					    AVX, ErrorBlockTest,
 | 
				
			||||||
    ::testing::Values(
 | 
					    ::testing::Values(
 | 
				
			||||||
        make_tuple(&wrap_vp9_highbd_block_error_8bit_avx,
 | 
					        make_tuple(&wrap_vp10_highbd_block_error_8bit_avx,
 | 
				
			||||||
                   &wrap_vp9_highbd_block_error_8bit_c, VPX_BITS_8)));
 | 
					                   &wrap_vp10_highbd_block_error_8bit_c, VPX_BITS_8)));
 | 
				
			||||||
#endif  // HAVE_AVX
 | 
					#endif  // HAVE_AVX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
					#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -179,11 +179,6 @@ TEST_P(VPxEncoderThreadTestLarge, EncoderResultTest) {
 | 
				
			|||||||
  DoTest();
 | 
					  DoTest();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(
 | 
					 | 
				
			||||||
    VPxEncoderThreadTest,
 | 
					 | 
				
			||||||
    ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
 | 
					 | 
				
			||||||
                      ::libvpx_test::kRealTime),
 | 
					 | 
				
			||||||
    ::testing::Range(1, 9));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(
 | 
					VP10_INSTANTIATE_TEST_CASE(
 | 
				
			||||||
    VPxEncoderThreadTest,
 | 
					    VPxEncoderThreadTest,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,220 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstdio>
 | 
					 | 
				
			||||||
#include <cstdlib>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "./vpx_config.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 "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using std::string;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct PauseFileList {
 | 
					 | 
				
			||||||
  const char *name;
 | 
					 | 
				
			||||||
  // md5 sum for decoded frames which does not include skipped frames.
 | 
					 | 
				
			||||||
  const char *expected_md5;
 | 
					 | 
				
			||||||
  const int pause_frame_num;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Decodes |filename| with |num_threads|. Pause at the specified frame_num,
 | 
					 | 
				
			||||||
// seek to next key frame and then continue decoding until the end. Return
 | 
					 | 
				
			||||||
// the md5 of the decoded frames which does not include skipped frames.
 | 
					 | 
				
			||||||
string DecodeFileWithPause(const string &filename, int num_threads,
 | 
					 | 
				
			||||||
                           int pause_num) {
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource video(filename);
 | 
					 | 
				
			||||||
  video.Init();
 | 
					 | 
				
			||||||
  int in_frames = 0;
 | 
					 | 
				
			||||||
  int out_frames = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_dec_cfg_t cfg = {0};
 | 
					 | 
				
			||||||
  cfg.threads = num_threads;
 | 
					 | 
				
			||||||
  vpx_codec_flags_t flags = 0;
 | 
					 | 
				
			||||||
  flags |= VPX_CODEC_USE_FRAME_THREADING;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder decoder(cfg, flags, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::MD5 md5;
 | 
					 | 
				
			||||||
  video.Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  do {
 | 
					 | 
				
			||||||
    ++in_frames;
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder.DecodeFrame(video.cxdata(), video.frame_size());
 | 
					 | 
				
			||||||
    if (res != VPX_CODEC_OK) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Pause at specified frame number.
 | 
					 | 
				
			||||||
    if (in_frames == pause_num) {
 | 
					 | 
				
			||||||
      // Flush the decoder and then seek to next key frame.
 | 
					 | 
				
			||||||
      decoder.DecodeFrame(NULL, 0);
 | 
					 | 
				
			||||||
      video.SeekToNextKeyFrame();
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      video.Next();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Flush the decoder at the end of the video.
 | 
					 | 
				
			||||||
    if (!video.cxdata())
 | 
					 | 
				
			||||||
      decoder.DecodeFrame(NULL, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Get decompressed data
 | 
					 | 
				
			||||||
    while ((img = dec_iter.Next())) {
 | 
					 | 
				
			||||||
      ++out_frames;
 | 
					 | 
				
			||||||
      md5.Add(img);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } while (video.cxdata() != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(in_frames, out_frames) <<
 | 
					 | 
				
			||||||
      "Input frame count does not match output frame count";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return string(md5.Get());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void DecodeFilesWithPause(const PauseFileList files[]) {
 | 
					 | 
				
			||||||
  for (const PauseFileList *iter = files; iter->name != NULL; ++iter) {
 | 
					 | 
				
			||||||
    SCOPED_TRACE(iter->name);
 | 
					 | 
				
			||||||
    for (int t = 2; t <= 8; ++t) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(iter->expected_md5,
 | 
					 | 
				
			||||||
                DecodeFileWithPause(iter->name, t, iter->pause_frame_num))
 | 
					 | 
				
			||||||
          << "threads = " << t;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9MultiThreadedFrameParallel, PauseSeekResume) {
 | 
					 | 
				
			||||||
  // vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
 | 
					 | 
				
			||||||
  // one key frame for every ten frames.
 | 
					 | 
				
			||||||
  static const PauseFileList files[] = {
 | 
					 | 
				
			||||||
    { "vp90-2-07-frame_parallel-1.webm",
 | 
					 | 
				
			||||||
      "6ea7c3875d67252e7caf2bc6e75b36b1", 6 },
 | 
					 | 
				
			||||||
    { "vp90-2-07-frame_parallel-1.webm",
 | 
					 | 
				
			||||||
      "4bb634160c7356a8d7d4299b6dc83a45", 12 },
 | 
					 | 
				
			||||||
    { "vp90-2-07-frame_parallel-1.webm",
 | 
					 | 
				
			||||||
      "89772591e6ef461f9fa754f916c78ed8", 26 },
 | 
					 | 
				
			||||||
    { NULL, NULL, 0 },
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  DecodeFilesWithPause(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct FileList {
 | 
					 | 
				
			||||||
  const char *name;
 | 
					 | 
				
			||||||
  // md5 sum for decoded frames which does not include corrupted frames.
 | 
					 | 
				
			||||||
  const char *expected_md5;
 | 
					 | 
				
			||||||
  // Expected number of decoded frames which does not include corrupted frames.
 | 
					 | 
				
			||||||
  const int expected_frame_count;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Decodes |filename| with |num_threads|. Return the md5 of the decoded
 | 
					 | 
				
			||||||
// frames which does not include corrupted frames.
 | 
					 | 
				
			||||||
string DecodeFile(const string &filename, int num_threads,
 | 
					 | 
				
			||||||
                  int expected_frame_count) {
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource video(filename);
 | 
					 | 
				
			||||||
  video.Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
  cfg.threads = num_threads;
 | 
					 | 
				
			||||||
  const vpx_codec_flags_t flags = VPX_CODEC_USE_FRAME_THREADING;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder decoder(cfg, flags, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::MD5 md5;
 | 
					 | 
				
			||||||
  video.Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int out_frames = 0;
 | 
					 | 
				
			||||||
  do {
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder.DecodeFrame(video.cxdata(), video.frame_size());
 | 
					 | 
				
			||||||
    // TODO(hkuang): frame parallel mode should return an error on corruption.
 | 
					 | 
				
			||||||
    if (res != VPX_CODEC_OK) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    video.Next();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Flush the decoder at the end of the video.
 | 
					 | 
				
			||||||
    if (!video.cxdata())
 | 
					 | 
				
			||||||
      decoder.DecodeFrame(NULL, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Get decompressed data
 | 
					 | 
				
			||||||
    while ((img = dec_iter.Next())) {
 | 
					 | 
				
			||||||
      ++out_frames;
 | 
					 | 
				
			||||||
      md5.Add(img);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } while (video.cxdata() != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_EQ(expected_frame_count, out_frames) <<
 | 
					 | 
				
			||||||
      "Input frame count does not match expected output frame count";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return string(md5.Get());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void DecodeFiles(const FileList files[]) {
 | 
					 | 
				
			||||||
  for (const FileList *iter = files; iter->name != NULL; ++iter) {
 | 
					 | 
				
			||||||
    SCOPED_TRACE(iter->name);
 | 
					 | 
				
			||||||
    for (int t = 2; t <= 8; ++t) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(iter->expected_md5,
 | 
					 | 
				
			||||||
                DecodeFile(iter->name, t, iter->expected_frame_count))
 | 
					 | 
				
			||||||
          << "threads = " << t;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9MultiThreadedFrameParallel, InvalidFileTest) {
 | 
					 | 
				
			||||||
  static const FileList files[] = {
 | 
					 | 
				
			||||||
    // invalid-vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
 | 
					 | 
				
			||||||
    // one key frame for every ten frames. The 11th frame has corrupted data.
 | 
					 | 
				
			||||||
    { "invalid-vp90-2-07-frame_parallel-1.webm",
 | 
					 | 
				
			||||||
      "0549d0f45f60deaef8eb708e6c0eb6cb", 30 },
 | 
					 | 
				
			||||||
    // invalid-vp90-2-07-frame_parallel-2.webm is a 40 frame video file with
 | 
					 | 
				
			||||||
    // one key frame for every ten frames. The 1st and 31st frames have
 | 
					 | 
				
			||||||
    // corrupted data.
 | 
					 | 
				
			||||||
    { "invalid-vp90-2-07-frame_parallel-2.webm",
 | 
					 | 
				
			||||||
      "6a1f3cf6f9e7a364212fadb9580d525e", 20 },
 | 
					 | 
				
			||||||
    // invalid-vp90-2-07-frame_parallel-3.webm is a 40 frame video file with
 | 
					 | 
				
			||||||
    // one key frame for every ten frames. The 5th and 13th frames have
 | 
					 | 
				
			||||||
    // corrupted data.
 | 
					 | 
				
			||||||
    { "invalid-vp90-2-07-frame_parallel-3.webm",
 | 
					 | 
				
			||||||
      "8256544308de926b0681e04685b98677", 27 },
 | 
					 | 
				
			||||||
    { NULL, NULL, 0 },
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  DecodeFiles(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {
 | 
					 | 
				
			||||||
  static const FileList files[] = {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					 | 
				
			||||||
    { "vp92-2-20-10bit-yuv420.webm",
 | 
					 | 
				
			||||||
      "a16b99df180c584e8db2ffeda987d293", 10 },
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    { NULL, NULL, 0 },
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  DecodeFiles(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -18,8 +18,8 @@
 | 
				
			|||||||
#include "test/clear_system_state.h"
 | 
					#include "test/clear_system_state.h"
 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					#include "test/register_state_check.h"
 | 
				
			||||||
#include "test/util.h"
 | 
					#include "test/util.h"
 | 
				
			||||||
#include "vp9/common/vp9_blockd.h"
 | 
					#include "vp10/common/blockd.h"
 | 
				
			||||||
#include "vp9/common/vp9_pred_common.h"
 | 
					#include "vp10/common/pred_common.h"
 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					#include "vpx_mem/vpx_mem.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,10 +123,6 @@ TEST_P(LosslessTest, TestLossLessEncodingCtrl) {
 | 
				
			|||||||
  EXPECT_GE(psnr_lossless, kMaxPsnr);
 | 
					  EXPECT_GE(psnr_lossless, kMaxPsnr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP9_INSTANTIATE_TEST_CASE(LosslessTest,
 | 
					 | 
				
			||||||
                          ::testing::Values(::libvpx_test::kRealTime,
 | 
					 | 
				
			||||||
                                            ::libvpx_test::kOnePassGood,
 | 
					 | 
				
			||||||
                                            ::libvpx_test::kTwoPassGood));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_INSTANTIATE_TEST_CASE(LosslessTest,
 | 
					VP10_INSTANTIATE_TEST_CASE(LosslessTest,
 | 
				
			||||||
                           ::testing::Values(::libvpx_test::kOnePassGood,
 | 
					                           ::testing::Values(::libvpx_test::kOnePassGood,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,351 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "./vpx_dsp_rtcd.h"
 | 
					 | 
				
			||||||
#include "test/acm_random.h"
 | 
					 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#include "vp9/common/vp9_entropy.h"
 | 
					 | 
				
			||||||
#include "vp9/common/vp9_scan.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_codec.h"
 | 
					 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using libvpx_test::ACMRandom;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					 | 
				
			||||||
const int number_of_iterations = 100;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
 | 
					 | 
				
			||||||
                             int skip_block, const int16_t *zbin,
 | 
					 | 
				
			||||||
                             const int16_t *round, const int16_t *quant,
 | 
					 | 
				
			||||||
                             const int16_t *quant_shift,
 | 
					 | 
				
			||||||
                             tran_low_t *qcoeff, tran_low_t *dqcoeff,
 | 
					 | 
				
			||||||
                             const int16_t *dequant,
 | 
					 | 
				
			||||||
                             uint16_t *eob, const int16_t *scan,
 | 
					 | 
				
			||||||
                             const int16_t *iscan);
 | 
					 | 
				
			||||||
typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
 | 
					 | 
				
			||||||
    QuantizeParam;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~VP9QuantizeTest() {}
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    quantize_op_   = GET_PARAM(0);
 | 
					 | 
				
			||||||
    ref_quantize_op_ = GET_PARAM(1);
 | 
					 | 
				
			||||||
    bit_depth_  = GET_PARAM(2);
 | 
					 | 
				
			||||||
    mask_ = (1 << bit_depth_) - 1;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() { libvpx_test::ClearSystemState(); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  vpx_bit_depth_t bit_depth_;
 | 
					 | 
				
			||||||
  int mask_;
 | 
					 | 
				
			||||||
  QuantizeFunc quantize_op_;
 | 
					 | 
				
			||||||
  QuantizeFunc ref_quantize_op_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~VP9Quantize32Test() {}
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    quantize_op_   = GET_PARAM(0);
 | 
					 | 
				
			||||||
    ref_quantize_op_ = GET_PARAM(1);
 | 
					 | 
				
			||||||
    bit_depth_  = GET_PARAM(2);
 | 
					 | 
				
			||||||
    mask_ = (1 << bit_depth_) - 1;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() { libvpx_test::ClearSystemState(); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  vpx_bit_depth_t bit_depth_;
 | 
					 | 
				
			||||||
  int mask_;
 | 
					 | 
				
			||||||
  QuantizeFunc quantize_op_;
 | 
					 | 
				
			||||||
  QuantizeFunc ref_quantize_op_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VP9QuantizeTest, OperationCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
 | 
					 | 
				
			||||||
  int err_count_total = 0;
 | 
					 | 
				
			||||||
  int first_failure = -1;
 | 
					 | 
				
			||||||
  for (int i = 0; i < number_of_iterations; ++i) {
 | 
					 | 
				
			||||||
    const int skip_block = i == 0;
 | 
					 | 
				
			||||||
    const TX_SIZE sz = (TX_SIZE)(i % 3);  // TX_4X4, TX_8X8 TX_16X16
 | 
					 | 
				
			||||||
    const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
 | 
					 | 
				
			||||||
    const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
 | 
					 | 
				
			||||||
    const int count = (4 << sz) * (4 << sz);  // 16, 64, 256
 | 
					 | 
				
			||||||
    int err_count = 0;
 | 
					 | 
				
			||||||
    *eob_ptr = rnd.Rand16();
 | 
					 | 
				
			||||||
    *ref_eob_ptr = *eob_ptr;
 | 
					 | 
				
			||||||
    for (int j = 0; j < count; j++) {
 | 
					 | 
				
			||||||
      coeff_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    for (int j = 0; j < 2; j++) {
 | 
					 | 
				
			||||||
      zbin_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
      round_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_shift_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      dequant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
 | 
					 | 
				
			||||||
                     quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
 | 
					 | 
				
			||||||
                     ref_dqcoeff_ptr, dequant_ptr,
 | 
					 | 
				
			||||||
                     ref_eob_ptr, scan_order->scan, scan_order->iscan);
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
 | 
					 | 
				
			||||||
                                          zbin_ptr, round_ptr, quant_ptr,
 | 
					 | 
				
			||||||
                                          quant_shift_ptr, qcoeff_ptr,
 | 
					 | 
				
			||||||
                                          dqcoeff_ptr, dequant_ptr, eob_ptr,
 | 
					 | 
				
			||||||
                                          scan_order->scan, scan_order->iscan));
 | 
					 | 
				
			||||||
    for (int j = 0; j < sz; ++j) {
 | 
					 | 
				
			||||||
      err_count += (ref_qcoeff_ptr[j]  != qcoeff_ptr[j]) |
 | 
					 | 
				
			||||||
          (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count += (*ref_eob_ptr != *eob_ptr);
 | 
					 | 
				
			||||||
    if (err_count && !err_count_total) {
 | 
					 | 
				
			||||||
      first_failure = i;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count_total += err_count;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, err_count_total)
 | 
					 | 
				
			||||||
      << "Error: Quantization Test, C output doesn't match SSE2 output. "
 | 
					 | 
				
			||||||
      << "First failed at test case " << first_failure;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VP9Quantize32Test, OperationCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
 | 
					 | 
				
			||||||
  int err_count_total = 0;
 | 
					 | 
				
			||||||
  int first_failure = -1;
 | 
					 | 
				
			||||||
  for (int i = 0; i < number_of_iterations; ++i) {
 | 
					 | 
				
			||||||
    const int skip_block = i == 0;
 | 
					 | 
				
			||||||
    const TX_SIZE sz = TX_32X32;
 | 
					 | 
				
			||||||
    const TX_TYPE tx_type = (TX_TYPE)(i % 4);
 | 
					 | 
				
			||||||
    const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
 | 
					 | 
				
			||||||
    const int count = (4 << sz) * (4 << sz);  // 1024
 | 
					 | 
				
			||||||
    int err_count = 0;
 | 
					 | 
				
			||||||
    *eob_ptr = rnd.Rand16();
 | 
					 | 
				
			||||||
    *ref_eob_ptr = *eob_ptr;
 | 
					 | 
				
			||||||
    for (int j = 0; j < count; j++) {
 | 
					 | 
				
			||||||
      coeff_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    for (int j = 0; j < 2; j++) {
 | 
					 | 
				
			||||||
      zbin_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
      round_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_shift_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      dequant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
 | 
					 | 
				
			||||||
                     quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
 | 
					 | 
				
			||||||
                     ref_dqcoeff_ptr, dequant_ptr,
 | 
					 | 
				
			||||||
                     ref_eob_ptr, scan_order->scan, scan_order->iscan);
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
 | 
					 | 
				
			||||||
                                          zbin_ptr, round_ptr, quant_ptr,
 | 
					 | 
				
			||||||
                                          quant_shift_ptr, qcoeff_ptr,
 | 
					 | 
				
			||||||
                                          dqcoeff_ptr, dequant_ptr, eob_ptr,
 | 
					 | 
				
			||||||
                                          scan_order->scan, scan_order->iscan));
 | 
					 | 
				
			||||||
    for (int j = 0; j < sz; ++j) {
 | 
					 | 
				
			||||||
      err_count += (ref_qcoeff_ptr[j]  != qcoeff_ptr[j]) |
 | 
					 | 
				
			||||||
          (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count += (*ref_eob_ptr != *eob_ptr);
 | 
					 | 
				
			||||||
    if (err_count && !err_count_total) {
 | 
					 | 
				
			||||||
      first_failure = i;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count_total += err_count;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, err_count_total)
 | 
					 | 
				
			||||||
      << "Error: Quantization Test, C output doesn't match SSE2 output. "
 | 
					 | 
				
			||||||
      << "First failed at test case " << first_failure;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VP9QuantizeTest, EOBCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
 | 
					 | 
				
			||||||
  int err_count_total = 0;
 | 
					 | 
				
			||||||
  int first_failure = -1;
 | 
					 | 
				
			||||||
  for (int i = 0; i < number_of_iterations; ++i) {
 | 
					 | 
				
			||||||
    int skip_block = i == 0;
 | 
					 | 
				
			||||||
    TX_SIZE sz = (TX_SIZE)(i % 3);  // TX_4X4, TX_8X8 TX_16X16
 | 
					 | 
				
			||||||
    TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
 | 
					 | 
				
			||||||
    const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
 | 
					 | 
				
			||||||
    int count = (4 << sz) * (4 << sz);  // 16, 64, 256
 | 
					 | 
				
			||||||
    int err_count = 0;
 | 
					 | 
				
			||||||
    *eob_ptr = rnd.Rand16();
 | 
					 | 
				
			||||||
    *ref_eob_ptr = *eob_ptr;
 | 
					 | 
				
			||||||
    // Two random entries
 | 
					 | 
				
			||||||
    for (int j = 0; j < count; j++) {
 | 
					 | 
				
			||||||
      coeff_ptr[j] = 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    for (int j = 0; j < 2; j++) {
 | 
					 | 
				
			||||||
      zbin_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
      round_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_shift_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      dequant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
 | 
					 | 
				
			||||||
                     quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
 | 
					 | 
				
			||||||
                     ref_dqcoeff_ptr, dequant_ptr,
 | 
					 | 
				
			||||||
                     ref_eob_ptr, scan_order->scan, scan_order->iscan);
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
 | 
					 | 
				
			||||||
                                          zbin_ptr, round_ptr, quant_ptr,
 | 
					 | 
				
			||||||
                                          quant_shift_ptr, qcoeff_ptr,
 | 
					 | 
				
			||||||
                                          dqcoeff_ptr, dequant_ptr, eob_ptr,
 | 
					 | 
				
			||||||
                                          scan_order->scan, scan_order->iscan));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int j = 0; j < sz; ++j) {
 | 
					 | 
				
			||||||
      err_count += (ref_qcoeff_ptr[j]  != qcoeff_ptr[j]) |
 | 
					 | 
				
			||||||
          (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count += (*ref_eob_ptr != *eob_ptr);
 | 
					 | 
				
			||||||
    if (err_count && !err_count_total) {
 | 
					 | 
				
			||||||
      first_failure = i;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count_total += err_count;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, err_count_total)
 | 
					 | 
				
			||||||
      << "Error: Quantization Test, C output doesn't match SSE2 output. "
 | 
					 | 
				
			||||||
      << "First failed at test case " << first_failure;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VP9Quantize32Test, EOBCheck) {
 | 
					 | 
				
			||||||
  ACMRandom rnd(ACMRandom::DeterministicSeed());
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
 | 
					 | 
				
			||||||
  DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
 | 
					 | 
				
			||||||
  int err_count_total = 0;
 | 
					 | 
				
			||||||
  int first_failure = -1;
 | 
					 | 
				
			||||||
  for (int i = 0; i < number_of_iterations; ++i) {
 | 
					 | 
				
			||||||
    int skip_block = i == 0;
 | 
					 | 
				
			||||||
    TX_SIZE sz = TX_32X32;
 | 
					 | 
				
			||||||
    TX_TYPE tx_type = (TX_TYPE)(i % 4);
 | 
					 | 
				
			||||||
    const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
 | 
					 | 
				
			||||||
    int count = (4 << sz) * (4 << sz);  // 1024
 | 
					 | 
				
			||||||
    int err_count = 0;
 | 
					 | 
				
			||||||
    *eob_ptr = rnd.Rand16();
 | 
					 | 
				
			||||||
    *ref_eob_ptr = *eob_ptr;
 | 
					 | 
				
			||||||
    for (int j = 0; j < count; j++) {
 | 
					 | 
				
			||||||
      coeff_ptr[j] = 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // Two random entries
 | 
					 | 
				
			||||||
    coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
    for (int j = 0; j < 2; j++) {
 | 
					 | 
				
			||||||
      zbin_ptr[j] = rnd.Rand16()&mask_;
 | 
					 | 
				
			||||||
      round_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      quant_shift_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
      dequant_ptr[j] = rnd.Rand16();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
 | 
					 | 
				
			||||||
                     quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
 | 
					 | 
				
			||||||
                     ref_dqcoeff_ptr, dequant_ptr,
 | 
					 | 
				
			||||||
                     ref_eob_ptr, scan_order->scan, scan_order->iscan);
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
 | 
					 | 
				
			||||||
                                          zbin_ptr, round_ptr, quant_ptr,
 | 
					 | 
				
			||||||
                                          quant_shift_ptr, qcoeff_ptr,
 | 
					 | 
				
			||||||
                                          dqcoeff_ptr, dequant_ptr, eob_ptr,
 | 
					 | 
				
			||||||
                                          scan_order->scan, scan_order->iscan));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int j = 0; j < sz; ++j) {
 | 
					 | 
				
			||||||
      err_count += (ref_qcoeff_ptr[j]  != qcoeff_ptr[j]) |
 | 
					 | 
				
			||||||
          (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count += (*ref_eob_ptr != *eob_ptr);
 | 
					 | 
				
			||||||
    if (err_count && !err_count_total) {
 | 
					 | 
				
			||||||
      first_failure = i;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    err_count_total += err_count;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, err_count_total)
 | 
					 | 
				
			||||||
      << "Error: Quantization Test, C output doesn't match SSE2 output. "
 | 
					 | 
				
			||||||
      << "First failed at test case " << first_failure;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
using std::tr1::make_tuple;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if HAVE_SSE2
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    SSE2, VP9QuantizeTest,
 | 
					 | 
				
			||||||
    ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_c, VPX_BITS_8),
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_c, VPX_BITS_10),
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_c, VPX_BITS_12)));
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(
 | 
					 | 
				
			||||||
    SSE2, VP9Quantize32Test,
 | 
					 | 
				
			||||||
    ::testing::Values(
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
 | 
					 | 
				
			||||||
        make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
 | 
					 | 
				
			||||||
                   &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
 | 
					 | 
				
			||||||
#endif  // HAVE_SSE2
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP9_HIGHBITDEPTH
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,180 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2015 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/decode_test_driver.h"
 | 
					 | 
				
			||||||
#include "test/md5_helper.h"
 | 
					 | 
				
			||||||
#include "test/util.h"
 | 
					 | 
				
			||||||
#include "test/webm_video_source.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const char kVp9TestFile[] = "vp90-2-08-tile_1x8_frame_parallel.webm";
 | 
					 | 
				
			||||||
const char kVp9Md5File[] = "vp90-2-08-tile_1x8_frame_parallel.webm.md5";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Class for testing shutting off the loop filter.
 | 
					 | 
				
			||||||
class SkipLoopFilterTest {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  SkipLoopFilterTest()
 | 
					 | 
				
			||||||
      : video_(NULL),
 | 
					 | 
				
			||||||
        decoder_(NULL),
 | 
					 | 
				
			||||||
        md5_file_(NULL) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ~SkipLoopFilterTest() {
 | 
					 | 
				
			||||||
    if (md5_file_ != NULL)
 | 
					 | 
				
			||||||
      fclose(md5_file_);
 | 
					 | 
				
			||||||
    delete decoder_;
 | 
					 | 
				
			||||||
    delete video_;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // If |threads| > 0 then set the decoder with that number of threads.
 | 
					 | 
				
			||||||
  void Init(int num_threads) {
 | 
					 | 
				
			||||||
    expected_md5_[0] = '\0';
 | 
					 | 
				
			||||||
    junk_[0] = '\0';
 | 
					 | 
				
			||||||
    video_ = new libvpx_test::WebMVideoSource(kVp9TestFile);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(video_ != NULL);
 | 
					 | 
				
			||||||
    video_->Init();
 | 
					 | 
				
			||||||
    video_->Begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
    if (num_threads > 0)
 | 
					 | 
				
			||||||
      cfg.threads = num_threads;
 | 
					 | 
				
			||||||
    decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(decoder_ != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    OpenMd5File(kVp9Md5File);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Set the VP9 skipLoopFilter control value.
 | 
					 | 
				
			||||||
  void SetSkipLoopFilter(int value, vpx_codec_err_t expected_value) {
 | 
					 | 
				
			||||||
    decoder_->Control(VP9_SET_SKIP_LOOP_FILTER, value, expected_value);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeOneFrame() {
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
    if (res == VPX_CODEC_OK) {
 | 
					 | 
				
			||||||
      ReadMd5();
 | 
					 | 
				
			||||||
      video_->Next();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return res;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_err_t DecodeRemainingFrames() {
 | 
					 | 
				
			||||||
    for (; video_->cxdata() != NULL; video_->Next()) {
 | 
					 | 
				
			||||||
      const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
          decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
 | 
					 | 
				
			||||||
      if (res != VPX_CODEC_OK)
 | 
					 | 
				
			||||||
        return res;
 | 
					 | 
				
			||||||
      ReadMd5();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return VPX_CODEC_OK;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Checks if MD5 matches or doesn't.
 | 
					 | 
				
			||||||
  void CheckMd5(bool matches) {
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img = dec_iter.Next();
 | 
					 | 
				
			||||||
    CheckMd5Vpx(*img, matches);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 private:
 | 
					 | 
				
			||||||
  // TODO(fgalligan): Move the MD5 testing code into another class.
 | 
					 | 
				
			||||||
  void OpenMd5File(const std::string &md5_file_name) {
 | 
					 | 
				
			||||||
    md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name);
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
 | 
					 | 
				
			||||||
        << md5_file_name;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Reads the next line of the MD5 file.
 | 
					 | 
				
			||||||
  void ReadMd5() {
 | 
					 | 
				
			||||||
    ASSERT_TRUE(md5_file_ != NULL);
 | 
					 | 
				
			||||||
    const int res = fscanf(md5_file_, "%s  %s", expected_md5_, junk_);
 | 
					 | 
				
			||||||
    ASSERT_NE(EOF, res) << "Read md5 data failed";
 | 
					 | 
				
			||||||
    expected_md5_[32] = '\0';
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Checks if the last read MD5 matches |img| or doesn't.
 | 
					 | 
				
			||||||
  void CheckMd5Vpx(const vpx_image_t &img, bool matches) {
 | 
					 | 
				
			||||||
    ::libvpx_test::MD5 md5_res;
 | 
					 | 
				
			||||||
    md5_res.Add(&img);
 | 
					 | 
				
			||||||
    const char *const actual_md5 = md5_res.Get();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check MD5.
 | 
					 | 
				
			||||||
    if (matches)
 | 
					 | 
				
			||||||
      ASSERT_STREQ(expected_md5_, actual_md5) << "MD5 checksums don't match";
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      ASSERT_STRNE(expected_md5_, actual_md5) << "MD5 checksums match";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource *video_;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder *decoder_;
 | 
					 | 
				
			||||||
  FILE *md5_file_;
 | 
					 | 
				
			||||||
  char expected_md5_[33];
 | 
					 | 
				
			||||||
  char junk_[128];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(SkipLoopFilterTest, ShutOffLoopFilter) {
 | 
					 | 
				
			||||||
  const int non_zero_value = 1;
 | 
					 | 
				
			||||||
  const int num_threads = 0;
 | 
					 | 
				
			||||||
  SkipLoopFilterTest skip_loop_filter;
 | 
					 | 
				
			||||||
  skip_loop_filter.Init(num_threads);
 | 
					 | 
				
			||||||
  skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
 | 
					 | 
				
			||||||
  skip_loop_filter.CheckMd5(false);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(SkipLoopFilterTest, ShutOffLoopFilterSingleThread) {
 | 
					 | 
				
			||||||
  const int non_zero_value = 1;
 | 
					 | 
				
			||||||
  const int num_threads = 1;
 | 
					 | 
				
			||||||
  SkipLoopFilterTest skip_loop_filter;
 | 
					 | 
				
			||||||
  skip_loop_filter.Init(num_threads);
 | 
					 | 
				
			||||||
  skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
 | 
					 | 
				
			||||||
  skip_loop_filter.CheckMd5(false);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(SkipLoopFilterTest, ShutOffLoopFilter8Threads) {
 | 
					 | 
				
			||||||
  const int non_zero_value = 1;
 | 
					 | 
				
			||||||
  const int num_threads = 8;
 | 
					 | 
				
			||||||
  SkipLoopFilterTest skip_loop_filter;
 | 
					 | 
				
			||||||
  skip_loop_filter.Init(num_threads);
 | 
					 | 
				
			||||||
  skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
 | 
					 | 
				
			||||||
  skip_loop_filter.CheckMd5(false);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(SkipLoopFilterTest, WithLoopFilter) {
 | 
					 | 
				
			||||||
  const int non_zero_value = 1;
 | 
					 | 
				
			||||||
  const int num_threads = 0;
 | 
					 | 
				
			||||||
  SkipLoopFilterTest skip_loop_filter;
 | 
					 | 
				
			||||||
  skip_loop_filter.Init(num_threads);
 | 
					 | 
				
			||||||
  skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  skip_loop_filter.SetSkipLoopFilter(0, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
 | 
					 | 
				
			||||||
  skip_loop_filter.CheckMd5(true);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(SkipLoopFilterTest, ToggleLoopFilter) {
 | 
					 | 
				
			||||||
  const int num_threads = 0;
 | 
					 | 
				
			||||||
  SkipLoopFilterTest skip_loop_filter;
 | 
					 | 
				
			||||||
  skip_loop_filter.Init(num_threads);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < 10; ++i) {
 | 
					 | 
				
			||||||
    skip_loop_filter.SetSkipLoopFilter(i % 2, VPX_CODEC_OK);
 | 
					 | 
				
			||||||
    ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeOneFrame());
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
 | 
					 | 
				
			||||||
  skip_loop_filter.CheckMd5(false);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,326 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "test/codec_factory.h"
 | 
					 | 
				
			||||||
#include "test/decode_test_driver.h"
 | 
					 | 
				
			||||||
#include "test/md5_helper.h"
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
#include "test/webm_video_source.h"
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#include "vpx_util/vpx_thread.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using std::string;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual ~VPxWorkerThreadTest() {}
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    vpx_get_worker_interface()->init(&worker_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual void TearDown() {
 | 
					 | 
				
			||||||
    vpx_get_worker_interface()->end(&worker_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void Run(VPxWorker* worker) {
 | 
					 | 
				
			||||||
    const bool synchronous = GetParam();
 | 
					 | 
				
			||||||
    if (synchronous) {
 | 
					 | 
				
			||||||
      vpx_get_worker_interface()->execute(worker);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      vpx_get_worker_interface()->launch(worker);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  VPxWorker worker_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int ThreadHook(void* data, void* return_value) {
 | 
					 | 
				
			||||||
  int* const hook_data = reinterpret_cast<int*>(data);
 | 
					 | 
				
			||||||
  *hook_data = 5;
 | 
					 | 
				
			||||||
  return *reinterpret_cast<int*>(return_value);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VPxWorkerThreadTest, HookSuccess) {
 | 
					 | 
				
			||||||
  // should be a no-op.
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < 2; ++i) {
 | 
					 | 
				
			||||||
    EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    int hook_data = 0;
 | 
					 | 
				
			||||||
    int return_value = 1;  // return successfully from the hook
 | 
					 | 
				
			||||||
    worker_.hook = ThreadHook;
 | 
					 | 
				
			||||||
    worker_.data1 = &hook_data;
 | 
					 | 
				
			||||||
    worker_.data2 = &return_value;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Run(&worker_);
 | 
					 | 
				
			||||||
    EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
 | 
					 | 
				
			||||||
    EXPECT_FALSE(worker_.had_error);
 | 
					 | 
				
			||||||
    EXPECT_EQ(5, hook_data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // should be a no-op.
 | 
					 | 
				
			||||||
    EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VPxWorkerThreadTest, HookFailure) {
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int hook_data = 0;
 | 
					 | 
				
			||||||
  int return_value = 0;  // return failure from the hook
 | 
					 | 
				
			||||||
  worker_.hook = ThreadHook;
 | 
					 | 
				
			||||||
  worker_.data1 = &hook_data;
 | 
					 | 
				
			||||||
  worker_.data2 = &return_value;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Run(&worker_);
 | 
					 | 
				
			||||||
  EXPECT_FALSE(vpx_get_worker_interface()->sync(&worker_));
 | 
					 | 
				
			||||||
  EXPECT_EQ(1, worker_.had_error);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Ensure _reset() clears the error and _launch() can be called again.
 | 
					 | 
				
			||||||
  return_value = 1;
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
 | 
					 | 
				
			||||||
  EXPECT_FALSE(worker_.had_error);
 | 
					 | 
				
			||||||
  vpx_get_worker_interface()->launch(&worker_);
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
 | 
					 | 
				
			||||||
  EXPECT_FALSE(worker_.had_error);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(VPxWorkerThreadTest, EndWithoutSync) {
 | 
					 | 
				
			||||||
  // Create a large number of threads to increase the chances of detecting a
 | 
					 | 
				
			||||||
  // race. Doing more work in the hook is no guarantee as any race would occur
 | 
					 | 
				
			||||||
  // post hook execution in the main thread loop driver.
 | 
					 | 
				
			||||||
  static const int kNumWorkers = 64;
 | 
					 | 
				
			||||||
  VPxWorker workers[kNumWorkers];
 | 
					 | 
				
			||||||
  int hook_data[kNumWorkers];
 | 
					 | 
				
			||||||
  int return_value[kNumWorkers];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int n = 0; n < kNumWorkers; ++n) {
 | 
					 | 
				
			||||||
    vpx_get_worker_interface()->init(&workers[n]);
 | 
					 | 
				
			||||||
    return_value[n] = 1;  // return successfully from the hook
 | 
					 | 
				
			||||||
    workers[n].hook = ThreadHook;
 | 
					 | 
				
			||||||
    workers[n].data1 = &hook_data[n];
 | 
					 | 
				
			||||||
    workers[n].data2 = &return_value[n];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (int i = 0; i < 2; ++i) {
 | 
					 | 
				
			||||||
    for (int n = 0; n < kNumWorkers; ++n) {
 | 
					 | 
				
			||||||
      EXPECT_NE(vpx_get_worker_interface()->reset(&workers[n]), 0);
 | 
					 | 
				
			||||||
      hook_data[n] = 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int n = 0; n < kNumWorkers; ++n) {
 | 
					 | 
				
			||||||
      Run(&workers[n]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int n = kNumWorkers - 1; n >= 0; --n) {
 | 
					 | 
				
			||||||
      vpx_get_worker_interface()->end(&workers[n]);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VPxWorkerThreadTest, TestInterfaceAPI) {
 | 
					 | 
				
			||||||
  EXPECT_EQ(0, vpx_set_worker_interface(NULL));
 | 
					 | 
				
			||||||
  EXPECT_TRUE(vpx_get_worker_interface() != NULL);
 | 
					 | 
				
			||||||
  for (int i = 0; i < 6; ++i) {
 | 
					 | 
				
			||||||
    VPxWorkerInterface winterface = *vpx_get_worker_interface();
 | 
					 | 
				
			||||||
    switch (i) {
 | 
					 | 
				
			||||||
      default:
 | 
					 | 
				
			||||||
      case 0: winterface.init = NULL; break;
 | 
					 | 
				
			||||||
      case 1: winterface.reset = NULL; break;
 | 
					 | 
				
			||||||
      case 2: winterface.sync = NULL; break;
 | 
					 | 
				
			||||||
      case 3: winterface.launch = NULL; break;
 | 
					 | 
				
			||||||
      case 4: winterface.execute = NULL; break;
 | 
					 | 
				
			||||||
      case 5: winterface.end = NULL; break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    EXPECT_EQ(0, vpx_set_worker_interface(&winterface));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// -----------------------------------------------------------------------------
 | 
					 | 
				
			||||||
// Multi-threaded decode tests
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
struct FileList {
 | 
					 | 
				
			||||||
  const char *name;
 | 
					 | 
				
			||||||
  const char *expected_md5;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.
 | 
					 | 
				
			||||||
string DecodeFile(const string& filename, int num_threads) {
 | 
					 | 
				
			||||||
  libvpx_test::WebMVideoSource video(filename);
 | 
					 | 
				
			||||||
  video.Init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
 | 
					 | 
				
			||||||
  cfg.threads = num_threads;
 | 
					 | 
				
			||||||
  libvpx_test::VP9Decoder decoder(cfg, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  libvpx_test::MD5 md5;
 | 
					 | 
				
			||||||
  for (video.Begin(); video.cxdata(); video.Next()) {
 | 
					 | 
				
			||||||
    const vpx_codec_err_t res =
 | 
					 | 
				
			||||||
        decoder.DecodeFrame(video.cxdata(), video.frame_size());
 | 
					 | 
				
			||||||
    if (res != VPX_CODEC_OK) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
 | 
					 | 
				
			||||||
    const vpx_image_t *img = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Get decompressed data
 | 
					 | 
				
			||||||
    while ((img = dec_iter.Next())) {
 | 
					 | 
				
			||||||
      md5.Add(img);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return string(md5.Get());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void DecodeFiles(const FileList files[]) {
 | 
					 | 
				
			||||||
  for (const FileList *iter = files; iter->name != NULL; ++iter) {
 | 
					 | 
				
			||||||
    SCOPED_TRACE(iter->name);
 | 
					 | 
				
			||||||
    for (int t = 1; t <= 8; ++t) {
 | 
					 | 
				
			||||||
      EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t))
 | 
					 | 
				
			||||||
          << "threads = " << t;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Trivial serialized thread worker interface implementation.
 | 
					 | 
				
			||||||
// Note any worker that requires synchronization between other workers will
 | 
					 | 
				
			||||||
// hang.
 | 
					 | 
				
			||||||
namespace impl {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Init(VPxWorker *const worker) { memset(worker, 0, sizeof(*worker)); }
 | 
					 | 
				
			||||||
int Reset(VPxWorker *const /*worker*/) { return 1; }
 | 
					 | 
				
			||||||
int Sync(VPxWorker *const worker) { return !worker->had_error; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Execute(VPxWorker *const worker) {
 | 
					 | 
				
			||||||
  worker->had_error |= !worker->hook(worker->data1, worker->data2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Launch(VPxWorker *const worker) { Execute(worker); }
 | 
					 | 
				
			||||||
void End(VPxWorker *const /*worker*/) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace impl
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VPxWorkerThreadTest, TestSerialInterface) {
 | 
					 | 
				
			||||||
  static const VPxWorkerInterface serial_interface = {
 | 
					 | 
				
			||||||
    impl::Init, impl::Reset, impl::Sync, impl::Launch, impl::Execute, impl::End
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  // TODO(jzern): Avoid using a file that will use the row-based thread
 | 
					 | 
				
			||||||
  // loopfilter, with the simple serialized implementation it will hang. This is
 | 
					 | 
				
			||||||
  // due to its expectation that rows will be run in parallel as they wait on
 | 
					 | 
				
			||||||
  // progress in the row above before proceeding.
 | 
					 | 
				
			||||||
  static const char expected_md5[] = "b35a1b707b28e82be025d960aba039bc";
 | 
					 | 
				
			||||||
  static const char filename[] = "vp90-2-03-size-226x226.webm";
 | 
					 | 
				
			||||||
  VPxWorkerInterface default_interface = *vpx_get_worker_interface();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_set_worker_interface(&serial_interface), 0);
 | 
					 | 
				
			||||||
  EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Reset the interface.
 | 
					 | 
				
			||||||
  EXPECT_NE(vpx_set_worker_interface(&default_interface), 0);
 | 
					 | 
				
			||||||
  EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9DecodeMultiThreadedTest, NoTilesNonFrameParallel) {
 | 
					 | 
				
			||||||
  // no tiles or frame parallel; this exercises loop filter threading.
 | 
					 | 
				
			||||||
  EXPECT_EQ("b35a1b707b28e82be025d960aba039bc",
 | 
					 | 
				
			||||||
            DecodeFile("vp90-2-03-size-226x226.webm", 2));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9DecodeMultiThreadedTest, FrameParallel) {
 | 
					 | 
				
			||||||
  static const FileList files[] = {
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x2_frame_parallel.webm",
 | 
					 | 
				
			||||||
      "68ede6abd66bae0a2edf2eb9232241b6" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x4_frame_parallel.webm",
 | 
					 | 
				
			||||||
      "368ebc6ebf3a5e478d85b2c3149b2848" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x8_frame_parallel.webm",
 | 
					 | 
				
			||||||
      "17e439da2388aff3a0f69cb22579c6c1" },
 | 
					 | 
				
			||||||
    { NULL, NULL }
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  DecodeFiles(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9DecodeMultiThreadedTest, FrameParallelResize) {
 | 
					 | 
				
			||||||
  static const FileList files[] = {
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-1-16.webm",
 | 
					 | 
				
			||||||
      "0cd5e632c326297e975f38949c31ea94" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm",
 | 
					 | 
				
			||||||
      "5c78a96a42e7f4a4f6b2edcdb791e44c" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-1-2.webm",
 | 
					 | 
				
			||||||
      "e030450ae85c3277be2a418769df98e2" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-1-4.webm",
 | 
					 | 
				
			||||||
      "312eed4e2b64eb7a4e7f18916606a430" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-16-1.webm",
 | 
					 | 
				
			||||||
      "1755c16d8af16a9cb3fe7338d90abe52" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-16-2.webm",
 | 
					 | 
				
			||||||
      "500300592d3fcb6f12fab25e48aaf4df" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-16-4.webm",
 | 
					 | 
				
			||||||
      "47c48379fa6331215d91c67648e1af6e" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm",
 | 
					 | 
				
			||||||
      "eecf17290739bc708506fa4827665989" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-16-8.webm",
 | 
					 | 
				
			||||||
      "29b6bb54e4c26b5ca85d5de5fed94e76" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-1-8.webm",
 | 
					 | 
				
			||||||
      "1b6f175e08cd82cf84bb800ac6d1caa3" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-2-16.webm",
 | 
					 | 
				
			||||||
      "ca3b03e4197995d8d5444ede7a6c0804" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-2-1.webm",
 | 
					 | 
				
			||||||
      "99aec065369d70bbb78ccdff65afed3f" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-2-4.webm",
 | 
					 | 
				
			||||||
      "22d0ebdb49b87d2920a85aea32e1afd5" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-2-8.webm",
 | 
					 | 
				
			||||||
      "c2115cf051c62e0f7db1d4a783831541" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-4-16.webm",
 | 
					 | 
				
			||||||
      "c690d7e1719b31367564cac0af0939cb" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-4-1.webm",
 | 
					 | 
				
			||||||
      "a926020b2cc3e15ad4cc271853a0ff26" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-4-2.webm",
 | 
					 | 
				
			||||||
      "42699063d9e581f1993d0cf890c2be78" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-4-8.webm",
 | 
					 | 
				
			||||||
      "7f76d96036382f45121e3d5aa6f8ec52" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-8-16.webm",
 | 
					 | 
				
			||||||
      "76a43fcdd7e658542913ea43216ec55d" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-8-1.webm",
 | 
					 | 
				
			||||||
      "8e3fbe89486ca60a59299dea9da91378" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-8-2.webm",
 | 
					 | 
				
			||||||
      "ae96f21f21b6370cc0125621b441fc52" },
 | 
					 | 
				
			||||||
    { "vp90-2-14-resize-fp-tiles-8-4.webm",
 | 
					 | 
				
			||||||
      "3eb4f24f10640d42218f7fd7b9fd30d4" },
 | 
					 | 
				
			||||||
    { NULL, NULL }
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  DecodeFiles(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST(VP9DecodeMultiThreadedTest, NonFrameParallel) {
 | 
					 | 
				
			||||||
  static const FileList files[] = {
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x2.webm", "570b4a5d5a70d58b5359671668328a16" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x4.webm", "988d86049e884c66909d2d163a09841a" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile_1x8.webm", "0941902a52e9092cb010905eab16364c" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile-4x1.webm", "06505aade6647c583c8e00a2f582266f" },
 | 
					 | 
				
			||||||
    { "vp90-2-08-tile-4x4.webm", "85c2299892460d76e2c600502d52bfe2" },
 | 
					 | 
				
			||||||
    { NULL, NULL }
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  DecodeFiles(files);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif  // CONFIG_WEBM_IO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(Synchronous, VPxWorkerThreadTest, ::testing::Bool());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -1,255 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  Use of this source code is governed by a BSD-style license
 | 
					 | 
				
			||||||
 *  that can be found in the LICENSE file in the root of the source
 | 
					 | 
				
			||||||
 *  tree. An additional intellectual property rights grant can be found
 | 
					 | 
				
			||||||
 *  in the file PATENTS.  All contributing project authors may
 | 
					 | 
				
			||||||
 *  be found in the AUTHORS file in the root of the source tree.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "third_party/googletest/src/include/gtest/gtest.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "./vpx_config.h"
 | 
					 | 
				
			||||||
#include "./vpx_scale_rtcd.h"
 | 
					 | 
				
			||||||
#include "test/clear_system_state.h"
 | 
					 | 
				
			||||||
#include "test/register_state_check.h"
 | 
					 | 
				
			||||||
#include "vpx_mem/vpx_mem.h"
 | 
					 | 
				
			||||||
#include "vpx_scale/yv12config.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef void (*ExtendFrameBorderFunc)(YV12_BUFFER_CONFIG *ybf);
 | 
					 | 
				
			||||||
typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf,
 | 
					 | 
				
			||||||
                              YV12_BUFFER_CONFIG *dst_ybf);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VpxScaleBase {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~VpxScaleBase() {
 | 
					 | 
				
			||||||
    libvpx_test::ClearSystemState();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void ResetImage(int width, int height) {
 | 
					 | 
				
			||||||
    width_ = width;
 | 
					 | 
				
			||||||
    height_ = height;
 | 
					 | 
				
			||||||
    memset(&img_, 0, sizeof(img_));
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&img_, width_, height_,
 | 
					 | 
				
			||||||
                                             VP8BORDERINPIXELS));
 | 
					 | 
				
			||||||
    memset(img_.buffer_alloc, kBufFiller, img_.frame_size);
 | 
					 | 
				
			||||||
    FillPlane(img_.y_buffer, img_.y_crop_width, img_.y_crop_height,
 | 
					 | 
				
			||||||
              img_.y_stride);
 | 
					 | 
				
			||||||
    FillPlane(img_.u_buffer, img_.uv_crop_width, img_.uv_crop_height,
 | 
					 | 
				
			||||||
              img_.uv_stride);
 | 
					 | 
				
			||||||
    FillPlane(img_.v_buffer, img_.uv_crop_width, img_.uv_crop_height,
 | 
					 | 
				
			||||||
              img_.uv_stride);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    memset(&ref_img_, 0, sizeof(ref_img_));
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&ref_img_, width_, height_,
 | 
					 | 
				
			||||||
                                             VP8BORDERINPIXELS));
 | 
					 | 
				
			||||||
    memset(ref_img_.buffer_alloc, kBufFiller, ref_img_.frame_size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    memset(&cpy_img_, 0, sizeof(cpy_img_));
 | 
					 | 
				
			||||||
    ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&cpy_img_, width_, height_,
 | 
					 | 
				
			||||||
                                             VP8BORDERINPIXELS));
 | 
					 | 
				
			||||||
    memset(cpy_img_.buffer_alloc, kBufFiller, cpy_img_.frame_size);
 | 
					 | 
				
			||||||
    ReferenceCopyFrame();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void DeallocImage() {
 | 
					 | 
				
			||||||
    vp8_yv12_de_alloc_frame_buffer(&img_);
 | 
					 | 
				
			||||||
    vp8_yv12_de_alloc_frame_buffer(&ref_img_);
 | 
					 | 
				
			||||||
    vp8_yv12_de_alloc_frame_buffer(&cpy_img_);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  static const int kBufFiller = 123;
 | 
					 | 
				
			||||||
  static const int kBufMax = kBufFiller - 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static void FillPlane(uint8_t *buf, int width, int height, int stride) {
 | 
					 | 
				
			||||||
    for (int y = 0; y < height; ++y) {
 | 
					 | 
				
			||||||
      for (int x = 0; x < width; ++x) {
 | 
					 | 
				
			||||||
        buf[x + (y * stride)] = (x + (width * y)) % kBufMax;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static void ExtendPlane(uint8_t *buf, int crop_width, int crop_height,
 | 
					 | 
				
			||||||
                          int width, int height, int stride, int padding) {
 | 
					 | 
				
			||||||
    // Copy the outermost visible pixel to a distance of at least 'padding.'
 | 
					 | 
				
			||||||
    // The buffers are allocated such that there may be excess space outside the
 | 
					 | 
				
			||||||
    // padding. As long as the minimum amount of padding is achieved it is not
 | 
					 | 
				
			||||||
    // necessary to fill this space as well.
 | 
					 | 
				
			||||||
    uint8_t *left = buf - padding;
 | 
					 | 
				
			||||||
    uint8_t *right = buf + crop_width;
 | 
					 | 
				
			||||||
    const int right_extend = padding + (width - crop_width);
 | 
					 | 
				
			||||||
    const int bottom_extend = padding + (height - crop_height);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Fill the border pixels from the nearest image pixel.
 | 
					 | 
				
			||||||
    for (int y = 0; y < crop_height; ++y) {
 | 
					 | 
				
			||||||
      memset(left, left[padding], padding);
 | 
					 | 
				
			||||||
      memset(right, right[-1], right_extend);
 | 
					 | 
				
			||||||
      left += stride;
 | 
					 | 
				
			||||||
      right += stride;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    left = buf - padding;
 | 
					 | 
				
			||||||
    uint8_t *top = left - (stride * padding);
 | 
					 | 
				
			||||||
    // The buffer does not always extend as far as the stride.
 | 
					 | 
				
			||||||
    // Equivalent to padding + width + padding.
 | 
					 | 
				
			||||||
    const int extend_width = padding + crop_width + right_extend;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // The first row was already extended to the left and right. Copy it up.
 | 
					 | 
				
			||||||
    for (int y = 0; y < padding; ++y) {
 | 
					 | 
				
			||||||
      memcpy(top, left, extend_width);
 | 
					 | 
				
			||||||
      top += stride;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    uint8_t *bottom = left + (crop_height * stride);
 | 
					 | 
				
			||||||
    for (int y = 0; y <  bottom_extend; ++y) {
 | 
					 | 
				
			||||||
      memcpy(bottom, left + (crop_height - 1) * stride, extend_width);
 | 
					 | 
				
			||||||
      bottom += stride;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void ReferenceExtendBorder() {
 | 
					 | 
				
			||||||
    ExtendPlane(ref_img_.y_buffer,
 | 
					 | 
				
			||||||
                ref_img_.y_crop_width, ref_img_.y_crop_height,
 | 
					 | 
				
			||||||
                ref_img_.y_width, ref_img_.y_height,
 | 
					 | 
				
			||||||
                ref_img_.y_stride,
 | 
					 | 
				
			||||||
                ref_img_.border);
 | 
					 | 
				
			||||||
    ExtendPlane(ref_img_.u_buffer,
 | 
					 | 
				
			||||||
                ref_img_.uv_crop_width, ref_img_.uv_crop_height,
 | 
					 | 
				
			||||||
                ref_img_.uv_width, ref_img_.uv_height,
 | 
					 | 
				
			||||||
                ref_img_.uv_stride,
 | 
					 | 
				
			||||||
                ref_img_.border / 2);
 | 
					 | 
				
			||||||
    ExtendPlane(ref_img_.v_buffer,
 | 
					 | 
				
			||||||
                ref_img_.uv_crop_width, ref_img_.uv_crop_height,
 | 
					 | 
				
			||||||
                ref_img_.uv_width, ref_img_.uv_height,
 | 
					 | 
				
			||||||
                ref_img_.uv_stride,
 | 
					 | 
				
			||||||
                ref_img_.border / 2);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void ReferenceCopyFrame() {
 | 
					 | 
				
			||||||
    // Copy img_ to ref_img_ and extend frame borders. This will be used for
 | 
					 | 
				
			||||||
    // verifying extend_fn_ as well as copy_frame_fn_.
 | 
					 | 
				
			||||||
    EXPECT_EQ(ref_img_.frame_size, img_.frame_size);
 | 
					 | 
				
			||||||
    for (int y = 0; y < img_.y_crop_height; ++y) {
 | 
					 | 
				
			||||||
      for (int x = 0; x < img_.y_crop_width; ++x) {
 | 
					 | 
				
			||||||
        ref_img_.y_buffer[x + y * ref_img_.y_stride] =
 | 
					 | 
				
			||||||
            img_.y_buffer[x + y * img_.y_stride];
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int y = 0; y < img_.uv_crop_height; ++y) {
 | 
					 | 
				
			||||||
      for (int x = 0; x < img_.uv_crop_width; ++x) {
 | 
					 | 
				
			||||||
        ref_img_.u_buffer[x + y * ref_img_.uv_stride] =
 | 
					 | 
				
			||||||
            img_.u_buffer[x + y * img_.uv_stride];
 | 
					 | 
				
			||||||
        ref_img_.v_buffer[x + y * ref_img_.uv_stride] =
 | 
					 | 
				
			||||||
            img_.v_buffer[x + y * img_.uv_stride];
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ReferenceExtendBorder();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void CompareImages(const YV12_BUFFER_CONFIG actual) {
 | 
					 | 
				
			||||||
    EXPECT_EQ(ref_img_.frame_size, actual.frame_size);
 | 
					 | 
				
			||||||
    EXPECT_EQ(0, memcmp(ref_img_.buffer_alloc, actual.buffer_alloc,
 | 
					 | 
				
			||||||
                        ref_img_.frame_size));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  YV12_BUFFER_CONFIG img_;
 | 
					 | 
				
			||||||
  YV12_BUFFER_CONFIG ref_img_;
 | 
					 | 
				
			||||||
  YV12_BUFFER_CONFIG cpy_img_;
 | 
					 | 
				
			||||||
  int width_;
 | 
					 | 
				
			||||||
  int height_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class ExtendBorderTest
 | 
					 | 
				
			||||||
    : public VpxScaleBase,
 | 
					 | 
				
			||||||
      public ::testing::TestWithParam<ExtendFrameBorderFunc> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~ExtendBorderTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    extend_fn_ = GetParam();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void ExtendBorder() {
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(extend_fn_(&img_));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void RunTest() {
 | 
					 | 
				
			||||||
#if ARCH_ARM
 | 
					 | 
				
			||||||
    // Some arm devices OOM when trying to allocate the largest buffers.
 | 
					 | 
				
			||||||
    static const int kNumSizesToTest = 6;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    static const int kNumSizesToTest = 7;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
 | 
					 | 
				
			||||||
    for (int h = 0; h < kNumSizesToTest; ++h) {
 | 
					 | 
				
			||||||
      for (int w = 0; w < kNumSizesToTest; ++w) {
 | 
					 | 
				
			||||||
        ResetImage(kSizesToTest[w], kSizesToTest[h]);
 | 
					 | 
				
			||||||
        ExtendBorder();
 | 
					 | 
				
			||||||
        ReferenceExtendBorder();
 | 
					 | 
				
			||||||
        CompareImages(img_);
 | 
					 | 
				
			||||||
        DeallocImage();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ExtendFrameBorderFunc extend_fn_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(ExtendBorderTest, ExtendBorder) {
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunTest());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,
 | 
					 | 
				
			||||||
                        ::testing::Values(vp8_yv12_extend_frame_borders_c));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class CopyFrameTest
 | 
					 | 
				
			||||||
    : public VpxScaleBase,
 | 
					 | 
				
			||||||
      public ::testing::TestWithParam<CopyFrameFunc> {
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  virtual ~CopyFrameTest() {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 protected:
 | 
					 | 
				
			||||||
  virtual void SetUp() {
 | 
					 | 
				
			||||||
    copy_frame_fn_ = GetParam();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void CopyFrame() {
 | 
					 | 
				
			||||||
    ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void RunTest() {
 | 
					 | 
				
			||||||
#if ARCH_ARM
 | 
					 | 
				
			||||||
    // Some arm devices OOM when trying to allocate the largest buffers.
 | 
					 | 
				
			||||||
    static const int kNumSizesToTest = 6;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    static const int kNumSizesToTest = 7;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
 | 
					 | 
				
			||||||
    for (int h = 0; h < kNumSizesToTest; ++h) {
 | 
					 | 
				
			||||||
      for (int w = 0; w < kNumSizesToTest; ++w) {
 | 
					 | 
				
			||||||
        ResetImage(kSizesToTest[w], kSizesToTest[h]);
 | 
					 | 
				
			||||||
        ReferenceCopyFrame();
 | 
					 | 
				
			||||||
        CopyFrame();
 | 
					 | 
				
			||||||
        CompareImages(cpy_img_);
 | 
					 | 
				
			||||||
        DeallocImage();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  CopyFrameFunc copy_frame_fn_;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_P(CopyFrameTest, CopyFrame) {
 | 
					 | 
				
			||||||
  ASSERT_NO_FATAL_FAILURE(RunTest());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,
 | 
					 | 
				
			||||||
                        ::testing::Values(vp8_yv12_copy_frame_c));
 | 
					 | 
				
			||||||
}  // namespace
 | 
					 | 
				
			||||||
@@ -11,19 +11,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
API_EXPORTS += exports
 | 
					API_EXPORTS += exports
 | 
				
			||||||
 | 
					
 | 
				
			||||||
API_SRCS-$(CONFIG_VP8_ENCODER) += vp8.h
 | 
					API_SRCS-$(CONFIG_VP10_ENCODER) += vp8.h
 | 
				
			||||||
API_SRCS-$(CONFIG_VP8_ENCODER) += vp8cx.h
 | 
					API_SRCS-$(CONFIG_VP10_ENCODER) += vp8cx.h
 | 
				
			||||||
API_DOC_SRCS-$(CONFIG_VP8_ENCODER) += vp8.h
 | 
					API_DOC_SRCS-$(CONFIG_VP10_ENCODER) += vp8.h
 | 
				
			||||||
API_DOC_SRCS-$(CONFIG_VP8_ENCODER) += vp8cx.h
 | 
					API_DOC_SRCS-$(CONFIG_VP10_ENCODER) += vp8cx.h
 | 
				
			||||||
ifeq ($(CONFIG_VP9_ENCODER),yes)
 | 
					ifeq ($(CONFIG_VP9_ENCODER),yes)
 | 
				
			||||||
  API_SRCS-$(CONFIG_SPATIAL_SVC) += src/svc_encodeframe.c
 | 
					  API_SRCS-$(CONFIG_SPATIAL_SVC) += src/svc_encodeframe.c
 | 
				
			||||||
  API_SRCS-$(CONFIG_SPATIAL_SVC) += svc_context.h
 | 
					  API_SRCS-$(CONFIG_SPATIAL_SVC) += svc_context.h
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
API_SRCS-$(CONFIG_VP8_DECODER) += vp8.h
 | 
					API_SRCS-$(CONFIG_VP10_DECODER) += vp8.h
 | 
				
			||||||
API_SRCS-$(CONFIG_VP8_DECODER) += vp8dx.h
 | 
					API_SRCS-$(CONFIG_VP10_DECODER) += vp8dx.h
 | 
				
			||||||
API_DOC_SRCS-$(CONFIG_VP8_DECODER) += vp8.h
 | 
					API_DOC_SRCS-$(CONFIG_VP10_DECODER) += vp8.h
 | 
				
			||||||
API_DOC_SRCS-$(CONFIG_VP8_DECODER) += vp8dx.h
 | 
					API_DOC_SRCS-$(CONFIG_VP10_DECODER) += vp8dx.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
API_DOC_SRCS-yes += vpx_codec.h
 | 
					API_DOC_SRCS-yes += vpx_codec.h
 | 
				
			||||||
API_DOC_SRCS-yes += vpx_decoder.h
 | 
					API_DOC_SRCS-yes += vpx_decoder.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,19 +100,6 @@ typedef unsigned int (*vpx_obmc_subpixvariance_fn_t)(const uint8_t *pred,
 | 
				
			|||||||
                                                     unsigned int *sse);
 | 
					                                                     unsigned int *sse);
 | 
				
			||||||
#endif  // CONFIG_VP10 && CONFIG_OBMC
 | 
					#endif  // CONFIG_VP10 && CONFIG_OBMC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9
 | 
					 | 
				
			||||||
typedef struct vp9_variance_vtable {
 | 
					 | 
				
			||||||
  vpx_sad_fn_t               sdf;
 | 
					 | 
				
			||||||
  vpx_sad_avg_fn_t           sdaf;
 | 
					 | 
				
			||||||
  vpx_variance_fn_t          vf;
 | 
					 | 
				
			||||||
  vpx_subpixvariance_fn_t    svf;
 | 
					 | 
				
			||||||
  vpx_subp_avg_variance_fn_t svaf;
 | 
					 | 
				
			||||||
  vpx_sad_multi_fn_t         sdx3f;
 | 
					 | 
				
			||||||
  vpx_sad_multi_fn_t         sdx8f;
 | 
					 | 
				
			||||||
  vpx_sad_multi_d_fn_t       sdx4df;
 | 
					 | 
				
			||||||
} vp9_variance_fn_ptr_t;
 | 
					 | 
				
			||||||
#endif  // CONFIG_VP9
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
typedef struct vp10_variance_vtable {
 | 
					typedef struct vp10_variance_vtable {
 | 
				
			||||||
  vpx_sad_fn_t                   sdf;
 | 
					  vpx_sad_fn_t                   sdf;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -204,7 +204,7 @@ DSP_SRCS-$(HAVE_MSA)    += mips/fwd_dct32x32_msa.c
 | 
				
			|||||||
endif  # CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
 | 
					endif  # CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# inverse transform
 | 
					# inverse transform
 | 
				
			||||||
ifneq ($(filter yes,$(CONFIG_VP9) $(CONFIG_VP10)),)
 | 
					ifeq ($(CONFIG_VP10), yes)
 | 
				
			||||||
DSP_SRCS-yes            += inv_txfm.h
 | 
					DSP_SRCS-yes            += inv_txfm.h
 | 
				
			||||||
DSP_SRCS-yes            += inv_txfm.c
 | 
					DSP_SRCS-yes            += inv_txfm.c
 | 
				
			||||||
DSP_SRCS-$(HAVE_SSE2)   += x86/inv_txfm_sse2.h
 | 
					DSP_SRCS-$(HAVE_SSE2)   += x86/inv_txfm_sse2.h
 | 
				
			||||||
@@ -252,7 +252,7 @@ DSP_SRCS-$(HAVE_DSPR2) += mips/itrans16_dspr2.c
 | 
				
			|||||||
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_dspr2.c
 | 
					DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_dspr2.c
 | 
				
			||||||
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_cols_dspr2.c
 | 
					DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_cols_dspr2.c
 | 
				
			||||||
endif  # CONFIG_VP9_HIGHBITDEPTH
 | 
					endif  # CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
endif  # CONFIG_VP9 || CONFIG_VP10
 | 
					endif  # CONFIG_VP10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# quantization
 | 
					# quantization
 | 
				
			||||||
ifneq ($(filter yes, $(CONFIG_VP9_ENCODER) $(CONFIG_VP10_ENCODER)),)
 | 
					ifneq ($(filter yes, $(CONFIG_VP9_ENCODER) $(CONFIG_VP10_ENCODER)),)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -680,7 +680,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Inverse transform
 | 
					# Inverse transform
 | 
				
			||||||
if ((vpx_config("CONFIG_VP9") eq "yes") || (vpx_config("CONFIG_VP10") eq "yes")) {
 | 
					if (vpx_config("CONFIG_VP10") eq "yes") {
 | 
				
			||||||
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
 | 
					if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
 | 
				
			||||||
  # Note as optimized versions of these functions are added we need to add a check to ensure
 | 
					  # Note as optimized versions of these functions are added we need to add a check to ensure
 | 
				
			||||||
  # that when CONFIG_EMULATE_HARDWARE is on, it defaults to the C versions only.
 | 
					  # that when CONFIG_EMULATE_HARDWARE is on, it defaults to the C versions only.
 | 
				
			||||||
@@ -915,7 +915,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
 | 
				
			|||||||
    specialize qw/vpx_iwht4x4_16_add msa sse2/;
 | 
					    specialize qw/vpx_iwht4x4_16_add msa sse2/;
 | 
				
			||||||
  }  # CONFIG_EMULATE_HARDWARE
 | 
					  }  # CONFIG_EMULATE_HARDWARE
 | 
				
			||||||
}  # CONFIG_VP9_HIGHBITDEPTH
 | 
					}  # CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
}  # CONFIG_VP9 || CONFIG_VP10
 | 
					}  # CONFIG_VP10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Quantization
 | 
					# Quantization
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,7 +114,7 @@ int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
 | 
				
			|||||||
  return -2;
 | 
					  return -2;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9 || CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
// TODO(jkoleszar): Maybe replace this with struct vpx_image
 | 
					// TODO(jkoleszar): Maybe replace this with struct vpx_image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
 | 
					int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -154,7 +154,7 @@ void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
 | 
				
			|||||||
               uv_border + ybf->uv_width - ybf->uv_crop_width);
 | 
					               uv_border + ybf->uv_width - ybf->uv_crop_width);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9 || CONFIG_VP10
 | 
					#if CONFIG_VP10
 | 
				
			||||||
static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
 | 
					static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
 | 
				
			||||||
  const int c_w = ybf->uv_crop_width;
 | 
					  const int c_w = ybf->uv_crop_width;
 | 
				
			||||||
  const int c_h = ybf->uv_crop_height;
 | 
					  const int c_h = ybf->uv_crop_height;
 | 
				
			||||||
@@ -230,7 +230,7 @@ void vpx_extend_frame_borders_y_c(YV12_BUFFER_CONFIG *ybf) {
 | 
				
			|||||||
               ext_size + ybf->y_height - ybf->y_crop_height,
 | 
					               ext_size + ybf->y_height - ybf->y_crop_height,
 | 
				
			||||||
               ext_size + ybf->y_width - ybf->y_crop_width);
 | 
					               ext_size + ybf->y_width - ybf->y_crop_width);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif  // CONFIG_VP9 || CONFIG_VP10
 | 
					#endif  // CONFIG_VP10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_VP9_HIGHBITDEPTH
 | 
					#if CONFIG_VP9_HIGHBITDEPTH
 | 
				
			||||||
static void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) {
 | 
					static void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ add_proto qw/void vp8_yv12_copy_frame/, "const struct yv12_buffer_config *src_yb
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
add_proto qw/void vpx_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
 | 
					add_proto qw/void vpx_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ((vpx_config("CONFIG_VP9") eq "yes") || (vpx_config("CONFIG_VP10") eq "yes")) {
 | 
					if (vpx_config("CONFIG_VP10") eq "yes") {
 | 
				
			||||||
    add_proto qw/void vpx_extend_frame_borders/, "struct yv12_buffer_config *ybf";
 | 
					    add_proto qw/void vpx_extend_frame_borders/, "struct yv12_buffer_config *ybf";
 | 
				
			||||||
    specialize qw/vpx_extend_frame_borders dspr2/;
 | 
					    specialize qw/vpx_extend_frame_borders dspr2/;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user