diff options
| author | Antonin Descampe <antonin@gmail.com> | 2005-01-26 09:59:31 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2005-01-26 09:59:31 +0000 |
| commit | c83ae7397d31444e8280ddd73959e10d1dd4fb84 (patch) | |
| tree | d29b6c20271acae6c98512b31df615a186450c7d | |
| parent | 3b1bee0eec81ae97bdb345103074e98ad1d29ab8 (diff) | |
Added layer option '-l' to the command line. This option allows user to
specify a maximum number of quality layers to be decoded.
| -rw-r--r-- | codec/j2k_to_image.c | 8 | ||||
| -rw-r--r-- | libopenjpeg/t2.c | 26 |
2 files changed, 20 insertions, 14 deletions
diff --git a/codec/j2k_to_image.c b/codec/j2k_to_image.c index 5895b8e3..d7f72183 100644 --- a/codec/j2k_to_image.c +++ b/codec/j2k_to_image.c @@ -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"); diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c index 092b509c..d3f1e4fc 100644 --- a/libopenjpeg/t2.c +++ b/libopenjpeg/t2.c @@ -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 */ |
