Fix misspelled function
Bug: webrtc:358039777
Change-Id: I640256a33c6a2f998042555607e053aa0b09e626
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363803
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43091}
diff --git a/video/corruption_detection/corruption_classifier.cc b/video/corruption_detection/corruption_classifier.cc
index d72626a..d9ead1f 100644
--- a/video/corruption_detection/corruption_classifier.cc
+++ b/video/corruption_detection/corruption_classifier.cc
@@ -38,7 +38,7 @@
<< "Calculating corruption probability using logistic function.";
}
-double CorruptionClassifier::CalculateCorruptionProbablility(
+double CorruptionClassifier::CalculateCorruptionProbability(
rtc::ArrayView<const FilteredSample> filtered_original_samples,
rtc::ArrayView<const FilteredSample> filtered_compressed_samples,
int luma_threshold,
@@ -59,6 +59,18 @@
return 1 / (1 + std::exp(-config->growth_rate * (loss - config->midpoint)));
}
+// TODO: bugs.webrtc.org/358039777 - Remove this function when Google
+// downstream projects start using the correctly spelled function.
+double CorruptionClassifier::CalculateCorruptionProbablility(
+ rtc::ArrayView<const FilteredSample> filtered_original_samples,
+ rtc::ArrayView<const FilteredSample> filtered_compressed_samples,
+ int luma_threshold,
+ int chroma_threshold) const {
+ return CalculateCorruptionProbability(filtered_original_samples,
+ filtered_compressed_samples,
+ luma_threshold, chroma_threshold);
+}
+
// The score is calculated according to the following formula :
//
// score = (sum_i max{(|original_i - compressed_i| - threshold, 0)^2}) / N
diff --git a/video/corruption_detection/corruption_classifier.h b/video/corruption_detection/corruption_classifier.h
index 8e0c061..538007b 100644
--- a/video/corruption_detection/corruption_classifier.h
+++ b/video/corruption_detection/corruption_classifier.h
@@ -18,7 +18,7 @@
namespace webrtc {
-// Based on the given filtered samples to `CalculateCorruptionProbablility` this
+// Based on the given filtered samples to `CalculateCorruptionProbability` this
// class calculates a probability to indicate whether the frame is corrupted.
// The classification is done either by scaling the loss to the interval of [0,
// 1] using a simple `scale_factor` or by applying a logistic function to the
@@ -41,6 +41,14 @@
// scaling the loss to the interval of [0, 1] using a simple `scale_factor`
// or by applying a logistic function to the loss. The method is chosen
// depending on the used constructor.
+ double CalculateCorruptionProbability(
+ rtc::ArrayView<const FilteredSample> filtered_original_samples,
+ rtc::ArrayView<const FilteredSample> filtered_compressed_samples,
+ int luma_threshold,
+ int chroma_threshold) const;
+
+ // TODO: bugs.webrtc.org/358039777 - Remove this function when Google
+ // downstream projects start using the correctly spelled function.
double CalculateCorruptionProbablility(
rtc::ArrayView<const FilteredSample> filtered_original_samples,
rtc::ArrayView<const FilteredSample> filtered_compressed_samples,
diff --git a/video/corruption_detection/corruption_classifier_unittest.cc b/video/corruption_detection/corruption_classifier_unittest.cc
index 8a68d56..5f82524 100644
--- a/video/corruption_detection/corruption_classifier_unittest.cc
+++ b/video/corruption_detection/corruption_classifier_unittest.cc
@@ -63,7 +63,7 @@
#if GTEST_HAS_DEATH_TEST
TEST(CorruptionClassifierTest, EmptySamplesShouldResultInDeath) {
CorruptionClassifier corruption_classifier(kScaleFactor);
- EXPECT_DEATH(corruption_classifier.CalculateCorruptionProbablility(
+ EXPECT_DEATH(corruption_classifier.CalculateCorruptionProbability(
{}, {}, kLumaThreshold, kChromaThreshold),
_);
}
@@ -73,7 +73,7 @@
const std::vector<FilteredSample> filtered_compressed_samples = {
{.value = 1.0, .plane = ImagePlane::kLuma}};
- EXPECT_DEATH(corruption_classifier.CalculateCorruptionProbablility(
+ EXPECT_DEATH(corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, filtered_compressed_samples,
kLumaThreshold, kChromaThreshold),
HasSubstr("The original and compressed frame have different "
@@ -95,7 +95,7 @@
// Logistic function giving the expected result inside DoubleNear. This
// applies for all the following tests.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0, kMaxAbsoluteError));
@@ -111,7 +111,7 @@
// Expected: score = 0. See above for explanation why we have `0.0009` below.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0009, kMaxAbsoluteError));
@@ -128,7 +128,7 @@
// Expected: score = 0.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0, kMaxAbsoluteError));
@@ -145,7 +145,7 @@
// Expected: score = 0.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0009, kMaxAbsoluteError));
@@ -162,7 +162,7 @@
// Expected: score = (0.5)^2 / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0060, kMaxAbsoluteError));
@@ -179,7 +179,7 @@
// Expected: score = (0.5)^2 / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.001, kMaxAbsoluteError));
@@ -196,7 +196,7 @@
// Expected: score = ((0.5)^2 + 2*(1.2)^2) / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.07452, kMaxAbsoluteError));
@@ -213,7 +213,7 @@
// Expected: score = ((0.5)^2 + 2*(1.2)^2) / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.0026, kMaxAbsoluteError));
@@ -233,7 +233,7 @@
// Expected: score = ((3)^2 + 2*(2)^2) / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.4048, kMaxAbsoluteError));
@@ -250,7 +250,7 @@
// Expected: score = ((3)^2 + 2*(2)^2) / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(0.2086, kMaxAbsoluteError));
@@ -267,7 +267,7 @@
// Expected: score = ((5)^2 + 2*(4)^2) / 3. Expected 1 because of capping.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(1, kMaxAbsoluteError));
@@ -284,7 +284,7 @@
// Expected: score = ((5)^2 + 2*(4)^2) / 3.
EXPECT_THAT(
- corruption_classifier.CalculateCorruptionProbablility(
+ corruption_classifier.CalculateCorruptionProbability(
kFilteredOriginalSampleValues, kFilteredCompressedSampleValues,
kLumaThreshold, kChromaThreshold),
DoubleNear(1, kMaxAbsoluteError));