Merge remote-tracking branch 'uclouvain/master' into coc-qcc

This commit is contained in:
mayeut 2015-09-08 22:33:07 +02:00
commit 66d890bf22
21 changed files with 570 additions and 207 deletions

19
.travis.yml Normal file
View File

@ -0,0 +1,19 @@
language: c
compiler:
- gcc
before_install:
- cmake --version
- git clone --depth=1 --branch=master git://github.com/uclouvain/openjpeg-data.git data
- wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xvz
install:
- chmod +x jpylyzer-1.14.2/jpylyzer/jpylyzer.py
script:
- mkdir build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_CODEC=ON -DBUILD_THIRDPARTY=ON -DBUILD_TESTING=ON -DOPJ_DATA_ROOT=${PWD}/../data -DJPYLYZER_EXECUTABLE=${PWD}/../jpylyzer-1.14.2/jpylyzer/jpylyzer.py -DSITE=travis-ci.org -DBUILDNAME=${TRAVIS_OS_NAME}-${CC}$(${CC} -dumpversion)-x86_64-${TRAVIS_BRANCH}$( [[ "${TRAVIS_PULL_REQUEST}" != "false" ]] && echo "-pr${TRAVIS_PULL_REQUEST}" )-Release-3rdP ..
- ctest -D ExperimentalStart
- ctest -D ExperimentalBuild -V
- ctest -D ExperimentalTest -j2 || true
- ctest -D ExperimentalSubmit || true

View File

@ -12,6 +12,9 @@ Anyone. As the OpenJPEG code is released under the [2-clauses BSD license](https
## How to install and use OpenJPEG ?
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
## Current Status
* Build status: [![Build Status](https://travis-ci.org/uclouvain/openjpeg.svg?branch=master)](https://travis-ci.org/uclouvain/openjpeg)
## Who are the developers ?
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).

View File

@ -305,6 +305,7 @@ void color_sycc_to_rgb(opj_image_t *img)
}/* color_sycc_to_rgb() */
#if defined(OPJ_HAVE_LIBLCMS2) || defined(OPJ_HAVE_LIBLCMS1)
#ifdef OPJ_HAVE_LIBLCMS1
/* Bob Friesenhahn proposed:*/
#define cmsSigXYZData icSigXYZData
@ -354,16 +355,16 @@ void color_apply_icc_profile(opj_image_t *image)
if(out_space == cmsSigRgbData) /* enumCS 16 */
{
if( prec <= 8 )
{
if( prec <= 8 )
{
in_type = TYPE_RGB_8;
out_type = TYPE_RGB_8;
}
else
{
}
else
{
in_type = TYPE_RGB_16;
out_type = TYPE_RGB_16;
}
}
out_prof = cmsCreate_sRGBProfile();
image->color_space = OPJ_CLRSPC_SRGB;
}
@ -389,8 +390,8 @@ else
fprintf(stderr,"%s:%d: color_apply_icc_profile\n\tICC Profile has unknown "
"output colorspace(%#x)(%c%c%c%c)\n\tICC Profile ignored.\n",
__FILE__,__LINE__,out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff);
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff);
#endif
return;
}
@ -398,21 +399,21 @@ __FILE__,__LINE__,out_space,
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tchannels(%d) prec(%d) w(%d) h(%d)"
"\n\tprofile: in(%p) out(%p)\n",__FILE__,__LINE__,image->numcomps,prec,
max_w,max_h, (void*)in_prof,(void*)out_prof);
max_w,max_h, (void*)in_prof,(void*)out_prof);
fprintf(stderr,"\trender_intent (%u)\n\t"
"color_space: in(%#x)(%c%c%c%c) out:(%#x)(%c%c%c%c)\n\t"
" type: in(%u) out:(%u)\n",
intent,
in_space,
(in_space>>24) & 0xff,(in_space>>16) & 0xff,
(in_space>>8) & 0xff, in_space & 0xff,
intent,
in_space,
(in_space>>24) & 0xff,(in_space>>16) & 0xff,
(in_space>>8) & 0xff, in_space & 0xff,
out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff,
out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff,
in_type,out_type
in_type,out_type
);
#else
(void)prec;
@ -444,11 +445,11 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
if(image->numcomps > 2)/* RGB, RGBA */
{
if( prec <= 8 )
{
if( prec <= 8 )
{
unsigned char *inbuf, *outbuf, *in, *out;
max = max_w * max_h;
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned char);
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned char);
in = inbuf = (unsigned char*)malloc(nr_samples);
out = outbuf = (unsigned char*)malloc(nr_samples);
@ -457,11 +458,11 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
{
*in++ = (unsigned char)*r++;
*in++ = (unsigned char)*g++;
*in++ = (unsigned char)*b++;
}
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
@ -470,18 +471,18 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
{
*r++ = (int)*out++;
*g++ = (int)*out++;
*b++ = (int)*out++;
}
}
free(inbuf); free(outbuf);
}
else
{
}
else
{
unsigned short *inbuf, *outbuf, *in, *out;
max = max_w * max_h;
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned short);
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned short);
in = inbuf = (unsigned short*)malloc(nr_samples);
out = outbuf = (unsigned short*)malloc(nr_samples);
@ -490,11 +491,11 @@ else
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
{
*in++ = (unsigned short)*r++;
*in++ = (unsigned short)*g++;
*in++ = (unsigned short)*b++;
}
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
@ -503,19 +504,19 @@ else
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
{
*r++ = (int)*out++;
*g++ = (int)*out++;
*b++ = (int)*out++;
}
}
free(inbuf); free(outbuf);
}
}
}
else /* GRAY, GRAYA */
{
unsigned char *in, *inbuf, *out, *outbuf;
max = max_w * max_h;
nr_samples = (cmsUInt32Number)max * 3 * sizeof(unsigned char);
max = max_w * max_h;
nr_samples = (cmsUInt32Number)max * 3 * sizeof(unsigned char);
in = inbuf = (unsigned char*)malloc(nr_samples);
out = outbuf = (unsigned char*)malloc(nr_samples);
@ -561,5 +562,227 @@ else
#endif
}/* color_apply_icc_profile() */
#endif /* OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 */
void color_apply_conversion(opj_image_t *image)
{
int *row;
int enumcs, numcomps;
image->color_space = OPJ_CLRSPC_SRGB;
numcomps = (int)image->numcomps;
if(numcomps != 3)
{
fprintf(stderr,"%s:%d:\n\tnumcomps %d not handled. Quitting.\n",
__FILE__,__LINE__,numcomps);
return;
}
row = (int*)image->icc_profile_buf;
enumcs = row[0];
if(enumcs == 14)// CIELab
{
int *L, *a, *b, *red, *green, *blue;
int *src0, *src1, *src2, *dst0, *dst1, *dst2;
double rl, ol, ra, oa, rb, ob, prec0, prec1, prec2;
double minL, maxL, mina, maxa, minb, maxb;
unsigned int default_type;
unsigned int i, max;
cmsHPROFILE in, out;
cmsHTRANSFORM transform;
cmsUInt16Number RGB[3];
cmsCIELab Lab;
in = cmsCreateLab4Profile(NULL);
out = cmsCreate_sRGBProfile();
transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0);
#ifdef HAVE_LIBLCMS2
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
if(transform == NULL)
{
#ifdef HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
return;
}
prec0 = (double)image->comps[0].prec;
prec1 = (double)image->comps[1].prec;
prec2 = (double)image->comps[2].prec;
default_type = (unsigned int)row[1];
if(default_type == 0x44454600)// DEF : default
{
rl = 100; ra = 170; rb = 200;
ol = 0;
oa = pow(2, prec1 - 1);
ob = pow(2, prec2 - 2) + pow(2, prec2 - 3);
}
else
{
rl = row[2]; ra = row[4]; rb = row[6];
ol = row[3]; oa = row[5]; ob = row[7];
}
L = src0 = image->comps[0].data;
a = src1 = image->comps[1].data;
b = src2 = image->comps[2].data;
max = image->comps[0].w * image->comps[0].h;
red = dst0 = (int*)malloc(max * sizeof(int));
green = dst1 = (int*)malloc(max * sizeof(int));
blue = dst2 = (int*)malloc(max * sizeof(int));
minL = -(rl * ol)/(pow(2, prec0)-1);
maxL = minL + rl;
mina = -(ra * oa)/(pow(2, prec1)-1);
maxa = mina + ra;
minb = -(rb * ob)/(pow(2, prec2)-1);
maxb = minb + rb;
for(i = 0; i < max; ++i)
{
Lab.L = minL + (double)(*L) * (maxL - minL)/(pow(2, prec0)-1); ++L;
Lab.a = mina + (double)(*a) * (maxa - mina)/(pow(2, prec1)-1); ++a;
Lab.b = minb + (double)(*b) * (maxb - minb)/(pow(2, prec2)-1); ++b;
cmsDoTransform(transform, &Lab, RGB, 1);
*red++ = RGB[0];
*green++ = RGB[1];
*blue++ = RGB[2];
}
cmsDeleteTransform(transform);
#ifdef HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
free(src0); image->comps[0].data = dst0;
free(src1); image->comps[1].data = dst1;
free(src2); image->comps[2].data = dst2;
image->color_space = OPJ_CLRSPC_SRGB;
image->comps[0].prec = 16;
image->comps[1].prec = 16;
image->comps[2].prec = 16;
return;
}
fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs);
}// color_apply_conversion()
#endif // HAVE_LIBLCMS2 || HAVE_LIBLCMS1
void color_cmyk_to_rgb(opj_image_t *image)
{
float C, M, Y, K;
float sC, sM, sY, sK;
unsigned int w, h, max, i;
w = image->comps[0].w;
h = image->comps[0].h;
if(image->numcomps < 4) return;
max = w * h;
sC = 1.0F / (float)((1 << image->comps[0].prec) - 1);
sM = 1.0F / (float)((1 << image->comps[1].prec) - 1);
sY = 1.0F / (float)((1 << image->comps[2].prec) - 1);
sK = 1.0F / (float)((1 << image->comps[3].prec) - 1);
for(i = 0; i < max; ++i)
{
/* CMYK values from 0 to 1 */
C = (float)(image->comps[0].data[i]) * sC;
M = (float)(image->comps[1].data[i]) * sM;
Y = (float)(image->comps[2].data[i]) * sY;
K = (float)(image->comps[3].data[i]) * sK;
/* Invert all CMYK values */
C = 1.0F - C;
M = 1.0F - M;
Y = 1.0F - Y;
K = 1.0F - K;
/* CMYK -> RGB : RGB results from 0 to 255 */
image->comps[0].data[i] = (int)(255.0F * C * K); /* R */
image->comps[1].data[i] = (int)(255.0F * M * K); /* G */
image->comps[2].data[i] = (int)(255.0F * Y * K); /* B */
}
free(image->comps[3].data); image->comps[3].data = NULL;
image->comps[0].prec = 8;
image->comps[1].prec = 8;
image->comps[2].prec = 8;
image->numcomps -= 1;
image->color_space = OPJ_CLRSPC_SRGB;
for (i = 3; i < image->numcomps; ++i) {
memcpy(&(image->comps[i]), &(image->comps[i+1]), sizeof(image->comps[i]));
}
}// color_cmyk_to_rgb()
//
// This code has been adopted from sjpx_openjpeg.c of ghostscript
//
void color_esycc_to_rgb(opj_image_t *image)
{
int y, cb, cr, sign1, sign2, val;
unsigned int w, h, max, i;
int flip_value = (1 << (image->comps[0].prec-1));
int max_value = (1 << image->comps[0].prec) - 1;
if(image->numcomps < 3) return;
w = image->comps[0].w;
h = image->comps[0].h;
sign1 = (int)image->comps[1].sgnd;
sign2 = (int)image->comps[2].sgnd;
max = w * h;
for(i = 0; i < max; ++i)
{
y = image->comps[0].data[i]; cb = image->comps[1].data[i]; cr = image->comps[2].data[i];
if( !sign1) cb -= flip_value;
if( !sign2) cr -= flip_value;
val = (int)
((float)y - (float)0.0000368 * (float)cb
+ (float)1.40199 * (float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[0].data[i] = val;
val = (int)
((float)1.0003 * (float)y - (float)0.344125 * (float)cb
- (float)0.7141128 * (float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[1].data[i] = val;
val = (int)
((float)0.999823 * (float)y + (float)1.77204 * (float)cb
- (float)0.000008 *(float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[2].data[i] = val;
}
image->color_space = OPJ_CLRSPC_SRGB;
}// color_esycc_to_rgb()

View File

@ -40,5 +40,8 @@
extern void color_sycc_to_rgb(opj_image_t *img);
extern void color_apply_icc_profile(opj_image_t *image);
extern void color_apply_conversion(opj_image_t *image);
extern void color_cmyk_to_rgb(opj_image_t *image);
extern void color_esycc_to_rgb(opj_image_t *image);
#endif /* _OPJ_COLOR_H_ */

View File

@ -315,7 +315,7 @@ static opj_image_t* bmp8toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_i
static OPJ_BOOL bmp_read_file_header(FILE* IN, OPJ_BITMAPFILEHEADER* header)
{
header->bfType = (OPJ_UINT16)getc(IN);
header->bfType |= (OPJ_UINT16)((OPJ_UINT32)(getc(IN) << 8));
header->bfType |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
if (header->bfType != 19778) {
fprintf(stderr,"Error, not a BMP file!\n");
@ -325,20 +325,20 @@ static OPJ_BOOL bmp_read_file_header(FILE* IN, OPJ_BITMAPFILEHEADER* header)
/* FILE HEADER */
/* ------------- */
header->bfSize = (OPJ_UINT32)getc(IN);
header->bfSize |= (OPJ_UINT32)(getc(IN) << 8);
header->bfSize |= (OPJ_UINT32)(getc(IN) << 16);
header->bfSize |= (OPJ_UINT32)(getc(IN) << 24);
header->bfSize |= (OPJ_UINT32)getc(IN) << 8;
header->bfSize |= (OPJ_UINT32)getc(IN) << 16;
header->bfSize |= (OPJ_UINT32)getc(IN) << 24;
header->bfReserved1 = (OPJ_UINT16)getc(IN);
header->bfReserved1 |= (OPJ_UINT16)((OPJ_UINT32)(getc(IN) << 8));
header->bfReserved1 |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
header->bfReserved2 = (OPJ_UINT16)getc(IN);
header->bfReserved2 |= (OPJ_UINT16)((OPJ_UINT32)(getc(IN) << 8));
header->bfReserved2 |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
header->bfOffBits = (OPJ_UINT32)getc(IN);
header->bfOffBits |= (OPJ_UINT32)(getc(IN) << 8);
header->bfOffBits |= (OPJ_UINT32)(getc(IN) << 16);
header->bfOffBits |= (OPJ_UINT32)(getc(IN) << 24);
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 8;
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 16;
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 24;
return OPJ_TRUE;
}
static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
@ -347,9 +347,9 @@ static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
/* INFO HEADER */
/* ------------- */
header->biSize = (OPJ_UINT32)getc(IN);
header->biSize |= (OPJ_UINT32)(getc(IN) << 8);
header->biSize |= (OPJ_UINT32)(getc(IN) << 16);
header->biSize |= (OPJ_UINT32)(getc(IN) << 24);
header->biSize |= (OPJ_UINT32)getc(IN) << 8;
header->biSize |= (OPJ_UINT32)getc(IN) << 16;
header->biSize |= (OPJ_UINT32)getc(IN) << 24;
switch (header->biSize) {
case 12U: /* BITMAPCOREHEADER */
@ -365,80 +365,80 @@ static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
}
header->biWidth = (OPJ_UINT32)getc(IN);
header->biWidth |= (OPJ_UINT32)(getc(IN) << 8);
header->biWidth |= (OPJ_UINT32)(getc(IN) << 16);
header->biWidth |= (OPJ_UINT32)(getc(IN) << 24);
header->biWidth |= (OPJ_UINT32)getc(IN) << 8;
header->biWidth |= (OPJ_UINT32)getc(IN) << 16;
header->biWidth |= (OPJ_UINT32)getc(IN) << 24;
header->biHeight = (OPJ_UINT32)getc(IN);
header->biHeight |= (OPJ_UINT32)(getc(IN) << 8);
header->biHeight |= (OPJ_UINT32)(getc(IN) << 16);
header->biHeight |= (OPJ_UINT32)(getc(IN) << 24);
header->biHeight |= (OPJ_UINT32)getc(IN) << 8;
header->biHeight |= (OPJ_UINT32)getc(IN) << 16;
header->biHeight |= (OPJ_UINT32)getc(IN) << 24;
header->biPlanes = (OPJ_UINT16)getc(IN);
header->biPlanes |= (OPJ_UINT16)((OPJ_UINT32)(getc(IN) << 8));
header->biPlanes |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
header->biBitCount = (OPJ_UINT16)getc(IN);
header->biBitCount |= (OPJ_UINT16)((OPJ_UINT32)(getc(IN) << 8));
header->biBitCount |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
if(header->biSize >= 40U) {
header->biCompression = (OPJ_UINT32)getc(IN);
header->biCompression |= (OPJ_UINT32)(getc(IN) << 8);
header->biCompression |= (OPJ_UINT32)(getc(IN) << 16);
header->biCompression |= (OPJ_UINT32)(getc(IN) << 24);
header->biCompression |= (OPJ_UINT32)getc(IN) << 8;
header->biCompression |= (OPJ_UINT32)getc(IN) << 16;
header->biCompression |= (OPJ_UINT32)getc(IN) << 24;
header->biSizeImage = (OPJ_UINT32)getc(IN);
header->biSizeImage |= (OPJ_UINT32)(getc(IN) << 8);
header->biSizeImage |= (OPJ_UINT32)(getc(IN) << 16);
header->biSizeImage |= (OPJ_UINT32)(getc(IN) << 24);
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 8;
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 16;
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 24;
header->biXpelsPerMeter = (OPJ_UINT32)getc(IN);
header->biXpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 8);
header->biXpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 16);
header->biXpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 24);
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 8;
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 16;
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 24;
header->biYpelsPerMeter = (OPJ_UINT32)getc(IN);
header->biYpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 8);
header->biYpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 16);
header->biYpelsPerMeter |= (OPJ_UINT32)(getc(IN) << 24);
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 8;
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 16;
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 24;
header->biClrUsed = (OPJ_UINT32)getc(IN);
header->biClrUsed |= (OPJ_UINT32)(getc(IN) << 8);
header->biClrUsed |= (OPJ_UINT32)(getc(IN) << 16);
header->biClrUsed |= (OPJ_UINT32)(getc(IN) << 24);
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 8;
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 16;
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 24;
header->biClrImportant = (OPJ_UINT32)getc(IN);
header->biClrImportant |= (OPJ_UINT32)(getc(IN) << 8);
header->biClrImportant |= (OPJ_UINT32)(getc(IN) << 16);
header->biClrImportant |= (OPJ_UINT32)(getc(IN) << 24);
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 8;
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 16;
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 24;
}
if(header->biSize >= 56U) {
header->biRedMask = (OPJ_UINT32)getc(IN);
header->biRedMask |= (OPJ_UINT32)(getc(IN) << 8);
header->biRedMask |= (OPJ_UINT32)(getc(IN) << 16);
header->biRedMask |= (OPJ_UINT32)(getc(IN) << 24);
header->biRedMask |= (OPJ_UINT32)getc(IN) << 8;
header->biRedMask |= (OPJ_UINT32)getc(IN) << 16;
header->biRedMask |= (OPJ_UINT32)getc(IN) << 24;
header->biGreenMask = (OPJ_UINT32)getc(IN);
header->biGreenMask |= (OPJ_UINT32)(getc(IN) << 8);
header->biGreenMask |= (OPJ_UINT32)(getc(IN) << 16);
header->biGreenMask |= (OPJ_UINT32)(getc(IN) << 24);
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 8;
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 16;
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 24;
header->biBlueMask = (OPJ_UINT32)getc(IN);
header->biBlueMask |= (OPJ_UINT32)(getc(IN) << 8);
header->biBlueMask |= (OPJ_UINT32)(getc(IN) << 16);
header->biBlueMask |= (OPJ_UINT32)(getc(IN) << 24);
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 8;
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 16;
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 24;
header->biAlphaMask = (OPJ_UINT32)getc(IN);
header->biAlphaMask |= (OPJ_UINT32)(getc(IN) << 8);
header->biAlphaMask |= (OPJ_UINT32)(getc(IN) << 16);
header->biAlphaMask |= (OPJ_UINT32)(getc(IN) << 24);
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 8;
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 16;
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 24;
}
if(header->biSize >= 108U) {
header->biColorSpaceType = (OPJ_UINT32)getc(IN);
header->biColorSpaceType |= (OPJ_UINT32)(getc(IN) << 8);
header->biColorSpaceType |= (OPJ_UINT32)(getc(IN) << 16);
header->biColorSpaceType |= (OPJ_UINT32)(getc(IN) << 24);
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 8;
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 16;
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 24;
if (fread(&(header->biColorSpaceEP), 1U, sizeof(header->biColorSpaceEP), IN) != sizeof(header->biColorSpaceEP)) {
fprintf(stderr,"Error, can't read BMP header\n");
@ -446,41 +446,41 @@ static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
}
header->biRedGamma = (OPJ_UINT32)getc(IN);
header->biRedGamma |= (OPJ_UINT32)(getc(IN) << 8);
header->biRedGamma |= (OPJ_UINT32)(getc(IN) << 16);
header->biRedGamma |= (OPJ_UINT32)(getc(IN) << 24);
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 8;
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 16;
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 24;
header->biGreenGamma = (OPJ_UINT32)getc(IN);
header->biGreenGamma |= (OPJ_UINT32)(getc(IN) << 8);
header->biGreenGamma |= (OPJ_UINT32)(getc(IN) << 16);
header->biGreenGamma |= (OPJ_UINT32)(getc(IN) << 24);
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 8;
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 16;
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 24;
header->biBlueGamma = (OPJ_UINT32)getc(IN);
header->biBlueGamma |= (OPJ_UINT32)(getc(IN) << 8);
header->biBlueGamma |= (OPJ_UINT32)(getc(IN) << 16);
header->biBlueGamma |= (OPJ_UINT32)(getc(IN) << 24);
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 8;
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 16;
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 24;
}
if(header->biSize >= 124U) {
header->biIntent = (OPJ_UINT32)getc(IN);
header->biIntent |= (OPJ_UINT32)(getc(IN) << 8);
header->biIntent |= (OPJ_UINT32)(getc(IN) << 16);
header->biIntent |= (OPJ_UINT32)(getc(IN) << 24);
header->biIntent |= (OPJ_UINT32)getc(IN) << 8;
header->biIntent |= (OPJ_UINT32)getc(IN) << 16;
header->biIntent |= (OPJ_UINT32)getc(IN) << 24;
header->biIccProfileData = (OPJ_UINT32)getc(IN);
header->biIccProfileData |= (OPJ_UINT32)(getc(IN) << 8);
header->biIccProfileData |= (OPJ_UINT32)(getc(IN) << 16);
header->biIccProfileData |= (OPJ_UINT32)(getc(IN) << 24);
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 8;
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 16;
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 24;
header->biIccProfileSize = (OPJ_UINT32)getc(IN);
header->biIccProfileSize |= (OPJ_UINT32)(getc(IN) << 8);
header->biIccProfileSize |= (OPJ_UINT32)(getc(IN) << 16);
header->biIccProfileSize |= (OPJ_UINT32)(getc(IN) << 24);
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 8;
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 16;
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 24;
header->biReserved = (OPJ_UINT32)getc(IN);
header->biReserved |= (OPJ_UINT32)(getc(IN) << 8);
header->biReserved |= (OPJ_UINT32)(getc(IN) << 16);
header->biReserved |= (OPJ_UINT32)(getc(IN) << 24);
header->biReserved |= (OPJ_UINT32)getc(IN) << 8;
header->biReserved |= (OPJ_UINT32)getc(IN) << 16;
header->biReserved |= (OPJ_UINT32)getc(IN) << 24;
}
return OPJ_TRUE;
}

View File

@ -183,7 +183,18 @@ int imagetotif(opj_image_t * image, const char *outfile)
numcomps = image->numcomps;
if (numcomps > 2U) {
if (image->color_space == OPJ_CLRSPC_CMYK) {
if (numcomps < 4U) {
fprintf(stderr,"imagetotif: CMYK images shall be composed of at least 4 planes.\n");
fprintf(stderr,"\tAborting\n");
return 1;
}
tiPhoto = PHOTOMETRIC_SEPARATED;
if (numcomps > 4U) {
numcomps = 4U; /* Alpha not supported */
}
}
else if (numcomps > 2U) {
tiPhoto = PHOTOMETRIC_RGB;
if (numcomps > 4U) {
numcomps = 4U;
@ -266,6 +277,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, tiPhoto);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
strip_size = TIFFStripSize(tif);
rowStride = ((OPJ_SIZE_T)width * numcomps * (OPJ_SIZE_T)bps + 7U) / 8U;
if (rowStride != (OPJ_SIZE_T)strip_size) {

View File

@ -1349,10 +1349,6 @@ int main(int argc, char **argv)
/* Close the byte stream */
opj_stream_destroy(l_stream);
if(image->color_space == OPJ_CLRSPC_SYCC){
color_sycc_to_rgb(image); /* FIXME */
}
if( image->color_space != OPJ_CLRSPC_SYCC
&& image->numcomps == 3 && image->comps[0].dx == image->comps[0].dy
&& image->comps[1].dx != 1 )
@ -1360,9 +1356,22 @@ int main(int argc, char **argv)
else if (image->numcomps <= 2)
image->color_space = OPJ_CLRSPC_GRAY;
if(image->color_space == OPJ_CLRSPC_SYCC){
color_sycc_to_rgb(image);
}
else if((image->color_space == OPJ_CLRSPC_CMYK) && (parameters.cod_format != TIF_DFMT)){
color_cmyk_to_rgb(image);
}
else if(image->color_space == OPJ_CLRSPC_EYCC){
color_esycc_to_rgb(image);
}
if(image->icc_profile_buf) {
#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
color_apply_icc_profile(image); /* FIXME */
if(image->icc_profile_len)
color_apply_icc_profile(image);
else
color_apply_conversion(image);
#endif
free(image->icc_profile_buf);
image->icc_profile_buf = NULL; image->icc_profile_len = 0;

View File

@ -2858,6 +2858,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
for (i = 0; i < w * h; i++) {
if (!fread(&value, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
image->comps[compno].data[i] = raw_cp->rawSigned?(char)value:value;
@ -2872,11 +2873,13 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
unsigned char temp;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
value = temp << 8;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
value += temp;
@ -2886,6 +2889,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
}
else {
fprintf(stderr,"OpenJPEG cannot encode raw components with bit depth higher than 16 bits.\n");
fclose(f);
return NULL;
}

View File

@ -889,7 +889,7 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
m_peektextCtrl->WriteText(text);
delete buffer;
delete [] buffer;
}
/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)

View File

@ -85,7 +85,9 @@ if(UNIX)
target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
endif()
set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
# Install library
install(TARGETS ${OPENJPEG_LIBRARY_NAME}

View File

@ -5614,8 +5614,7 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,
assert(p_stream != 00);
l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);
l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;
l_mco_size = 5 + l_tcp->m_nb_mcc_records;
if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {
@ -5630,6 +5629,8 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,
p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;
p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size;
}
l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;
opj_write_bytes(l_current_data,J2K_MS_MCO,2); /* MCO */
l_current_data += 2;
@ -5641,10 +5642,9 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,
++l_current_data;
l_mcc_record = l_tcp->m_mcc_records;
for (i=0;i<l_tcp->m_nb_mcc_records;++i) {
for (i=0;i<l_tcp->m_nb_mcc_records;++i) {
opj_write_bytes(l_current_data,l_mcc_record->m_index,1);/* Imco -> use the mcc indicated by 1*/
++l_current_data;
++l_mcc_record;
}

View File

@ -849,6 +849,8 @@ static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color,
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].cn, nr_channels);
return OPJ_FALSE;
}
if (info[i].asoc == 65535U) continue;
if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= nr_channels) {
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].asoc - 1, nr_channels);
return OPJ_FALSE;
@ -1313,15 +1315,15 @@ static OPJ_BOOL opj_jp2_read_cdef( opj_jp2_t * jp2,
}
cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(opj_jp2_cdef_info_t));
if (!cdef_info)
return OPJ_FALSE;
if (!cdef_info)
return OPJ_FALSE;
jp2->color.jp2_cdef = (opj_jp2_cdef_t*)opj_malloc(sizeof(opj_jp2_cdef_t));
if(!jp2->color.jp2_cdef)
{
opj_free(cdef_info);
return OPJ_FALSE;
}
if(!jp2->color.jp2_cdef)
{
opj_free(cdef_info);
return OPJ_FALSE;
}
jp2->color.jp2_cdef->info = cdef_info;
jp2->color.jp2_cdef->n = (OPJ_UINT16) l_value;
@ -1383,14 +1385,59 @@ static OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size: %d)\n", p_colr_header_size);
return OPJ_FALSE;
}
if (p_colr_header_size > 7) {
if ((p_colr_header_size > 7) && (jp2->enumcs != 14)) { /* handled below for CIELab) */
/* testcase Altona_Technical_v20_x4.pdf */
opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (bad size: %d)\n", p_colr_header_size);
}
opj_read_bytes(p_colr_header_data,&jp2->enumcs ,4); /* EnumCS */
jp2->color.jp2_has_colr = 1;
p_colr_header_data += 4;
if(jp2->enumcs == 14)/* CIELab */
{
OPJ_UINT32 *cielab;
OPJ_UINT32 rl, ol, ra, oa, rb, ob, il;
cielab = (OPJ_UINT32*)opj_malloc(9 * sizeof(OPJ_UINT32));
cielab[0] = 14; /* enumcs */
/* default values */
rl = ra = rb = ol = oa = ob = 0;
il = 0x00443530; /* D50 */
cielab[1] = 0x44454600;/* DEF */
if(p_colr_header_size == 35)
{
opj_read_bytes(p_colr_header_data, &rl, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &ol, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &ra, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &oa, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &rb, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &ob, 4);
p_colr_header_data += 4;
opj_read_bytes(p_colr_header_data, &il, 4);
p_colr_header_data += 4;
cielab[1] = 0;
}
else if(p_colr_header_size != 7)
{
opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (CIELab, bad size: %d)\n", p_colr_header_size);
}
cielab[2] = rl; cielab[4] = ra; cielab[6] = rb;
cielab[3] = ol; cielab[5] = oa; cielab[7] = ob;
cielab[8] = il;
jp2->color.icc_profile_buf = (OPJ_BYTE*)cielab;
jp2->color.icc_profile_len = 0;
}
jp2->color.jp2_has_colr = 1;
}
else if (jp2->meth == 2) {
/* ICC profile */
@ -1399,11 +1446,11 @@ static OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
jp2->color.icc_profile_len = (OPJ_UINT32)icc_len;
jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_calloc(1,(size_t)icc_len);
if (!jp2->color.icc_profile_buf)
{
jp2->color.icc_profile_len = 0;
return OPJ_FALSE;
}
if (!jp2->color.icc_profile_buf)
{
jp2->color.icc_profile_len = 0;
return OPJ_FALSE;
}
for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value)
{
@ -1412,16 +1459,16 @@ static OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
jp2->color.icc_profile_buf[it_icc_value] = (OPJ_BYTE) l_value;
}
jp2->color.jp2_has_colr = 1;
jp2->color.jp2_has_colr = 1;
}
else if (jp2->meth > 2)
{
/* ISO/IEC 15444-1:2004 (E), Table I.9 Legal METH values:
conforming JP2 reader shall ignore the entire Colour Specification box.*/
opj_event_msg(p_manager, EVT_INFO, "COLR BOX meth value is not a regular value (%d), "
"so we will ignore the entire Colour Specification box. \n", jp2->meth);
}
return OPJ_TRUE;
{
/* ISO/IEC 15444-1:2004 (E), Table I.9 Legal METH values:
conforming JP2 reader shall ignore the entire Colour Specification box.*/
opj_event_msg(p_manager, EVT_INFO, "COLR BOX meth value is not a regular value (%d), "
"so we will ignore the entire Colour Specification box. \n", jp2->meth);
}
return OPJ_TRUE;
}
OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
@ -1438,42 +1485,44 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
return OPJ_FALSE;
}
if (!jp2->ignore_pclr_cmap_cdef){
if (!opj_jp2_check_color(p_image, &(jp2->color), p_manager)) {
return OPJ_FALSE;
}
if (!jp2->ignore_pclr_cmap_cdef){
if (!opj_jp2_check_color(p_image, &(jp2->color), p_manager)) {
return OPJ_FALSE;
}
/* Set Image Color Space */
if (jp2->enumcs == 16)
p_image->color_space = OPJ_CLRSPC_SRGB;
else if (jp2->enumcs == 17)
p_image->color_space = OPJ_CLRSPC_GRAY;
else if (jp2->enumcs == 18)
p_image->color_space = OPJ_CLRSPC_SYCC;
else if (jp2->enumcs == 24)
p_image->color_space = OPJ_CLRSPC_EYCC;
else
p_image->color_space = OPJ_CLRSPC_UNKNOWN;
/* Set Image Color Space */
if (jp2->enumcs == 16)
p_image->color_space = OPJ_CLRSPC_SRGB;
else if (jp2->enumcs == 17)
p_image->color_space = OPJ_CLRSPC_GRAY;
else if (jp2->enumcs == 18)
p_image->color_space = OPJ_CLRSPC_SYCC;
else if (jp2->enumcs == 24)
p_image->color_space = OPJ_CLRSPC_EYCC;
else if (jp2->enumcs == 12)
p_image->color_space = OPJ_CLRSPC_CMYK;
else
p_image->color_space = OPJ_CLRSPC_UNKNOWN;
if(jp2->color.jp2_pclr) {
/* Part 1, I.5.3.4: Either both or none : */
if( !jp2->color.jp2_pclr->cmap)
opj_jp2_free_pclr(&(jp2->color));
else
opj_jp2_apply_pclr(p_image, &(jp2->color));
}
if(jp2->color.jp2_pclr) {
/* Part 1, I.5.3.4: Either both or none : */
if( !jp2->color.jp2_pclr->cmap)
opj_jp2_free_pclr(&(jp2->color));
else
opj_jp2_apply_pclr(p_image, &(jp2->color));
}
/* Apply the color space if needed */
if(jp2->color.jp2_cdef) {
opj_jp2_apply_cdef(p_image, &(jp2->color), p_manager);
}
/* Apply the color space if needed */
if(jp2->color.jp2_cdef) {
opj_jp2_apply_cdef(p_image, &(jp2->color), p_manager);
}
if(jp2->color.icc_profile_buf) {
p_image->icc_profile_buf = jp2->color.icc_profile_buf;
p_image->icc_profile_len = jp2->color.icc_profile_len;
jp2->color.icc_profile_buf = NULL;
}
}
if(jp2->color.icc_profile_buf) {
p_image->icc_profile_buf = jp2->color.icc_profile_buf;
p_image->icc_profile_len = jp2->color.icc_profile_len;
jp2->color.icc_profile_buf = NULL;
}
}
return OPJ_TRUE;
}
@ -2824,6 +2873,10 @@ OPJ_BOOL opj_jp2_get_tile( opj_jp2_t *p_jp2,
p_image->color_space = OPJ_CLRSPC_GRAY;
else if (p_jp2->enumcs == 18)
p_image->color_space = OPJ_CLRSPC_SYCC;
else if (p_jp2->enumcs == 24)
p_image->color_space = OPJ_CLRSPC_EYCC;
else if (p_jp2->enumcs == 12)
p_image->color_space = OPJ_CLRSPC_CMYK;
else
p_image->color_space = OPJ_CLRSPC_UNKNOWN;

View File

@ -135,7 +135,15 @@ Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
return (OPJ_INT32)((a + (OPJ_INT64)(1 << b) - 1) >> b);
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
Divide a 64bits integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b) {
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
@ -143,7 +151,7 @@ static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
@return Returns a divided by 2^b
*/
static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b) {
return (OPJ_UINT32)((a + (OPJ_UINT64)(1U << b) - 1U) >> b);
return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
}
/**
@ -184,8 +192,8 @@ Multiply two fixed-precision rational numbers.
@return Returns a * b
*/
static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
#else
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
#endif
@ -196,8 +204,8 @@ static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
}
static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b) {
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
#else
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
#endif

View File

@ -862,10 +862,10 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
/* y0b = 1 if bandno = 2 or 3 */
l_y0b = (OPJ_INT32)((l_band->bandno)>>1);
/* l_band border (global) */
l_band->x0 = opj_int_ceildivpow2(l_tilec->x0 - (1 << l_level_no) * l_x0b, (OPJ_INT32)(l_level_no + 1));
l_band->y0 = opj_int_ceildivpow2(l_tilec->y0 - (1 << l_level_no) * l_y0b, (OPJ_INT32)(l_level_no + 1));
l_band->x1 = opj_int_ceildivpow2(l_tilec->x1 - (1 << l_level_no) * l_x0b, (OPJ_INT32)(l_level_no + 1));
l_band->y1 = opj_int_ceildivpow2(l_tilec->y1 - (1 << l_level_no) * l_y0b, (OPJ_INT32)(l_level_no + 1));
l_band->x0 = opj_int64_ceildivpow2(l_tilec->x0 - ((OPJ_INT64)l_x0b << l_level_no), (OPJ_INT32)(l_level_no + 1));
l_band->y0 = opj_int64_ceildivpow2(l_tilec->y0 - ((OPJ_INT64)l_y0b << l_level_no), (OPJ_INT32)(l_level_no + 1));
l_band->x1 = opj_int64_ceildivpow2(l_tilec->x1 - ((OPJ_INT64)l_x0b << l_level_no), (OPJ_INT32)(l_level_no + 1));
l_band->y1 = opj_int64_ceildivpow2(l_tilec->y1 - ((OPJ_INT64)l_y0b << l_level_no), (OPJ_INT32)(l_level_no + 1));
}
/** avoid an if with storing function pointer */

View File

@ -27,7 +27,9 @@ if(UNIX)
target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
endif()
set_target_properties(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
target_compile_options(${OPENJP3D_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(${OPENJP3D_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
# Install library
install(TARGETS ${OPENJP3D_LIBRARY_NAME}

View File

@ -61,7 +61,9 @@ endif()
add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
set_target_properties(openjpip
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
if(WIN32)
# add Winsock on windows+mingw

View File

@ -51,7 +51,9 @@ if(UNIX)
endif()
set_target_properties(openjpwl
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
target_compile_options(openjpwl PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(openjpwl PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
# Install library
install(TARGETS openjpwl

View File

@ -46,7 +46,9 @@ if(UNIX)
target_link_libraries(${OPENMJ2_LIBRARY_NAME} m)
endif()
set_target_properties(${OPENMJ2_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
target_compile_options(${OPENMJ2_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(${OPENMJ2_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
# Install library
install(TARGETS ${OPENMJ2_LIBRARY_NAME}

View File

@ -1,5 +1,7 @@
# NON-REGRESSION TESTS ON THIS DATASET LOCATED ${OPJ_DATA_ROOT}/input/nonregression
cmake_minimum_required(VERSION 2.8.7)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary)
set(TEMP ${CMAKE_CURRENT_BINARY_DIR}/Temporary)

View File

@ -24,26 +24,24 @@ c6091c07bf0ff221008dfb60d893cdff issue134.jp2_2.pgx
cccccccccccccccccccccccccccccccc issue135.j2k_0.pgx
cccccccccccccccccccccccccccccccc issue135.j2k_1.pgx
cccccccccccccccccccccccccccccccc issue135.j2k_2.pgx
619694e5674992b3286244bf13058f7c issue142.j2k_0.pgx
c675c4b77dc3cc2a0d6542a32b438a48 issue142.j2k_1.pgx
663ebdd12dd6a36915ea1152c43cb69a issue142.j2k_2.pgx
aa7461b31e14641586803b23b7fb04f2 issue142.j2k_0.pgx
a809006e7a0c1eed68bc86c96af43fe3 issue142.j2k_1.pgx
74f7a7a194a74a947245b843c62c4054 issue142.j2k_2.pgx
c44662b1f7fe01caa2ebf3ad62948e3e issue171.jp2_0.pgx
f70e8a4e5dbefeb44d50edd79b6c4cf6 issue171.jp2_1.pgx
18bc167a1c851db2fd9f8c7af3289134 issue171.jp2_2.pgx
adda4f5e46845b96dd3df14a76aa7229 issue188_beach_64bitsbox.jp2_0.pgx
90a9709c166019d1e101e7b96d257ed9 issue188_beach_64bitsbox.jp2_1.pgx
37e23d2df06ee60bf0f9f5e1c16054d8 issue188_beach_64bitsbox.jp2_2.pgx
cb89739232898a823355861d834b5734 issue205.jp2_0.pgx
a09d34928fd86e6f2d7e6edc1764d2b7 issue205.jp2_1.pgx
6f712d0685f2c5522f01b238365f4284 issue205.jp2_2.pgx
de992d54d59032eb07d21983dbe8155b issue205.jp2_3.pgx
4507d80b4133fc8d8f84beca949dbca5 issue205.jp2_0.pgx
697b6a4b1a7eea09110a029fa28cf51e issue205.jp2_1.pgx
911a6e6b3dec0fa7c5dd821f92dd707f issue205.jp2_2.pgx
1a507a95237768e41cd0987ad0f134f4 issue206_image-000.jp2_0.pgx
dacea42ff8bb859504820100637de2b6 issue206_image-000.jp2_1.pgx
1831abb207d2c85e9b8d4da308144213 issue206_image-000.jp2_2.pgx
b7073a2c1b5a42f9555eb0f0bd3c6510 issue208.jp2_0.pgx
df65beeb8fd056c8f7b8dfc699caa12b issue208.jp2_1.pgx
15cba2ad37c1a8e1eb3eb4bc42d5a2a2 issue208.jp2_2.pgx
301fabf4aac5729b44aab845580d5038 issue208.jp2_3.pgx
6e40cbf1dbf7db68ff7975a7a99362b9 issue208.jp2_0.pgx
822f330a38c053130c707cadd31d3b41 issue208.jp2_1.pgx
60316fb101af743c0f3e24924365b178 issue208.jp2_2.pgx
a0823d21d9de699353a3bd1adb23bd1c issue211.jp2_0.pgx
1820161df26c360a62d11800d6cf173f issue211.jp2_1.pgx
e1807db57b5f5192c4b77b83e8b5c477 issue228.j2k_0.pgx
@ -258,7 +256,16 @@ fc2844a9f3c8e924e349180ba9e122dd p0_14_png-2.png
0c1cc85c051dd95394d06103c8d9bbef p0_14_png-6.png
230e4968cb445b222ee2095014ba1d26 p0_14_png-8.png
5a6131ad9ea5d191ffcdf6435be89cb4 v4dwt_interleave_h.gsr105.j2k_0.pgx
5e3ada868a3b0238f38c15e134090971 dwt_interleave_h.gsr105.jp2_0.pgx
5e3ada868a3b0238f38c15e134090971 dwt_interleave_h.gsr105.jp2_1.pgx
8a9142362814afeef644f6d054bca43a dwt_interleave_h.gsr105.jp2_2.pgx
4426ed46f75a45782c551d82818b9e60 dwt_interleave_h.gsr105.jp2_0.pgx
382e7297e062d729a7a7726e964f1a0a dwt_interleave_h.gsr105.jp2_1.pgx
64c1027db97421e348f823178b5d9c4b dwt_interleave_h.gsr105.jp2_2.pgx
63bf755af5a1f8a478d65079dc7c8964 issue205-tif.jp2.tif
b01ed87dbac424bc820b2ac590e4884e issue236-ESYCC-CDEF.jp2_0.pgx
2635cc00b1e18ef11adcba09e845d459 issue236-ESYCC-CDEF.jp2_1.pgx
f9c95d0aec2f6e7b814fa1d09edcdbda issue236-ESYCC-CDEF.jp2_2.pgx
5f0c1d5c5127c1eabb86a5e0112f139b issue559-eci-090-CIELab.jp2_0.pgx
cdae87485eaada56be3671eec39452e6 issue559-eci-090-CIELab.jp2_1.pgx
e163102afcc857cf001337178241f518 issue559-eci-090-CIELab.jp2_2.pgx
b004b2e08b0dfb217c131b353cf157eb issue559-eci-091-CIELab.jp2_0.pgx
2400da6b8ed6b1747b9913af544580f9 issue559-eci-091-CIELab.jp2_1.pgx
cf73dda887967928dbcf5cc87ab204cc issue559-eci-091-CIELab.jp2_2.pgx

View File

@ -490,5 +490,15 @@ opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-14.pn
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-16.png -p 16S
# issue 388
opj_decompress -i @INPUT_NR_PATH@/v4dwt_interleave_h.gsr105.j2k -o @TEMP_PATH@/v4dwt_interleave_h.gsr105.j2k.pgx
!opj_decompress -i @INPUT_NR_PATH@/v4dwt_interleave_h.gsr105.j2k -o @TEMP_PATH@/v4dwt_interleave_h.gsr105.j2k.pgx
opj_decompress -i @INPUT_NR_PATH@/dwt_interleave_h.gsr105.jp2 -o @TEMP_PATH@/dwt_interleave_h.gsr105.jp2.pgx
# PR 559 : CMYK tif output
opj_decompress -i @INPUT_NR_PATH@/issue205.jp2 -o @TEMP_PATH@/issue205-tif.jp2.tif
# issue 236: esYCC colorspace
opj_decompress -i @INPUT_NR_PATH@/issue236-ESYCC-CDEF.jp2 -o @TEMP_PATH@/issue236-ESYCC-CDEF.jp2.pgx
# issue 326 + PR 559: CIELab colorspace
opj_decompress -i @INPUT_NR_PATH@/issue559-eci-090-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-090-CIELab.jp2.pgx
opj_decompress -i @INPUT_NR_PATH@/issue559-eci-091-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-091-CIELab.jp2.pgx