Exemple #1
0
static void jpc_qmfb1d_setup(jpc_fix_t *startptr, int startind, int endind,
  int intrastep, jpc_fix_t **lstartptr, int *lstartind, int *lendind,
  jpc_fix_t **hstartptr, int *hstartind, int *hendind)
{
	*lstartind = JPC_CEILDIVPOW2(startind, 1);
	*lendind = JPC_CEILDIVPOW2(endind, 1);
	*hstartind = JPC_FLOORDIVPOW2(startind, 1);
	*hendind = JPC_FLOORDIVPOW2(endind, 1);
	*lstartptr = startptr;
	*hstartptr = &startptr[(*lendind - *lstartind) * intrastep];
}
void jpc_tsfb_getbands2(jpc_tsfb_t *tsfb, int locxstart, int locystart,
  int xstart, int ystart, int xend, int yend, jpc_tsfb_band_t **bands,
  int numlvls)
{
	int newxstart;
	int newystart;
	int newxend;
	int newyend;
	jpc_tsfb_band_t *band;

	newxstart = JPC_CEILDIVPOW2(xstart, 1);
	newystart = JPC_CEILDIVPOW2(ystart, 1);
	newxend = JPC_CEILDIVPOW2(xend, 1);
	newyend = JPC_CEILDIVPOW2(yend, 1);

	if (numlvls > 0) {

		jpc_tsfb_getbands2(tsfb, locxstart, locystart, newxstart, newystart,
		  newxend, newyend, bands, numlvls - 1);

		band = *bands;
		band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
		band->ystart = newystart;
		band->xend = JPC_FLOORDIVPOW2(xend, 1);
		band->yend = newyend;
		band->locxstart = locxstart + newxend - newxstart;
		band->locystart = locystart;
		band->locxend = band->locxstart + band->xend - band->xstart;
		band->locyend = band->locystart + band->yend - band->ystart;
		band->orient = JPC_TSFB_HL;
		band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
		  tsfb->numlvls - numlvls] * tsfb->qmfb->lpenergywts[
		  tsfb->numlvls - numlvls]);
		++(*bands);

		band = *bands;
		band->xstart = newxstart;
		band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
		band->xend = newxend;
		band->yend = JPC_FLOORDIVPOW2(yend, 1);
		band->locxstart = locxstart;
		band->locystart = locystart + newyend - newystart;
		band->locxend = band->locxstart + band->xend - band->xstart;
		band->locyend = band->locystart + band->yend - band->ystart;
		band->orient = JPC_TSFB_LH;
		band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
		  tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
		  tsfb->numlvls - numlvls]);
		++(*bands);

		band = *bands;
		band->xstart = JPC_FLOORDIVPOW2(xstart, 1);
		band->ystart = JPC_FLOORDIVPOW2(ystart, 1);
		band->xend = JPC_FLOORDIVPOW2(xend, 1);
		band->yend = JPC_FLOORDIVPOW2(yend, 1);
		band->locxstart = locxstart + newxend - newxstart;
		band->locystart = locystart + newyend - newystart;
		band->locxend = band->locxstart + band->xend - band->xstart;
		band->locyend = band->locystart + band->yend - band->ystart;
		band->orient = JPC_TSFB_HH;
		band->synenergywt = jpc_dbltofix(tsfb->qmfb->hpenergywts[
		  tsfb->numlvls - numlvls] * tsfb->qmfb->hpenergywts[
		  tsfb->numlvls - numlvls]);
		++(*bands);

	} else {

		band = *bands;
		band->xstart = xstart;
		band->ystart = ystart;
		band->xend = xend;
		band->yend = yend;
		band->locxstart = locxstart;
		band->locystart = locystart;
		band->locxend = band->locxstart + band->xend - band->xstart;
		band->locyend = band->locystart + band->yend - band->ystart;
		band->orient = JPC_TSFB_LL;
		band->synenergywt = jpc_dbltofix(tsfb->qmfb->lpenergywts[
		  tsfb->numlvls - numlvls - 1] * tsfb->qmfb->lpenergywts[
		  tsfb->numlvls - numlvls - 1]);
		++(*bands);

	}

}