vp8[loongarch]: Optimize vp8 encoding partial function
[platform/upstream/libvpx.git] / test / idct_test.cc
index 084b2ed..1b9532e 100644 (file)
@@ -30,12 +30,15 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
   virtual void SetUp() {
     UUT = GetParam();
 
-    input = new (std::nothrow) Buffer<int16_t>(4, 4, 0);
-    ASSERT_TRUE(input != NULL);
-    predict = new (std::nothrow) Buffer<uint8_t>(4, 4, 3);
-    ASSERT_TRUE(predict != NULL);
-    output = new (std::nothrow) Buffer<uint8_t>(4, 4, 3);
-    ASSERT_TRUE(output != NULL);
+    input = new Buffer<int16_t>(4, 4, 0);
+    ASSERT_NE(input, nullptr);
+    ASSERT_TRUE(input->Init());
+    predict = new Buffer<uint8_t>(4, 4, 3);
+    ASSERT_NE(predict, nullptr);
+    ASSERT_TRUE(predict->Init());
+    output = new Buffer<uint8_t>(4, 4, 3);
+    ASSERT_NE(output, nullptr);
+    ASSERT_TRUE(output->Init());
   }
 
   virtual void TearDown() {
@@ -69,6 +72,7 @@ TEST_P(IDCTTest, TestAllZeros) {
 
 TEST_P(IDCTTest, TestAllOnes) {
   input->Set(0);
+  ASSERT_NE(input->TopLeftPixel(), nullptr);
   // When the first element is '4' it will fill the output buffer with '1'.
   input->TopLeftPixel()[0] = 4;
   predict->Set(0);
@@ -86,6 +90,7 @@ TEST_P(IDCTTest, TestAddOne) {
   // Set the transform output to '1' and make sure it gets added to the
   // prediction buffer.
   input->Set(0);
+  ASSERT_NE(input->TopLeftPixel(), nullptr);
   input->TopLeftPixel()[0] = 4;
   output->Set(0);
 
@@ -150,20 +155,26 @@ TEST_P(IDCTTest, TestWithData) {
   ASSERT_TRUE(output->CheckPadding());
 }
 
-INSTANTIATE_TEST_CASE_P(C, IDCTTest, ::testing::Values(vp8_short_idct4x4llm_c));
+INSTANTIATE_TEST_SUITE_P(C, IDCTTest,
+                         ::testing::Values(vp8_short_idct4x4llm_c));
 
 #if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(NEON, IDCTTest,
-                        ::testing::Values(vp8_short_idct4x4llm_neon));
+INSTANTIATE_TEST_SUITE_P(NEON, IDCTTest,
+                         ::testing::Values(vp8_short_idct4x4llm_neon));
 #endif  // HAVE_NEON
 
 #if HAVE_MMX
-INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
-                        ::testing::Values(vp8_short_idct4x4llm_mmx));
+INSTANTIATE_TEST_SUITE_P(MMX, IDCTTest,
+                         ::testing::Values(vp8_short_idct4x4llm_mmx));
 #endif  // HAVE_MMX
 
 #if HAVE_MSA
-INSTANTIATE_TEST_CASE_P(MSA, IDCTTest,
-                        ::testing::Values(vp8_short_idct4x4llm_msa));
+INSTANTIATE_TEST_SUITE_P(MSA, IDCTTest,
+                         ::testing::Values(vp8_short_idct4x4llm_msa));
 #endif  // HAVE_MSA
-}
+
+#if HAVE_MMI
+INSTANTIATE_TEST_SUITE_P(MMI, IDCTTest,
+                         ::testing::Values(vp8_short_idct4x4llm_mmi));
+#endif  // HAVE_MMI
+}  // namespace