[trunk] fixed a bug leading to jpwl build failure & add related odd width/height sYCC tests (fixes issue 422)
This commit is contained in:
parent
50acc339c5
commit
b65e3ebdb6
@ -91,12 +91,13 @@ static void sycc444_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b;
|
||||
const int *y, *cb, *cr;
|
||||
int maxw, maxh, max, i, offset, upb;
|
||||
unsigned int maxw, maxh, max, i;
|
||||
int offset, upb;
|
||||
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
@ -107,12 +108,11 @@ static void sycc444_to_rgb(opj_image_t *img)
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++cb; ++cr; ++r; ++g; ++b;
|
||||
}
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++cb; ++cr; ++r; ++g; ++b;
|
||||
}
|
||||
free(img->comps[0].data); img->comps[0].data = d0;
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
@ -123,13 +123,14 @@ static void sycc422_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b;
|
||||
const int *y, *cb, *cr;
|
||||
int maxw, maxh, max, offset, upb;
|
||||
int i, j;
|
||||
unsigned int maxw, maxh, max;
|
||||
int offset, upb;
|
||||
unsigned int i, j;
|
||||
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
@ -140,16 +141,13 @@ static void sycc422_to_rgb(opj_image_t *img)
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0; i < maxh; ++i)
|
||||
for(i=0U; i < maxh; ++i)
|
||||
{
|
||||
for(j=0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
|
||||
for(j=0U; j < (maxw & ~(unsigned int)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b; ++cb; ++cr;
|
||||
}
|
||||
if (j < maxw) {
|
||||
@ -179,13 +177,14 @@ static void sycc420_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b, *nr, *ng, *nb;
|
||||
const int *y, *cb, *cr, *ny;
|
||||
int maxw, maxh, max, offset, upb;
|
||||
int i, j;
|
||||
unsigned int maxw, maxh, max;
|
||||
int offset, upb;
|
||||
unsigned int i, j;
|
||||
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
@ -196,44 +195,36 @@ static void sycc420_to_rgb(opj_image_t *img)
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0; (OPJ_UINT32)i < (maxh & ~(OPJ_UINT32)1); i += 2)
|
||||
for(i=0U; i < (maxh & ~(unsigned int)1U); i += 2U)
|
||||
{
|
||||
ny = y + maxw;
|
||||
nr = r + maxw; ng = g + maxw; nb = b + maxw;
|
||||
|
||||
for(j=0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
|
||||
for(j=0; j < (maxw & ~(unsigned int)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
|
||||
++ny; ++nr; ++ng; ++nb;
|
||||
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
|
||||
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
|
||||
}
|
||||
if(j < maxw)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
|
||||
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
|
||||
}
|
||||
y += maxw; r += maxw; g += maxw; b += maxw;
|
||||
}
|
||||
if(i < maxh)
|
||||
{
|
||||
for(j=0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
|
||||
{
|
||||
for(j=0U; j < (maxw & ~(unsigned int)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
@ -269,11 +260,11 @@ static void sycc420_to_rgb(opj_image_t *img)
|
||||
|
||||
void color_sycc_to_rgb(opj_image_t *img)
|
||||
{
|
||||
if(img->numcomps < 3)
|
||||
{
|
||||
img->color_space = OPJ_CLRSPC_GRAY;
|
||||
return;
|
||||
}
|
||||
if(img->numcomps < 3)
|
||||
{
|
||||
img->color_space = OPJ_CLRSPC_GRAY;
|
||||
return;
|
||||
}
|
||||
|
||||
if((img->comps[0].dx == 1)
|
||||
&& (img->comps[1].dx == 2)
|
||||
@ -282,7 +273,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
&& (img->comps[1].dy == 2)
|
||||
&& (img->comps[2].dy == 2))/* horizontal and vertical sub-sample */
|
||||
{
|
||||
sycc420_to_rgb(img);
|
||||
sycc420_to_rgb(img);
|
||||
}
|
||||
else
|
||||
if((img->comps[0].dx == 1)
|
||||
@ -292,7 +283,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
&& (img->comps[1].dy == 1)
|
||||
&& (img->comps[2].dy == 1))/* horizontal sub-sample only */
|
||||
{
|
||||
sycc422_to_rgb(img);
|
||||
sycc422_to_rgb(img);
|
||||
}
|
||||
else
|
||||
if((img->comps[0].dx == 1)
|
||||
@ -302,13 +293,12 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
&& (img->comps[1].dy == 1)
|
||||
&& (img->comps[2].dy == 1))/* no sub-sample */
|
||||
{
|
||||
sycc444_to_rgb(img);
|
||||
sycc444_to_rgb(img);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n",
|
||||
__FILE__,__LINE__);
|
||||
return;
|
||||
fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
|
||||
return;
|
||||
}
|
||||
img->color_space = OPJ_CLRSPC_SRGB;
|
||||
|
||||
|
@ -163,3 +163,12 @@ a73bec4d6d82c8a64203e8fdf893b86d issue428.jp2_0.pgx
|
||||
ec6886229ffaeaddfe22ce02b7a75e15 issue414.jp2_3.pgx
|
||||
6aa5c69c83d6f4d5d65968f34f9bc2a3 issue414.jp2_4.pgx
|
||||
00f34217ad2f88f4d4e1c5cd0d2c4329 issue399.j2k_0.pgx
|
||||
d8fb69def2a48a3686483c4353544f4b issue411-ycc444.jp2_0.pgx
|
||||
d2911f75ed1758057f9b1bf26bcb2400 issue411-ycc444.jp2_1.pgx
|
||||
f7c23ee589ceda07ffb77a83018606cc issue411-ycc444.jp2_2.pgx
|
||||
7e5e5546ae7ab4e9257ec30185ff9155 issue411-ycc422.jp2_0.pgx
|
||||
d5ecef537edf294af83826763c0cf860 issue411-ycc422.jp2_1.pgx
|
||||
3a8d91d7cf3e8887dd0d29beac030620 issue411-ycc422.jp2_2.pgx
|
||||
07480962d25b3d8cce18096648963c8a issue411-ycc420.jp2_0.pgx
|
||||
149a69831b42401f20b8f7492ef99d97 issue411-ycc420.jp2_1.pgx
|
||||
ec8d1c99db9763a8ba489df4f41dda53 issue411-ycc420.jp2_2.pgx
|
||||
|
@ -219,6 +219,10 @@ opj_decompress -i @INPUT_NR_PATH@/issue414.jp2 -o @TEMP_PATH@/issue414.jp2.pgx
|
||||
!opj_decompress -i @INPUT_NR_PATH@/issue418.jp2 -o @TEMP_PATH@/issue418.jp2.pgx
|
||||
# issue 420 (from pdfium fuzz engine) Illegal custom precinct exponent.
|
||||
!opj_decompress -i @INPUT_NR_PATH@/issue420.jp2 -o @TEMP_PATH@/issue420.jp2.pgx
|
||||
# issue 422 (rework of issue 411). ycc with odd width/height
|
||||
opj_decompress -i @INPUT_NR_PATH@/issue411-ycc444.jp2 -o @TEMP_PATH@/issue411-ycc444.jp2.pgx
|
||||
opj_decompress -i @INPUT_NR_PATH@/issue411-ycc422.jp2 -o @TEMP_PATH@/issue411-ycc422.jp2.pgx
|
||||
opj_decompress -i @INPUT_NR_PATH@/issue411-ycc420.jp2 -o @TEMP_PATH@/issue411-ycc420.jp2.pgx
|
||||
|
||||
# decode with specific area
|
||||
# prec=12; nb_c=1
|
||||
|
Loading…
Reference in New Issue
Block a user