@param compno Number of the component concerned by the information written
*/
static void j2k_write_qcx(opj_j2k_t *j2k, int compno);
-/**
-Read the value concerning the specified component in the marker QCD and QCC
-@param j2k J2K handle
-@param compno Number of the component concern by the information read
-@param len Length of the information in the QCX part of the marker QCD/QCC
-*/
-static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len);
+
/**
Write the QCD marker (quantization default)
@param j2k J2K handle
}
}
-static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
- int tmp;
- int bandno, numbands;
-
- opj_cp_t *cp = j2k->cp;
- opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
- opj_tccp_t *tccp = &tcp->tccps[compno];
- opj_cio_t *cio = j2k->cio;
-
- tmp = cio_read(cio, 1); /* Sqcx */
- tccp->qntsty = tmp & 0x1f;
- tccp->numgbits = tmp >> 5;
- numbands = (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) ?
- 1 : ((tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) ? len - 1 : (len - 1) / 2);
-
-#ifdef USE_JPWL
- if (j2k->cp->correct) {
-
- /* if JPWL is on, we check whether there are too many subbands */
- if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) {
- opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
- "JPWL: bad number of subbands in Sqcx (%d)\n",
- numbands);
- if (!JPWL_ASSUME) {
- opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL: giving up\n");
- return;
- }
- /* we try to correct */
- numbands = 1;
- opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust them\n"
- "- setting number of bands to %d => HYPOTHESIS!!!\n",
- numbands);
- };
-
- };
-
-#else
- /* We check whether there are too many subbands */
- if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) {
- opj_event_msg(j2k->cinfo, EVT_WARNING ,
- "bad number of subbands in Sqcx (%d) regarding to J2K_MAXBANDS (%d) \n"
- "- limiting number of bands to J2K_MAXBANDS and try to move to the next markers\n", numbands, J2K_MAXBANDS);
- }
-
-#endif /* USE_JPWL */
-
- for (bandno = 0; bandno < numbands; bandno++) {
- int expn, mant;
- if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
- expn = cio_read(cio, 1) >> 3; /* SPqcx_i */
- mant = 0;
- } else {
- tmp = cio_read(cio, 2); /* SPqcx_i */
- expn = tmp >> 11;
- mant = tmp & 0x7ff;
- }
- if (bandno < J2K_MAXBANDS){
- tccp->stepsizes[bandno].expn = expn;
- tccp->stepsizes[bandno].mant = mant;
- }
- }
-
- /* Add Antonin : if scalar_derived -> compute other stepsizes */
- if (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
- for (bandno = 1; bandno < J2K_MAXBANDS; bandno++) {
- tccp->stepsizes[bandno].expn =
- ((tccp->stepsizes[0].expn) - ((bandno - 1) / 3) > 0) ?
- (tccp->stepsizes[0].expn) - ((bandno - 1) / 3) : 0;
- tccp->stepsizes[bandno].mant = tccp->stepsizes[0].mant;
- }
- }
- /* ddA */
-}
static void j2k_write_qcd(opj_j2k_t *j2k) {
int lenp, len;