Flags in T1 shall be unsigned (#840)

This will remove some conversion warnings
This commit is contained in:
Matthieu Darbois 2016-09-14 23:46:46 +02:00 committed by GitHub
parent 0954bc11e3
commit f88c9974e2
4 changed files with 129 additions and 128 deletions

View File

@ -338,18 +338,18 @@ static INLINE void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT
/* and T1_SIG_E == T1_SIG_N << 1, T1_SIG_W == T1_SIG_N << 2 and T1_SIG_S == T1_SIG_N << 2 */
/* and T1_SGN_E == T1_SGN_N << 1, T1_SGN_W == T1_SGN_N << 2 and T1_SGN_S == T1_SGN_N << 2 */
opj_flag_t flag_N = T1_SIG_N | (T1_SIG_N << (4 * s));
unsigned int flag_N = T1_SIG_N | ((unsigned int)T1_SIG_N << (4U * s));
np[-1] |= T1_SIG_SE;
np[0] |= flag_N << 2;
np[0] |= (opj_flag_t)(flag_N << 2U);
np[1] |= T1_SIG_SW;
flagsp[-1] |= flag_N << 1;
flagsp[-1] |= (opj_flag_t)(flag_N << 1U);
flagsp[0] |= T1_SIG;
flagsp[1] |= flag_N << 3;
flagsp[1] |= (opj_flag_t)(flag_N << 3U);
sp[-1] |= T1_SIG_NE;
sp[0] |= flag_N;
sp[0] |= (opj_flag_t)flag_N;
sp[1] |= T1_SIG_NW;
}
@ -358,39 +358,39 @@ static INLINE void opj_t1_updateflagscolflags(opj_flag_t *flagsp, opj_colflag_t
opj_t1_updateflags(flagsp, s, stride);
if( row == 0U )
{
*colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*colflagsp |= (opj_colflag_t)((T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
*(colflagsp - 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
*(colflagsp + 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
*(colflagsp - stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3);
*(colflagsp - stride) |= (T1_COLFLAG_SIG_OTHER_ROW_3);
*(colflagsp - stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3);
}
else if( row == 3U )
{
*colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1)));
*(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1)));
*(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS* (row-1)));
*colflagsp |= (opj_colflag_t)((T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1U))));
*(colflagsp - 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1U))));
*(colflagsp + 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS* (row-1))));
*(colflagsp + stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0);
*(colflagsp + stride) |= (T1_COLFLAG_SIG_OTHER_ROW_0);
*(colflagsp + stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0);
}
else
{
*(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1)));
*(colflagsp - 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1U))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
*colflagsp |= (opj_colflag_t)((T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1U))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
*(colflagsp + 1) |= (opj_colflag_t)((T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1U))) |
(T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1U))));
}
}
@ -443,20 +443,20 @@ static INLINE void opj_t1_dec_sigpass_step_raw(
OPJ_INT32 vsc,
OPJ_UINT32 row)
{
OPJ_INT32 v, flag;
OPJ_UINT32 v, flag;
opj_raw_t *raw = t1->raw; /* RAW component */
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) {
if (opj_raw_decode(raw)) {
v = (OPJ_INT32)opj_raw_decode(raw); /* ESSAI */
v = opj_raw_decode(raw); /* ESSAI */
*datap = v ? -oneplushalf : oneplushalf;
opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row);
opj_t1_updateflagscolflags(flagsp, colflagsp, v, t1->flags_stride, row);
}
#ifdef CONSISTENCY_CHECK
*flagsp |= T1_VISIT;
#endif
*colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
}
}
@ -490,7 +490,7 @@ static INLINE void opj_t1_dec_sigpass_step_mqc(
#ifdef CONSISTENCY_CHECK
*flagsp |= T1_VISIT;
#endif
*colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
}
} /* VSC and BYPASS by Antonin */
@ -503,23 +503,23 @@ static INLINE void opj_t1_dec_sigpass_step_mqc_vsc(
OPJ_INT32 vsc,
OPJ_UINT32 row)
{
OPJ_INT32 v, flag;
OPJ_UINT32 v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag));
if (opj_mqc_decode(mqc)) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag));
v = (OPJ_UINT32)opj_mqc_decode(mqc) ^ opj_t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row);
opj_t1_updateflagscolflags(flagsp, colflagsp, v, t1->flags_stride, row);
}
#ifdef CONSISTENCY_CHECK
*flagsp |= T1_VISIT;
#endif
*colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row));
}
} /* VSC and BYPASS by Antonin */
@ -742,7 +742,7 @@ static INLINE void opj_t1_dec_refpass_step_raw(
v = (OPJ_INT32)opj_raw_decode(raw);
t = v ? poshalf : neghalf;
*datap += *datap < 0 ? -t : t;
*colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
}
} /* VSC and BYPASS by Antonin */
@ -776,7 +776,7 @@ static INLINE void opj_t1_dec_refpass_step_mqc(
v = opj_mqc_decode(mqc);
t = v ? poshalf : neghalf;
*datap += *datap < 0 ? -t : t;
*colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
}
} /* VSC and BYPASS by Antonin */
@ -790,20 +790,21 @@ static INLINE void opj_t1_dec_refpass_step_mqc_vsc(
OPJ_INT32 vsc,
OPJ_UINT32 row)
{
OPJ_INT32 v, t;
OPJ_UINT32 v;
OPJ_INT32 t;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) ==
((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) {
OPJ_INT32 flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
OPJ_UINT32 flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
OPJ_UINT32 tmp1 = (flag & T1_SIG_OTH) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2 : tmp1;
OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2U : tmp1;
opj_mqc_setcurctx(mqc, tmp2); /* ESSAI */
v = opj_mqc_decode(mqc);
v = (OPJ_UINT32)opj_mqc_decode(mqc);
t = v ? poshalf : neghalf;
*datap += *datap < 0 ? -t : t;
*colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
*colflagsp |= (opj_colflag_t)(T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row));
}
} /* VSC and BYPASS by Antonin */
@ -1008,7 +1009,7 @@ LABEL_PARTIAL:
opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride);
}
}
*flagsp &= ~T1_VISIT;
*flagsp &= (opj_flag_t)~T1_VISIT;
}
static void opj_t1_dec_clnpass_step_partial(
@ -1099,7 +1100,7 @@ static void opj_t1_dec_clnpass_step_vsc(
OPJ_INT32 vsc,
OPJ_UINT32 row)
{
OPJ_INT32 v, flag;
OPJ_UINT32 v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
@ -1108,13 +1109,13 @@ static void opj_t1_dec_clnpass_step_vsc(
goto LABEL_PARTIAL;
}
if (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag));
if (opj_mqc_decode(mqc)) {
LABEL_PARTIAL:
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag));
v = (OPJ_UINT32)opj_mqc_decode(mqc) ^ opj_t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row);
opj_t1_updateflagscolflags(flagsp, colflagsp, v, t1->flags_stride, row);
}
}
#ifdef CONSISTENCY_CHECK
@ -1236,7 +1237,7 @@ static void opj_t1_enc_clnpass(
agg && (j == k + (OPJ_UINT32)runlen), \
vsc, j - k); \
} \
*colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
*colflags2 &= (opj_colflag_t)~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
} \
colflags1 += flags_stride; \
} \
@ -1285,31 +1286,31 @@ static void opj_t1_enc_clnpass(
if (!(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0))) {\
opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 0U, flags_stride); \
} \
if( consistency_check ) *flags2 &= ~T1_VISIT; \
if( consistency_check ) *flags2 &= (opj_flag_t)~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \
if (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) {\
opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 1U, flags_stride); \
} \
if( consistency_check ) *flags2 &= ~T1_VISIT; \
if( consistency_check ) *flags2 &= (opj_flag_t)~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \
if (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) {\
opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 2U, flags_stride); \
} \
if( consistency_check ) *flags2 &= ~T1_VISIT; \
if( consistency_check ) *flags2 &= (opj_flag_t)~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \
if (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) {\
opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 3U, flags_stride); \
} \
if( consistency_check ) *flags2 &= ~T1_VISIT; \
if( consistency_check ) *flags2 &= (opj_flag_t)~T1_VISIT; \
data2 += w; \
} \
*colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
*colflags2 &= (opj_colflag_t)~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
} \
data1 += w << 2; \
flags1 += flags_stride << 2; \
@ -1324,7 +1325,7 @@ static void opj_t1_enc_clnpass(
opj_t1_dec_clnpass_step(t1, flags2, colflags2, data2, oneplushalf, j - k); \
data2 += w; \
} \
*colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
*colflags2 &= (opj_colflag_t)~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \
} \
} \
\

View File

@ -53,40 +53,40 @@ in T1.C are used by some function in TCD.C.
/* CAUTION: the value of those constants must not be changed, otherwise the */
/* optimization of opj_t1_updateflags() will break! */
/* BEGINNING of flags that apply to opj_flag_t */
#define T1_SIG_NE 0x0001 /**< Context orientation : North-East direction */
#define T1_SIG_SE 0x0002 /**< Context orientation : South-East direction */
#define T1_SIG_SW 0x0004 /**< Context orientation : South-West direction */
#define T1_SIG_NW 0x0008 /**< Context orientation : North-West direction */
#define T1_SIG_N 0x0010 /**< Context orientation : North direction */
#define T1_SIG_E 0x0020 /**< Context orientation : East direction */
#define T1_SIG_S 0x0040 /**< Context orientation : South direction */
#define T1_SIG_W 0x0080 /**< Context orientation : West direction */
#define T1_SIG_NE 0x0001U /**< Context orientation : North-East direction */
#define T1_SIG_SE 0x0002U /**< Context orientation : South-East direction */
#define T1_SIG_SW 0x0004U /**< Context orientation : South-West direction */
#define T1_SIG_NW 0x0008U /**< Context orientation : North-West direction */
#define T1_SIG_N 0x0010U /**< Context orientation : North direction */
#define T1_SIG_E 0x0020U /**< Context orientation : East direction */
#define T1_SIG_S 0x0040U /**< Context orientation : South direction */
#define T1_SIG_W 0x0080U /**< Context orientation : West direction */
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
#define T1_SGN_N 0x0100
#define T1_SGN_E 0x0200
#define T1_SGN_S 0x0400
#define T1_SGN_W 0x0800
#define T1_SGN_N 0x0100U
#define T1_SGN_E 0x0200U
#define T1_SGN_S 0x0400U
#define T1_SGN_W 0x0800U
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
#define T1_SIG 0x1000 /**< No longer used by decoder */
#define T1_REFINE 0x2000 /**< No longer used by decoder */
#define T1_VISIT 0x4000 /**< No longer used by decoder */
#define T1_SIG 0x1000U /**< No longer used by decoder */
#define T1_REFINE 0x2000U /**< No longer used by decoder */
#define T1_VISIT 0x4000U /**< No longer used by decoder */
/* END of flags that apply to opj_flag_t */
#define T1_NUMCTXS_ZC 9
#define T1_NUMCTXS_SC 5
#define T1_NUMCTXS_ZC 9
#define T1_NUMCTXS_SC 5
#define T1_NUMCTXS_MAG 3
#define T1_NUMCTXS_AGG 1
#define T1_NUMCTXS_UNI 1
#define T1_CTXNO_ZC 0
#define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
#define T1_CTXNO_ZC 0
#define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
@ -94,27 +94,27 @@ in T1.C are used by some function in TCD.C.
#define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
/* Those flags are used by opj_colflag_t */
#define T1_COLFLAG_RBS 4 /* RBS = Row Bit Shift */
#define T1_COLFLAG_SIG_OTHER_ROW_0 (1 << 0) /**< This sample has at least one significant neighbour */
#define T1_COLFLAG_SIG_ROW_0 (1 << 1) /**< This sample is significant */
#define T1_COLFLAG_VISIT_ROW_0 (1 << 2) /**< This sample has been visited */
#define T1_COLFLAG_REFINE_ROW_0 (1 << 3) /**< This sample has been refined */
#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << T1_COLFLAG_RBS)
#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << T1_COLFLAG_RBS)
#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << T1_COLFLAG_RBS)
#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << T1_COLFLAG_RBS)
#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2*T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2*T1_COLFLAG_RBS))
#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2*T1_COLFLAG_RBS))
#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2*T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3*T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3*T1_COLFLAG_RBS))
#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3*T1_COLFLAG_RBS))
#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3*T1_COLFLAG_RBS))
#define T1_COLFLAG_RBS 4U /* RBS = Row Bit Shift */
#define T1_COLFLAG_SIG_OTHER_ROW_0 (1U << 0U) /**< This sample has at least one significant neighbour */
#define T1_COLFLAG_SIG_ROW_0 (1U << 1U) /**< This sample is significant */
#define T1_COLFLAG_VISIT_ROW_0 (1U << 2U) /**< This sample has been visited */
#define T1_COLFLAG_REFINE_ROW_0 (1U << 3U) /**< This sample has been refined */
#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << (1U * T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << (1U * T1_COLFLAG_RBS))
#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << (1U * T1_COLFLAG_RBS))
#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << (1U * T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2U * T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2U * T1_COLFLAG_RBS))
#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2U * T1_COLFLAG_RBS))
#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2U * T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3U * T1_COLFLAG_RBS))
#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3U * T1_COLFLAG_RBS))
#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3U * T1_COLFLAG_RBS))
#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3U * T1_COLFLAG_RBS))
/* ----------------------------------------------------------------------- */
typedef OPJ_INT16 opj_flag_t;
typedef OPJ_UINT16 opj_flag_t;
/** Flags for 4 consecutive rows of a column */
typedef OPJ_UINT16 opj_colflag_t;

View File

@ -38,7 +38,7 @@
#include "opj_includes.h"
static int t1_init_ctxno_zc(int f, int orient) {
static int t1_init_ctxno_zc(unsigned int f, unsigned int orient) {
int h, v, d, n, t, hv;
h = ((f & T1_SIG_W) != 0) + ((f & T1_SIG_E) != 0);
v = ((f & T1_SIG_N) != 0) + ((f & T1_SIG_S) != 0);
@ -113,7 +113,7 @@ static int t1_init_ctxno_zc(int f, int orient) {
return (T1_CTXNO_ZC + n);
}
static int t1_init_ctxno_sc(int f) {
static int t1_init_ctxno_sc(unsigned int f) {
int hc, vc, n;
n = 0;
@ -154,7 +154,7 @@ static int t1_init_ctxno_sc(int f) {
return (T1_CTXNO_SC + n);
}
static int t1_init_spb(int f) {
static int t1_init_spb(unsigned int f) {
int hc, vc, n;
hc = opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
@ -192,7 +192,7 @@ static void dump_array16(int array[],int size){
int main(int argc, char **argv)
{
int i, j;
unsigned int i, j;
double u, v, t;
int lut_ctxno_zc[1024];
@ -205,47 +205,47 @@ int main(int argc, char **argv)
printf("/* This file was automatically generated by t1_generate_luts.c */\n\n");
/* lut_ctxno_zc */
for (j = 0; j < 4; ++j) {
for (i = 0; i < 256; ++i) {
int orient = j;
if (orient == 2) {
orient = 1;
} else if (orient == 1) {
orient = 2;
for (j = 0U; j < 4U; ++j) {
for (i = 0U; i < 256U; ++i) {
unsigned int orient = j;
if (orient == 2U) {
orient = 1U;
} else if (orient == 1U) {
orient = 2U;
}
lut_ctxno_zc[(orient << 8) | i] = t1_init_ctxno_zc(i, j);
}
}
printf("static const OPJ_BYTE lut_ctxno_zc[1024] = {\n ");
for (i = 0; i < 1023; ++i) {
for (i = 0U; i < 1023U; ++i) {
printf("%i, ", lut_ctxno_zc[i]);
if(!((i+1)&0x1f))
if(!((i+1U)&0x1fU))
printf("\n ");
}
printf("%i\n};\n\n", lut_ctxno_zc[1023]);
/* lut_ctxno_sc */
printf("static const OPJ_BYTE lut_ctxno_sc[256] = {\n ");
for (i = 0; i < 255; ++i) {
for (i = 0U; i < 255U; ++i) {
printf("0x%x, ", t1_init_ctxno_sc(i << 4));
if(!((i+1)&0xf))
if(!((i+1U)&0xfU))
printf("\n ");
}
printf("0x%x\n};\n\n", t1_init_ctxno_sc(255 << 4));
printf("0x%x\n};\n\n", t1_init_ctxno_sc(255U << 4));
/* lut_spb */
printf("static const OPJ_BYTE lut_spb[256] = {\n ");
for (i = 0; i < 255; ++i) {
for (i = 0U; i < 255U; ++i) {
printf("%i, ", t1_init_spb(i << 4));
if(!((i+1)&0x1f))
if(!((i+1U)&0x1fU))
printf("\n ");
}
printf("%i\n};\n\n", t1_init_spb(255 << 4));
printf("%i\n};\n\n", t1_init_spb(255U << 4));
/* FIXME FIXME FIXME */
/* fprintf(stdout,"nmsedec luts:\n"); */
for (i = 0; i < (1 << T1_NMSEDEC_BITS); ++i) {
for (i = 0U; i < (1U << T1_NMSEDEC_BITS); ++i) {
t = i / pow(2, T1_NMSEDEC_FRACBITS);
u = t;
v = t - 1.5;
@ -269,17 +269,17 @@ int main(int argc, char **argv)
(int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
}
printf("static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_sig, 1 << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_sig, 1U << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_sig0, 1 << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_sig0, 1U << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_ref, 1 << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_ref, 1U << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_ref0, 1 << T1_NMSEDEC_BITS);
printf("static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = {\n ");
dump_array16(lut_nmsedec_ref0, 1U << T1_NMSEDEC_BITS);
return 0;
}

View File

@ -65,7 +65,7 @@ static const OPJ_BYTE lut_spb[256] = {
0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {
static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@ -84,7 +84,7 @@ static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {
0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680
};
static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {
static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
@ -103,7 +103,7 @@ static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {
0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00
};
static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {
static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = {
0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480,
0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080,
0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80,
@ -122,7 +122,7 @@ static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {
0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780
};
static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {
static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = {
0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980,
0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300,
0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00,