Commit graph

1584 commits

Author SHA1 Message Date
Jean-Marc Valin
d6c3d3ceae Error handling in _create() functions 2011-01-30 11:00:24 -05:00
Jean-Marc Valin
913a1742b9 Adding resampling support
We use the MDCT as low-pass filter.
2011-01-29 11:35:19 -05:00
Timothy B. Terriberry
9b34bd835c Change qb cap to prevent side-fold collapses.
Previously, in a stereo split with itheta==16384, but without
 enough bits left over to actually code a pulse, the target band
 would completely collapse, because the mid gain would be zero and
 we don't fold the side.
This changes the limit to ensure that we never set qn>1 unless we
 know we'll have enough bits for at least one pulse.
This should eliminate the last possible whole-band collapse.
2011-01-29 01:31:09 -05:00
Jean-Marc Valin
c97b258c62 celt_encoder_create() now defaults to Opus standard mode
The old constructor is renamed celt_encoder_create_custom(). Same
for the decoder.
2011-01-28 23:07:32 -05:00
Jean-Marc Valin
5ad35bf3bf Enabling the standard static mode by default 2011-01-28 22:42:09 -05:00
Jean-Marc Valin
d9e4b1d72c Adding the auto-generated static modes for float and fixed 2011-01-28 22:24:40 -05:00
Jean-Marc Valin
17cab431db Using the actual degrees of freedom rather than N*C for fine offset 2011-01-28 20:56:56 -05:00
Gregory Maxwell
420c325875 Prevent VBR from shooting up to the maximum rate if set to very low target rates, and prevent the encoder VBR from producing 1 byte frames (which are no longer allowed). 2011-01-27 22:58:12 -05:00
Jean-Marc Valin
09213de91c Don't rebalance bits for itheta=0 or 16384 2011-01-27 21:43:24 -05:00
Jean-Marc Valin
a928572055 Making rebalance a celt_int32 2011-01-27 18:44:26 -05:00
Jean-Marc Valin
47e905dce7 Making anti-collapse a bit more conservative again
The energy memory can be lowered (not increased) during a transient
2011-01-27 18:05:47 -05:00
Jean-Marc Valin
b417d8392e Changing some double constants to float 2011-01-27 17:19:49 -05:00
Jean-Marc Valin
61f40418fa Adjusting post-filter coefficients to be exact in 13 bit precision.
That way they can be exact in 16 bits once multiplied by the gain
2011-01-27 17:14:33 -05:00
Jean-Marc Valin
49f76805ba Adjusting pre-emphasis coefs to be exact in 16-bit precision 2011-01-27 17:01:59 -05:00
Jean-Marc Valin
097c5be8dc Using a real 16-bit value for the coarse beta on intra frames 2011-01-27 16:51:20 -05:00
Jean-Marc Valin
8ca161212b Reducing waste at high bit-rate
We now encode the highest bitrate part of the split first and transfer
any unused bits to the other part. We use a dead zone of three bits
to prevent redistributing in cases of random fluctuation (or else
we will statistically lower the allocation of higher frequencies at
low-mid bitrates).
2011-01-27 16:28:16 -05:00
Jean-Marc Valin
c30f8ca666 Minor opus_compare fix 2011-01-27 15:50:27 -05:00
Jean-Marc Valin
4cd3dd31ee Comparison tool for decoder compliance 2011-01-27 15:47:15 -05:00
Jean-Marc Valin
79afa9c605 Fixes fixed-point overflow on really low energy
Makes celt_exp2() use Q10 input to avoid problems on very low energy.
Also makes the pitch downsampling more conservative on gain to avoid
problems later.
2011-01-27 10:46:01 -05:00
Jean-Marc Valin
02ad779f5f Fixes a fixed-point overflow in anti-collapse 2011-01-27 09:53:09 -05:00
Timothy B. Terriberry
045e47cede Improve accuracy of update_lowband test. 2011-01-26 23:52:27 -05:00
Jean-Marc Valin
65d35a35cf Only allowing silence in non-hybrid mode.
Also defining a 1-byte packet as triggering the PLC/CNG
2011-01-26 22:04:59 -05:00
Timothy B. Terriberry
a396e153b9 More anti-collapse fixes, as well as a fold fix.
This changes folding so that the LCG is never used on transients
 (either short blocks or long blocks with increased time
 resolution), except in the case that there's not enough decoded
 spectrum to fold yet.

It also now only subtracts the anti-collapse bit from the total
 allocation in quant_all_bands() when space has actually been
 reserved for it.

Finally, it cleans up some of the fill and collapse_mask tracking
 (this tracking was originally made intentionally sloppy to save
 work, but then converted to replace the existing fill flag at the
 last minute, which can have a number of logical implications).
The changes, in particular:
1) Splits of less than a block now correctly mark the second half
    as filled only if the whole block was filled (previously it
    would also mark it filled if the next block was filled).
2) Splits of less than a block now correctly mark a block as
    un-collapsed if either half was un-collapsed, instead of marking
    the next block as un-collapsed when the high half was.
3) The N=2 stereo special case now keeps its fill mask even when
    itheta==16384; previously this would have gotten cleared,
    despite the fact that we fold into the side in this case.
4) The test against fill for folding now only considers the bits
    corresponding to the current set of blocks.
   Previously it would still fold if any later block was filled.
5) The collapse mask used for the LCG fold data is now correctly
    initialized when B=16 on platforms with a 16-bit int.
6) The high bits on a collapse mask are now cleared after the TF
    resolution changes and interleaving at level 0, instead of
    waiting until the very end.
   This prevents extraneous high flags set on mid from being mixed
    into the side flags for mid-side stereo.
2011-01-26 20:54:13 -05:00
Jean-Marc Valin
4b000c37e7 Setting bandE[] to zero after log2Amp when silence=1 2011-01-26 20:30:21 -05:00
Gregory Maxwell
8b631f2c5f Fixes for silence handling in VBR mode, plus an encoder/decoder desync triggered by silent frames. 2011-01-26 20:26:31 -05:00
Jean-Marc Valin
e3e2c26dfc Removing more unused function params 2011-01-26 13:09:53 -05:00
Jean-Marc Valin
13a7c26654 Removes explicit filling of remaining bits with zeros
The initialiser already takes care of this
2011-01-26 10:58:33 -05:00
Jean-Marc Valin
c39bb8ab8c Removes unused function parameters 2011-01-26 10:50:55 -05:00
Jean-Marc Valin
4610d18305 Should avoid running log2Amp on uninitialized data 2011-01-26 10:00:28 -05:00
Jean-Marc Valin
de79c378bd Adding a special way to code digital silence in two or more bytes 2011-01-26 09:24:33 -05:00
Jean-Marc Valin
72e86fa26e Remove // comment 2011-01-25 21:43:23 -05:00
Jean-Marc Valin
9ce95e0bd0 anti-collapse tuning
Using the min energy of the two last non-transient frames rather
than the min of just the two last frames. Also slightly increasing
the "thresh" upper bound coefficient to 0.5.
2011-01-25 19:12:06 -05:00
Jean-Marc Valin
72a554775f Oops, fixed the sqrt(2) constant for anti_collapse() 2011-01-25 16:01:27 -05:00
Jean-Marc Valin
d121260f38 Minimum period is now 15 2011-01-25 13:11:36 -05:00
Jean-Marc Valin
01fa338985 Taking LM into account for anti-collapse 2011-01-24 17:21:12 -05:00
Timothy B. Terriberry
68b8d72e6a Fix off-by-one error in ec_laplace_encode.
di_max was counting the _number_ of code-points remaining, not the
 largest one that could be used.
2011-01-24 15:55:02 -05:00
Jean-Marc Valin
495114b755 Moving energy floor to coarse quantization
By moving the energy floor to the encoder, we can use a different
floor for prediction than for the decay level. Also, the fixed-point
dynamic range has been increased to avoid overflows when a fixed-point
decoder is used on a stream encoded in floating-point.
2011-01-24 15:53:17 -05:00
Jean-Marc Valin
6ec2ca56cf Clipping the encoder input to +/-2 to prevent scaling errors
If someone messed up scaling, they'll know because it'll sound bad
2011-01-23 18:22:14 -05:00
Jean-Marc Valin
3a56c9e1c6 prefilter/postfilter now forced off in Opus hybrid mode 2011-01-23 11:34:55 -05:00
Jean-Marc Valin
eafd8a7f17 Simple DTX/CNG implementation 2011-01-23 00:24:45 -05:00
Jean-Marc Valin
2293e4613e Considering "badness" in two-pass quant_coarse_energy().
The most important thing is to not screw up the energy. Then we
compare the bit-rates.
2011-01-22 22:29:25 -05:00
Jean-Marc Valin
ad3d813f01 Stop uselessly calling haar1() when resynth=0
This was computing on uninitialized data (though the result was never
used)
2011-01-22 21:22:03 -05:00
Gregory Maxwell
568326bfe2 Prevent out of bounds access to collapse_masks. 2011-01-22 20:37:14 -05:00
Gregory Maxwell
8f02c482ba Correct an encoder/decoder mismatch at low volume levels. Relax some low level clamps so that the dynamic range can extend further below the 16bit floor. 2011-01-22 19:50:36 -05:00
Jean-Marc Valin
5c2ac2b75d Tracking the background noise level
Also a fix for the zero-ing of unused band energies.
2011-01-22 14:48:20 -05:00
Jean-Marc Valin
620e716b76 Defining merge_stereo() when S==-M or S==M 2011-01-21 18:41:48 -05:00
Timothy B. Terriberry
6bdc53b86f Fix collapse_masks overflow for mono.
We were always storing collapse_masks[i*C+1], which could have
 overflowed the buffer on the last band in mono.
This also moves the stores outside the conditional, which allows
 common code to be used for masking the high bits, address
 generation, etc.
2011-01-21 06:53:03 -05:00
Jean-Marc Valin
5da938b2db Reorders some operations in anti-collapse to reuse values 2011-01-21 00:07:03 -05:00
Jean-Marc Valin
986e269537 Prevents taking the log of zero in fixed-point 2011-01-21 00:02:10 -05:00
Jean-Marc Valin
63fb61f176 Using previous range coder state for PRNG
This provides more entropy and allows some more flexibility on the
encoder side.
2011-01-20 23:29:05 -05:00