Merged wiredfool's changes.

This commit is contained in:
Alastair Houghton 2014-03-19 14:58:47 +00:00
commit fea6811af0
2 changed files with 19 additions and 14 deletions

View File

@ -230,7 +230,7 @@ j2ku_graya_la(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
const UINT8 *adata = &atiledata[acsiz * y * w]; const UINT8 *adata = &atiledata[acsiz * y * w];
UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4; UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4;
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
UINT32 word, aword; UINT32 word = 0, aword = 0;
switch (csiz) { switch (csiz) {
case 1: word = *data++; break; case 1: word = *data++; break;
@ -288,7 +288,7 @@ j2ku_srgb_rgb(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 3; ++n) { for (n = 0; n < 3; ++n) {
UINT32 word; UINT32 word = 0;
switch (csiz[n]) { switch (csiz[n]) {
case 1: word = *data[n]++; break; case 1: word = *data[n]++; break;
@ -341,7 +341,7 @@ j2ku_sycc_rgb(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 3; ++n) { for (n = 0; n < 3; ++n) {
UINT32 word; UINT32 word = 0;
switch (csiz[n]) { switch (csiz[n]) {
case 1: word = *data[n]++; break; case 1: word = *data[n]++; break;
@ -395,7 +395,7 @@ j2ku_srgba_rgba(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 4; ++n) { for (n = 0; n < 4; ++n) {
UINT32 word; UINT32 word = 0;
switch (csiz[n]) { switch (csiz[n]) {
case 1: word = *data[n]++; break; case 1: word = *data[n]++; break;
@ -447,7 +447,7 @@ j2ku_sycca_rgba(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 4; ++n) { for (n = 0; n < 4; ++n) {
UINT32 word; UINT32 word = 0;
switch (csiz[n]) { switch (csiz[n]) {
case 1: word = *data[n]++; break; case 1: word = *data[n]++; break;

View File

@ -80,9 +80,10 @@ j2k_pack_l(Imaging im, UINT8 *buf,
unsigned x0, unsigned y0, unsigned w, unsigned h) unsigned x0, unsigned y0, unsigned w, unsigned h)
{ {
UINT8 *ptr = buf; UINT8 *ptr = buf;
for (unsigned y = 0; y < h; ++y) { unsigned x,y;
for (y = 0; y < h; ++y) {
UINT8 *data = (UINT8 *)(im->image[y + y0] + x0); UINT8 *data = (UINT8 *)(im->image[y + y0] + x0);
for (unsigned x = 0; x < w; ++x) for (x = 0; x < w; ++x)
*ptr++ = *data++; *ptr++ = *data++;
} }
} }
@ -93,9 +94,10 @@ j2k_pack_la(Imaging im, UINT8 *buf,
{ {
UINT8 *ptr = buf; UINT8 *ptr = buf;
UINT8 *ptra = buf + w * h; UINT8 *ptra = buf + w * h;
for (unsigned y = 0; y < h; ++y) { unsigned x,y;
for (y = 0; y < h; ++y) {
UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0); UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0);
for (unsigned x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
*ptr++ = data[0]; *ptr++ = data[0];
*ptra++ = data[3]; *ptra++ = data[3];
data += 4; data += 4;
@ -110,9 +112,10 @@ j2k_pack_rgb(Imaging im, UINT8 *buf,
UINT8 *pr = buf; UINT8 *pr = buf;
UINT8 *pg = pr + w * h; UINT8 *pg = pr + w * h;
UINT8 *pb = pg + w * h; UINT8 *pb = pg + w * h;
for (unsigned y = 0; y < h; ++y) { unsigned x,y;
for (y = 0; y < h; ++y) {
UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0); UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0);
for (unsigned x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
*pr++ = data[0]; *pr++ = data[0];
*pg++ = data[1]; *pg++ = data[1];
*pb++ = data[2]; *pb++ = data[2];
@ -129,9 +132,10 @@ j2k_pack_rgba(Imaging im, UINT8 *buf,
UINT8 *pg = pr + w * h; UINT8 *pg = pr + w * h;
UINT8 *pb = pg + w * h; UINT8 *pb = pg + w * h;
UINT8 *pa = pb + w * h; UINT8 *pa = pb + w * h;
for (unsigned y = 0; y < h; ++y) { unsigned x,y;
for (y = 0; y < h; ++y) {
UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0); UINT8 *data = (UINT8 *)(im->image[y + y0] + 4 * x0);
for (unsigned x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
*pr++ = *data++; *pr++ = *data++;
*pg++ = *data++; *pg++ = *data++;
*pb++ = *data++; *pb++ = *data++;
@ -239,6 +243,7 @@ j2k_encode_entry(Imaging im, ImagingCodecState state,
unsigned tile_width, tile_height; unsigned tile_width, tile_height;
unsigned tiles_x, tiles_y, num_tiles; unsigned tiles_x, tiles_y, num_tiles;
unsigned x, y, tile_ndx; unsigned x, y, tile_ndx;
unsigned n;
j2k_pack_tile_t pack; j2k_pack_tile_t pack;
int ret = -1; int ret = -1;
@ -283,7 +288,7 @@ j2k_encode_entry(Imaging im, ImagingCodecState state,
goto quick_exit; goto quick_exit;
} }
for (unsigned n = 0; n < components; ++n) { for (n = 0; n < components; ++n) {
image_params[n].dx = image_params[n].dy = 1; image_params[n].dx = image_params[n].dy = 1;
image_params[n].w = im->xsize; image_params[n].w = im->xsize;
image_params[n].h = im->ysize; image_params[n].h = im->ysize;