Defines MAX_FINE_BITS to ensure that we're using the same value everywhere
This commit is contained in:
parent
9d2d0510a1
commit
a66b7574f6
4 changed files with 9 additions and 32 deletions
|
@ -965,32 +965,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
|
|||
ALLOC(lowband_scratch, M*(eBands[m->nbEBands]-eBands[m->nbEBands-1]), celt_norm);
|
||||
norm = _norm;
|
||||
norm2 = norm + M*eBands[m->nbEBands];
|
||||
#if 0
|
||||
if (C==2)
|
||||
{
|
||||
int j;
|
||||
int left = 0;
|
||||
for (j=intensity;j<codedBands;j++)
|
||||
{
|
||||
int tmp = pulses[j]/2;
|
||||
left += tmp;
|
||||
pulses[j] -= tmp;
|
||||
}
|
||||
if (codedBands) {
|
||||
int perband;
|
||||
perband = left/(m->eBands[codedBands]-m->eBands[start]);
|
||||
for (j=start;j<codedBands;j++)
|
||||
pulses[j] += perband*(m->eBands[j+1]-m->eBands[j]);
|
||||
left = left-(m->eBands[codedBands]-m->eBands[start])*perband;
|
||||
for (j=start;j<codedBands;j++)
|
||||
{
|
||||
int tmp = IMIN(left, m->eBands[j+1]-m->eBands[j]);
|
||||
pulses[j] += tmp;
|
||||
left -= tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (encode)
|
||||
seed = ((ec_enc*)ec)->rng;
|
||||
else
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "arch.h"
|
||||
#include "mathops.h"
|
||||
#include "stack_alloc.h"
|
||||
#include "rate.h"
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
/* Mean energy in each band quantized in Q6 */
|
||||
|
@ -384,7 +385,7 @@ void quant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBa
|
|||
{
|
||||
for (i=start;i<end && bits_left>=C ;i++)
|
||||
{
|
||||
if (fine_quant[i] >= 7 || fine_priority[i]!=prio)
|
||||
if (fine_quant[i] >= MAX_FINE_BITS || fine_priority[i]!=prio)
|
||||
continue;
|
||||
c=0;
|
||||
do {
|
||||
|
@ -495,7 +496,7 @@ void unquant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *e
|
|||
{
|
||||
for (i=start;i<end && bits_left>=C ;i++)
|
||||
{
|
||||
if (fine_quant[i] >= 8 || fine_priority[i]!=prio)
|
||||
if (fine_quant[i] >= MAX_FINE_BITS || fine_priority[i]!=prio)
|
||||
continue;
|
||||
c=0;
|
||||
do {
|
||||
|
|
|
@ -366,9 +366,8 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
|||
if (C*ebits[j] > (bits[j]>>BITRES))
|
||||
ebits[j] = bits[j] >> stereo >> BITRES;
|
||||
|
||||
/* More than 8 is useless because that's about as far as PVQ can go */
|
||||
if (ebits[j]>8)
|
||||
ebits[j]=8;
|
||||
/* More than that is useless because that's about as far as PVQ can go */
|
||||
ebits[j] = IMIN(ebits[j], MAX_FINE_BITS);
|
||||
|
||||
/* If we rounded down or capped this band, make it a candidate for the
|
||||
final fine energy pass */
|
||||
|
@ -376,7 +375,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
|||
|
||||
} else {
|
||||
/* For N=1, all bits go to fine energy except for a single sign bit */
|
||||
ebits[j] = IMIN(IMAX(0,(bits[j] >> stereo >> BITRES)-1),8);
|
||||
ebits[j] = IMIN(IMAX(0,(bits[j] >> stereo >> BITRES)-1),MAX_FINE_BITS);
|
||||
fine_priority[j] = (ebits[j]+1)*C<<BITRES >= (bits[j]-balance);
|
||||
/* N=1 bands can't take advantage of the re-balancing in
|
||||
quant_all_bands() because they don't have shape, only fine energy.
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#define MAX_PULSES 128
|
||||
|
||||
#define MAX_FINE_BITS 8
|
||||
|
||||
#define BITRES 3
|
||||
#define FINE_OFFSET 21
|
||||
#define QTHETA_OFFSET 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue