Adjust fine bits allocation.
The old code allocated too many fine bits to large bands. New allocations were derived from by numerical optimization using quantization MSE sampled from Laplacian distributed random data to within +/- 1 bit for N=2...160 and bits per band from 0 to 64. Those allocations could be modeled with only minor errors using a simple offset of 19/8+log2(N), with no bits spent on fine energy when there would not be enough bits remaining to code a single pulse. However, PEAQ testing suggested an offset of 14/8 was better, and that it was always worth spending at least one bit on fine energy.
This commit is contained in:
parent
6f1cbca519
commit
a345decd97
2 changed files with 4 additions and 2 deletions
|
@ -160,7 +160,7 @@ static inline void interp_bits2pulses(const CELTMode *m, int start, int end, int
|
|||
N=M*(m->eBands[j+1]-m->eBands[j]);
|
||||
/* Compensate for the extra DoF in stereo */
|
||||
d=(C*N+ ((C==2 && N>2) ? 1 : 0))<<BITRES;
|
||||
offset = FINE_OFFSET - m->logN[j] - logM;
|
||||
offset = FINE_OFFSET - ((m->logN[j] + logM)>>1);
|
||||
/* Offset for the number of fine bits compared to their "fair share" of total/N */
|
||||
offset = bits[j]-offset*N*C;
|
||||
/* Compensate for the prediction gain in stereo */
|
||||
|
@ -173,6 +173,8 @@ static inline void interp_bits2pulses(const CELTMode *m, int start, int end, int
|
|||
|
||||
if (N==1)
|
||||
ebits[j] = (bits[j]/C >> BITRES)-1;
|
||||
if (ebits[j] < 1)
|
||||
ebits[j] = 1;
|
||||
/* Make sure not to bust */
|
||||
if (C*ebits[j] > (bits[j]>>BITRES))
|
||||
ebits[j] = bits[j]/C >> BITRES;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define LOG_MAX_PULSES 7
|
||||
|
||||
#define BITRES 3
|
||||
#define FINE_OFFSET 25
|
||||
#define FINE_OFFSET 14
|
||||
#define QTHETA_OFFSET 18
|
||||
|
||||
#define BITOVERFLOW 30000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue