From a7676a2b26121f6d5bfdf349004e79996b00d152 Mon Sep 17 00:00:00 2001 From: refraction Date: Fri, 3 Dec 2010 23:36:51 +0000 Subject: [PATCH] IPU hack removal - Well, still one bit i'm not sure on, but everything else should be correct. Hack was due to differences between IPU and the MPEG standard. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4074 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/IPU/IPU.cpp | 5 ++--- pcsx2/IPU/mpeg2lib/Mpeg.cpp | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pcsx2/IPU/IPU.cpp b/pcsx2/IPU/IPU.cpp index 6dcdd387af..3e9e5ab9dc 100644 --- a/pcsx2/IPU/IPU.cpp +++ b/pcsx2/IPU/IPU.cpp @@ -440,10 +440,9 @@ static __fi bool ipuVDEC(u32 val) // very choppy (basically only decoding/updating every 30th frame or so). So yeah, // someone with knowledge on the subject please feel free to explain this one. :) --air - ipuRegs.cmd.DATA &= 0xFFFF; - ipuRegs.cmd.DATA |= 0x10000; + // The upper bits are the "length" of the decoded command, where the lower is the address. + // This is due to differences with IPU and the MPEG standard. See get_macroblock_address_increment(). - //ipuRegs.cmd.DATA = (ipuRegs.cmd.DATA & 0xFFFF) | ((decoder.bitstream_bits + 16) << 16); ipuRegs.ctrl.ECD = (ipuRegs.cmd.DATA == 0); case 1: diff --git a/pcsx2/IPU/mpeg2lib/Mpeg.cpp b/pcsx2/IPU/mpeg2lib/Mpeg.cpp index f2fd7e3ac8..4ee86af652 100644 --- a/pcsx2/IPU/mpeg2lib/Mpeg.cpp +++ b/pcsx2/IPU/mpeg2lib/Mpeg.cpp @@ -135,14 +135,13 @@ int get_macroblock_modes() { macroblock_modes |= GETBITS(2) * MOTION_TYPE_BASE; } - - return macroblock_modes; + return (macroblock_modes | (tab->len << 16)); } else if (decoder.frame_pred_frame_dct) { /* if (! (macroblock_modes & MACROBLOCK_INTRA)) */ macroblock_modes |= MC_FRAME; - return macroblock_modes; + return (macroblock_modes | (tab->len << 16)); } else { @@ -155,15 +154,15 @@ int get_macroblock_modes() intra: macroblock_modes |= GETBITS(1) * DCT_TYPE_INTERLACED; } - - return macroblock_modes; + return (macroblock_modes | (tab->len << 16)); } case D_TYPE: macroblock_modes = GETBITS(1); - + //I suspect (as this is actually a 2 bit command) that this should be getbits(2) + //additionally, we arent dumping any bits here when i think we should be, need a game to test. (Refraction) if (macroblock_modes == 0) return 0; // error - return MACROBLOCK_INTRA; + return (MACROBLOCK_INTRA | (1 << 16)); default: return 0; @@ -222,7 +221,8 @@ int __fi get_motion_delta(const int f_code) sign = SBITS(1); DUMPBITS(1); - return (delta ^ sign) - sign; + + return (((delta ^ sign) - sign) | (tab->len << 16)); } int __fi get_dmv() @@ -246,13 +246,13 @@ int get_macroblock_address_increment() { case 8: /* macroblock_escape */ DUMPBITS(11); - return 0x23; + return 0xb0023; case 15: /* macroblock_stuffing (MPEG1 only) */ if (decoder.mpeg1) { DUMPBITS(11); - return 0x22; + return 0xb0022; } default: @@ -261,7 +261,7 @@ int get_macroblock_address_increment() DUMPBITS(mba->len); - return mba->mba + 1; + return ((mba->mba + 1) | (mba->len << 16)); } static __fi int get_luma_dc_dct_diff()