public override Object look(DspState vd, InfoMode mi, Object i)
{
float scale;
Info vi=vd.vi;
InfoFloor0 info=(InfoFloor0)i;
LookFloor0 look=new LookFloor0();
look.m=info.order;
look.n=vi.blocksizes[mi.blockflag]/2;
look.ln=info.barkmap;
look.vi=info;
look.lpclook.init(look.ln,look.m);
// we choose a scaling constant so that:
// floor(bark(rate/2-1)*C)=mapped-1
// floor(bark(rate/2)*C)=mapped
scale = look.ln / (float)toBARK((float)(info.rate/2.0));
// the mapping from a linear scale to a smaller bark scale is
// straightforward. We do *not* make sure that the linear mapping
// does not skip bark-scale bins; the decoder simply skips them and
// the encoder may do what it wishes in filling them. They're
// necessary in some mapping combinations to keep the scale spacing
// accurate
look.linearmap=new int[look.n];
for(int j=0; j<look.n; j++)
{
int val=(int)Math.Floor(toBARK((float)((info.rate/2.0)/look.n*j))
*scale); // bark numbers represent band edges
if(val>=look.ln) val=look.ln; // guard against the approximation
look.linearmap[j]=val;
}
return look;
}