/*
+ * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
- * Copyright (c) 2005, Herv� Drolon, FreeImage Team
- * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
+ * Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* (tile->x1 - tile->x0)
* (tile->y1 - tile->y0)
* image->comps[0].prec))/
- (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy) + 34
+ (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)
: 0;
if (tcp->rates[j]) {
double hi = max;
int success = 0;
/* TODO: remove maxlen */
- int maxlen = tcd_tcp->rates[layno] ? (tcd_tcp->rates[layno] < len ? tcd_tcp->rates[layno] : len) : len;
+ int maxlen = tcd_tcp->rates[layno] ? int_min(((int) ceil(tcd_tcp->rates[layno])), len) : len;
double goodthresh = 0;
int i;
double distotarget; /* fixed_quality */
tcd_makelayer(tcd, layno, thresh, 0);
if (cp->fixed_quality) { /* fixed_quality */
- distoachieved = (layno == 0) ?
- tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
- if (distoachieved < distotarget) {
- hi = thresh;
- continue;
+ if(cp->cinema){
+ l = t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest, maxlen, image_info);
+ if (l == -999) {
+ lo = thresh;
+ continue;
+ }else{
+ distoachieved = layno == 0 ?
+ tcd_tile->distolayer[0] : cumdisto[layno - 1] + tcd_tile->distolayer[layno];
+ if (distoachieved < distotarget) {
+ hi=thresh; continue;
+ }else{
+ lo=thresh;
+ }
+ }
+ }else{
+ distoachieved = (layno == 0) ?
+ tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
+ if (distoachieved < distotarget) {
+ hi = thresh;
+ continue;
+ }
+ lo = thresh;
}
- lo = thresh;
} else {
l = t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest, maxlen, image_info);
/* TODO: what to do with l ??? seek / tell ??? */