Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches.
This commit is contained in:
parent
6628a4df45
commit
b5ff4ffedc
|
@ -6,6 +6,7 @@ What's New for OpenJPEG
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
April 8, 2010
|
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] 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)
|
! [FOD] Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter)
|
||||||
|
|
||||||
|
|
|
@ -324,8 +324,6 @@ int imagetobmp(opj_image_t * img, char *outfile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
opj_free(img->comps[1].data);
|
|
||||||
opj_free(img->comps[2].data);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
fprintf(stdout,"The frames will be output in a bmp format (output_1.bmp, ...)\n");
|
||||||
sprintf(outfilename,"output_%d.bmp",snum);
|
sprintf(outfilename,"output_%d.bmp",snum);
|
||||||
if (imagetobmp(img, outfilename)) // Convert image to YUV
|
if (imagetobmp(img, outfilename)) // Convert image to BMP
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,16 +133,26 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
|
||||||
movie->tk[0].depth = image->comps[0].prec;
|
movie->tk[0].depth = image->comps[0].prec;
|
||||||
|
|
||||||
if (image->numcomps==3) {
|
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;
|
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;
|
movie->tk[0].CbCr_subsampling_dx = 2;
|
||||||
else
|
else
|
||||||
fprintf(stderr,"Image component sizes are incoherent\n");
|
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;
|
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;
|
movie->tk[0].CbCr_subsampling_dy = 2;
|
||||||
else
|
else
|
||||||
fprintf(stderr,"Image component sizes are incoherent\n");
|
fprintf(stderr,"Image component sizes are incoherent\n");
|
||||||
|
@ -193,12 +203,22 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
|
||||||
if (image->numcomps == 1)
|
if (image->numcomps == 1)
|
||||||
movie->tk[0].jp2_struct.enumcs = 17; // Grayscale
|
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) &&
|
else
|
||||||
(image->comps[0].dy == 1) && (image->comps[1].dy == 1) && (image->comps[1].dy == 1))
|
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
|
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) &&
|
else
|
||||||
(image->comps[0].dy == 1) && (image->comps[1].dy == 2) && (image->comps[1].dy == 2))
|
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
|
movie->tk[0].jp2_struct.enumcs = 18; // YUV
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue