#include "fix.h"
#include "tcd.h"
#include <stdlib.h>
-//#include <stdio.h>
-//#include <math.h>
#define S(i) a[(i)*2]
#define D(i) a[(1+(i)*2)]
/* </summary> */
void dwt_interleave_h(int *a, int *b, int dn, int sn, int cas) {
int i;
-// for (i=0; i<sn; i++) b[2*i+cas]=a[i];
-// for (i=0; i<dn; i++) b[2*i+1-cas]=a[(sn+i)];
+/* for (i=0; i<sn; i++) b[2*i+cas]=a[i];*/
+/* for (i=0; i<dn; i++) b[2*i+1-cas]=a[(sn+i)];*/
int* ai;
int* bi;
ai=a;
/* </summary> */
void dwt_interleave_v(int *a, int *b, int dn, int sn, int x, int cas) {
int i;
-// for (i=0; i<sn; i++) b[2*i+cas]=a[i*x];
-// for (i=0; i<dn; i++) b[2*i+1-cas]=a[(sn+i)*x];
+/* for (i=0; i<sn; i++) b[2*i+cas]=a[i*x];*/
+/* for (i=0; i<dn; i++) b[2*i+1-cas]=a[(sn+i)*x];*/
int* ai;
int* bi;
ai=a;
*/
#include "fix.h"
-#include <math.h> //Add Antonin : multbug1
+#include <math.h> /*Add Antonin : multbug1*/
#ifdef WIN32
#define int64 __int64
* Multiply two fixed-precision rational numbers.
*/
-//int fix_mul(int a, int b)
-//{
-// return (int) ((int64) a * (int64) b >> 13);
-//}
+/*int fix_mul(int a, int b)
+{
+ return (int) ((int64) a * (int64) b >> 13);
+}*/
-//Mod Antonin : multbug1
+/*Mod Antonin : multbug1*/
/*
int fix_mul(int a, int b)
{
return (int) v;
}
*/
-//doM
+/*doM*/
-int fix_mul(int a, int b) // Luke Lee optimized : 11/16/2004
+int fix_mul(int a, int b) /* Luke Lee optimized : 11/16/2004*/
{
int64 temp = (int64) a * (int64) b >> 12;
return (int) ((temp >> 1) + (temp & 1)) ;
J2K_STATE_TPH ? &j2k_cp->tcps[j2k_curtileno] : &j2k_default_tcp;
tccp = &tcp->tccps[compno];
tccp->numresolutions = cio_read(1) + 1; /* SPcox (D) */
- //Check the reduce value
+ /*Check the reduce value*/
j2k_cp->reduce=int_min((tccp->numresolutions)-1,j2k_cp->reduce);
tccp->cblkw = cio_read(1) + 2; /* SPcox (E) */
tccp->cblkh = cio_read(1) + 2; /* SPcox (F) */
len = 2 + (5 + 2 * (j2k_img->numcomps <= 256 ? 1 : 2)) * numpchgs;
cio_write(len, 2); /* Lpoc */
for (i = 0; i < numpchgs; i++) {
- // MODIF
+ /* MODIF*/
j2k_poc_t *poc;
poc = &tcp->pocs[i];
cio_write(poc->resno0, 1); /* RSpoc_i */
(unsigned char *) calloc(N_ppm, sizeof(unsigned char));
j2k_cp->ppm_data_first = j2k_cp->ppm_data;
- j2k_cp->ppm_len = N_ppm; //Add antonin : ppmbug1
+ j2k_cp->ppm_len = N_ppm; /*Add antonin : ppmbug1*/
} else { /* NON-first PPM marker */
j2k_cp->ppm_data =
sizeof(unsigned char));
j2k_cp->ppm_data_first = j2k_cp->ppm_data;
- j2k_cp->ppm_len = N_ppm + j2k_cp->ppm_store; //Add antonin : ppmbug1
+ j2k_cp->ppm_len = N_ppm + j2k_cp->ppm_store; /*Add antonin : ppmbug1*/
}
tcp->ppt_data_first = tcp->ppt_data;
tcp->ppt_store = 0;
- tcp->ppt_len = len - 3; //Add antonin : ppmbug1
+ tcp->ppt_len = len - 3; /*Add antonin : ppmbug1*/
} else { /* NON-first PPT marker */
tcp->ppt_data =
(unsigned char *) realloc(tcp->ppt_data,
tcp->ppt_store) * sizeof(unsigned char));
tcp->ppt_data_first = tcp->ppt_data;
- tcp->ppt_len = len - 3 + tcp->ppt_store; //Add antonin : ppmbug1
+ tcp->ppt_len = len - 3 + tcp->ppt_store; /*Add antonin : ppmbug1*/
}
tcp = &j2k_cp->tcps[j2k_curtileno];
for (layno = 0; layno < tcp->numlayers; layno++) {
- tcp->rates[layno] -= tcp->rates[layno] ? (j2k_sod_start / (j2k_cp->th * j2k_cp->tw)) : 0; //Mod antonin losslessbug
+ tcp->rates[layno] -= tcp->rates[layno] ? (j2k_sod_start / (j2k_cp->th * j2k_cp->tw)) : 0; /*Mod antonin losslessbug*/
}
info_IM.num = 0;
for (resno = info_IM.Decomposition; resno >= 0; resno--) {
- fprintf(INDEX, "[%d,%d] ", (1 << info_IM.tile[0].pdx[resno]), (1 << info_IM.tile[0].pdx[resno])); //based on tile 0
+ fprintf(INDEX, "[%d,%d] ", (1 << info_IM.tile[0].pdx[resno]), (1 << info_IM.tile[0].pdx[resno])); /*based on tile 0*/
}
"pkno tileno layerno resno compno precno start_pos end_pos deltaSE \n"); */
if (info_IM.Prog == 0) { /* LRCP */
- //fprintf(INDEX, "pack_nb tileno layno resno compno precno start_pos end_pos disto");
+ /*fprintf(INDEX, "pack_nb tileno layno resno compno precno start_pos end_pos disto");*/
for (layno = 0; layno < info_IM.Layer; layno++) {
for (resno = 0; resno < info_IM.Decomposition + 1; resno++) {
for (compno = 0; compno < info_IM.Comp; compno++) {
}
}
} else if (info_IM.Prog == 1) { /* RLCP */
- //fprintf(INDEX, "pack_nb tileno resno layno compno precno start_pos end_pos disto");
+ /*fprintf(INDEX, "pack_nb tileno resno layno compno precno start_pos end_pos disto");*/
for (resno = 0; resno < info_IM.Decomposition + 1; resno++) {
for (layno = 0; layno < info_IM.Layer; layno++) {
for (compno = 0; compno < info_IM.Comp; compno++) {
}
}
} else if (info_IM.Prog == 2) { /* RPCL */
- //fprintf(INDEX, "\npack_nb tileno resno precno compno layno start_pos end_pos disto\n");
+ /*fprintf(INDEX, "\npack_nb tileno resno precno compno layno start_pos end_pos disto\n"); */
for (resno = 0; resno < info_IM.Decomposition + 1; resno++) {
/* I suppose components have same XRsiz, YRsiz */
int x0 = info_IM.Tile_Ox + tileno - (int)floor( tileno/info_IM.tw ) * info_IM.tw * info_IM.Tile_x;
}
}
} else if (info_IM.Prog == 3) { /* PCRL */
- // I suppose components have same XRsiz, YRsiz
+ /* I suppose components have same XRsiz, YRsiz*/
int x0 = info_IM.Tile_Ox + tileno - (int)floor( tileno/info_IM.tw ) * info_IM.tw * info_IM.Tile_x;
int y0 = info_IM.Tile_Ox + (int)floor( tileno/info_IM.tw ) * info_IM.Tile_y;
int x1 = x0 + info_IM.Tile_x;
int y1 = y0 + info_IM.Tile_y;
- //fprintf(INDEX, "\npack_nb tileno precno compno resno layno start_pos end_pos disto\n");
+ /*fprintf(INDEX, "\npack_nb tileno precno compno resno layno start_pos end_pos disto\n"); */
for (y=y0; y<y1; y++) {
for (x=x0; x<x1; x++) {
for (compno = 0; compno < info_IM.Comp; compno++) {
}
}
} else { /* CPRL */
- //fprintf(INDEX, "\npack_nb tileno compno precno resno layno start_pos end_pos disto\n");
+ /*fprintf(INDEX, "\npack_nb tileno compno precno resno layno start_pos end_pos disto\n"); */
for (compno = 0; compno < info_IM.Comp; compno++) {
/* I suppose components have same XRsiz, YRsiz */
int x0 = info_IM.Tile_Ox + tileno - (int)floor( tileno/info_IM.tw ) * info_IM.tw * info_IM.Tile_x;
}
}
- fprintf(INDEX, "%8e\n", info_IM.D_max); //SE max
+ fprintf(INDEX, "%8e\n", info_IM.D_max); /*SE max*/
- fprintf(INDEX, "%.8e\n", DistoTotal); // SE totale
+ fprintf(INDEX, "%.8e\n", DistoTotal); /* SE totale*/
fclose(INDEX);
- //tcd_dec_release();
+ /*tcd_dec_release();*/
int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t * img,
j2k_cp_t * cp);
-LIBJ2K_API void j2k_dec_release();//antonin
+LIBJ2K_API void j2k_dec_release();/*antonin*/
#endif
jp2_struct->comps =
(jp2_comps_t *) malloc(jp2_struct->numcomps * sizeof(jp2_comps_t));
- jp2_struct->precedence = 0; // PRECEDENCE
- jp2_struct->approx = 0; // APPROX
+ jp2_struct->precedence = 0; /* PRECEDENCE*/
+ jp2_struct->approx = 0; /* APPROX*/
jp2_struct->brand = JP2_JP2; /* BR */
jp2_struct->minversion = 0; /* MinV */
jp2_struct->cl = (int *) malloc(jp2_struct->numcl * sizeof(int));
jp2_struct->cl[0] = JP2_JP2; /* CL0 : JP2 */
- jp2_struct->C = 7; // C : Always 7
- jp2_struct->UnkC = 0; // UnkC, colorspace specified in colr box
- jp2_struct->IPR = 0; // IPR, no intellectual property
+ jp2_struct->C = 7; /* C : Always 7*/
+ jp2_struct->UnkC = 0; /* UnkC, colorspace specified in colr box*/
+ jp2_struct->IPR = 0; /* IPR, no intellectual property*/
return 0;
}
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_URL, 4); // DBTL
- cio_write(0, 1); // VERS
- cio_write(0, 3); // FLAG
+ cio_write(JP2_URL, 4); /* DBTL*/
+ cio_write(0, 1); /* VERS*/
+ cio_write(0, 3); /* FLAG*/
for (i = 0; i < strlen(str); i++) {
cio_write(str[i], 1);
return 1;
}
- jp2_struct->h = cio_read(4); // HEIGHT
- jp2_struct->w = cio_read(4); // WIDTH
- jp2_struct->numcomps = cio_read(2); // NC
+ jp2_struct->h = cio_read(4); /* HEIGHT*/
+ jp2_struct->w = cio_read(4); /* WIDTH*/
+ jp2_struct->numcomps = cio_read(2); /* NC*/
- jp2_struct->bpc = cio_read(1); // BPC
+ jp2_struct->bpc = cio_read(1); /* BPC*/
- jp2_struct->C = cio_read(1); // C
- jp2_struct->UnkC = cio_read(1); // UnkC
- jp2_struct->IPR = cio_read(1); // IPR
+ jp2_struct->C = cio_read(1); /* C */
+ jp2_struct->UnkC = cio_read(1); /* UnkC*/
+ jp2_struct->IPR = cio_read(1); /* IPR*/
if (cio_tell() - box.init_pos != box.length) {
fprintf(stderr, "Error with IHDR Box\n");
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_IHDR, 4); // IHDR
+ cio_write(JP2_IHDR, 4); /* IHDR*/
- cio_write(jp2_struct->h, 4); // HEIGHT
- cio_write(jp2_struct->w, 4); // WIDTH
- cio_write(jp2_struct->numcomps, 2); // NC
+ cio_write(jp2_struct->h, 4); /* HEIGHT*/
+ cio_write(jp2_struct->w, 4); /* WIDTH*/
+ cio_write(jp2_struct->numcomps, 2); /* NC*/
- cio_write(jp2_struct->bpc, 1); // BPC
+ cio_write(jp2_struct->bpc, 1); /* BPC */
- cio_write(jp2_struct->C, 1); // C : Always 7
- cio_write(jp2_struct->UnkC, 1); // UnkC, colorspace unknow
- cio_write(jp2_struct->IPR, 1); // IPR, no intellectual property
+ cio_write(jp2_struct->C, 1); /* C : Always 7*/
+ cio_write(jp2_struct->UnkC, 1); /* UnkC, colorspace unknow*/
+ cio_write(jp2_struct->IPR, 1); /* IPR, no intellectual property*/
box.length = cio_tell() - box.init_pos;
cio_seek(box.init_pos);
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_BPCC, 4); // BPCC
+ cio_write(JP2_BPCC, 4); /* BPCC*/
for (i = 0; i < jp2_struct->numcomps; i++)
cio_write(jp2_struct->comps[i].bpcc, 1);
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_COLR, 4); // COLR
+ cio_write(JP2_COLR, 4); /* COLR*/
- cio_write(jp2_struct->meth, 1); // METH
- cio_write(jp2_struct->precedence, 1); // PRECEDENCE
- cio_write(jp2_struct->approx, 1); // APPROX
+ cio_write(jp2_struct->meth, 1); /* METH*/
+ cio_write(jp2_struct->precedence, 1); /* PRECEDENCE*/
+ cio_write(jp2_struct->approx, 1); /* APPROX*/
if (jp2_struct->meth == 1)
- cio_write(jp2_struct->enumcs, 4); // EnumCS
+ cio_write(jp2_struct->enumcs, 4); /* EnumCS*/
else
- cio_write(0, 1); // PROFILE (??)
+ cio_write(0, 1); /* PROFILE (??)*/
box.length = cio_tell() - box.init_pos;
cio_seek(box.init_pos);
}
} while (JP2_COLR != box.type);
- jp2_struct->meth = cio_read(1); // METH
- jp2_struct->precedence = cio_read(1); // PRECEDENCE
- jp2_struct->approx = cio_read(1); // APPROX
+ jp2_struct->meth = cio_read(1); /* METH*/
+ jp2_struct->precedence = cio_read(1); /* PRECEDENCE*/
+ jp2_struct->approx = cio_read(1); /* APPROX*/
if (jp2_struct->meth == 1)
- jp2_struct->enumcs = cio_read(4); // EnumCS
+ jp2_struct->enumcs = cio_read(4); /* EnumCS*/
else {
- // SKIP PROFILE
+ /* SKIP PROFILE */
skip_len = box.init_pos + box.length - cio_tell();
if (skip_len < 0) {
fprintf(stderr, "Error with JP2H box size\n");
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_JP2C, 4); // JP2C
+ cio_write(JP2_JP2C, 4); /* JP2C*/
*j2k_codestream_offset = cio_tell();
memcpy(cio_getbp(), j2k_codestream, j2k_codestream_len);
box.init_pos = cio_tell();
cio_skip(4);
- cio_write(JP2_JP, 4); // JP
+ cio_write(JP2_JP, 4); /* JP*/
cio_write(0x0d0a870a, 4);
box.length = cio_tell() - box.init_pos;
mqc_start = bp;
mqc_end = bp + len;
mqc_bp = bp;
- //add antonin initbug1
+ /*add antonin initbug1*/
if (len==0) mqc_c = 0xff << 16;
else mqc_c = *mqc_bp << 16;
- //dda
+ /*dda*/
mqc_bytein();
mqc_c <<= 7;
mqc_ct -= 7;
py0 = int_floordivpow2(ry0, res->pdy) << res->pdy;
px1 = int_ceildivpow2(rx1, res->pdx) << res->pdx;
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
- res->pw = (rx0==rx1)?0:((px1 - px0) >> res->pdx); //Mod Antonin : sizebug1
- res->ph = (ry0==ry1)?0:((py1 - py0) >> res->pdy); //Mod Antonin : sizebug1
+ res->pw = (rx0==rx1)?0:((px1 - px0) >> res->pdx); /*Mod Antonin : sizebug1*/
+ res->ph = (ry0==ry1)?0:((py1 - py0) >> res->pdy); /*Mod Antonin : sizebug1*/
}
}
pi->compno < pi->poc.compno1; pi->compno++) {
int levelno;
int trx0, try0;
- int trx1, try1;// Add antonin pcrl
+ int trx1, try1;/* Add antonin pcrl*/
int rpx, rpy;
int prci, prcj;
comp = &pi->comps[pi->compno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
- trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);// Add antonin pcrl
- try1 = int_ceildiv(pi->ty1, comp->dy << levelno);// Add antonin pcrl
+ trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);/* Add antonin pcrl*/
+ try1 = int_ceildiv(pi->ty1, comp->dy << levelno);/* Add antonin pcrl*/
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
continue;
}
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((res->pw==0)||(res->pw==0)) continue;
- //ddA
+ /*ddA*/
- //Add Antonin : pcrl
+ /*Add Antonin : pcrl*/
if ((trx0==trx1)||(try0==try1)) continue;
- //ddA
+ /*ddA*/
prci =
int_floordivpow2(int_ceildiv
comp->numresolutions); pi->resno++) {
int levelno;
int trx0, try0;
- int trx1, try1;// Add antonin pcrl
+ int trx1, try1;/* Add antonin pcrl*/
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
- trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);// Add antonin pcrl
- try1 = int_ceildiv(pi->ty1, comp->dy << levelno);// Add antonin pcrl
+ trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);/* Add antonin pcrl*/
+ try1 = int_ceildiv(pi->ty1, comp->dy << levelno);/* Add antonin pcrl*/
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
continue;
}
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((res->pw==0)||(res->pw==0)) continue;
- //ddA
+ /*ddA*/
- //Add Antonin : pcrl
+ /*Add Antonin : pcrl*/
if ((trx0==trx1)||(try0==try1)) continue;
- //ddA
+ /*ddA*/
prci =
int_floordivpow2(int_ceildiv
comp->numresolutions); pi->resno++) {
int levelno;
int trx0, try0;
- int trx1, try1;// Add antonin pcrl
+ int trx1, try1;/* Add antonin pcrl*/
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
- trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);// Add antonin pcrl
- try1 = int_ceildiv(pi->ty1, comp->dy << levelno);// Add antonin pcrl
+ trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);/* Add antonin pcrl*/
+ try1 = int_ceildiv(pi->ty1, comp->dy << levelno);/* Add antonin pcrl*/
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
continue;
}
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((res->pw==0)||(res->pw==0)) continue;
- //ddA
+ /*ddA*/
- //Add Antonin : pcrl
+ /*Add Antonin : pcrl*/
if ((trx0==trx1)||(try0==try1)) continue;
- //ddA
+ /*ddA*/
prci =
int_floordivpow2(int_ceildiv
}
} /* VSC and BYPASS by Antonin */
-double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, float stepsize, int numcomps) //mod fixed_quality
+double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, float stepsize, int numcomps) /*mod fixed_quality*/
{
double w1, w2, wmsedec;
if (qmfbid == 1) {
return wmsedec;
}
-void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, float stepsize, int cblksty, int numcomps, tcd_tile_t * tile) //mod fixed_quality
+void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, float stepsize, int cblksty, int numcomps, tcd_tile_t * tile) /*mod fixed_quality*/
{
int i, j;
int w, h;
break;
}
- cumwmsedec += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps); //mod fixed_quality
- tile->distotile += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps); //add antonin quality
+ cumwmsedec += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps); /*mod fixed_quality*/
+ tile->distotile += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps); /*add antonin quality*/
/* Code switch "RESTART" (i.e. TERMALL) */
int i, j, w, h;
int bpno, passtype;
int segno, passno;
- char type = T1_TYPE_MQ; //BYPASS mode
+ char type = T1_TYPE_MQ; /*BYPASS mode*/
w = cblk->x1 - cblk->x0;
h = cblk->y1 - cblk->y0;
for (segno = 0; segno < cblk->numsegs; segno++) {
tcd_seg_t *seg = &cblk->segs[segno];
- // Add BYPASS mode
+ /* Add BYPASS mode */
type = ((bpno <= (cblk->numbps - 1) - 4) && (passtype < 2)
&& (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW :
T1_TYPE_MQ;
raw_init_dec(seg->data, seg->len);
else
mqc_init_dec(seg->data, seg->len);
- // ddA
+ /* ddA */
for (passno = 0; passno < seg->numpasses; passno++) {
switch (passtype) {
tcd_precinct_t *prc;
tcd_cblk_t *cblk;
- tile->distotile = 0; //add fixed_quality
+ tile->distotile = 0; /*add fixed_quality*/
for (compno = 0; compno < tile->numcomps; compno++) {
tilec = &tile->comps[compno];
} else if (orient == 1) {
orient = 2;
}
- t1_encode_cblk(cblk, orient, compno, tilec->numresolutions - 1 - resno, tcp->tccps[compno].qmfbid, band->stepsize, tcp->tccps[compno].cblksty, tile->numcomps, tile); //mod fixed_quality
+ t1_encode_cblk(cblk, orient, compno, tilec->numresolutions - 1 - resno, tcp->tccps[compno].qmfbid, band->stepsize, tcp->tccps[compno].cblksty, tile->numcomps, tile); /*mod fixed_quality*/
} /* cblkno */
} /* precno */
} /* bandno */
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
- //ddA
+ /*ddA*/
tgt_reset(prc->incltree);
- // SOP markers
+ /* SOP markers*/
if (tcp->csty & J2K_CP_CSTY_SOP) {
}
- //TODO : check the Nsop value
+ /*TODO : check the Nsop value*/
}
if (cp->ppm == 1) { /* PPM */
hd = cp->ppm_data;
- bio_init_dec(hd, cp->ppm_len); //Mod Antonin : ppmbug1
+ bio_init_dec(hd, cp->ppm_len); /*Mod Antonin : ppmbug1*/
} else if (tcp->ppt == 1) { /* PPT */
hd = tcp->ppt_data;
- bio_init_dec(hd, tcp->ppt_len); //Mod Antonin : ppmbug1
+ bio_init_dec(hd, tcp->ppt_len); /*Mod Antonin : ppmbug1*/
} else { /* Normal Case */
hd = c;
- // EPH markers
+ /* EPH markers*/
if (tcp->csty & J2K_CP_CSTY_EPH) {
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
- //ddA
+ /*ddA*/
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
hd += bio_numbytes();
- // EPH markers
+ /* EPH markers*/
if (tcp->csty & J2K_CP_CSTY_EPH) {
if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
fprintf(stderr,"Error : expected EPH marker\n");
- //Add Antonin : sizebug1
+ /*Add Antonin : sizebug1*/
if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
- //ddA
+ /*ddA*/
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
/* tile->PPT=img->PPT; */
/* Modification of the RATE >> */
for (j = 0; j < tcp->numlayers; j++) {
- tcp->rates[j] = tcp->rates[j] ? int_ceildiv(tile->numcomps * (tile->x1 - tile->x0) * (tile->y1 - tile->y0) * img->comps[0].prec, (tcp->rates[j] * 8 * img->comps[0].dx * img->comps[0].dy)) : 0; //Mod antonin losslessbug
+ tcp->rates[j] = tcp->rates[j] ? int_ceildiv(tile->numcomps * (tile->x1 - tile->x0) * (tile->y1 - tile->y0) * img->comps[0].prec, (tcp->rates[j] * 8 * img->comps[0].dx * img->comps[0].dy)) : 0; /*Mod antonin losslessbug*/
if (tcp->rates[j]) {
if (j && tcp->rates[j] < tcp->rates[j - 1] + 10) {
tcp->rates[j] = tcp->rates[j - 1] + 20;
for (tileno = 0; tileno < 1; tileno++) {
j2k_tcp_t *tcp = &cp->tcps[curtileno];
int j;
- // int previous_x0, previous_x1, previous_y0, previous_y1;
+ /* int previous_x0, previous_x1, previous_y0, previous_y1;*/
/* cfr p59 ISO/IEC FDIS15444-1 : 2000 (18 august 2000) */
int p = curtileno % cp->tw;
int q = curtileno / cp->tw;
/* tile->PPT=img->PPT; */
/* Modification of the RATE >> */
for (j = 0; j < tcp->numlayers; j++) {
- tcp->rates[j] = tcp->rates[j] ? int_ceildiv(tile->numcomps * (tile->x1 - tile->x0) * (tile->y1 - tile->y0) * img->comps[0].prec, (tcp->rates[j] * 8 * img->comps[0].dx * img->comps[0].dy)) : 0; //Mod antonin losslessbug
+ tcp->rates[j] = tcp->rates[j] ? int_ceildiv(tile->numcomps * (tile->x1 - tile->x0) * (tile->y1 - tile->y0) * img->comps[0].prec, (tcp->rates[j] * 8 * img->comps[0].dx * img->comps[0].dy)) : 0; /*Mod antonin losslessbug*/
if (tcp->rates[j]) {
if (j && tcp->rates[j] < tcp->rates[j - 1] + 10) {
tcp->rates[j] = tcp->rates[j - 1] + 20;
tileno = cp->tileno[i];
- // int previous_x0, previous_x1, previous_y0, previous_y1;
+ /* int previous_x0, previous_x1, previous_y0, previous_y1;*/
/* cfr p59 ISO/IEC FDIS15444-1 : 2000 (18 august 2000) */
p = tileno % cp->tw; /* si numerotation matricielle .. */
q = tileno / cp->tw; /* .. coordonnees de la tile (q,p) q pour ligne et p pour colonne */
tlprcystart = int_floordivpow2(res->y0, pdy) << pdy;
brprcxend = int_ceildivpow2(res->x1, pdx) << pdx;
brprcyend = int_ceildivpow2(res->y1, pdy) << pdy;
- res->pw = (res->x0 == res->x1) ? 0 : ((brprcxend - tlprcxstart) >> pdx); // Mod Antonin : sizebug1
- res->ph = (res->y0 == res->y1) ? 0 : ((brprcyend - tlprcystart) >> pdy); // Mod Antonin : sizebug1
+ res->pw = (res->x0 == res->x1) ? 0 : ((brprcxend - tlprcxstart) >> pdx); /* Mod Antonin : sizebug1*/
+ res->ph = (res->y0 == res->y1) ? 0 : ((brprcyend - tlprcystart) >> pdy); /* Mod Antonin : sizebug1*/
if (resno == 0) {
tlcbgxstart = tlprcxstart;
}
}
}
- //tcd_dump(&tcd_image,0);
+ /*tcd_dump(&tcd_image,0);*/
/* Allocate place to store the data decoded = final image */
void tcd_makelayer_fixed(int layno, int final)
{
int compno, resno, bandno, precno, cblkno;
- int value; //, matrice[tcd_tcp->numlayers][tcd_tile->comps[0].numresolutions][3];
+ int value; /*, matrice[tcd_tcp->numlayers][tcd_tile->comps[0].numresolutions][3];*/
int matrice[10][10][3];
int i, j, k;
{
int compno, resno, bandno, precno, cblkno, passno;
- tcd_tile->distolayer[layno] = 0; //add fixed_quality
+ tcd_tile->distolayer[layno] = 0; /*add fixed_quality*/
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
cblk->passes[cblk->numpassesinlayers - 1].distortiondec;
}
- tcd_tile->distolayer[layno] += layer->disto; //add fixed_quality
+ tcd_tile->distolayer[layno] += layer->disto; /*add fixed_quality*/
if (final)
cblk->numpassesinlayers = n;
{
int compno, resno, bandno, precno, cblkno, passno, layno;
double min, max;
- double cumdisto[100]; //add fixed_quality
- const double K = 1; // 1.1; //add fixed_quality
+ double cumdisto[100]; /*add fixed_quality*/
+ const double K = 1; /* 1.1; /*add fixed_quality*/*/
double maxSE = 0;
min = DBL_MAX;
max = 0;
- tcd_tile->nbpix = 0; //add fixed_quality
+ tcd_tile->nbpix = 0; /*add fixed_quality*/
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
}
} /* passno */
- tcd_tile->nbpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0)); //add fixed_quality
+ tcd_tile->nbpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0)); /*add fixed_quality*/
- tilec->nbpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0)); //add fixed_quality
+ tilec->nbpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0)); /*add fixed_quality*/
} /* cbklno */
} /* precno */
volatile double lo = min;
volatile double hi = max;
volatile int success = 0;
- volatile int maxlen = tcd_tcp->rates[layno] ? int_min(tcd_tcp->rates[layno], len) : len; //Mod antonin losslessbug
+ volatile int maxlen = tcd_tcp->rates[layno] ? int_min(tcd_tcp->rates[layno], len) : len; /*Mod antonin losslessbug*/
volatile double goodthresh;
volatile int i;
- double distotarget; //add fixed_quality
+ double distotarget; /*add fixed_quality*/
- distotarget = tcd_tile->distotile - ((K * maxSE) / pow(10, tcd_tcp->distoratio[layno] / 10)); // add fixed_quality
+ distotarget = tcd_tile->distotile - ((K * maxSE) / pow(10, tcd_tcp->distoratio[layno] / 10)); /* add fixed_quality*/
if ((tcd_tcp->rates[layno]) || (tcd_cp->disto_alloc==0)) {
for (i = 0; i < 32; i++) {
volatile double thresh = (lo + hi) / 2;
int l = 0;
- double distoachieved = 0; // add fixed_quality
+ double distoachieved = 0; /* add fixed_quality*/
tcd_makelayer(layno, thresh, 0);
- if (tcd_cp->fixed_quality) { // add fixed_quality
+ if (tcd_cp->fixed_quality) { /* add fixed_quality*/
distoachieved =
layno ==
0 ? tcd_tile->distolayer[0] : cumdisto[layno - 1] +
}
tcd_makelayer(layno, goodthresh, 1);
- cumdisto[layno] = layno == 0 ? tcd_tile->distolayer[0] : cumdisto[layno - 1] + tcd_tile->distolayer[layno]; // add fixed_quality
+ cumdisto[layno] = layno == 0 ? tcd_tile->distolayer[0] : cumdisto[layno - 1] + tcd_tile->distolayer[layno]; /* add fixed_quality*/
}
}
tile = tcd_tile;
/* INDEX >> "Precinct_nb_X et Precinct_nb_Y" */
if (info_IM->index_on) {
- tcd_tilecomp_t *tilec_idx = &tile->comps[0]; //Based on Component 0
+ tcd_tilecomp_t *tilec_idx = &tile->comps[0]; /*Based on Component 0*/
for (i = 0; i < tilec_idx->numresolutions; i++) {
}
/*----------------DWT---------------------*/
-// mod Ive
+/* mod Ive*/
for (compno = 0; compno < tile->numcomps; compno++) {
tcd_tilecomp_t *tilec = &tile->comps[compno];
if (tcd_tcp->tccps[compno].qmfbid == 1) {
dwt_encode_real(tilec);
}
}
-// /mod Ive
+/* /mod Ive*/
/*------------------TIER1-----------------*/
t1_init_luts();
/*-----------RATE-ALLOCATE------------------*/
info_IM->index_write = 0; /* INDEX */
- if (tcd_cp->disto_alloc || tcd_cp->fixed_quality) // mod fixed_quality
+ if (tcd_cp->disto_alloc || tcd_cp->fixed_quality) /* mod fixed_quality*/
/* Normal Rate/distortion allocation */
tcd_rateallocate(dest, len, info_IM);
else
tile = tcd_tile;
/* INDEX >> "Precinct_nb_X et Precinct_nb_Y" */
if (info_IM->index_on) {
- tcd_tilecomp_t *tilec_idx = &tile->comps[0]; //Based on Component 0
+ tcd_tilecomp_t *tilec_idx = &tile->comps[0]; /*Based on Component 0*/
for (i = 0; i < tilec_idx->numresolutions; i++) {
/*----------------DWT---------------------*/
-// mod Ive
+/* mod Ive*/
for (compno = 0; compno < tile->numcomps; compno++) {
tcd_tilecomp_t *tilec = &tile->comps[compno];
if (tcd_tcp->tccps[compno].qmfbid == 1) {
dwt_encode_real(tilec);
}
}
-// /mod Ive
+/* /mod Ive*/
/*------------------TIER1-----------------*/
info_IM->index_write = 0; /* INDEX */
- if (tcd_cp->disto_alloc || tcd_cp->fixed_quality) // mod fixed_quality
+ if (tcd_cp->disto_alloc || tcd_cp->fixed_quality) /* mod fixed_quality*/
/* Normal Rate/distortion allocation */
}
- // mod Ive
+ /* mod Ive */
if (tcd_tcp->tccps[compno].qmfbid == 1) {
dwt_decode(tilec,
tilec->numresolutions - 1 -
tilec->numresolutions - 1 -
tcd_img->comps[compno].resno_decoded);
}
- // /mod Ive
+ /* /mod Ive*/
if (tile->comps[compno].numresolutions > 0)
tcd_img->comps[compno].factor =