Restore BPE FMV cutover fix and SIMD MDEC paths.

Only re-arm depth24 cutover blank on long MDEC idle (not every ~15fps
decode gap), and bring back SSE2/NEON IDCT hot paths lost from the dirty tree.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alex Vanderveen
2026-07-31 17:07:58 -04:00
parent 2d0bfe5dac
commit e7f68a2ba7
2 changed files with 334 additions and 47 deletions
+13 -6
View File
@@ -427,8 +427,9 @@ static int s_fmv_skip_present_skip = 0;
static int s_netplay_depth24_present_skip = 0;
static uint32_t s_fmv_skip_last_mdec = 0;
static int s_fmv_skip_hold = 0;
/* MotK FMV cutover: after an idle gap, blank the first depth24+MDEC presents
* so one-frame RGB888 junk (stale VRAM) never reaches the window. */
/* MotK FMV cutover: after leaving depth24 (or a long MDEC idle), blank the
* first depth24+MDEC presents so one-frame RGB888 junk never reaches the
* window. Short inter-frame MDEC gaps must not re-arm this (see cutover_tick). */
static int s_d24_prev_mdec = 0;
static int s_d24_saw_gap = 0;
static int s_d24_cutover_blank = 0;
@@ -3681,16 +3682,22 @@ static void load_transition_note(int read_active, int load_active,
}
/* Tick MotK-style depth24 cutover state once per present. Arm a short full-
* frame blank when MDEC returns after an idle gap (or after leaving depth24). */
* frame blank when MDEC returns after leaving depth24, or after a *long*
* intra-depth24 idle (real inter-movie gap) — not after every short gap
* between ~15fps MDEC frames. With SIMD IDCT a movie frame often finishes in
* one vblank; treating !mdec_recently_active(3) as a cutover re-armed a
* 2-present full black blank on every decode burst (BPE FMV flicker). */
static void depth24_cutover_tick(int depth24) {
const int mdec_on = depth24 && mdec_recently_active(3);
/* ~0.5s @60Hz — longer than inter-frame MDEC idle in a live movie. */
const int mdec_long_idle = depth24 && !mdec_recently_active(30);
if (!depth24) {
s_d24_prev_mdec = 0;
s_d24_cutover_blank = 0;
s_d24_saw_gap = 1; /* next depth24+MDEC is a fresh movie cutover */
return;
}
if (!mdec_on)
if (mdec_long_idle)
s_d24_saw_gap = 1;
if (s_d24_saw_gap && mdec_on && !s_d24_prev_mdec) {
/* Hide the transitional present(s) that still show stale RGB888 junk. */
@@ -3710,8 +3717,8 @@ static void depth24_cutover_tick(int depth24) {
* reset the span — hold ticks skip Swap, then the next present saw lim=0
* and wiped the whole frame every vblank.
*
* Optional short cutover blank (tip): full-frame black for 1–2 presents when
* MDEC returns after an idle gap, hiding one-frame transitional junk. */
* Optional short cutover blank: full-frame black for 1–2 presents on movie
* start / long idle resume only (see depth24_cutover_tick). */
static void depth24_fix_trailing_margin(uint32_t *buf, uint32_t w, uint32_t h,
uint32_t display_x) {
if (!buf || w < 8u || h == 0u) return;