aom: cpu_used_firstpass_test: move early exit check up

From f6b976de024e998f19d3f8c3ed045e3273fcc288 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Wed, 14 Aug 2024 13:34:18 -0700
Subject: [PATCH] cpu_used_firstpass_test: move early exit check up

Nothing but the reference encode is performed when the first pass speed
is equivalent to the second pass speed. There are enough encode tests
with additional expectations that we don't need to run these. They are
slow under the address and undefined behavior sanitizers.

Change-Id: Ifb27ee7611e76bfb378c657ba873a4f6876af5ab
---
 test/cpu_used_firstpass_test.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/cpu_used_firstpass_test.cc b/test/cpu_used_firstpass_test.cc
index 46d97f444c..e1d389f238 100644
--- a/test/cpu_used_firstpass_test.cc
+++ b/test/cpu_used_firstpass_test.cc
@@ -73,6 +73,10 @@ class CpuUsedFirstpassTest
   double GetPsnrDiffThreshold() { return kPsnrDiffThreshold; }
 
   void DoTest() {
+    if (GET_PARAM(1) == second_pass_cpu_used_) {
+      GTEST_SKIP() << "Reference cpu used values match test cpu used values.";
+    }
+
     libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480,
                                        cfg_.g_timebase.den, cfg_.g_timebase.num,
                                        0, 30);
@@ -84,7 +88,6 @@ class CpuUsedFirstpassTest
     ref_psnr = GetAveragePsnr();
 
     first_pass_cpu_used_ = GET_PARAM(1);
-    if (first_pass_cpu_used_ == second_pass_cpu_used_) return;
     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
     psnr_diff = std::abs(ref_psnr - GetAveragePsnr());
     EXPECT_LT(psnr_diff, GetPsnrDiffThreshold())