@param stepsize
@param cblksty Code-block style
@param numcomps
+@param mct
@param tile
*/
static void t1_encode_cblk(
int vsc)
{
int v, flag;
-
opj_raw_t *raw = t1->raw; /* RAW component */
+ OPJ_ARG_NOT_USED(orient);
+
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
if (raw_decode(raw)) {
int oneplushalf)
{
int v, flag;
-
opj_mqc_t *mqc = t1->mqc; /* MQC component */
+ OPJ_ARG_NOT_USED(orient);
+
flag = *flagsp;
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = mqc_decode(mqc) ^ t1_getspb(flag);
return wmsedec;
}
-static bool allocate_buffers(
+static opj_bool allocate_buffers(
opj_t1_t *t1,
int w,
int h)
opj_aligned_free(t1->data);
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
if(!t1->data){
- return false;
+ return OPJ_FALSE;
}
t1->datasize=datasize;
}
opj_aligned_free(t1->flags);
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
if(!t1->flags){
- return false;
+ return OPJ_FALSE;
}
t1->flagssize=flagssize;
}
t1->w=w;
t1->h=h;
- return true;
+ return OPJ_TRUE;
}
/** mod fixed_quality */
for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_band_t* restrict band = &res->bands[bandno];
+ int bandconst = 8192 * 8192 / ((int) floor(band->stepsize * 8192));
for (precno = 0; precno < res->pw * res->ph; ++precno) {
opj_tcd_precinct_t *prc = &band->precincts[precno];
datap[(j * cblk_w) + i] =
fix_mul(
tmp,
- 8192 * 8192 / ((int) floor(band->stepsize * 8192))) >> (11 - T1_NMSEDEC_FRACBITS);
+ bandconst) >> (11 - T1_NMSEDEC_FRACBITS);
}
}
}
} /* resno */
}
+
+
+/* ----------------------------------------------------------------------- */
+/**
+ * Creates a new Tier 1 handle
+ * and initializes the look-up tables of the Tier-1 coder/decoder
+ * @return a new T1 handle if successful, returns NULL otherwise
+*/
+opj_t1_t* t1_create_v2()
+{
+ opj_t1_t *l_t1 = 00;
+
+ l_t1 = (opj_t1_t*) opj_malloc(sizeof(opj_t1_t));
+ if
+ (!l_t1)
+ {
+ return 00;
+ }
+ memset(l_t1,0,sizeof(opj_t1_t));
+
+ /* create MQC and RAW handles */
+ l_t1->mqc = mqc_create();
+ if
+ (! l_t1->mqc)
+ {
+ t1_destroy(l_t1);
+ return 00;
+ }
+ l_t1->raw = raw_create();
+ if
+ (! l_t1->raw)
+ {
+ t1_destroy(l_t1);
+ return 00;
+ }
+ return l_t1;
+}
+
+
+/**
+ * Destroys a previously created T1 handle
+ *
+ * @param p_t1 Tier 1 handle to destroy
+*/
+void t1_destroy_v2(opj_t1_t *p_t1)
+{
+ if
+ (! p_t1)
+ {
+ return;
+ }
+
+ /* destroy MQC and RAW handles */
+ mqc_destroy(p_t1->mqc);
+ p_t1->mqc = 00;
+ raw_destroy(p_t1->raw);
+ p_t1->raw = 00;
+ if
+ (p_t1->data)
+ {
+ opj_aligned_free(p_t1->data);
+ p_t1->data = 00;
+ }
+ if
+ (p_t1->flags)
+ {
+ opj_aligned_free(p_t1->flags);
+ p_t1->flags = 00;
+ }
+ opj_free(p_t1);
+}