fi.helsinki.cs.ohtu.mpeg2.audio.mpa
Class BitAllocator
java.lang.Object
fi.helsinki.cs.ohtu.mpeg2.audio.mpa.BitAllocator
public class BitAllocator
- extends java.lang.Object
Implements a bit allocator for MPEG-1 Layer II audio. The class
MP2Encoder
uses the the allocator to fit a frame of audio
samples to a given number of representation bits. As an output the
allocator returns a quantization level for each of the 32 sub-bands.
Before quantization a sub-band sample is (almost) noiseless in
respect of representation. Quantization maps the rather precise
sub-band samples to a very restricted set of presentation steps.
This introduces quantization noise to the samples. The bit allocator
tries to 'push' the quantization noise level below the masking
level by incrementally increasing the representation precision
(also known as bit allocation or quantization level). It does it
by increasing the precision on sub-bands that are the most noisy.
The total number of representation bits is limited, so the
allocation is done once nothing more can be added without
overrunning the limit.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BitAllocator
public BitAllocator()
allocate
public static BitAllocator.Allocation allocate(QuantizationTables.QuantizationTable qtable,
int bitsAvail,
int[][] scfsi,
double[][] smr)
- Calculates a bit allocation for a frame with given parameters.
- Parameters:
qtable
- the quantization tablebitsAvail
- the number of bits available for the allocationscfsi
- the scale factor select information for the frame [subband][3]smr
- the signal-to-mask ratios[channel][subband]
- Returns:
- an
Allocation
for the frame