mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Merge pull request #2728 from ggrtk/mdec-eob
MDEC: EOB is optional for complete blocks
This commit is contained in:
commit
83a031e22f
|
@ -595,12 +595,8 @@ bool MDEC::rl_decode_block(s16* blk, const u8* qt)
|
||||||
m_remaining_halfwords--;
|
m_remaining_halfwords--;
|
||||||
|
|
||||||
m_current_coefficient += ((n >> 10) & 0x3F) + 1;
|
m_current_coefficient += ((n >> 10) & 0x3F) + 1;
|
||||||
if (m_current_coefficient >= 64)
|
if (m_current_coefficient < 64)
|
||||||
{
|
{
|
||||||
m_current_coefficient = 64;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 val = (SignExtendN<10, s32>(static_cast<s32>(n & 0x3FF)) *
|
s32 val = (SignExtendN<10, s32>(static_cast<s32>(n & 0x3FF)) *
|
||||||
static_cast<s32>(ZeroExtend32(qt[m_current_coefficient])) * static_cast<s32>(m_current_q_scale) +
|
static_cast<s32>(ZeroExtend32(qt[m_current_coefficient])) * static_cast<s32>(m_current_q_scale) +
|
||||||
4) /
|
4) /
|
||||||
|
@ -610,13 +606,19 @@ bool MDEC::rl_decode_block(s16* blk, const u8* qt)
|
||||||
val = SignExtendN<10, s32>(static_cast<s32>(n & 0x3FF)) * 2;
|
val = SignExtendN<10, s32>(static_cast<s32>(n & 0x3FF)) * 2;
|
||||||
|
|
||||||
val = std::clamp(val, -0x400, 0x3FF);
|
val = std::clamp(val, -0x400, 0x3FF);
|
||||||
// val = val * static_cast<s32>(ZeroExtend32(scalezag[i]));
|
|
||||||
if (m_current_q_scale > 0)
|
if (m_current_q_scale > 0)
|
||||||
blk[zagzig[m_current_coefficient]] = static_cast<s16>(val);
|
blk[zagzig[m_current_coefficient]] = static_cast<s16>(val);
|
||||||
else if (m_current_q_scale == 0)
|
else if (m_current_q_scale == 0)
|
||||||
blk[m_current_coefficient] = static_cast<s16>(val);
|
blk[m_current_coefficient] = static_cast<s16>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_current_coefficient >= 63)
|
||||||
|
{
|
||||||
|
m_current_coefficient = 64;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue