added the ability to specify the rate as "float" (before : integer)
This commit is contained in:
parent
480021bc33
commit
b565431251
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
October 31, 2006
|
||||||
|
+ [Antonin] added the ability to specify the rate as "float" (before : integer)
|
||||||
|
|
||||||
August 18, 2006
|
August 18, 2006
|
||||||
* [Antonin] fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly.
|
* [Antonin] fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly.
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||||
case 'r': /* rates rates/distorsion */
|
case 'r': /* rates rates/distorsion */
|
||||||
{
|
{
|
||||||
char *s = optarg;
|
char *s = optarg;
|
||||||
while (sscanf(s, "%d", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||||
parameters->tcp_numlayers++;
|
parameters->tcp_numlayers++;
|
||||||
while (*s && *s != ',') {
|
while (*s && *s != ',') {
|
||||||
s++;
|
s++;
|
||||||
|
|
|
@ -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, " mct=%d\n", tcp->mct);
|
||||||
fprintf(fd, " rates=");
|
fprintf(fd, " rates=");
|
||||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
for (layno = 0; layno < tcp->numlayers; layno++) {
|
||||||
fprintf(fd, "%d ", tcp->rates[layno]);
|
fprintf(fd, "%.1f ", tcp->rates[layno]);
|
||||||
}
|
}
|
||||||
fprintf(fd, "\n");
|
fprintf(fd, "\n");
|
||||||
for (compno = 0; compno < img->numcomps; compno++) {
|
for (compno = 0; compno < img->numcomps; compno++) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ typedef struct opj_tcp {
|
||||||
/** multi-component transform identifier */
|
/** multi-component transform identifier */
|
||||||
int mct;
|
int mct;
|
||||||
/** rates of layers */
|
/** rates of layers */
|
||||||
int rates[100];
|
float rates[100];
|
||||||
/** number of progression order changes */
|
/** number of progression order changes */
|
||||||
int numpocs;
|
int numpocs;
|
||||||
/** indicates if a POC marker has been used O:NO, 1:YES */
|
/** indicates if a POC marker has been used O:NO, 1:YES */
|
||||||
|
|
|
@ -216,7 +216,7 @@ typedef struct opj_cparameters {
|
||||||
/** number of layers */
|
/** number of layers */
|
||||||
int tcp_numlayers;
|
int tcp_numlayers;
|
||||||
/** rates of layers */
|
/** rates of layers */
|
||||||
int tcp_rates[100];
|
float tcp_rates[100];
|
||||||
/** different psnr for successive layers */
|
/** different psnr for successive layers */
|
||||||
float tcp_distoratio[100];
|
float tcp_distoratio[100];
|
||||||
/** number of resolutions */
|
/** number of resolutions */
|
||||||
|
|
|
@ -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 >> */
|
/* Modification of the RATE >> */
|
||||||
for (j = 0; j < tcp->numlayers; j++) {
|
for (j = 0; j < tcp->numlayers; j++) {
|
||||||
tcp->rates[j] = tcp->rates[j] ?
|
tcp->rates[j] = tcp->rates[j] ?
|
||||||
int_ceildiv(tile->numcomps
|
((float) (tile->numcomps
|
||||||
* (tile->x1 - tile->x0)
|
* (tile->x1 - tile->x0)
|
||||||
* (tile->y1 - tile->y0)
|
* (tile->y1 - tile->y0)
|
||||||
* image->comps[0].prec,
|
* image->comps[0].prec))/
|
||||||
(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy))
|
(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy) + 34
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if (tcp->rates[j]) {
|
if (tcp->rates[j]) {
|
||||||
|
@ -394,11 +394,11 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur
|
||||||
/* Modification of the RATE >> */
|
/* Modification of the RATE >> */
|
||||||
for (j = 0; j < tcp->numlayers; j++) {
|
for (j = 0; j < tcp->numlayers; j++) {
|
||||||
tcp->rates[j] = tcp->rates[j] ?
|
tcp->rates[j] = tcp->rates[j] ?
|
||||||
int_ceildiv(tile->numcomps
|
((float) (tile->numcomps
|
||||||
* (tile->x1 - tile->x0)
|
* (tile->x1 - tile->x0)
|
||||||
* (tile->y1 - tile->y0)
|
* (tile->y1 - tile->y0)
|
||||||
* image->comps[0].prec,
|
* image->comps[0].prec))/
|
||||||
(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy))
|
(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if (tcp->rates[j]) {
|
if (tcp->rates[j]) {
|
||||||
|
@ -1020,7 +1020,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_image_in
|
||||||
double hi = max;
|
double hi = max;
|
||||||
int success = 0;
|
int success = 0;
|
||||||
/* TODO: remove maxlen */
|
/* 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;
|
double goodthresh = 0;
|
||||||
int i;
|
int i;
|
||||||
double distotarget; /* fixed_quality */
|
double distotarget; /* fixed_quality */
|
||||||
|
|
Loading…
Reference in New Issue