Difference between revisions of "User:Robin Cornelius/OpenJPEG 1.3"
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
return image; | return image; | ||
} | } | ||
=== Patch 2 === | === Patch 2 === | ||
--- ./libopenjpeg/t1.c 2009-08-16 09:17:53.000000000 +0100 | |||
+++ ./libopenjpeg/t1.c 2009-08-16 09:21:42.000000000 +0100 | |||
@@ -738,14 +738,27 @@ | |||
double stepsize, | |||
int numcomps) | |||
{ | |||
- double w1, w2, wmsedec; | |||
+ double w1 = 1, w2, wmsedec; | |||
+ | |||
+ // Prevent running an MCT on more than 3 components. NB openjpeg v2.0 will support this via | |||
+ // custom MCT tables that can be passed as encode parameters, 1.3 cannot support this as it | |||
+ // uses a static table of 3 entries and there for can only cope with 3 components with out an | |||
+ // array overflow | |||
+ | |||
+ if(numcomps==3) { | |||
+ if (qmfbid == 1) { | |||
+ w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0; | |||
+ } else { | |||
+ w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0; | |||
+ } | |||
+ } | |||
+ | |||
if (qmfbid == 1) { | |||
- w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0; | |||
w2 = dwt_getnorm(level, orient); | |||
} else { /* if (qmfbid == 0) */ | |||
- w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0; | |||
w2 = dwt_getnorm_real(level, orient); | |||
} | |||
+ | |||
wmsedec = w1 * w2 * stepsize * (1 << bpno); | |||
wmsedec *= wmsedec * nmsedec / 8192.0; |
Revision as of 05:21, 4 November 2009
Openjpeg 1.3 requires some patches in order to correctly work with SecondLife/Snowglobe
--- openjpeg-1.3+dfsg.orig/libopenjpeg/image.c 2007-10-18 13:26:11.000000000 +0100 +++ openjpeg/libopenjpeg/image.c 2009-10-29 09:16:32.578125000 +0000 @@ -28,6 +28,7 @@ opj_image_t* opj_image_create0(void) { opj_image_t *image = (opj_image_t*)opj_malloc(sizeof(opj_image_t)); + image->comps = NULL; return image; }
Patch 2
--- ./libopenjpeg/t1.c 2009-08-16 09:17:53.000000000 +0100 +++ ./libopenjpeg/t1.c 2009-08-16 09:21:42.000000000 +0100 @@ -738,14 +738,27 @@ double stepsize, int numcomps) { - double w1, w2, wmsedec; + double w1 = 1, w2, wmsedec; + + // Prevent running an MCT on more than 3 components. NB openjpeg v2.0 will support this via + // custom MCT tables that can be passed as encode parameters, 1.3 cannot support this as it + // uses a static table of 3 entries and there for can only cope with 3 components with out an + // array overflow + + if(numcomps==3) { + if (qmfbid == 1) { + w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0; + } else { + w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0; + } + } + if (qmfbid == 1) { - w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0; w2 = dwt_getnorm(level, orient); } else { /* if (qmfbid == 0) */ - w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0; w2 = dwt_getnorm_real(level, orient); } + wmsedec = w1 * w2 * stepsize * (1 << bpno); wmsedec *= wmsedec * nmsedec / 8192.0;