author | Paul Adenot <paul@paul.cx> |
Mon, 28 Sep 2020 18:16:45 +0000 (2020-09-28) | |
changeset 550725 | 324ea565091e3750883d25856591dd8b86a3c1fc |
parent 550724 | 25237c3afce6a7777c13c49c26511411d43665d9 |
child 550726 | f4c6aeca6e2fae2c0e928be6f43748c3bedc4df2 |
push id | 37820 |
push user | dluca@mozilla.com |
push date | Tue, 29 Sep 2020 15:38:31 +0000 (2020-09-29) |
treeherder | mozilla-central@324ea565091e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | chunmin |
bugs | 1624026 |
milestone | 83.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
new file mode 100644 --- /dev/null +++ b/media/libsoundtouch/disable-cross-corr-accumulate.patch @@ -0,0 +1,60 @@ +diff --git a/src/TDStretch.cpp b/src/TDStretch.cpp +--- a//src/TDStretch.cpp ++++ b//src/TDStretch.cpp +@@ -921,55 +921,17 @@ double TDStretch::calcCrossCorr(const sh + norm = (double)lnorm; + return (double)corr / sqrt((norm < 1e-9) ? 1.0 : norm); + } + + + /// Update cross-correlation by accumulating "norm" coefficient by previously calculated value + double TDStretch::calcCrossCorrAccumulate(const short *mixingPos, const short *compare, double &norm) + { +- long corr; +- unsigned long lnorm; +- int i; +- +- // cancel first normalizer tap from previous round +- lnorm = 0; +- for (i = 1; i <= channels; i ++) +- { +- lnorm -= (mixingPos[-i] * mixingPos[-i]) >> overlapDividerBitsNorm; +- } +- +- corr = 0; +- // Same routine for stereo and mono. For stereo, unroll loop for better +- // efficiency and gives slightly better resolution against rounding. +- // For mono it same routine, just unrolls loop by factor of 4 +- for (i = 0; i < channels * overlapLength; i += 4) +- { +- corr += (mixingPos[i] * compare[i] + +- mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBitsNorm; // notice: do intermediate division here to avoid integer overflow +- corr += (mixingPos[i + 2] * compare[i + 2] + +- mixingPos[i + 3] * compare[i + 3]) >> overlapDividerBitsNorm; +- } +- +- // update normalizer with last samples of this round +- for (int j = 0; j < channels; j ++) +- { +- i --; +- lnorm += (mixingPos[i] * mixingPos[i]) >> overlapDividerBitsNorm; +- } +- +- norm += (double)lnorm; +- if (norm > maxnorm) +- { +- maxnorm = (unsigned long)norm; +- } +- +- // Normalize result by dividing by sqrt(norm) - this step is easiest +- // done using floating point operation +- return (double)corr / sqrt((norm < 1e-9) ? 1.0 : norm); ++ return calcCrossCorr(mixingPos, compare, norm); + } + + #endif // SOUNDTOUCH_INTEGER_SAMPLES + + ////////////////////////////////////////////////////////////////////////////// + // + // Floating point arithmetic specific algorithm implementations. + //
--- a/media/libsoundtouch/src/TDStretch.cpp +++ b/media/libsoundtouch/src/TDStretch.cpp @@ -921,55 +921,17 @@ double TDStretch::calcCrossCorr(const sh norm = (double)lnorm; return (double)corr / sqrt((norm < 1e-9) ? 1.0 : norm); } /// Update cross-correlation by accumulating "norm" coefficient by previously calculated value double TDStretch::calcCrossCorrAccumulate(const short *mixingPos, const short *compare, double &norm) { - long corr; - unsigned long lnorm; - int i; - - // cancel first normalizer tap from previous round - lnorm = 0; - for (i = 1; i <= channels; i ++) - { - lnorm -= (mixingPos[-i] * mixingPos[-i]) >> overlapDividerBitsNorm; - } - - corr = 0; - // Same routine for stereo and mono. For stereo, unroll loop for better - // efficiency and gives slightly better resolution against rounding. - // For mono it same routine, just unrolls loop by factor of 4 - for (i = 0; i < channels * overlapLength; i += 4) - { - corr += (mixingPos[i] * compare[i] + - mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBitsNorm; // notice: do intermediate division here to avoid integer overflow - corr += (mixingPos[i + 2] * compare[i + 2] + - mixingPos[i + 3] * compare[i + 3]) >> overlapDividerBitsNorm; - } - - // update normalizer with last samples of this round - for (int j = 0; j < channels; j ++) - { - i --; - lnorm += (mixingPos[i] * mixingPos[i]) >> overlapDividerBitsNorm; - } - - norm += (double)lnorm; - if (norm > maxnorm) - { - maxnorm = (unsigned long)norm; - } - - // Normalize result by dividing by sqrt(norm) - this step is easiest - // done using floating point operation - return (double)corr / sqrt((norm < 1e-9) ? 1.0 : norm); + return calcCrossCorr(mixingPos, compare, norm); } #endif // SOUNDTOUCH_INTEGER_SAMPLES ////////////////////////////////////////////////////////////////////////////// // // Floating point arithmetic specific algorithm implementations. //
--- a/media/libsoundtouch/update.sh +++ b/media/libsoundtouch/update.sh @@ -38,9 +38,11 @@ cp $1/include/STTypes.h src for i in src/* do cat $i | tr -d '\015' > $i.lf mv $i.lf $i done # Patch the imported files. patch -p1 < moz-libsoundtouch.patch +# Disable a path on s16 + !x86 (bug 1624026) to sidestep a bug +patch -p1 < disable-cross-corr-accumulate.patch