Consolidated some calls to mqc_setcurctx. Cleaned up t1_generate_luts to output the...
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Tue, 21 Aug 2007 12:36:05 +0000 (12:36 +0000)
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Tue, 21 Aug 2007 12:36:05 +0000 (12:36 +0000)
ChangeLog
LibOpenJPEG.vcproj
libopenjpeg/t1.c
libopenjpeg/t1_generate_luts.c

index dbb072e5242c1529b23dfffe7d6d8d2fef59ccaf..063da5f86e8d1dbf78be8072fd17a6237b44ca60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@ August 21, 2007
 * [Callum Lerwick] Memory leaks fixed
 * [Callum Lerwick] Reworks of t1_updateflags to get rid of the shift operation
 * [Callum Lerwick] mqc_setcurctx moved to the header to allow it to be inlined into the t1.
+* [Callum Lerwick] Consolidated some calls to mqc_setcurctx.
+* [Callum Lerwick] Cleaned up t1_generate_luts to output the proper types.
 
 August 20, 2007
 + [FOD] Added support for the TGA file format in the codec
index e55fd8b2ede3dfaaa3ed2b4cf9fceec9a87ec7de..505f89b2f02870c2535fa60b96956e48968590c1 100644 (file)
@@ -3,7 +3,7 @@
        ProjectType="Visual C++"\r
        Version="8,00"\r
        Name="LibOpenJPEG"\r
-       ProjectGUID="{4F27AA53-4181-4A1A-8238-3931B0A41048}"\r
+       ProjectGUID="{BDB8C37B-824E-4617-827C-B13E2F015EFE}"\r
        >\r
        <Platforms>\r
                <Platform\r
index c815cff19ec22292bed4ca72099ff3f63428be1b..5a36148b24f13543636bfb485ebab7f8c166f495 100644 (file)
@@ -298,21 +298,19 @@ static void t1_enc_sigpass_step(
        flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
        if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
                v = int_abs(*datap) & one ? 1 : 0;
+               mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));       /* ESSAI */
                if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
-                       mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));       /* ESSAI */
                        mqc_bypass_enc(mqc, v);
                } else {
-                       mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
                        mqc_encode(mqc, v);
                }
                if (v) {
                        v = *datap < 0 ? 1 : 0;
                        *nmsedec +=     t1_getnmsedec_sig(int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
+                       mqc_setcurctx(mqc, t1_getctxno_sc(flag));       /* ESSAI */
                        if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
-                               mqc_setcurctx(mqc, t1_getctxno_sc(flag));       /* ESSAI */
                                mqc_bypass_enc(mqc, v);
                        } else {
-                               mqc_setcurctx(mqc, t1_getctxno_sc(flag));
                                mqc_encode(mqc, v ^ t1_getspb(flag));
                        }
                        t1_updateflags(flagsp, v, t1->flags_stride);
@@ -432,11 +430,10 @@ static void t1_enc_refpass_step(
        if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
                *nmsedec += t1_getnmsedec_ref(int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
                v = int_abs(*datap) & one ? 1 : 0;
+               mqc_setcurctx(mqc, t1_getctxno_mag(flag));      /* ESSAI */
                if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
-                       mqc_setcurctx(mqc, t1_getctxno_mag(flag));      /* ESSAI */
                        mqc_bypass_enc(mqc, v);
                } else {
-                       mqc_setcurctx(mqc, t1_getctxno_mag(flag));
                        mqc_encode(mqc, v);
                }
                *flagsp |= T1_REFINE;
@@ -459,11 +456,10 @@ static void t1_dec_refpass_step(
        
        flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
        if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
+               mqc_setcurctx(mqc, t1_getctxno_mag(flag));      /* ESSAI */
                if (type == T1_TYPE_RAW) {
-                       mqc_setcurctx(mqc, t1_getctxno_mag(flag));      /* ESSAI */
                        v = raw_decode(raw);
                } else {
-                       mqc_setcurctx(mqc, t1_getctxno_mag(flag));
                        v = mqc_decode(mqc);
                }
                t = v ? poshalf : neghalf;
index 62cb1589e960c7087ce14ee779d2c008727134f2..e1f47dfb36a9885910143ce746bacdeba201b97a 100644 (file)
@@ -212,7 +212,7 @@ int main(){
                }
        }
 
-       printf("static int8_t lut_ctxno_zc[1024] = {\n  ");
+       printf("static char lut_ctxno_zc[1024] = {\n  ");
        for (i = 0; i < 1023; ++i) {
                printf("%i, ", lut_ctxno_zc[i]);
                if(!((i+1)&0x1f))
@@ -221,7 +221,7 @@ int main(){
        printf("%i\n};\n\n", lut_ctxno_zc[1023]);
 
        // lut_ctxno_sc
-       printf("static int8_t lut_ctxno_sc[256] = {\n  ");
+       printf("static char lut_ctxno_sc[256] = {\n  ");
        for (i = 0; i < 255; ++i) {
                printf("0x%x, ", t1_init_ctxno_sc(i << 4));
                if(!((i+1)&0xf))
@@ -236,7 +236,7 @@ int main(){
                }
        }
 
-       printf("static int8_t lut_ctxno_mag[4096] = {\n  ");
+       printf("static char lut_ctxno_mag[4096] = {\n  ");
        for (i = 0; i < 4095; ++i) {
                printf("%i, ", lut_ctxno_mag[i]);
                if(!((i+1)&0xf))
@@ -245,7 +245,7 @@ int main(){
        printf("%i\n};\n\n", lut_ctxno_mag[4095]);
 
        // lut_spb
-       printf("static int8_t lut_spb[256] = {\n  ");
+       printf("static char lut_spb[256] = {\n  ");
        for (i = 0; i < 255; ++i) {
                printf("%i, ", t1_init_spb(i << 4));
                if(!((i+1)&0x1f))
@@ -279,16 +279,16 @@ int main(){
                                        (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
        }
 
-       printf("static int16_t lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n  ");
+       printf("static short lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n  ");
        dump_array16(&lut_nmsedec_sig, 1 << T1_NMSEDEC_BITS);
 
-       printf("static int16_t lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n  ");
+       printf("static short lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n  ");
        dump_array16(&lut_nmsedec_sig0, 1 << T1_NMSEDEC_BITS);
 
-       printf("static int16_t lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n  ");
+       printf("static short lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n  ");
        dump_array16(&lut_nmsedec_ref, 1 << T1_NMSEDEC_BITS);
 
-       printf("static int16_t lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n  ");
+       printf("static short lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n  ");
        dump_array16(&lut_nmsedec_ref0, 1 << T1_NMSEDEC_BITS);
 
        return 0;