SPfQuantU
Routine

int SPfQuantU (double x, const float Xq[], int Nreg)
Purpose

Binary search for a bounding interval
Description
This function returns the index of the quantizer region corresponding to
a given input value. The quantizer is specified by an array of quantizer
decision levels. A binary search is used to determine the quantizer region.
The index value takes on values from 0 to Nreg1. If Nreg is equal to one,
the index is set to zero. Otherwise, the index is determined as shown in
the following table. The number of decision levels is one less than the
number of regions.
index input value
0 x <= Xq[0]
1 Xq[0] < x <= Xq[1]
2 Xq[1] < x <= Xq[2]
... ...
i Xq[i1] < x <= Xq[i]
... ...
Nreg2 Xq[Nreg3] < x <= Xq[Nreg2]
Nreg1 Xq[Nreg2] < x
Parameters

< int SPfQuantU

Output index of the quantizer region containing the input value x.
The index takes on values from 0 to Nreg1.

> double x

Value to be quantized

> const float Xq[]

Array of Nreg1 quantizer decision levels which delimit the Nreg
quantizer regions. These levels must be in ascending order.

> int Nreg

Number of quantizer regions
Author / revision
P. Kabal
/ Revision 1.17 2004/07/11
Main Index libtsp