From 1cfbdcc9ceedc96dac508a68f4d1cf59d3696b6f Mon Sep 17 00:00:00 2001 From: Francois-Olivier Devaux Date: Tue, 21 Aug 2007 12:36:05 +0000 Subject: [PATCH] Consolidated some calls to mqc_setcurctx. Cleaned up t1_generate_luts to output the proper types. --- ChangeLog | 2 ++ LibOpenJPEG.vcproj | 2 +- libopenjpeg/t1.c | 12 ++++-------- libopenjpeg/t1_generate_luts.c | 16 ++++++++-------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbb072e5..063da5f8 100644 --- 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 diff --git a/LibOpenJPEG.vcproj b/LibOpenJPEG.vcproj index e55fd8b2..505f89b2 100644 --- a/LibOpenJPEG.vcproj +++ b/LibOpenJPEG.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="8,00" Name="LibOpenJPEG" - ProjectGUID="{4F27AA53-4181-4A1A-8238-3931B0A41048}" + ProjectGUID="{BDB8C37B-824E-4617-827C-B13E2F015EFE}" > 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; diff --git a/libopenjpeg/t1_generate_luts.c b/libopenjpeg/t1_generate_luts.c index 62cb1589..e1f47dfb 100644 --- a/libopenjpeg/t1_generate_luts.c +++ b/libopenjpeg/t1_generate_luts.c @@ -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;