Added layer option '-l' to the command line. This option allows user to

specify a maximum number of quality layers to be decoded.
This commit is contained in:
Antonin Descampe 2005-01-26 09:59:31 +00:00
parent 3b1bee0eec
commit c83ae7397d
2 changed files with 20 additions and 14 deletions

View File

@ -75,10 +75,10 @@ void usage_display(char *prgm)
fprintf(stdout," image resolution is effectively divided by 2 to the power of the\n");
fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n");
fprintf(stdout," smallest total number of decomposition levels among tiles.\n");
//fprintf(stdout," -l <number of quality layers to decode>\n");
//fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
//fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
//fprintf(stdout," are decoded.\n");
fprintf(stdout," -l <number of quality layers to decode>\n");
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
fprintf(stdout," are decoded.\n");
fprintf(stdout," -u\n");
fprintf(stdout," print an usage statement\n");
fprintf(stdout,"\n");

View File

@ -666,23 +666,29 @@ int t2_decode_packets(unsigned char *src, int len, j2k_image_t * img,
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++) {
while (pi_next(&pi[pino])) {
e = t2_decode_packet(c, src + len - c, tile, cp,
&cp->tcps[tileno], pi[pino].compno,
pi[pino].resno, pi[pino].precno,
pi[pino].layno);
if ((cp->layer==0) || (cp->layer>=((pi[pino].layno)+1))) {
e = t2_decode_packet(c, src + len - c, tile, cp,
&cp->tcps[tileno], pi[pino].compno,
pi[pino].resno, pi[pino].precno,
pi[pino].layno);
} else {
e = 0;
}
/* progression in resolution */
img->comps[pi[pino].compno].resno_decoded =
e > 0 ? int_max(pi[pino].resno,
img->comps[pi[pino].compno].
resno_decoded) : img->comps[pi[pino].
compno].resno_decoded;
img->comps[pi[pino].compno].
resno_decoded) : img->comps[pi[pino].
compno].resno_decoded;
n++;
if (e == -999) { /* ADD */
break;
} else
} else {
c += e;
}
}
/* FREE space memory taken by pi */