Bug 1376395 - opus: Update to the 1.2.1 release. r=rillian

New upstream release. Fixes an issue where the encoder would
incorrectly bandlimit signals to 12 kHz.

MozReview-Commit-ID: 91LsUhXDlxT

--HG--
extra : rebase_source : a7c476f073536521e614479e9e809a95b8873b07
This commit is contained in:
Ralph Giles 2017-06-27 07:28:00 +02:00
parent 991d1134d8
commit 6860e65987
4 changed files with 11 additions and 4 deletions

View File

@ -8,4 +8,4 @@ files after the copy step.
The upstream repository is https://git.xiph.org/opus.git
The git tag/revision used was v1.2.
The git tag/revision used was v1.2.1.

View File

@ -20,7 +20,7 @@ ALLOW_COMPILER_WARNINGS = True
FINAL_LIBRARY = 'gkmedias'
DEFINES['OPUS_BUILD'] = True
DEFINES['OPUS_VERSION'] = '"v1.2-mozilla"'
DEFINES['OPUS_VERSION'] = '"v1.2.1-mozilla"'
DEFINES['USE_ALLOCA'] = True
# Don't export symbols

View File

@ -663,8 +663,10 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
}
/* Special case for the last two bands, for which we don't have spectrum but only
the energy above 12 kHz. */
{
if (tonal->Fs == 48000) {
float ratio;
float E = hp_ener*(1.f/(240*240));
ratio = tonal->prev_bandwidth==20 ? 0.03f : 0.07f;
#ifdef FIXED_POINT
/* silk_resampler_down2_hp() shifted right by an extra 8 bits. */
E *= 256.f*(1.f/Q15ONE)*(1.f/Q15ONE);
@ -674,7 +676,10 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
E = MAX32(E, tonal->meanE[b]);
/* Use a simple follower with 13 dB/Bark slope for spreading function */
bandwidth_mask = MAX32(.05f*bandwidth_mask, E);
if (E>.1*bandwidth_mask && E*1e9f > maxE && E > noise_floor*160)
if (E>ratio*bandwidth_mask && E*1e9f > maxE && E > noise_floor*160)
bandwidth = 20;
/* This detector is unreliable, so if the bandwidth is close to SWB, assume it's FB. */
if (bandwidth >= 17)
bandwidth = 20;
}
if (tonal->count<=2)
@ -896,6 +901,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
#endif
info->bandwidth = bandwidth;
tonal->prev_bandwidth = bandwidth;
/*printf("%d %d\n", info->bandwidth, info->opus_bandwidth);*/
info->noisiness = frame_noisiness;
info->valid = 1;

View File

@ -55,6 +55,7 @@ typedef struct {
int mem_fill; /* number of usable samples in the buffer */
float prev_band_tonality[NB_TBANDS];
float prev_tonality;
int prev_bandwidth;
float E[NB_FRAMES][NB_TBANDS];
float logE[NB_FRAMES][NB_TBANDS];
float lowE[NB_TBANDS];