diff options
author | Timothy B. Terriberry <tterribe@xiph.org> | 2011-10-14 13:38:24 -0700 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-10-17 16:03:41 -0400 |
commit | 53cc1a033a3183c9d137b03446db58d2e58c0e0a (patch) | |
tree | 24476c962dbb081126c89d6f26dd9d02f7bf88e7 /silk/float/process_gains_FLP.c | |
parent | 7ef6c7c1b465df4ef3b4ece2ecbf9d35c625beb4 (diff) | |
download | opus-53cc1a033a3183c9d137b03446db58d2e58c0e0a.tar.gz |
Fix the side frame conditional coding rules.
b24e5746 introduced changes to LastGainIndex which broke
conditional coding for side frames after a mid-only frame (i.e.,
in a 60 ms frame where the side is coded, not coded, then coded
again).
These rules were a mess in general, however, because the side
channel state kept a different nFramesDecoded count from the mid
channel state, and had no way to tell if the prior side frame was
coded.
This patch attempts to rationalize them by moving the conditional
coding decision up to the top level, where all this information is
available.
The first coded side frame after an uncoded side frame now always
uses independent coding.
If such a frame is also not the first side frame in an Opus frame,
then it doesn't include an LTP scaling parameter (because the LTP
state is well-defined).
Diffstat (limited to 'silk/float/process_gains_FLP.c')
-rw-r--r-- | silk/float/process_gains_FLP.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/silk/float/process_gains_FLP.c b/silk/float/process_gains_FLP.c index e0c18a97..2c7dfdd0 100644 --- a/silk/float/process_gains_FLP.c +++ b/silk/float/process_gains_FLP.c @@ -35,7 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Processing of gains */ void silk_process_gains_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ - silk_encoder_control_FLP *psEncCtrl /* I/O Encoder control FLP */ + silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ + opus_int condCoding /* I The type of conditional coding to use */ ) { silk_shape_state_FLP *psShapeSt = &psEnc->sShape; @@ -68,7 +69,7 @@ void silk_process_gains_FLP( /* Noise shaping quantization */ silk_gains_quant( psEnc->sCmn.indices.GainsIndices, pGains_Q16, - &psShapeSt->LastGainIndex, psEnc->sCmn.nFramesEncoded, psEnc->sCmn.nb_subfr ); + &psShapeSt->LastGainIndex, condCoding == CODE_CONDITIONALLY, psEnc->sCmn.nb_subfr ); /* Overwrite unquantized gains with quantized gains and convert back to Q0 from Q16 */ for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { |