diff options
| author | Antonin Descampe <antonin@gmail.com> | 2006-10-31 17:10:14 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2006-10-31 17:10:14 +0000 |
| commit | b565431251c607fe58fda307794bf09399b2681c (patch) | |
| tree | 74c9a00f6bf266d393c9195fe2cee6d86a850c62 /libopenjpeg | |
| parent | 480021bc336e22f1b927a3a0267ae38031b902f8 (diff) | |
added the ability to specify the rate as "float" (before : integer)
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/j2k.c | 2 | ||||
| -rw-r--r-- | libopenjpeg/j2k.h | 2 | ||||
| -rw-r--r-- | libopenjpeg/openjpeg.h | 2 | ||||
| -rw-r--r-- | libopenjpeg/tcd.c | 20 |
4 files changed, 13 insertions, 13 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 5c1d10d6..bbca537f 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -259,7 +259,7 @@ void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) { fprintf(fd, " mct=%d\n", tcp->mct); fprintf(fd, " rates="); for (layno = 0; layno < tcp->numlayers; layno++) { - fprintf(fd, "%d ", tcp->rates[layno]); + fprintf(fd, "%.1f ", tcp->rates[layno]); } fprintf(fd, "\n"); for (compno = 0; compno < img->numcomps; compno++) { diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index 42e452a9..c5282465 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -151,7 +151,7 @@ typedef struct opj_tcp { /** multi-component transform identifier */ int mct; /** rates of layers */ - int rates[100]; + float rates[100]; /** number of progression order changes */ int numpocs; /** indicates if a POC marker has been used O:NO, 1:YES */ diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h index 90d23639..5961dabf 100644 --- a/libopenjpeg/openjpeg.h +++ b/libopenjpeg/openjpeg.h @@ -216,7 +216,7 @@ typedef struct opj_cparameters { /** number of layers */ int tcp_numlayers; /** rates of layers */ - int tcp_rates[100]; + float tcp_rates[100]; /** different psnr for successive layers */ float tcp_distoratio[100]; /** number of resolutions */ diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index 9222a4d8..bf0a81bf 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -149,11 +149,11 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c /* Modification of the RATE >> */ for (j = 0; j < tcp->numlayers; j++) { tcp->rates[j] = tcp->rates[j] ? - int_ceildiv(tile->numcomps + ((float) (tile->numcomps * (tile->x1 - tile->x0) * (tile->y1 - tile->y0) - * image->comps[0].prec, - (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) + * image->comps[0].prec))/ + (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy) + 34 : 0; if (tcp->rates[j]) { @@ -394,12 +394,12 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur /* Modification of the RATE >> */ for (j = 0; j < tcp->numlayers; j++) { tcp->rates[j] = tcp->rates[j] ? - int_ceildiv(tile->numcomps - * (tile->x1 - tile->x0) - * (tile->y1 - tile->y0) - * image->comps[0].prec, - (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) - : 0; + ((float) (tile->numcomps + * (tile->x1 - tile->x0) + * (tile->y1 - tile->y0) + * image->comps[0].prec))/ + (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy) + : 0; if (tcp->rates[j]) { if (j && tcp->rates[j] < tcp->rates[j - 1] + 10) { @@ -1020,7 +1020,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_image_in double hi = max; int success = 0; /* TODO: remove maxlen */ - int maxlen = tcd_tcp->rates[layno] ? int_min(tcd_tcp->rates[layno], len) : len; + int maxlen = tcd_tcp->rates[layno] ? (tcd_tcp->rates[layno] < len ? tcd_tcp->rates[layno] : len) : len; double goodthresh = 0; int i; double distotarget; /* fixed_quality */ |
