static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) {
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
- d = 1 - (*mqc->curctx)->mps;
+ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
} else {
- d = (*mqc->curctx)->mps;
+ d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
}
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->a = (*mqc->curctx)->qeval;
- d = (*mqc->curctx)->mps;
+ d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
} else {
mqc->a = (*mqc->curctx)->qeval;
- d = 1 - (*mqc->curctx)->mps;
+ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
}
if (mqc->ct != 0) {
while (mqc->ct > 0) {
mqc->ct--;
- mqc->c += bit_padding << mqc->ct;
+ mqc->c += (OPJ_UINT32)(bit_padding << mqc->ct);
bit_padding = (bit_padding + 1) & 0x01;
}
mqc->bp++;
OPJ_UINT32 correction = 1;
/* <flush part> */
- OPJ_INT32 n = 27 - 15 - mqc->ct;
+ OPJ_INT32 n = (OPJ_INT32)(27 - 15 - mqc->ct);
mqc->c <<= mqc->ct;
while (n > 0) {
opj_mqc_byteout(mqc);
- n -= mqc->ct;
+ n -= (OPJ_INT32)mqc->ct;
mqc->c <<= mqc->ct;
}
opj_mqc_byteout(mqc);
}
void opj_mqc_erterm_enc(opj_mqc_t *mqc) {
- OPJ_INT32 k = 11 - mqc->ct + 1;
+ OPJ_INT32 k = (OPJ_INT32)(11 - mqc->ct + 1);
while (k > 0) {
mqc->c <<= mqc->ct;
mqc->ct = 0;
opj_mqc_byteout(mqc);
- k -= mqc->ct;
+ k -= (OPJ_INT32)mqc->ct;
}
if (*mqc->bp != 0xff) {
mqc->end = bp + len;
mqc->bp = bp;
if (len==0) mqc->c = 0xff << 16;
- else mqc->c = *mqc->bp << 16;
+ else mqc->c = (OPJ_UINT32)(*mqc->bp << 16);
#ifdef MQC_PERF_OPT /* TODO_MSD: check this option and put in experimental */
{
d = opj_mqc_mpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
- d = (*mqc->curctx)->mps;
+ d = (OPJ_INT32)(*mqc->curctx)->mps;
}
}
}
void opj_mqc_setstate(opj_mqc_t *mqc, OPJ_UINT32 ctxno, OPJ_UINT32 msb, OPJ_INT32 prob) {
- mqc->ctxs[ctxno] = &mqc_states[msb + (prob << 1)];
+ mqc->ctxs[ctxno] = &mqc_states[msb + (OPJ_UINT32)(prob << 1)];
}