Skip to content
Snippets Groups Projects
Commit 36034282 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Adaptive fine offset value

parent 39ffbeec
No related branches found
No related tags found
No related merge requests found
......@@ -154,13 +154,22 @@ static inline void interp_bits2pulses(const CELTMode *m, int start, int end, int
}
for (j=start;j<end;j++)
{
int N, d;
int N0, N, d;
int offset;
N=M*(m->eBands[j+1]-m->eBands[j]);
int fine_offset;
N0 = m->eBands[j+1]-m->eBands[j];
N=M*N0;
/* Compensate for the extra DoF in stereo */
d=(C*N+ ((C==2 && N>2) ? 1 : 0))<<BITRES;
offset = FINE_OFFSET - ((m->logN[j] + logM)>>1);
d=(C*N+ ((C==2 && N>2) ? 1 : 0))<<BITRES;
if (N0==1)
fine_offset = 19;
else if (N0<=4)
fine_offset = 14;
else
fine_offset = 12;
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 */
......
......@@ -40,7 +40,6 @@
#define LOG_MAX_PULSES 7
#define BITRES 3
#define FINE_OFFSET 14
#define QTHETA_OFFSET 6
#define QTHETA_OFFSET_STEREO 4
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment