From 8f70003cce7bdfbced9ebac7db35634f333fe3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 25 Sep 2026 16:40:11 -0600 Subject: [PATCH] Remove the PaceVideocodecDecode workaround for Ys I & II The blit cost model now paces its movies at 30 fps without it. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/Compatibility.cpp | 1 - Core/Compatibility.h | 1 - Core/HLE/sceVideocodec.cpp | 16 ++-------------- Core/HW/AvcDecoder.cpp | 11 ----------- Core/HW/AvcDecoder.h | 2 -- assets/compat.ini | 7 ------- pspautotests | 2 +- 7 files changed, 3 insertions(+), 37 deletions(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 1e83eddc83..ae9abde6c9 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -167,7 +167,6 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "SpriteBorderFix", &flags_.SpriteBorderFix); CheckSetting(iniFile, gameID, "TextureCLUTInShader", &flags_.TextureCLUTInShader); CheckSetting(iniFile, gameID, "DisableRangeCulling", &flags_.DisableRangeCulling); - CheckSetting(iniFile, gameID, "PaceVideocodecDecode", &flags_.PaceVideocodecDecode); } void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index f39d40e5f0..7eafcd3600 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -122,7 +122,6 @@ struct CompatFlags { float SpriteBorderFix; bool TextureCLUTInShader; bool DisableRangeCulling; - bool PaceVideocodecDecode; }; struct VRCompat { diff --git a/Core/HLE/sceVideocodec.cpp b/Core/HLE/sceVideocodec.cpp index 4fd7070402..06b97185b9 100644 --- a/Core/HLE/sceVideocodec.cpp +++ b/Core/HLE/sceVideocodec.cpp @@ -43,6 +43,7 @@ #include "Core/Util/BlockAllocator.h" #include "Core/HLE/sceMpeg.h" #include "Core/HLE/sceMpegbase.h" +#include "Core/HLE/scePower.h" #include "Core/HW/AvcDecoder.h" #include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" @@ -98,9 +99,6 @@ struct VideocodecCtx { u32 frameBuffersSize = 0; int frameBufferWidth = 0; int frameBufferHeight = 0; - // When the next decode may finish, for PaceVideocodecDecode. Not serialized: a restored state - // just paces from scratch. - s64 pacedUntilUs = 0; }; static std::map g_videocodecCtxs; @@ -595,19 +593,9 @@ static int sceVideocodecDecode(u32 ctxAddr, int type) { // vblank wait rely on decode, colour conversion and blit adding up to more than a vblank. int delayUs = 0; if (gotFrame && width > 0 && height > 0) { - delayUs = (int)(3400LL * width * height / (480 * 272)); + delayUs = PowerScaleFromDefaultClock((int)(3400LL * width * height / (480 * 272))); } - // This is a compat hack for games that do not seem to pace playback in any way, such as Ys I & II. - if (gotFrame && PSP_CoreParameter().compat.flags().PaceVideocodecDecode && vctx.decoder) { - const int period = vctx.decoder->FramePeriodUs(); - if (period > 0) { - const s64 now = CoreTiming::GetGlobalTimeUs(); - const int wait = (int)std::max((s64)0, vctx.pacedUntilUs - now); - vctx.pacedUntilUs = now + wait + period; - delayUs = std::max(delayUs, wait); - } - } if (delayUs > 0) { return hleDelayResult(hleLogDebug(Log::ME, 0, "type %d, %d bytes -> frame %dx%d", type, auBytes, width, height), "videocodec decode", delayUs); diff --git a/Core/HW/AvcDecoder.cpp b/Core/HW/AvcDecoder.cpp index 09fc39f12a..4627112440 100644 --- a/Core/HW/AvcDecoder.cpp +++ b/Core/HW/AvcDecoder.cpp @@ -193,17 +193,6 @@ bool AvcDecoder::Decode(const u8 *data, int size) { #endif } -int AvcDecoder::FramePeriodUs() const { -#ifdef USE_FFMPEG - if (!codecCtx_ || codecCtx_->framerate.num <= 0 || codecCtx_->framerate.den <= 0) { - return 0; - } - return (int)((s64)1000000 * codecCtx_->framerate.den / codecCtx_->framerate.num); -#else - return 0; -#endif -} - const u8 *AvcDecoder::Plane(int index) const { #ifdef USE_FFMPEG if (!haveFrame_ || !frame_ || index < 0 || index >= 3) { diff --git a/Core/HW/AvcDecoder.h b/Core/HW/AvcDecoder.h index 8ee1caf4d8..5724f3d5a7 100644 --- a/Core/HW/AvcDecoder.h +++ b/Core/HW/AvcDecoder.h @@ -56,8 +56,6 @@ public: // necessarily the width. const u8 *Plane(int index) const; int Stride(int index) const; - // The frame period the bitstream declares, in microseconds, or 0 if it says nothing useful. - int FramePeriodUs() const; // True if we were built without ffmpeg, in which case nothing decodes. static bool IsAvailable(); diff --git a/assets/compat.ini b/assets/compat.ini index a26636869d..61775f02a8 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -2218,10 +2218,3 @@ UCJS10100 = true UCKS45127 = true UCJS18055 = true NPJG00027 = true - -[PaceVideocodecDecode] -# Ys I & II Chronicles - the game never paces the video itself, so an instant decode runs -# the picture ahead of the audio and the movie ends early. -ULUS10547 = true -ULJM05475 = true -NPUH10091 = true diff --git a/pspautotests b/pspautotests index 2c804f5cb3..b3b8509b0a 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit 2c804f5cb3cd97b5ca3e11242060fee73e50bc47 +Subproject commit b3b8509b0ac932f8edc15ed29243b8f7be1e51f0