* Fix a potentially obscure bug in ipuCSC (color space conversion) which would have caused PCSX2 to hang on certain types of rare partial transfers.
 * Remove some more dead code and structure data from the mpeg library.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3833 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-09-25 05:36:30 +00:00
parent 9ebace0a8d
commit e24ceba0e1
5 changed files with 12 additions and 70 deletions

View File

@ -51,7 +51,6 @@ u8 indx4[16*16/2];
void tIPU_cmd::clear()
{
memzero_sse_a(*this);
//memzero(*this);
current = 0xffffffff;
}
@ -365,7 +364,7 @@ static __ri void ipuIDEC(tIPU_CMD_IDEC idec)
decoder.scantype = ipuRegs.ctrl.AS;
decoder.intra_dc_precision = ipuRegs.ctrl.IDP;
//from IDEC value
//from IDEC value
decoder.quantizer_scale = idec.QSC;
decoder.frame_pred_frame_dct= !idec.DTD;
decoder.sgn = idec.SGN;
@ -551,9 +550,8 @@ static bool ipuSETVQ(u32 val)
}
// IPU Transfers are split into 8Qwords so we need to send ALL the data
static bool __fastcall ipuCSC(u32 val)
static __ri bool ipuCSC(tIPU_CMD_CSC csc)
{
tIPU_CMD_CSC csc(val);
csc.log_from_YCbCr();
for (;ipu_cmd.index < (int)csc.MBC; ipu_cmd.index++)
@ -568,21 +566,13 @@ static bool __fastcall ipuCSC(u32 val)
if (csc.OFM)
{
while (ipu_cmd.pos[1] < 32)
{
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*) & decoder.rgb16) + 4 * ipu_cmd.pos[1], 32 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] <= 0) return false;
}
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*) & decoder.rgb16) + 4 * ipu_cmd.pos[1], 32 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] < 32) return false;
}
else
{
while (ipu_cmd.pos[1] < 64)
{
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*) & decoder.rgb32) + 4 * ipu_cmd.pos[1], 64 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] <= 0) return false;
}
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*) & decoder.rgb32) + 4 * ipu_cmd.pos[1], 64 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] < 64) return false;
}
ipu_cmd.pos[0] = 0;
@ -592,10 +582,8 @@ static bool __fastcall ipuCSC(u32 val)
return true;
}
// Todo - Need to add the same stop and start code as CSC
static bool ipuPACK(u32 val)
static __ri bool ipuPACK(tIPU_CMD_CSC csc)
{
tIPU_CMD_CSC csc(val);
csc.log_from_RGB32();
for (;ipu_cmd.index < (int)csc.MBC; ipu_cmd.index++)
@ -613,13 +601,11 @@ static bool ipuPACK(u32 val)
if (csc.OFM)
{
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*) & decoder.rgb16) + 4 * ipu_cmd.pos[1], 32 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] < 32) return false;
}
else
{
ipu_cmd.pos[1] += ipu_fifo.out.write(((u32*)indx4) + 4 * ipu_cmd.pos[1], 8 - ipu_cmd.pos[1]);
if (ipu_cmd.pos[1] < 8) return false;
}
@ -887,17 +873,13 @@ __fi void IPUCMD_WRITE(u32 val)
break;
case SCE_IPU_CSC:
ipu_cmd.pos[1] = 0;
ipu_cmd.index = 0;
break;
case SCE_IPU_PACK:
ipu_cmd.pos[1] = 0;
ipu_cmd.index = 0;
break;
jNO_DEFAULT;
}
}
ipuRegs.ctrl.BUSY = 1;
@ -966,7 +948,7 @@ __noinline void IPUWorker()
break;
jNO_DEFAULT
}
}
// success
ipuRegs.ctrl.BUSY = 0;

View File

@ -127,26 +127,6 @@ int IPU_Fifo_Output::write(const u32 *value, uint size)
} while(true);
return origsize - size;
#if 0
if (ipuRegs.ctrl.OFC >= 8) IPU0dma();
uint transsize = min(size, 8 - (uint)ipuRegs.ctrl.OFC);
uint firsttrans = transsize;
while (transsize > 0)
{
CopyQWC(&data[writepos], value);
writepos = (writepos + 4) & 31;
value += 4;
--transsize;
}
ipuRegs.ctrl.OFC += firsttrans;
IPU0dma();
return firsttrans;
#endif
}
void IPU_Fifo_Output::read(void *value, uint size)

View File

@ -699,7 +699,6 @@ __fi bool mpeg2sliceIDEC()
decoder.dc_dct_pred[1] =
decoder.dc_dct_pred[2] = 128 << decoder.intra_dc_precision;
decoder.mbc = 0;
ipuRegs.top = 0;
ipuRegs.ctrl.ECD = 0;
@ -818,7 +817,6 @@ __fi bool mpeg2sliceIDEC()
return false;
}
decoder.mbc++;
mbaCount = 0;
}
@ -867,8 +865,6 @@ __fi bool mpeg2sliceIDEC()
decoder.dc_dct_pred[0] =
decoder.dc_dct_pred[1] =
decoder.dc_dct_pred[2] = 128 << decoder.intra_dc_precision;
decoder.mbc += mbaCount;
}
case 4:
@ -1110,7 +1106,6 @@ __fi bool mpeg2_slice()
ipuRegs.ctrl.SCD = 0;
coded_block_pattern = decoder.coded_block_pattern;
decoder.mbc = 1;
decoder.SetOutputTo(mb16);
case 3:
@ -1127,7 +1122,6 @@ __fi bool mpeg2_slice()
return false;
}
decoder.mbc++;
mbaCount = 0;
}

View File

@ -151,12 +151,7 @@ struct decoder_t {
uint ipu0_data; // amount of data in the output macroblock (in QWC)
uint ipu0_idx;
/* bit parsing stuff */
//u32 bitstream_buf; /* current 32 bit working set */
//int bitstream_bits; /* used bits in working set */
int quantizer_scale; /* remove */
int dmv_offset; /* remove */
int quantizer_scale;
/* now non-slice-specific information */
@ -191,8 +186,6 @@ struct decoder_t {
int dte;
// Output Format
int ofm;
// Macroblock count
int mbc;
// Macroblock type
int macroblock_modes;
// DC Reset
@ -205,8 +198,6 @@ struct decoder_t {
/* the zigzag scan we're supposed to be using, true for alt, false for normal */
bool scantype;
int second_field;
int mpeg1;
template< typename T >
@ -225,12 +216,10 @@ struct decoder_t {
void AdvanceIpuDataBy(uint amt)
{
pxAssumeDev(ipu0_data>=amt, "IPU FIFO Overflow on advance!" );
pxAssumeMsg(ipu0_data>=amt, "IPU FIFO Overflow on advance!" );
ipu0_idx += amt;
ipu0_data -= amt;
}
__fi bool ReadIpuData(u128* out);
};
struct mpeg2_scan_pack
@ -248,9 +237,6 @@ extern s32 SBITS(uint bits);
extern void mpeg2_idct_copy(s16 * block, u8* dest, int stride);
extern void mpeg2_idct_add(int last, s16 * block, s16* dest, int stride);
#define IDEC 0
#define BDEC 1
extern bool mpeg2sliceIDEC();
extern bool mpeg2_slice();
extern int get_macroblock_address_increment();

View File

@ -24,7 +24,7 @@
// the lower 16 bit value. IF the change is breaking of all compatibility with old
// states, increment the upper 16 bit value, and clear the lower 16 bits to 0.
static const u32 g_SaveVersion = 0x8b4b0000;
static const u32 g_SaveVersion = 0x8b4c0000;
// this function is meant to be used in the place of GSfreeze, and provides a safe layer
// between the GS saving function and the MTGS's needs. :)