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," 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," 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," smallest total number of decomposition levels among tiles.\n");
//fprintf(stdout," -l <number of quality layers to decode>\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," 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," less quality layers than the specified number, all the quality layers\n");
//fprintf(stdout," are decoded.\n"); fprintf(stdout," are decoded.\n");
fprintf(stdout," -u\n"); fprintf(stdout," -u\n");
fprintf(stdout," print an usage statement\n"); fprintf(stdout," print an usage statement\n");
fprintf(stdout,"\n"); fprintf(stdout,"\n");

View File

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