Compare commits
1 Commits
master
...
dev-restar
Author | SHA1 | Date |
---|---|---|
Antonin Descampe | bfdcca770b |
|
@ -324,10 +324,12 @@ void opj_mqc_flush(opj_mqc_t *mqc) {
|
||||||
|
|
||||||
if (*mqc->bp != 0xff) {
|
if (*mqc->bp != 0xff) {
|
||||||
mqc->bp++;
|
mqc->bp++;
|
||||||
|
*mqc->bp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc) {
|
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc) {
|
||||||
|
opj_mqc_byteout(mqc);
|
||||||
mqc->c = 0;
|
mqc->c = 0;
|
||||||
mqc->ct = 8;
|
mqc->ct = 8;
|
||||||
/*if (*mqc->bp == 0xff) {
|
/*if (*mqc->bp == 0xff) {
|
||||||
|
@ -362,6 +364,8 @@ OPJ_UINT32 opj_mqc_bypass_flush_enc(opj_mqc_t *mqc) {
|
||||||
}
|
}
|
||||||
mqc->bp++;
|
mqc->bp++;
|
||||||
*mqc->bp = (OPJ_BYTE)mqc->c;
|
*mqc->bp = (OPJ_BYTE)mqc->c;
|
||||||
|
mqc->bp++;
|
||||||
|
*mqc->bp = 0;
|
||||||
mqc->ct = 8;
|
mqc->ct = 8;
|
||||||
mqc->c = 0;
|
mqc->c = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2102,9 +2102,9 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
|
||||||
/* Code switch "RESTART" (i.e. TERMALL) */
|
/* Code switch "RESTART" (i.e. TERMALL) */
|
||||||
if ((cblksty & J2K_CCP_CBLKSTY_TERMALL) && !((passtype == 2) && (bpno - 1 < 0))) {
|
if ((cblksty & J2K_CCP_CBLKSTY_TERMALL) && !((passtype == 2) && (bpno - 1 < 0))) {
|
||||||
if (type == T1_TYPE_RAW) {
|
if (type == T1_TYPE_RAW) {
|
||||||
opj_mqc_flush(mqc);
|
/*opj_mqc_flush(mqc);*/
|
||||||
|
opj_mqc_bypass_flush_enc(mqc);
|
||||||
correction = 1;
|
correction = 1;
|
||||||
/* correction = mqc_bypass_flush_enc(); */
|
|
||||||
} else { /* correction = mqc_restart_enc(); */
|
} else { /* correction = mqc_restart_enc(); */
|
||||||
opj_mqc_flush(mqc);
|
opj_mqc_flush(mqc);
|
||||||
correction = 1;
|
correction = 1;
|
||||||
|
@ -2114,9 +2114,9 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
|
||||||
if (((bpno < ((OPJ_INT32) (cblk->numbps) - 4) && (passtype > 0))
|
if (((bpno < ((OPJ_INT32) (cblk->numbps) - 4) && (passtype > 0))
|
||||||
|| ((bpno == ((OPJ_INT32)cblk->numbps - 4)) && (passtype == 2))) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) {
|
|| ((bpno == ((OPJ_INT32)cblk->numbps - 4)) && (passtype == 2))) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) {
|
||||||
if (type == T1_TYPE_RAW) {
|
if (type == T1_TYPE_RAW) {
|
||||||
opj_mqc_flush(mqc);
|
/*opj_mqc_flush(mqc);*/
|
||||||
|
opj_mqc_bypass_flush_enc(mqc);
|
||||||
correction = 1;
|
correction = 1;
|
||||||
/* correction = mqc_bypass_flush_enc(); */
|
|
||||||
} else { /* correction = mqc_restart_enc(); */
|
} else { /* correction = mqc_restart_enc(); */
|
||||||
opj_mqc_flush(mqc);
|
opj_mqc_flush(mqc);
|
||||||
correction = 1;
|
correction = 1;
|
||||||
|
@ -2132,7 +2132,8 @@ static void opj_t1_encode_cblk(opj_t1_t *t1,
|
||||||
bpno--;
|
bpno--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pass->term && bpno > 0) {
|
/*if (pass->term && bpno > 0) {*/
|
||||||
|
if (pass->term && (bpno > 0 || (bpno == 0 && passtype < 2))) {
|
||||||
type = ((bpno < ((OPJ_INT32) (cblk->numbps) - 4)) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
|
type = ((bpno < ((OPJ_INT32) (cblk->numbps) - 4)) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
|
||||||
if (type == T1_TYPE_RAW)
|
if (type == T1_TYPE_RAW)
|
||||||
opj_mqc_bypass_init_enc(mqc);
|
opj_mqc_bypass_init_enc(mqc);
|
||||||
|
|
Loading…
Reference in New Issue