Expand description
Quantization and rate control for MP3 encoding
This module implements the quantization loop that controls the trade-off between audio quality and bitrate by adjusting quantization step sizes and managing the bit reservoir.
The implementation strictly follows the shine reference implementation in ref/shine/src/lib/l3loop.c
Functions§
- bigv_
tab_ select - Select Huffman code tables for bigvalues regions Corresponds to bigv_tab_select() in l3loop.c
- calc_
runlen - Calculate run length encoding information Corresponds to calc_runlen() in l3loop.c
- count1_
bitcount - Count bits for count1 region Corresponds to count1_bitcount() in l3loop.c
- count_
bit - Count the number of bits necessary to code the subregion Corresponds to count_bit() in l3loop.c
- ix_max
- Calculate maximum value in range
- labs
- Absolute value function (matches shine labs)
- mulr
- Multiply with rounding and 32-bit right shift (matches shine mulr)
- mulsr
- Multiplication macros matching shine’s mult_noarch_gcc.h These implement fixed-point arithmetic operations
- part2_
length - Calculate part2 length (scalefactors) Corresponds to part2_length() in l3loop.c
- quantize
- Quantize MDCT coefficients Corresponds to quantize() in l3loop.c
- quantize_
with_ l3loop - Helper function to avoid borrowing conflicts
- shine_
inner_ loop - Inner loop: find optimal quantization step size for given scalefactors Corresponds to shine_inner_loop() in l3loop.c
- shine_
iteration_ loop - Main iteration loop for encoding Corresponds to shine_iteration_loop() in l3loop.c
- shine_
loop_ initialise - Initialize quantization loop tables Corresponds to shine_loop_initialise() in l3loop.c
- shine_
outer_ loop - Outer loop: controls masking conditions and computes best scalefac and global gain Corresponds to shine_outer_loop() in l3loop.c
- subdivide
- Subdivide big values region into regions for different Huffman tables Corresponds to subdivide() in l3loop.c
- subdivide_
with_ samplerate - Helper function to subdivide without borrowing conflicts