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
|
||||
+ : added
|
||||
|
||||
October 31, 2006
|
||||
+ [Antonin] added the ability to specify the rate as "float" (before : integer)
|
||||
|
||||
August 18, 2006
|
||||
* [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 */
|
||||
{
|
||||
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++;
|
||||
while (*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, " 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++) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue