/* ----------------------------------------------------- */
- case 'q': { /* add fixed_quality */
+ case 'q': { /* layer allocation by distortion ratio (PSNR) */
char *s = opj_optarg;
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers])
== 1) {
/* dda */
/* ----------------------------------------------------- */
- case 'f': { /* mod fixed_quality (before : -q) */
+ case 'f': { /* layer allocation by fixed layer */
int *row = NULL, *col = NULL;
OPJ_UINT32 numlayers = 0, numresolution = 0, matrix_width = 0;
parameters->cp_fixed_quality))) {
fprintf(stderr, "[ERROR] options -r -q and -f cannot be used together !!\n");
return 1;
- } /* mod fixed_quality */
+ }
/* if no rate entered, lossless by default */
/** @name Local static functions */
/*@{*/
-/**
-Write a bit
-@param bio BIO handle
-@param b Bit to write (0 or 1)
-*/
-static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b);
/**
Read a bit
@param bio BIO handle
return OPJ_TRUE;
}
-static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b)
-{
- if (bio->ct == 0) {
- opj_bio_byteout(
- bio); /* MSD: why not check the return value of this function ? */
- }
- bio->ct--;
- bio->buf |= b << bio->ct;
-}
-
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio)
{
if (bio->ct == 0) {
bio->ct = 0;
}
+void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b)
+{
+ if (bio->ct == 0) {
+ opj_bio_byteout(
+ bio); /* MSD: why not check the return value of this function ? */
+ }
+ bio->ct--;
+ bio->buf |= b << bio->ct;
+}
+
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n)
{
OPJ_INT32 i;
@param n Number of bits to write
*/
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n);
+
+/**
+Write a bit
+@param bio BIO handle
+@param b Bit to write (0 or 1)
+*/
+void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b);
+
/**
Read bits
@param bio BIO handle
return OPJ_FALSE;
}
+ if (parameters->cp_fixed_alloc) {
+ if (parameters->cp_matrice == NULL) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "cp_fixed_alloc set, but cp_matrice missing\n");
+ return OPJ_FALSE;
+ }
+
+ if (parameters->tcp_numlayers > J2K_TCD_MATRIX_MAX_LAYER_COUNT) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "tcp_numlayers when cp_fixed_alloc set should not exceed %d\n",
+ J2K_TCD_MATRIX_MAX_LAYER_COUNT);
+ return OPJ_FALSE;
+ }
+ if (parameters->numresolution > J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "numresolution when cp_fixed_alloc set should not exceed %d\n",
+ J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT);
+ return OPJ_FALSE;
+ }
+ }
+
p_j2k->m_specific_param.m_encoder.m_nb_comps = image->numcomps;
/* keep a link to cp so that we can destroy it later in j2k_destroy_compress */
cp->m_specific_param.m_enc.m_max_comp_size = (OPJ_UINT32)
parameters->max_comp_size;
cp->rsiz = parameters->rsiz;
- cp->m_specific_param.m_enc.m_disto_alloc = (OPJ_UINT32)
- parameters->cp_disto_alloc & 1u;
- cp->m_specific_param.m_enc.m_fixed_alloc = (OPJ_UINT32)
- parameters->cp_fixed_alloc & 1u;
- cp->m_specific_param.m_enc.m_fixed_quality = (OPJ_UINT32)
- parameters->cp_fixed_quality & 1u;
-
- /* mod fixed_quality */
- if (parameters->cp_fixed_alloc && parameters->cp_matrice) {
+ if (parameters->cp_fixed_alloc) {
+ cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy = FIXED_LAYER;
+ } else if (parameters->cp_fixed_quality) {
+ cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy =
+ FIXED_DISTORTION_RATIO;
+ } else {
+ cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy =
+ RATE_DISTORTION_RATIO;
+ }
+
+ if (parameters->cp_fixed_alloc) {
size_t array_size = (size_t)parameters->tcp_numlayers *
(size_t)parameters->numresolution * 3 * sizeof(OPJ_INT32);
cp->m_specific_param.m_enc.m_matrice = (OPJ_INT32 *) opj_malloc(array_size);
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
opj_tcp_t *tcp = &cp->tcps[tileno];
+ const OPJ_BOOL fixed_distoratio =
+ cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ FIXED_DISTORTION_RATIO;
tcp->numlayers = (OPJ_UINT32)parameters->tcp_numlayers;
for (j = 0; j < tcp->numlayers; j++) {
if (OPJ_IS_CINEMA(cp->rsiz) || OPJ_IS_IMF(cp->rsiz)) {
- if (cp->m_specific_param.m_enc.m_fixed_quality) {
+ if (fixed_distoratio) {
tcp->distoratio[j] = parameters->tcp_distoratio[j];
}
tcp->rates[j] = parameters->tcp_rates[j];
} else {
- if (cp->m_specific_param.m_enc.m_fixed_quality) { /* add fixed_quality */
+ if (fixed_distoratio) {
tcp->distoratio[j] = parameters->tcp_distoratio[j];
} else {
tcp->rates[j] = parameters->tcp_rates[j];
}
}
- if (!cp->m_specific_param.m_enc.m_fixed_quality &&
+ if (!fixed_distoratio &&
tcp->rates[j] <= 1.0) {
tcp->rates[j] = 0.0; /* force lossless */
}
#define J2K_MAX_POCS 32 /**< Maximum number of POCs */
+#define J2K_TCD_MATRIX_MAX_LAYER_COUNT 10
+#define J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT 10
+
/* ----------------------------------------------------------------------- */
/**
OPJ_UINT32 ppt_data_size;
/** size of ppt_data*/
OPJ_UINT32 ppt_len;
- /** add fixed_quality */
+ /** PSNR values */
OPJ_FLOAT32 distoratio[100];
/** tile-component coding parameters */
opj_tccp_t *tccps;
} opj_tcp_t;
+/**
+Rate allocation strategy
+*/
+typedef enum {
+ RATE_DISTORTION_RATIO = 0, /** allocation by rate/distortion */
+ FIXED_DISTORTION_RATIO = 1, /** allocation by fixed distortion ratio (PSNR) (fixed quality) */
+ FIXED_LAYER = 2, /** allocation by fixed layer (number of passes per layer / resolution / subband) */
+} J2K_QUALITY_LAYER_ALLOCATION_STRATEGY;
typedef struct opj_encoding_param {
OPJ_INT32 *m_matrice;
/** Flag determining tile part generation*/
OPJ_BYTE m_tp_flag;
- /** allocation by rate/distortion */
- OPJ_BITFIELD m_disto_alloc : 1;
- /** allocation by fixed layer */
- OPJ_BITFIELD m_fixed_alloc : 1;
- /** add fixed_quality */
- OPJ_BITFIELD m_fixed_quality : 1;
+ /** Quality layer allocation strategy */
+ J2K_QUALITY_LAYER_ALLOCATION_STRATEGY m_quality_layer_alloc_strategy;
/** Enabling Tile part generation*/
OPJ_BITFIELD m_tp_on : 1;
}
int cp_disto_alloc;
/** allocation by fixed layer */
int cp_fixed_alloc;
- /** add fixed_quality */
+ /** allocation by fixed quality (PSNR) */
int cp_fixed_quality;
/** fixed layer */
int *cp_matrice;
int pdy[33];
/** information concerning packets inside tile */
opj_packet_info_t *packet;
- /** add fixed_quality */
+ /** number of pixels of the tile */
int numpix;
- /** add fixed_quality */
+ /** distortion of the tile */
double distotile;
/** number of markers */
int marknum;
}
-/** mod fixed_quality */
static OPJ_FLOAT64 opj_t1_getwmsedec(
OPJ_INT32 nmsedec,
OPJ_UINT32 compno,
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
opj_mutex_t* mutex = opj_mutex_create();
- tile->distotile = 0; /* fixed_quality */
+ tile->distotile = 0;
for (compno = 0; compno < tile->numcomps; ++compno) {
opj_tcd_tilecomp_t* tilec = &tile->comps[compno];
}
-/** mod fixed_quality */
static OPJ_FLOAT64 opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
break;
}
- /* fixed_quality */
tempwmsedec = opj_t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid,
stepsize, numcomps, mct_norms, mct_numcomps) ;
cumwmsedec += tempwmsedec;
static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n)
{
while (--n >= 0) {
- opj_bio_write(bio, 1, 1);
+ opj_bio_putbit(bio, 1);
}
- opj_bio_write(bio, 0, 1);
+ opj_bio_putbit(bio, 0);
}
static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
static void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n)
{
if (n == 1) {
- opj_bio_write(bio, 0, 1);
+ opj_bio_putbit(bio, 0);
} else if (n == 2) {
opj_bio_write(bio, 2, 2);
} else if (n <= 5) {
}
}
#endif
- opj_bio_write(bio, packet_empty ? 0 : 1, 1); /* Empty header bit */
+ opj_bio_putbit(bio, packet_empty ? 0 : 1); /* Empty header bit */
/* Writing Packet header */
band = res->bands;
if (!cblk->numpasses) {
opj_tgt_encode(bio, prc->incltree, cblkno, (OPJ_INT32)(layno + 1));
} else {
- opj_bio_write(bio, layer->numpasses != 0, 1);
+ opj_bio_putbit(bio, layer->numpasses != 0);
}
/* if cblk not included, go to the next cblk */
return OPJ_FALSE;
}
- memcpy(c, layer->data, layer->len);
+ if (p_t2_mode == FINAL_PASS) {
+ memcpy(c, layer->data, layer->len);
+ }
cblk->numpasses += layer->numpasses;
c += layer->len;
length -= layer->len;
#include "opj_includes.h"
#include "opj_common.h"
+// #define DEBUG_RATE_ALLOC
+
/* ----------------------------------------------------------------------- */
/* TODO MSD: */
*/
static void opj_tcd_code_block_enc_deallocate(opj_tcd_precinct_t * p_precinct);
+static
+void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
+ OPJ_UINT32 final);
/**
Free the memory allocated for encoding
/* ----------------------------------------------------------------------- */
+static
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd)
{
OPJ_UINT32 layno;
}
-void opj_tcd_makelayer(opj_tcd_t *tcd,
- OPJ_UINT32 layno,
- OPJ_FLOAT64 thresh,
- OPJ_UINT32 final)
+/* ----------------------------------------------------------------------- */
+
+/** Returns OPJ_TRUE if the layer allocation is unchanged w.r.t to the previous
+ * invokation with a different threshold */
+static
+OPJ_BOOL opj_tcd_makelayer(opj_tcd_t *tcd,
+ OPJ_UINT32 layno,
+ OPJ_FLOAT64 thresh,
+ OPJ_UINT32 final)
{
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_UINT32 passno;
opj_tcd_tile_t *tcd_tile = tcd->tcd_image->tiles;
+ OPJ_BOOL layer_allocation_is_same = OPJ_TRUE;
- tcd_tile->distolayer[layno] = 0; /* fixed_quality */
+ tcd_tile->distolayer[layno] = 0;
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
}
}
- layer->numpasses = n - cblk->numpassesinlayers;
+ if (layer->numpasses != n - cblk->numpassesinlayers) {
+ layer_allocation_is_same = OPJ_FALSE;
+ layer->numpasses = n - cblk->numpassesinlayers;
+ }
if (!layer->numpasses) {
layer->disto = 0;
cblk->passes[cblk->numpassesinlayers - 1].distortiondec;
}
- tcd_tile->distolayer[layno] += layer->disto; /* fixed_quality */
+ tcd_tile->distolayer[layno] += layer->disto;
if (final) {
cblk->numpassesinlayers = n;
}
}
}
+ return layer_allocation_is_same;
}
+/** For m_quality_layer_alloc_strategy == FIXED_LAYER */
+static
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
OPJ_UINT32 final)
{
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_INT32 value; /*, matrice[tcd_tcp->numlayers][tcd_tile->comps[0].numresolutions][3]; */
- OPJ_INT32 matrice[10][10][3];
+ OPJ_INT32 matrice[J2K_TCD_MATRIX_MAX_LAYER_COUNT][J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT][3];
OPJ_UINT32 i, j, k;
opj_cp_t *cp = tcd->cp;
}
}
+/** Rate allocation for the following methods:
+ * - allocation by rate/distortio (m_quality_layer_alloc_strategy == RATE_DISTORTION_RATIO)
+ * - allocation by fixed quality (m_quality_layer_alloc_strategy == FIXED_DISTORTION_RATIO)
+ */
+static
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 compno, resno, bandno, precno, cblkno, layno;
OPJ_UINT32 passno;
OPJ_FLOAT64 min, max;
- OPJ_FLOAT64 cumdisto[100]; /* fixed_quality */
- const OPJ_FLOAT64 K = 1; /* 1.1; fixed_quality */
+ OPJ_FLOAT64 cumdisto[100];
+ const OPJ_FLOAT64 K = 1;
OPJ_FLOAT64 maxSE = 0;
opj_cp_t *cp = tcd->cp;
min = DBL_MAX;
max = 0;
- tcd_tile->numpix = 0; /* fixed_quality */
+ tcd_tile->numpix = 0;
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
}
} /* passno */
- /* fixed_quality */
- tcd_tile->numpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0));
- tilec->numpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0));
+ {
+ const OPJ_SIZE_T cblk_pix_count = (OPJ_SIZE_T)((cblk->x1 - cblk->x0) *
+ (cblk->y1 - cblk->y0));
+ tcd_tile->numpix += cblk_pix_count;
+ tilec->numpix += cblk_pix_count;
+ }
} /* cbklno */
} /* precno */
} /* bandno */
/* index file */
if (cstr_info) {
opj_tile_info_t *tile_info = &cstr_info->tile[tcd->tcd_tileno];
- tile_info->numpix = tcd_tile->numpix;
- tile_info->distotile = tcd_tile->distotile;
+ tile_info->numpix = (int)tcd_tile->numpix;
+ tile_info->distotile = (int)tcd_tile->distotile;
tile_info->thresh = (OPJ_FLOAT64 *) opj_malloc(tcd_tcp->numlayers * sizeof(
OPJ_FLOAT64));
if (!tile_info->thresh) {
OPJ_FLOAT64 goodthresh = 0;
OPJ_FLOAT64 stable_thresh = 0;
OPJ_UINT32 i;
- OPJ_FLOAT64 distotarget; /* fixed_quality */
+ OPJ_FLOAT64 distotarget;
- /* fixed_quality */
distotarget = tcd_tile->distotile - ((K * maxSE) / pow((OPJ_FLOAT32)10,
tcd_tcp->distoratio[layno] / 10));
/* Don't try to find an optimal threshold but rather take everything not included yet, if
- -r xx,yy,zz,0 (disto_alloc == 1 and rates == 0)
- -q xx,yy,zz,0 (fixed_quality == 1 and distoratio == 0)
+ -r xx,yy,zz,0 (m_quality_layer_alloc_strategy == RATE_DISTORTION_RATIO and rates == NULL)
+ -q xx,yy,zz,0 (m_quality_layer_alloc_strategy == FIXED_DISTORTION_RATIO and distoratio == NULL)
==> possible to have some lossy layers and the last layer for sure lossless */
- if (((cp->m_specific_param.m_enc.m_disto_alloc == 1) &&
+ if (((cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ RATE_DISTORTION_RATIO) &&
(tcd_tcp->rates[layno] > 0.0f)) ||
- ((cp->m_specific_param.m_enc.m_fixed_quality == 1) &&
+ ((cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ FIXED_DISTORTION_RATIO) &&
(tcd_tcp->distoratio[layno] > 0.0))) {
opj_t2_t*t2 = opj_t2_create(tcd->image, cp);
OPJ_FLOAT64 thresh = 0;
+ OPJ_BOOL last_layer_allocation_ok = OPJ_FALSE;
if (t2 == 00) {
return OPJ_FALSE;
}
for (i = 0; i < 128; ++i) {
- OPJ_FLOAT64 distoachieved = 0; /* fixed_quality */
-
- thresh = (lo + hi) / 2;
-
- opj_tcd_makelayer(tcd, layno, thresh, 0);
+ OPJ_FLOAT64 distoachieved = 0;
+ OPJ_BOOL layer_allocation_is_same;
+
+ OPJ_FLOAT64 new_thresh = (lo + hi) / 2;
+ /* Stop iterating when the threshold has stabilized enough */
+ /* 0.5 * 1e-5 is somewhat arbitrary, but has been selected */
+ /* so that this doesn't change the results of the regression */
+ /* test suite. */
+ if (fabs(new_thresh - thresh) <= 0.5 * 1e-5 * thresh) {
+ break;
+ }
+ thresh = new_thresh;
+#ifdef DEBUG_RATE_ALLOC
+ opj_event_msg(p_manager, EVT_INFO, "layno=%u, iter=%u, thresh=%g",
+ layno, i, new_thresh);
+#endif
- if (cp->m_specific_param.m_enc.m_fixed_quality) { /* fixed_quality */
+ layer_allocation_is_same = opj_tcd_makelayer(tcd, layno, thresh, 0) && i != 0;
+#ifdef DEBUG_RATE_ALLOC
+ opj_event_msg(p_manager, EVT_INFO, "--> layer_allocation_is_same = %d",
+ layer_allocation_is_same);
+#endif
+ if (cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ FIXED_DISTORTION_RATIO) {
if (OPJ_IS_CINEMA(cp->rsiz) || OPJ_IS_IMF(cp->rsiz)) {
if (! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
}
lo = thresh;
}
- } else {
- if (! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
- p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
- tcd->cur_pino,
- THRESH_CALC, p_manager)) {
- /* TODO: what to do with l ??? seek / tell ??? */
- /* opj_event_msg(tcd->cinfo, EVT_INFO, "rate alloc: len=%d, max=%d\n", l, maxlen); */
+ } else { /* Disto/rate based optimization */
+ /* Check if the layer allocation done by opj_tcd_makelayer()
+ * is compatible of the maximum rate allocation. If not,
+ * retry with a higher threshold.
+ * If OK, try with a lower threshold.
+ * Call opj_t2_encode_packets() only if opj_tcd_makelayer()
+ * has resulted in different truncation points since its last
+ * call. */
+ if ((layer_allocation_is_same && !last_layer_allocation_ok) ||
+ (!layer_allocation_is_same &&
+ ! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
+ p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
+ tcd->cur_pino,
+ THRESH_CALC, p_manager))) {
+
+#ifdef DEBUG_RATE_ALLOC
+ if (!layer_allocation_is_same) {
+ opj_event_msg(p_manager, EVT_INFO,
+ "--> check rate alloc failed (> maxlen=%u)\n", maxlen);
+ }
+#endif
+ last_layer_allocation_ok = OPJ_FALSE;
lo = thresh;
continue;
}
+#ifdef DEBUG_RATE_ALLOC
+ if (!layer_allocation_is_same) {
+ opj_event_msg(p_manager, EVT_INFO,
+ "--> check rate alloc success (len=%u <= maxlen=%u)\n", *p_data_written,
+ maxlen);
+ }
+#endif
+
+ last_layer_allocation_ok = OPJ_TRUE;
hi = thresh;
stable_thresh = thresh;
}
opj_tcd_makelayer(tcd, layno, goodthresh, 1);
- /* fixed_quality */
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] :
(cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
}
p_cstr_info->index_write = 0;
}
- if (l_cp->m_specific_param.m_enc.m_disto_alloc ||
- l_cp->m_specific_param.m_enc.m_fixed_quality) {
- /* fixed_quality */
- /* Normal Rate/distortion allocation */
+ if (l_cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ RATE_DISTORTION_RATIO ||
+ l_cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
+ FIXED_DISTORTION_RATIO) {
if (! opj_tcd_rateallocate(p_tcd, p_dest_data, &l_nb_written, p_max_dest_size,
p_cstr_info, p_manager)) {
return OPJ_FALSE;
OPJ_UINT32 win_x1;
OPJ_UINT32 win_y1;
- /* add fixed_quality */
- OPJ_INT32 numpix;
+ /* number of pixels */
+ OPJ_SIZE_T numpix;
} opj_tcd_tilecomp_t;
OPJ_INT32 x0, y0, x1, y1;
OPJ_UINT32 numcomps; /* number of components in tile */
opj_tcd_tilecomp_t *comps; /* Components information */
- OPJ_INT32 numpix; /* add fixed_quality */
- OPJ_FLOAT64 distotile; /* add fixed_quality */
- OPJ_FLOAT64 distolayer[100]; /* add fixed_quality */
+ OPJ_SIZE_T numpix; /* number of pixels */
+ OPJ_FLOAT64 distotile; /* distortion of the tile */
+ OPJ_FLOAT64 distolayer[100]; /* distortion per layer */
OPJ_UINT32 packno; /* packet number */
} opj_tcd_tile_t;
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
opj_event_mgr_t* p_manager);
-void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
- OPJ_UINT32 final);
-
-void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd);
-
-void opj_tcd_makelayer(opj_tcd_t *tcd,
- OPJ_UINT32 layno,
- OPJ_FLOAT64 thresh,
- OPJ_UINT32 final);
-
-OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
- OPJ_BYTE *dest,
- OPJ_UINT32 * p_data_written,
- OPJ_UINT32 len,
- opj_codestream_info_t *cstr_info,
- opj_event_mgr_t *p_manager);
-
/**
* Gets the maximum tile size that will be taken by the tile once decoded.
*/
while (low < threshold) {
if (low >= node->value) {
if (!node->known) {
- opj_bio_write(bio, 1, 1);
+ opj_bio_putbit(bio, 1);
node->known = 1;
}
break;
}
- opj_bio_write(bio, 0, 1);
+ opj_bio_putbit(bio, 0);
++low;
}