switch (ci) {
case 0U: {
*flagsp |= T1_CHI_1;
+ north = flagsp - stride;
*north |= T1_CHI_5;
break;
}
break;
case 3: {
*flagsp |= T1_CHI_4;
+ south = flagsp + stride;
*south |= T1_CHI_0;
break;
}
OPJ_UINT32 vsc
)
{
- OPJ_INT32 v;
+ OPJ_UINT32 v;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
ci);
OPJ_UINT32 ctxt2 = opj_t1_enc_getctxno_sc(lu);
v = *datap < 0 ? 1 : 0;
- *nmsedec += opj_t1_getnmsedec_sig(opj_int_abs(*datap), bpno);
+ *nmsedec += opj_t1_getnmsedec_sig((OPJ_UINT32)opj_int_abs(*datap),
+ (OPJ_UINT32)bpno);
#ifdef DEBUG_ENC_SIG
fprintf(stderr, " ctxt2=%d\n", ctxt2);
#endif
OPJ_UINT32 vsc
)
{
- OPJ_INT32 v;
+ OPJ_UINT32 v;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
if ((shift_flags & (T1_SIGMA_THIS | T1_PI_THIS)) == T1_SIGMA_THIS) {
OPJ_UINT32 ctxt = opj_t1_enc_getctxno_mag(shift_flags);
- *nmsedec += opj_t1_getnmsedec_ref(opj_int_abs(*datap), bpno);
+ *nmsedec += opj_t1_getnmsedec_ref((OPJ_UINT32)opj_int_abs(*datap),
+ (OPJ_UINT32)bpno);
v = opj_int_abs(*datap) & one ? 1 : 0;
#ifdef DEBUG_ENC_REF
fprintf(stderr, " ctxt=%d\n", ctxt);
OPJ_UINT32 lim,
OPJ_UINT32 cblksty)
{
- OPJ_INT32 v;
+ OPJ_UINT32 v;
OPJ_UINT32 ci;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
*flagsp & vsc_mask,
flagsp[-1] & vsc_mask, flagsp[1] & vsc_mask,
ci);
- *nmsedec += opj_t1_getnmsedec_sig(opj_int_abs(*datap), bpno);
+ *nmsedec += opj_t1_getnmsedec_sig((OPJ_UINT32)opj_int_abs(*datap),
+ (OPJ_UINT32)bpno);
ctxt2 = opj_t1_enc_getctxno_sc(lu);
#ifdef DEBUG_ENC_CLN
printf(" ctxt2=%d\n", ctxt2);
if (!t1->encoder) {
+ size_t colflags_size;
+
if (flagssize > (size_t)t1->flagssize) {
/* Overflow check */
if (flagssize > (SIZE_MAX / sizeof(opj_flag_t))) {
memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
- size_t colflags_size = ((((size_t)h + 3U) / 4U) +
- 2U); /* Can't overflow, h checked against UINT32_MAX - 3U */
+ colflags_size = ((((size_t)h + 3U) / 4U) +
+ 2U); /* Can't overflow, h checked against UINT32_MAX - 3U */
/* Overflow check */
if (colflags_size > (SIZE_MAX / (size_t)t1->flags_stride)) {