diff options
| author | Antonin Descampe <antonin@gmail.com> | 2004-05-07 13:50:47 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2004-05-07 13:50:47 +0000 |
| commit | a4911967eb32c3b9ea5bdcef10205f68e136b123 (patch) | |
| tree | da4417fbd5d8c55f63e87946bc4271f1de063284 /codec | |
| parent | 32e7b1529bea8f4464a7f511ac86e7b30b0aa0c5 (diff) | |
* Fixed_quality option added : specifying -q psnr1,psnr2,psnr3,... at the command line when encoding an image generates layers with the corresponding psnr. You have to specify values in the increase order. This option is incompatible with "-r" or "-f" options.
* Old -q option is now available with -f
* The INDEX-file structure has been modified and is now like this :
------------------------------
image_width image_height
progression order
tile_width tile_height
nb_tiles_width nb_tiles_height
nb_components
nb_layers
nb_decompositions
foreach resolution_level {[precinct_width,precinct_height]}
main_header_end
codestream_size
foreach tile {
tileno start_pos end_header end_pos squarred_error_total nb_pixels mean_squarred_error
}
foreach tile {
foreach packet {
packetno tileno layerno resno compno precinctno start_pos end_pos SE_reduction
}
}
SE max
SE total
-----------------------------
Diffstat (limited to 'codec')
| -rw-r--r-- | codec/image_to_j2k.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c index 5fcfcc57..cbe329b3 100644 --- a/codec/image_to_j2k.c +++ b/codec/image_to_j2k.c @@ -300,6 +300,7 @@ int main(int argc, char **argv) cp.comment = NULL; cp.disto_alloc = 0; cp.fixed_alloc = 0; + cp.fixed_quality = 0; //add fixed_quality /* img.PPT=0; */ Tile_arg = 0; @@ -309,7 +310,7 @@ int main(int argc, char **argv) while (1) { int c = getopt(argc, argv, - "i:o:r:q:t:n:c:b:x:p:s:d:h:P:S:E:M:R:T:C:I"); + "i:o:r:q:f:t:n:c:b:x:p:s:d:h:P:S:E:M:R:T:C:I"); if (c == -1) break; switch (c) { @@ -375,7 +376,24 @@ int main(int argc, char **argv) cp.matrice = NULL; break; /* ----------------------------------------------------- */ - case 'q': /* rates fixed */ + case 'q': /* add fixed_quality */ + s = optarg; + while (sscanf(s, "%f", &tcp_init->distoratio[tcp_init->numlayers]) == + 1) { + tcp_init->numlayers++; + while (*s && *s != ',') { + s++; + } + if (!*s) + break; + s++; + } + cp.fixed_quality = 1; + cp.matrice = NULL; + break; + /* dda */ + /* ----------------------------------------------------- */ + case 'f': /* mod fixed_quality (before : -q) */ s = optarg; sscanf(s, "%d", &tcp_init->numlayers); s++; @@ -563,11 +581,11 @@ int main(int argc, char **argv) return 1; } - if (cp.disto_alloc & cp.fixed_alloc) { + if (!(cp.disto_alloc ^ cp.fixed_alloc ^ cp.fixed_quality)) { fprintf(stderr, - "Error: option -r and -q can not be used together !!\n"); + "Error: options -r -q and -f can not be used together !!\n"); return 1; - } + } // mod fixed_quality /* if no rate entered, lossless by default */ if (tcp_init->numlayers == 0) { @@ -657,7 +675,10 @@ int main(int argc, char **argv) tcp = &cp.tcps[tileno]; tcp->numlayers = tcp_init->numlayers; for (j = 0; j < tcp->numlayers; j++) { - tcp->rates[j] = tcp_init->rates[j]; + if (cp.fixed_quality) // add fixed_quality + tcp->distoratio[j] = tcp_init->distoratio[j]; + else + tcp->rates[j] = tcp_init->rates[j]; } tcp->csty = CSty; tcp->prg = Prog_order; @@ -769,5 +790,6 @@ int main(int argc, char **argv) } } + system("pause"); return 0; } |
