fix parital update

This commit is contained in:
Yihao Deng 2024-06-18 12:51:24 +00:00
parent 0397826c68
commit aa83628383
1 changed files with 14 additions and 7 deletions

View File

@ -2918,6 +2918,7 @@ int32_t tcompressDebug(uint32_t cmprAlg, uint8_t *l1Alg, uint8_t *l2Alg, uint8_t
} }
int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, uint8_t lvlDiabled, uint8_t lvlDefault, int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, uint8_t lvlDiabled, uint8_t lvlDefault,
uint32_t *dst) { uint32_t *dst) {
int8_t update = 0;
uint8_t ol1 = COMPRESS_L1_TYPE_U32(oldCmpr); uint8_t ol1 = COMPRESS_L1_TYPE_U32(oldCmpr);
uint8_t ol2 = COMPRESS_L2_TYPE_U32(oldCmpr); uint8_t ol2 = COMPRESS_L2_TYPE_U32(oldCmpr);
uint8_t olvl = COMPRESS_L2_TYPE_LEVEL_U32(oldCmpr); uint8_t olvl = COMPRESS_L2_TYPE_LEVEL_U32(oldCmpr);
@ -2927,8 +2928,11 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u
uint8_t nlvl = COMPRESS_L2_TYPE_LEVEL_U32(newCmpr); uint8_t nlvl = COMPRESS_L2_TYPE_LEVEL_U32(newCmpr);
if (nl1 != 0 && ol1 != nl1) { if (nl1 != 0 && ol1 != nl1) {
SET_COMPRESS(nl1, ol2, olvl, *dst); SET_COMPRESS(nl1, ol2, olvl, *dst);
return 1; update = 1;
} else if (nl2 != 0 && ol2 != nl2) { ol1 = nl1;
}
if (nl2 != 0 && ol2 != nl2) {
if (nl2 == l2Disabled) { if (nl2 == l2Disabled) {
SET_COMPRESS(ol1, nl2, lvlDiabled, *dst); SET_COMPRESS(ol1, nl2, lvlDiabled, *dst);
} else { } else {
@ -2938,10 +2942,13 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u
SET_COMPRESS(ol1, nl2, olvl, *dst); SET_COMPRESS(ol1, nl2, olvl, *dst);
} }
} }
return 1; update = 1;
} else if (nlvl != 0 && olvl != nlvl) { ol2 = nl2;
}
if (nlvl != 0 && olvl != nlvl) {
SET_COMPRESS(ol1, ol2, nlvl, *dst); SET_COMPRESS(ol1, ol2, nlvl, *dst);
return 1; update = 1;
} }
return 0; return update;
} }