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 /libopenjpeg/t1.c | |
| 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 'libopenjpeg/t1.c')
| -rw-r--r-- | libopenjpeg/t1.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index 2765c418..deb6b98a 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -514,24 +514,22 @@ void t1_dec_clnpass(int w, int h, int bpno, int orient, int cblksty) } } /* VSC and BYPASS by Antonin */ -double t1_getwmsedec(int nmsedec, int compno, int level, int orient, - int bpno, int qmfbid, double stepsize) +double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, double stepsize, int numcomps) //mod fixed_quality { double w1, w2, wmsedec; if (qmfbid == 1) { - w1 = mct_getnorm(compno); + w1 = (numcomps > 1) ? mct_getnorm(compno) : 1; w2 = dwt_getnorm(level, orient); } else { /* if (qmfbid == 0) */ - w1 = mct_getnorm_real(compno); + w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1; w2 = dwt_getnorm_real(level, orient); } - wmsedec = w1 * w2 * stepsize * (1 << bpno); + wmsedec = w1 * w2 * (stepsize / 8192.0) * (1 << bpno); wmsedec *= wmsedec * nmsedec / 8192.0; return wmsedec; } -void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, - int qmfbid, double stepsize, int cblksty) +void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, double stepsize, int cblksty, int numcomps, tcd_tile_t * tile) //mod fixed_quality { int i, j; int w, h; @@ -587,9 +585,9 @@ void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, break; } - cumwmsedec += - t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, - stepsize); + 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) */ if ((cblksty & J2K_CCP_CBLKSTY_TERMALL) @@ -728,6 +726,8 @@ void t1_encode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp) tcd_precinct_t *prc; tcd_cblk_t *cblk; + tile->distotile = 0; //add fixed_quality + for (compno = 0; compno < tile->numcomps; compno++) { tilec = &tile->comps[compno]; for (resno = 0; resno < tilec->numresolutions; resno++) { @@ -787,10 +787,7 @@ void t1_encode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp) } 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); + 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 */ |
