summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2010-04-08 17:50:05 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2010-04-08 17:50:05 +0000
commitb5ff4ffedcf5a944723631f7e680c8f5a45ae34f (patch)
tree8466f842dd748ae026ce4e4704bb541b5fe628a1
parent6628a4df4535b1afa13b7103528c722413a42d02 (diff)
Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches.
-rw-r--r--ChangeLog1
-rw-r--r--mj2/mj2_convert.c2
-rw-r--r--mj2/mj2_to_frames.c2
-rw-r--r--mj2/wrap_j2k_in_mj2.c44
4 files changed, 34 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index a19d2ce2..b9670842 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ What's New for OpenJPEG
+ : added
April 8, 2010
+* [FOD] Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches
* [FOD] Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
! [FOD] Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter)
diff --git a/mj2/mj2_convert.c b/mj2/mj2_convert.c
index 8868843a..c7e0c04f 100644
--- a/mj2/mj2_convert.c
+++ b/mj2/mj2_convert.c
@@ -324,8 +324,6 @@ int imagetobmp(opj_image_t * img, char *outfile) {
}
}
fclose(f);
- opj_free(img->comps[1].data);
- opj_free(img->comps[2].data);
}
return 0;
}
diff --git a/mj2/mj2_to_frames.c b/mj2/mj2_to_frames.c
index b87703cc..0f2cb779 100644
--- a/mj2/mj2_to_frames.c
+++ b/mj2/mj2_to_frames.c
@@ -183,7 +183,7 @@ int main(int argc, char *argv[]) {
{
fprintf(stdout,"The frames will be output in a bmp format (output_1.bmp, ...)\n");
sprintf(outfilename,"output_%d.bmp",snum);
- if (imagetobmp(img, outfilename)) // Convert image to YUV
+ if (imagetobmp(img, outfilename)) // Convert image to BMP
return 1;
}
diff --git a/mj2/wrap_j2k_in_mj2.c b/mj2/wrap_j2k_in_mj2.c
index 0237d8bc..7615cfde 100644
--- a/mj2/wrap_j2k_in_mj2.c
+++ b/mj2/wrap_j2k_in_mj2.c
@@ -133,16 +133,26 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
movie->tk[0].depth = image->comps[0].prec;
if (image->numcomps==3) {
- if ((image->comps[0].dx == 1) && (image->comps[1].dx == 1) && (image->comps[1].dx == 1))
+ if ((image->comps[0].dx == 1)
+ && (image->comps[1].dx == 1)
+ && (image->comps[2].dx == 1))
movie->tk[0].CbCr_subsampling_dx = 1;
- else if ((image->comps[0].dx == 1) && (image->comps[1].dx == 2) && (image->comps[1].dx == 2))
+ else
+ if ((image->comps[0].dx == 1)
+ && (image->comps[1].dx == 2)
+ && (image->comps[2].dx == 2))
movie->tk[0].CbCr_subsampling_dx = 2;
else
fprintf(stderr,"Image component sizes are incoherent\n");
- if ((image->comps[0].dy == 1) && (image->comps[1].dy == 1) && (image->comps[1].dy == 1))
+ if ((image->comps[0].dy == 1)
+ && (image->comps[1].dy == 1)
+ && (image->comps[2].dy == 1))
movie->tk[0].CbCr_subsampling_dy = 1;
- else if ((image->comps[0].dy == 1) && (image->comps[1].dy == 2) && (image->comps[1].dy == 2))
+ else
+ if ((image->comps[0].dy == 1)
+ && (image->comps[1].dy == 2)
+ && (image->comps[2].dy == 2))
movie->tk[0].CbCr_subsampling_dy = 2;
else
fprintf(stderr,"Image component sizes are incoherent\n");
@@ -190,16 +200,26 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
else
movie->tk[0].jp2_struct.meth = 2;
- if (image->numcomps == 1)
- movie->tk[0].jp2_struct.enumcs = 17; // Grayscale
+ if (image->numcomps == 1)
+ movie->tk[0].jp2_struct.enumcs = 17; // Grayscale
- else if ((image->comps[0].dx == 1) && (image->comps[1].dx == 1) && (image->comps[1].dx == 1) &&
- (image->comps[0].dy == 1) && (image->comps[1].dy == 1) && (image->comps[1].dy == 1))
- movie->tk[0].jp2_struct.enumcs = 16; // RGB
+ else
+ if ((image->comps[0].dx == 1)
+ && (image->comps[1].dx == 1)
+ && (image->comps[2].dx == 1)
+ && (image->comps[0].dy == 1)
+ && (image->comps[1].dy == 1)
+ && (image->comps[2].dy == 1))
+ movie->tk[0].jp2_struct.enumcs = 16; // RGB
- else if ((image->comps[0].dx == 1) && (image->comps[1].dx == 2) && (image->comps[1].dx == 2) &&
- (image->comps[0].dy == 1) && (image->comps[1].dy == 2) && (image->comps[1].dy == 2))
- movie->tk[0].jp2_struct.enumcs = 18; // YUV
+ else
+ if ((image->comps[0].dx == 1)
+ && (image->comps[1].dx == 2)
+ && (image->comps[2].dx == 2)
+ && (image->comps[0].dy == 1)
+ && (image->comps[1].dy == 2)
+ && (image->comps[2].dy == 2))
+ movie->tk[0].jp2_struct.enumcs = 18; // YUV
else
movie->tk[0].jp2_struct.enumcs = 0; // Unkown profile */