internal float[] unquantize()
{
if(maptype==1 || maptype==2)
{
int quantvals;
float mindel=float32_unpack(q_min);
float delta=float32_unpack(q_delta);
float[] r=new float[entries*dim];
//System.err.println("q_min="+q_min+", mindel="+mindel);
// maptype 1 and 2 both use a quantized value vector, but
// different sizes
switch(maptype)
{
case 1:
// most of the time, entries%dimensions == 0, but we need to be
// well defined. We define that the possible vales at each
// scalar is values == entries/dim. If entries%dim != 0, we'll
// have 'too few' values (values*dim<entries), which means that
// we'll have 'left over' entries; left over entries use zeroed
// values (and are wasted). So don't generate codebooks like that
quantvals=maptype1_quantvals();
for(int j=0;j<entries;j++)
{
float last=0.0f;
int indexdiv=1;
for(int k=0;k<dim;k++)
{
int index=(j/indexdiv)%quantvals;
float val=quantlist[index];
val=Math.Abs(val)*delta+mindel+last;
if(q_sequencep!=0)last=val;
r[j*dim+k]=val;
indexdiv*=quantvals;
}
}
break;
case 2:
for(int j=0;j<entries;j++)
{
float last=0.0f;
for(int k=0;k<dim;k++)
{
float val=quantlist[j*dim+k];
//if((j*dim+k)==0){System.err.println(" | 0 -> "+val+" | ");}
val=Math.Abs(val)*delta+mindel+last;
if(q_sequencep!=0)last=val;
r[j*dim+k]=val;
//if((j*dim+k)==0){System.err.println(" $ r[0] -> "+r[0]+" | ");}
}
}
//System.err.println("\nr[0]="+r[0]);
break;
default:
break;
}
return(r);
}
return(null);
}