mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
[dep-quant] Fix read out of bounds and left shift of negative
This commit is contained in:
parent
634cf72c5d
commit
d008a00335
|
@ -573,8 +573,8 @@ static INLINE void update_common_context(
|
|||
uint8_t* sbbFlags = cc->m_allSbbCtx[cc->m_curr_sbb_ctx_offset].sbbFlags;
|
||||
uint8_t* levels = cc->m_allSbbCtx[cc->m_curr_sbb_ctx_offset].levels;
|
||||
size_t setCpSize = cc->m_nbInfo[scan_pos - 1].maxDist * sizeof(uint8_t);
|
||||
int8_t prev_sbb_state = ctxs->m_allStates.m_refSbbCtxId[prev_state];
|
||||
if (prev_state != -1 && prev_sbb_state >= 0) {
|
||||
if (prev_state != -1) {
|
||||
const int8_t prev_sbb_state = ctxs->m_allStates.m_refSbbCtxId[prev_state];
|
||||
for (int i = 0; i < numSbb; ++i) {
|
||||
sbbFlags[i * 4 + curr_state_without_offset] = cc->m_allSbbCtx[cc->m_prev_sbb_ctx_offset].sbbFlags[i * 4 + prev_sbb_state];
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ void uvg_dep_quant_dequant(
|
|||
{
|
||||
invQScale <<= -shift;
|
||||
}
|
||||
int qIdx = (level << 1) + (level > 0 ? -(state >> 1) : (state >> 1));
|
||||
int qIdx = (level * 2) + (level > 0 ? -(state >> 1) : (state >> 1));
|
||||
int64_t nomTCoeff = ((int64_t)qIdx * (int64_t)invQScale + add) >> ((shift < 0) ? 0 : shift);
|
||||
coeff[rasterPos] = (coeff_t)CLIP(minTCoeff, maxTCoeff, nomTCoeff);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue