Fixes a few minor issues (no bit-stream change)

- Safer gain clamping for PLC
- Makes opus_decoder_get_nb_samples() report an error on invalid ToC
- Giving a free license to the text ofthe draft (not just the code)
This commit is contained in:
Jean-Marc Valin 2012-01-24 14:45:08 +13:00
parent a51ebd6831
commit ee8adbe701
4 changed files with 20 additions and 2 deletions

View file

@ -7175,6 +7175,14 @@ for their bug reports and feedback.
</t>
</section>
<section title="Copying Conditions">
<t>The authors agree to grant third parties the irrevocable right to copy, use and distribute
the work (excluding Code Components available under the simplified BSD license), with or
without modification, in any medium, without royalty, provided that, unless separate
permission is granted, redistributed modified works do not contain misleading author, version,
name of work, or endorsement information.</t>
</section>
</middle>
<back>

View file

@ -315,7 +315,12 @@ opus_int silk_Decode( /* O Returns error co
decControl->prevPitchLag = 0;
}
if( lostFlag != FLAG_PACKET_LOST ) {
if( lostFlag == FLAG_PACKET_LOST ) {
/* On packet loss, remove the gain clamping to prevent having the energy "bounce back"
if we lose packets when the energy is going down */
for ( i = 0; i < psDec->nChannelsInternal; i++ )
psDec->channel_state[ i ].LastGainIndex = 10;
} else {
psDec->prev_decode_only_middle = decode_only_middle;
}
return ret;

View file

@ -72,7 +72,8 @@ void silk_decode_core(
psDec->exc_Q14[ i ] += QUANT_LEVEL_ADJUST_Q10 << 4;
}
psDec->exc_Q14[ i ] += offset_Q10 << 4;
psDec->exc_Q14[ i ] ^= silk_RSHIFT( rand_seed, 31 );
if ( rand_seed < 0 )
psDec->exc_Q14[ i ] = -psDec->exc_Q14[ i ];
rand_seed = silk_ADD32_ovflw( rand_seed, pulses[ i ] );
}

View file

@ -923,6 +923,10 @@ int opus_decoder_get_nb_samples(const OpusDecoder *dec,
{
int samples;
int count = opus_packet_get_nb_frames(packet, len);
if (count<0)
return count;
samples = count*opus_packet_get_samples_per_frame(packet, dec->Fs);
/* Can't have more than 120 ms */
if (samples*25 > dec->Fs*3)