First I guess I should explain the AC-3 basic bit allocation process.
1) run window+MDCT on input samples
2) extract exponents (range 0-24) from MDCT coefficients
3) compress exponents for efficient encoding (part of the compression is not optional)
4) calculate approximate PSD for each frequency bin from compressed exponents
5) group frequency bins into critical bands and merge PSD for each band
6) spreading function + ATH comparison to calculate masking curve
7) allocate bits for each bin based on the PSD, masking curve, and an SNR offset value
Stages 6 and 7 use parameters from a pre-defined list for the spreading function and bit allocation. The SNR offset parameter in stage 7 is chosen by the encoder so that the number of allocated bits will fit in the frame.
I have several ideas to try to improve the accuracy of the bit allocation.
1) Adjust fast gain value in the spreading function based on the exponent strategy. This is a very rough estimate of noisiness, so it could lead to a more accurate masking curve.
2) If I decide to port VBR mode, try using the original exponents to calculate the masking curve and bap based on the target quality. Then when using the compressed exponents, select a final SNR offset that ensures that each bin gets at least as many bits as determined by the more accurate calculation.
3) Same as #2, but use in CBR mode and use delta bit allocation to adjust the masking curve to more closely match the one that used uncompressed exponents.
4) Same as #2, but use in CBR mode and vary the bandwidth first if needed in order to allocate more bits to bins that need them based on the more accurate masking curve.
5) Same as #2, but calculate a more accurate PSD based on original coefficients rather than exponents. Would probably have to modify low_comp1() in ac3.c to use a threshold comparison instead of an equivalency.
6) Run a separate psychoacoustic model using the original input samples to determine better parameters and masking curve. Adjust parameters to better match the more accurate masking curve. Use delta bit allocation if necessary.
7) Same as #2, but adjust SNR offsets per-block and per-channel to possibly achieve desired quality with fewer bits. The cost of re-transmitting SNR offsets in each block would need to be taken into consideration.
No comments:
Post a Comment