[mus422] Quantize testing program on CCRMA system

Craig Sapp craigsapp at gmail.com
Wed Jan 27 00:12:15 PST 2010


Hello Music 422 Class,

If you want to do more rigorous testing of your quantizer algorithms,
you can run this program on the CCRMA system to compare with my
algorithms:
    /user/c/craig/bin/linux/quantize

Usage: quantize -n # [-b # | [[-f | --bf [--max #]] -s # -m #]

Using the following options:
   -n #       = quantize/dequantize the given number
   -b #       = use a uniform (midtread) quantizer with the given size in bits
   -f           = use a floating-point quantizer/dequantizer
      -s #    = set the scale size of the floating point quantizer code
      -m #   = set the mantissa size of the floating point quantizer code
   --bf        = use block floating point (like floating point, but
don't drop the leading 1
                  and don't add a trailing 1 if the |mantissa| is zero
when dequantizing.
   --max #  = use the given number as the max value for the block.
The scale will be extracted
                   from the max value, and the number given with the
-n option will borrow that scale.

Example quantization/dequantization of the value 0.05 with 12-bit
uniform quantizer:
     /user/c/craig/bin/linux/quantize -n 0.05 -b 12
which results in:
     0.05    0000_0110_0110  0.0498168
(first number is the input, last number is the output, and the middle
number is the quantization code displayed in binary digits (which is
the best way to look at quantization codes when debugging).

Example quantization/dequantization using 3,5 fp quant:
     /user/c/craig/bin/linux/quantize -n 0.05 -f -s 3 -m 5
     0.05    (100)0_1001 u:0000_0110_0110    0.0498168

In this case there are two quantization codes displayed (as explained
in my previous email).  The first
code is the actual fp quant code, and the code following the "u:"
string is the results of unpacking
the fp code into a uniform quantization code, just before the final
dequantization.

For block floating point, use --bf instead of -f (two dashes before bf):
     /user/c/craig/bin/linux/quantize -n 0.05 --bf -s 3 -m 5
     0.05    (100)0_1100 u:0000_0110_0100    0.04884

The above call assumes that the input number is only number in the
block, which may
not be the case.  To test block floating point when the quantized
value is less than the
max absolute value in the block, add the --max option:

     /user/c/craig/bin/linux/quantize -n 0.05 --bf -s 3 -m 5 --max 1.0
     0.05    (000)0_0000 u:0000_0000_0000    0
The scale (000) is extracted from the --max value, and then used to quantize
the -n number.  Normally 0.05 has a block floating point scale of
(100) when it is the
largest number in the block, but when 1.0 is the largest number in the
block, the scale
must be (000).

The shell script /user/c/craig/bin/linux/qtest demonstrates how to
produce the data to fill in HW 2's table.

-=+Craig



More information about the 422 mailing list