Using the actual degrees of freedom rather than N*C for fine offset
This commit is contained in:
parent
420c325875
commit
17cab431db
1 changed files with 4 additions and 4 deletions
|
@ -339,18 +339,18 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
|
|
||||||
if (N>1)
|
if (N>1)
|
||||||
{
|
{
|
||||||
NClogN = N*C*(m->logN[j] + logM);
|
|
||||||
|
|
||||||
/* Compensate for the extra DoF in stereo */
|
/* Compensate for the extra DoF in stereo */
|
||||||
den=(C*N+ ((C==2 && N>2) ? 1 : 0));
|
den=(C*N+ ((C==2 && N>2) ? 1 : 0));
|
||||||
|
|
||||||
|
NClogN = den*(m->logN[j] + logM);
|
||||||
|
|
||||||
/* Offset for the number of fine bits by log2(N)/2 + FINE_OFFSET
|
/* Offset for the number of fine bits by log2(N)/2 + FINE_OFFSET
|
||||||
compared to their "fair share" of total/N */
|
compared to their "fair share" of total/N */
|
||||||
offset = (NClogN>>1)-N*C*FINE_OFFSET;
|
offset = (NClogN>>1)-den*FINE_OFFSET;
|
||||||
|
|
||||||
/* N=2 is the only point that doesn't match the curve */
|
/* N=2 is the only point that doesn't match the curve */
|
||||||
if (N==2)
|
if (N==2)
|
||||||
offset += N*C<<BITRES>>2;
|
offset += den<<BITRES>>2;
|
||||||
|
|
||||||
/* Changing the offset for allocating the second and third
|
/* Changing the offset for allocating the second and third
|
||||||
fine energy bit */
|
fine energy bit */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue