From 5c5c7dec863a5cddc1c28febb5654eeaf2befe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 18 Sep 2026 11:59:48 -0600 Subject: [PATCH] Include what these files use UnitTest.h's EXPECT_ macros all call printf and EXPECT_EQ_MEM calls memcmp, but it included neither nor - it has been relying on whatever the including file happened to pull in first, and TestMpegCsc was the first not to. The same shape in sceMpegbase.cpp and sceVideocodec.cpp, which use std::min, std::move and memcpy without saying where they come from. Also drop an abs() from TestMpegCsc rather than include for one subtraction. Co-Authored-By: Claude Opus 5 (1M context) --- Core/HLE/sceMpegbase.cpp | 3 +++ Core/HLE/sceVideocodec.cpp | 2 ++ unittest/TestMpegCsc.cpp | 8 +++++--- unittest/UnitTest.h | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceMpegbase.cpp b/Core/HLE/sceMpegbase.cpp index eae9945cdf..12c02560f4 100644 --- a/Core/HLE/sceMpegbase.cpp +++ b/Core/HLE/sceMpegbase.cpp @@ -20,7 +20,10 @@ // mpeg.prx drives these directly, so they have to be real for the firmware module to run in place // of our sceMpeg HLE. +#include +#include #include +#include #include #include "Common/Serialize/Serializer.h" diff --git a/Core/HLE/sceVideocodec.cpp b/Core/HLE/sceVideocodec.cpp index abfe1457f9..0c109e25f1 100644 --- a/Core/HLE/sceVideocodec.cpp +++ b/Core/HLE/sceVideocodec.cpp @@ -26,7 +26,9 @@ // by looking at sceMpegBaseYCrCbCopy output on a real PSP. #include +#include #include +#include #include #include "Common/Serialize/Serializer.h" diff --git a/unittest/TestMpegCsc.cpp b/unittest/TestMpegCsc.cpp index c9a845297e..5e20b7d40b 100644 --- a/unittest/TestMpegCsc.cpp +++ b/unittest/TestMpegCsc.cpp @@ -23,8 +23,9 @@ // MpegCscRange has something to be wrong against that isn't itself. The speed half reports // megapixels per second for a 480x272 frame, the size a PSP movie actually is. -#include +#include #include +#include #include #include "Common/CommonTypes.h" @@ -351,8 +352,9 @@ bool TestMpegCsc() { memcpy(&a, &sws[off], bpp); memcpy(&b, &ref[off], bpp); for (int ch = 0; ch < 3; ch++) { - const int d = abs((int)((a >> shifts[ch]) & masks[ch]) - - (int)((b >> shifts[ch]) & masks[ch])); + const int va = (int)((a >> shifts[ch]) & masks[ch]); + const int vb = (int)((b >> shifts[ch]) & masks[ch]); + const int d = va > vb ? va - vb : vb - va; worst = worst > d ? worst : d; total += d; count++; diff --git a/unittest/UnitTest.h b/unittest/UnitTest.h index 6588edd40d..35f42f53af 100644 --- a/unittest/UnitTest.h +++ b/unittest/UnitTest.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include inline bool rel_equal(float a, float b, float precision) {