static void jpc_tsfbnode_synthesize(jpc_tsfbnode_t *node, int flags, jas_seq2d_t *x) { jpc_tsfbnodeband_t nodebands[JPC_TSFB_MAXBANDSPERNODE]; int numbands; jas_seq2d_t *y; int bandno; jpc_tsfbnodeband_t *band; if (node->numchildren > 0) { qmfb2d_getbands(node->hqmfb, node->vqmfb, jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x), jas_seq2d_yend(x), JPC_TSFB_MAXBANDSPERNODE, &numbands, nodebands); y = jas_seq2d_create(0, 0, 0, 0); for (bandno = 0, band = nodebands; bandno < numbands; ++bandno, ++band) { if (node->children[bandno]) { if (band->xstart != band->xend && band->ystart != band->yend) { jas_seq2d_bindsub(y, x, band->locxstart, band->locystart, band->locxend, band->locyend); jas_seq2d_setshift(y, band->xstart, band->ystart); jpc_tsfbnode_synthesize(node->children[bandno], flags, y); } } } jas_seq2d_destroy(y); } if (node->hqmfb) { jpc_qmfb1d_synthesize(node->hqmfb, flags, x); } if (node->vqmfb) { jpc_qmfb1d_synthesize(node->vqmfb, flags | JPC_QMFB1D_VERT, x); } }
static void jpc_tsfbnode_getbandstree(jpc_tsfbnode_t *node, uint_fast32_t posxstart, uint_fast32_t posystart, uint_fast32_t xstart, uint_fast32_t ystart, uint_fast32_t xend, uint_fast32_t yend, jpc_tsfb_band_t **bands) { jpc_tsfbnodeband_t nodebands[JPC_TSFB_MAXBANDSPERNODE]; jpc_tsfbnodeband_t *nodeband; int nodebandno; int numnodebands; jpc_tsfb_band_t *band; jas_seq_t *hfilter; jas_seq_t *vfilter; qmfb2d_getbands(node->hqmfb, node->vqmfb, xstart, ystart, xend, yend, JPC_TSFB_MAXBANDSPERNODE, &numnodebands, nodebands); if (node->numchildren > 0) { for (nodebandno = 0, nodeband = nodebands; nodebandno < numnodebands; ++nodebandno, ++nodeband) { if (node->children[nodebandno]) { jpc_tsfbnode_getbandstree(node->children[ nodebandno], posxstart + nodeband->locxstart - xstart, posystart + nodeband->locystart - ystart, nodeband->xstart, nodeband->ystart, nodeband->xend, nodeband->yend, bands); } } } assert(numnodebands == 4 || numnodebands == 3); for (nodebandno = 0, nodeband = nodebands; nodebandno < numnodebands; ++nodebandno, ++nodeband) { if (!node->children[nodebandno]) { band = *bands; band->xstart = nodeband->xstart; band->ystart = nodeband->ystart; band->xend = nodeband->xend; band->yend = nodeband->yend; band->locxstart = posxstart + nodeband->locxstart - xstart; band->locystart = posystart + nodeband->locystart - ystart; band->locxend = band->locxstart + band->xend - band->xstart; band->locyend = band->locystart + band->yend - band->ystart; if (numnodebands == 4) { switch (nodebandno) { case 0: band->orient = JPC_TSFB_LL; break; case 1: band->orient = JPC_TSFB_HL; break; case 2: band->orient = JPC_TSFB_LH; break; case 3: band->orient = JPC_TSFB_HH; break; default: abort(); break; } } else { switch (nodebandno) { case 0: band->orient = JPC_TSFB_HL; break; case 1: band->orient = JPC_TSFB_LH; break; case 2: band->orient = JPC_TSFB_HH; break; default: abort(); break; } } jpc_tsfbnode_getequivfilters(node, nodebandno, band->xend - band->xstart, band->yend - band->ystart, &hfilter, &vfilter); band->synenergywt = jpc_fix_mul(jpc_seq_norm(hfilter), jpc_seq_norm(vfilter)); jas_seq_destroy(hfilter); jas_seq_destroy(vfilter); ++(*bands); } } }
static void jpc_tsfbnode_synthesize(jpc_tsfbnode_t *node, int flags, jas_seq2d_t *x) { jpc_tsfbnodeband_t nodebands[JPC_TSFB_MAXBANDSPERNODE]; int numbands; jas_seq2d_t *y; int bandno; jpc_tsfbnodeband_t *band; if (node->numchildren > 0) { jas_matrix_t org; qmfb2d_getbands( node->hqmfb, node->vqmfb, jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x), jas_seq2d_yend(x), JPC_TSFB_MAXBANDSPERNODE, &numbands, nodebands ); y = &org; memset( y, 0, sizeof(org)); for (bandno = 0, band = nodebands; bandno < numbands; ++bandno, ++band) { if (node->children[bandno]) { if (band->xstart != band->xend && band->ystart != band->yend) { jas_seq2d_bindsub( y, x, band->locxstart, band->locystart, band->locxend, band->locyend ); jas_seq2d_setshift( y, band->xstart, band->ystart ); jpc_tsfbnode_synthesize( node->children[bandno], flags, y ); } } } } if (node->hqmfb) { (*(node->hqmfb)->ops->synthesize)(node->hqmfb, flags, x); } if (node->vqmfb) { (*(node->vqmfb)->ops->synthesize)(node->vqmfb, flags | JPC_QMFB1D_VERT, x); } }