diff options
| author | Matthieu Darbois <mayeut@users.noreply.github.com> | 2016-09-14 23:46:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 23:46:46 +0200 |
| commit | f88c9974e27161427c003dda5d89f61a5a3995e9 (patch) | |
| tree | 3e05f5cf6e3960744687603c91ebd8732b79c4b5 /src/lib/openjp2/t1_generate_luts.c | |
| parent | 0954bc11e3ab6a39d86e5ed51286da4b8989743d (diff) | |
Flags in T1 shall be unsigned (#840)
This will remove some conversion warnings
Diffstat (limited to 'src/lib/openjp2/t1_generate_luts.c')
| -rw-r--r-- | src/lib/openjp2/t1_generate_luts.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/openjp2/t1_generate_luts.c b/src/lib/openjp2/t1_generate_luts.c index bc01c994..1a843089 100644 --- a/src/lib/openjp2/t1_generate_luts.c +++ b/src/lib/openjp2/t1_generate_luts.c @@ -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; } |
