fixed some uninitialised memory access, mitigated BYPASS/RESTART-mode issues
This commit is contained in:
parent
7113c4e3bb
commit
fcb95513c2
|
@ -324,10 +324,12 @@ void opj_mqc_flush(opj_mqc_t *mqc) {
|
|||
|
||||
if (*mqc->bp != 0xff) {
|
||||
mqc->bp++;
|
||||
*mqc->bp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc) {
|
||||
opj_mqc_byteout(mqc);
|
||||
mqc->c = 0;
|
||||
mqc->ct = 8;
|
||||
/*if (*mqc->bp == 0xff) {
|
||||
|
@ -362,6 +364,8 @@ OPJ_UINT32 opj_mqc_bypass_flush_enc(opj_mqc_t *mqc) {
|
|||
}
|
||||
mqc->bp++;
|
||||
*mqc->bp = (OPJ_BYTE)mqc->c;
|
||||
mqc->bp++;
|
||||
*mqc->bp = 0;
|
||||
mqc->ct = 8;
|
||||
mqc->c = 0;
|
||||
}
|
||||
|
|
|
@ -2102,7 +2102,7 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
|
|||
/* Code switch "RESTART" (i.e. TERMALL) */
|
||||
if ((cblksty & J2K_CCP_CBLKSTY_TERMALL) && !((passtype == 2) && (bpno - 1 < 0))) {
|
||||
if (type == T1_TYPE_RAW) {
|
||||
opj_mqc_flush(mqc);
|
||||
opj_mqc_bypass_flush_enc(mqc);
|
||||
correction = 1;
|
||||
/* correction = mqc_bypass_flush_enc(); */
|
||||
} else { /* correction = mqc_restart_enc(); */
|
||||
|
@ -2114,7 +2114,7 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
|
|||
if (((bpno < ((OPJ_INT32) (cblk->numbps) - 4) && (passtype > 0))
|
||||
|| ((bpno == ((OPJ_INT32)cblk->numbps - 4)) && (passtype == 2))) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) {
|
||||
if (type == T1_TYPE_RAW) {
|
||||
opj_mqc_flush(mqc);
|
||||
opj_mqc_bypass_flush_enc(mqc);
|
||||
correction = 1;
|
||||
/* correction = mqc_bypass_flush_enc(); */
|
||||
} else { /* correction = mqc_restart_enc(); */
|
||||
|
|
Loading…
Reference in New Issue