mirror of
https://github.com/xiph/opus.git
synced 2025-06-06 15:30:48 +00:00
Makes bandwidth detection less aggressive.
The original code was causing parts of a sine sweep to be completely dropped due to the 300 Hz margin and the hysteresis. Also, fixes scaling for the analysis downmix when the input is 16-bit PCM.
This commit is contained in:
parent
f982b84d1e
commit
c5e04e4aa4
2 changed files with 7 additions and 5 deletions
|
@ -376,8 +376,8 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con
|
||||||
float E=0;
|
float E=0;
|
||||||
int band_start, band_end;
|
int band_start, band_end;
|
||||||
/* Keep a margin of 300 Hz for aliasing */
|
/* Keep a margin of 300 Hz for aliasing */
|
||||||
band_start = extra_bands[b]+3;
|
band_start = extra_bands[b];
|
||||||
band_end = extra_bands[b+1]+3;
|
band_end = extra_bands[b+1];
|
||||||
for (i=band_start;i<band_end;i++)
|
for (i=band_start;i<band_end;i++)
|
||||||
{
|
{
|
||||||
float binE = out[i].r*out[i].r + out[N-i].r*out[N-i].r
|
float binE = out[i].r*out[i].r + out[N-i].r*out[N-i].r
|
||||||
|
@ -569,11 +569,11 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con
|
||||||
printf("%f ", features[i]);
|
printf("%f ", features[i]);
|
||||||
printf("\n");*/
|
printf("\n");*/
|
||||||
|
|
||||||
if (bandwidth<=12 || (bandwidth==13 && tonal->opus_bandwidth == OPUS_BANDWIDTH_NARROWBAND))
|
if (bandwidth<=12)
|
||||||
tonal->opus_bandwidth = OPUS_BANDWIDTH_NARROWBAND;
|
tonal->opus_bandwidth = OPUS_BANDWIDTH_NARROWBAND;
|
||||||
else if (bandwidth<=14 || (bandwidth==15 && tonal->opus_bandwidth == OPUS_BANDWIDTH_MEDIUMBAND))
|
else if (bandwidth<=14)
|
||||||
tonal->opus_bandwidth = OPUS_BANDWIDTH_MEDIUMBAND;
|
tonal->opus_bandwidth = OPUS_BANDWIDTH_MEDIUMBAND;
|
||||||
else if (bandwidth<=16 || (bandwidth==17 && tonal->opus_bandwidth == OPUS_BANDWIDTH_WIDEBAND))
|
else if (bandwidth<=16)
|
||||||
tonal->opus_bandwidth = OPUS_BANDWIDTH_WIDEBAND;
|
tonal->opus_bandwidth = OPUS_BANDWIDTH_WIDEBAND;
|
||||||
else if (bandwidth<=18)
|
else if (bandwidth<=18)
|
||||||
tonal->opus_bandwidth = OPUS_BANDWIDTH_SUPERWIDEBAND;
|
tonal->opus_bandwidth = OPUS_BANDWIDTH_SUPERWIDEBAND;
|
||||||
|
|
|
@ -695,6 +695,8 @@ void downmix_int(const void *_x, float *sub, int subframe, int offset, int C)
|
||||||
for (c=1;c<C;c++)
|
for (c=1;c<C;c++)
|
||||||
for (j=0;j<subframe;j++)
|
for (j=0;j<subframe;j++)
|
||||||
sub[j] += x[(j+offset)*C+c];
|
sub[j] += x[(j+offset)*C+c];
|
||||||
|
for (j=0;j<subframe;j++)
|
||||||
|
sub[j] *= (1.f/32768);
|
||||||
}
|
}
|
||||||
|
|
||||||
int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
|
int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue