Rename Kalman filter to match RFC3393
This CL updates the file and class naming, based on the naming discussion in https://webrtc-review.googlesource.com/c/src/+/265877. Concretely, that means replacing "delta" with "variation" in the name. Bug: webrtc:14151 Change-Id: I43e74b1d25f9441015445101f3eb6a7b52f3adba Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273960 Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37999}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
4bed30c37f
commit
665875b0d8
@ -30,10 +30,10 @@ rtc_library("inter_frame_delay") {
|
|||||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_library("frame_delay_delta_kalman_filter") {
|
rtc_library("frame_delay_variation_kalman_filter") {
|
||||||
sources = [
|
sources = [
|
||||||
"frame_delay_delta_kalman_filter.cc",
|
"frame_delay_variation_kalman_filter.cc",
|
||||||
"frame_delay_delta_kalman_filter.h",
|
"frame_delay_variation_kalman_filter.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../../../api/units:data_size",
|
"../../../api/units:data_size",
|
||||||
@ -51,7 +51,7 @@ rtc_library("jitter_estimator") {
|
|||||||
"jitter_estimator.h",
|
"jitter_estimator.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":frame_delay_delta_kalman_filter",
|
":frame_delay_variation_kalman_filter",
|
||||||
":rtt_filter",
|
":rtt_filter",
|
||||||
"../../../api:field_trials_view",
|
"../../../api:field_trials_view",
|
||||||
"../../../api/units:data_size",
|
"../../../api/units:data_size",
|
||||||
@ -102,14 +102,14 @@ rtc_library("timing_module") {
|
|||||||
rtc_library("timing_unittests") {
|
rtc_library("timing_unittests") {
|
||||||
testonly = true
|
testonly = true
|
||||||
sources = [
|
sources = [
|
||||||
"frame_delay_delta_kalman_filter_unittest.cc",
|
"frame_delay_variation_kalman_filter_unittest.cc",
|
||||||
"inter_frame_delay_unittest.cc",
|
"inter_frame_delay_unittest.cc",
|
||||||
"jitter_estimator_unittest.cc",
|
"jitter_estimator_unittest.cc",
|
||||||
"rtt_filter_unittest.cc",
|
"rtt_filter_unittest.cc",
|
||||||
"timing_unittest.cc",
|
"timing_unittest.cc",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":frame_delay_delta_kalman_filter",
|
":frame_delay_variation_kalman_filter",
|
||||||
":inter_frame_delay",
|
":inter_frame_delay",
|
||||||
":jitter_estimator",
|
":jitter_estimator",
|
||||||
":rtt_filter",
|
":rtt_filter",
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/timing/frame_delay_delta_kalman_filter.h"
|
#include "modules/video_coding/timing/frame_delay_variation_kalman_filter.h"
|
||||||
|
|
||||||
#include "api/units/data_size.h"
|
#include "api/units/data_size.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
@ -18,9 +18,9 @@ namespace webrtc {
|
|||||||
namespace {
|
namespace {
|
||||||
// TODO(brandtr): The value below corresponds to 8 Gbps. Is that reasonable?
|
// TODO(brandtr): The value below corresponds to 8 Gbps. Is that reasonable?
|
||||||
constexpr double kMaxBandwidth = 0.000001; // Unit: [1 / bytes per ms].
|
constexpr double kMaxBandwidth = 0.000001; // Unit: [1 / bytes per ms].
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
FrameDelayDeltaKalmanFilter::FrameDelayDeltaKalmanFilter() {
|
FrameDelayVariationKalmanFilter::FrameDelayVariationKalmanFilter() {
|
||||||
// TODO(brandtr): Is there a factor 1000 missing here?
|
// TODO(brandtr): Is there a factor 1000 missing here?
|
||||||
estimate_[0] = 1 / (512e3 / 8); // Unit: [1 / bytes per ms]
|
estimate_[0] = 1 / (512e3 / 8); // Unit: [1 / bytes per ms]
|
||||||
estimate_[1] = 0; // Unit: [ms]
|
estimate_[1] = 0; // Unit: [ms]
|
||||||
@ -35,7 +35,7 @@ FrameDelayDeltaKalmanFilter::FrameDelayDeltaKalmanFilter() {
|
|||||||
process_noise_cov_diag_[1] = 1e-10; // Unit: [ms^2]
|
process_noise_cov_diag_[1] = 1e-10; // Unit: [ms^2]
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameDelayDeltaKalmanFilter::PredictAndUpdate(
|
void FrameDelayVariationKalmanFilter::PredictAndUpdate(
|
||||||
double frame_delay_variation_ms,
|
double frame_delay_variation_ms,
|
||||||
double frame_size_variation_bytes,
|
double frame_size_variation_bytes,
|
||||||
double max_frame_size_bytes,
|
double max_frame_size_bytes,
|
||||||
@ -131,13 +131,13 @@ void FrameDelayDeltaKalmanFilter::PredictAndUpdate(
|
|||||||
estimate_cov_[0][0] >= 0);
|
estimate_cov_[0][0] >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
double FrameDelayDeltaKalmanFilter::GetFrameDelayVariationEstimateSizeBased(
|
double FrameDelayVariationKalmanFilter::GetFrameDelayVariationEstimateSizeBased(
|
||||||
double frame_size_variation_bytes) const {
|
double frame_size_variation_bytes) const {
|
||||||
// Unit: [1 / bytes per millisecond] * [bytes] = [milliseconds].
|
// Unit: [1 / bytes per millisecond] * [bytes] = [milliseconds].
|
||||||
return estimate_[0] * frame_size_variation_bytes;
|
return estimate_[0] * frame_size_variation_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FrameDelayDeltaKalmanFilter::GetFrameDelayVariationEstimateTotal(
|
double FrameDelayVariationKalmanFilter::GetFrameDelayVariationEstimateTotal(
|
||||||
double frame_size_variation_bytes) const {
|
double frame_size_variation_bytes) const {
|
||||||
double frame_transmission_delay_ms =
|
double frame_transmission_delay_ms =
|
||||||
GetFrameDelayVariationEstimateSizeBased(frame_size_variation_bytes);
|
GetFrameDelayVariationEstimateSizeBased(frame_size_variation_bytes);
|
||||||
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_DELTA_KALMAN_FILTER_H_
|
#ifndef MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_VARIATION_KALMAN_FILTER_H_
|
||||||
#define MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_DELTA_KALMAN_FILTER_H_
|
#define MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_VARIATION_KALMAN_FILTER_H_
|
||||||
|
|
||||||
#include "api/units/data_size.h"
|
#include "api/units/data_size.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
@ -51,10 +51,10 @@ namespace webrtc {
|
|||||||
// [(1 / bytes per ms)^2, ms^2].
|
// [(1 / bytes per ms)^2, ms^2].
|
||||||
// * The observation noise covariance (`r`) is a scalar [ms^2] that is
|
// * The observation noise covariance (`r`) is a scalar [ms^2] that is
|
||||||
// determined externally to this class.
|
// determined externally to this class.
|
||||||
class FrameDelayDeltaKalmanFilter {
|
class FrameDelayVariationKalmanFilter {
|
||||||
public:
|
public:
|
||||||
FrameDelayDeltaKalmanFilter();
|
FrameDelayVariationKalmanFilter();
|
||||||
~FrameDelayDeltaKalmanFilter() = default;
|
~FrameDelayVariationKalmanFilter() = default;
|
||||||
|
|
||||||
// Predicts and updates the filter, given a new pair of frame delay variation
|
// Predicts and updates the filter, given a new pair of frame delay variation
|
||||||
// and frame size variation.
|
// and frame size variation.
|
||||||
@ -103,4 +103,4 @@ class FrameDelayDeltaKalmanFilter {
|
|||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_DELTA_KALMAN_FILTER_H_
|
#endif // MODULES_VIDEO_CODING_TIMING_FRAME_DELAY_VARIATION_KALMAN_FILTER_H_
|
||||||
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/timing/frame_delay_delta_kalman_filter.h"
|
#include "modules/video_coding/timing/frame_delay_variation_kalman_filter.h"
|
||||||
|
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ namespace {
|
|||||||
// This test verifies that the initial filter state (link bandwidth, link
|
// This test verifies that the initial filter state (link bandwidth, link
|
||||||
// propagation delay) is such that a frame of size zero would take no time to
|
// propagation delay) is such that a frame of size zero would take no time to
|
||||||
// propagate.
|
// propagate.
|
||||||
TEST(FrameDelayDeltaKalmanFilterTest,
|
TEST(FrameDelayVariationKalmanFilterTest,
|
||||||
InitializedFilterWithZeroSizeFrameTakesNoTimeToPropagate) {
|
InitializedFilterWithZeroSizeFrameTakesNoTimeToPropagate) {
|
||||||
FrameDelayDeltaKalmanFilter filter;
|
FrameDelayVariationKalmanFilter filter;
|
||||||
|
|
||||||
// A zero-sized frame...
|
// A zero-sized frame...
|
||||||
double frame_size_variation_bytes = 0.0;
|
double frame_size_variation_bytes = 0.0;
|
||||||
@ -38,9 +38,9 @@ TEST(FrameDelayDeltaKalmanFilterTest,
|
|||||||
|
|
||||||
// TODO(brandtr): Look into if there is a factor 1000 missing here? It seems
|
// TODO(brandtr): Look into if there is a factor 1000 missing here? It seems
|
||||||
// unreasonable to have an initial link bandwidth of 512 _mega_bits per second?
|
// unreasonable to have an initial link bandwidth of 512 _mega_bits per second?
|
||||||
TEST(FrameDelayDeltaKalmanFilterTest,
|
TEST(FrameDelayVariationKalmanFilterTest,
|
||||||
InitializedFilterWithSmallSizeFrameTakesFixedTimeToPropagate) {
|
InitializedFilterWithSmallSizeFrameTakesFixedTimeToPropagate) {
|
||||||
FrameDelayDeltaKalmanFilter filter;
|
FrameDelayVariationKalmanFilter filter;
|
||||||
|
|
||||||
// A 1000-byte frame...
|
// A 1000-byte frame...
|
||||||
double frame_size_variation_bytes = 1000.0;
|
double frame_size_variation_bytes = 1000.0;
|
||||||
@ -55,9 +55,9 @@ TEST(FrameDelayDeltaKalmanFilterTest,
|
|||||||
expected_frame_delay_variation_estimate_ms);
|
expected_frame_delay_variation_estimate_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FrameDelayDeltaKalmanFilterTest,
|
TEST(FrameDelayVariationKalmanFilterTest,
|
||||||
NegativeNoiseVarianceDoesNotUpdateFilter) {
|
NegativeNoiseVarianceDoesNotUpdateFilter) {
|
||||||
FrameDelayDeltaKalmanFilter filter;
|
FrameDelayVariationKalmanFilter filter;
|
||||||
|
|
||||||
// Negative variance...
|
// Negative variance...
|
||||||
double var_noise = -0.1;
|
double var_noise = -0.1;
|
||||||
@ -82,9 +82,9 @@ TEST(FrameDelayDeltaKalmanFilterTest,
|
|||||||
0.0);
|
0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FrameDelayDeltaKalmanFilterTest,
|
TEST(FrameDelayVariationKalmanFilterTest,
|
||||||
VerifyConvergenceWithAlternatingDeviations) {
|
VerifyConvergenceWithAlternatingDeviations) {
|
||||||
FrameDelayDeltaKalmanFilter filter;
|
FrameDelayVariationKalmanFilter filter;
|
||||||
|
|
||||||
// One frame every 33 ms.
|
// One frame every 33 ms.
|
||||||
int framerate_fps = 30;
|
int framerate_fps = 30;
|
||||||
@ -79,7 +79,7 @@ void JitterEstimator::Reset() {
|
|||||||
rtt_filter_.Reset();
|
rtt_filter_.Reset();
|
||||||
fps_counter_.Reset();
|
fps_counter_.Reset();
|
||||||
|
|
||||||
kalman_filter_ = FrameDelayDeltaKalmanFilter();
|
kalman_filter_ = FrameDelayVariationKalmanFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the estimates with the new measurements.
|
// Updates the estimates with the new measurements.
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
#include "api/units/frequency.h"
|
#include "api/units/frequency.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "modules/video_coding/timing/frame_delay_delta_kalman_filter.h"
|
#include "modules/video_coding/timing/frame_delay_variation_kalman_filter.h"
|
||||||
#include "modules/video_coding/timing/rtt_filter.h"
|
#include "modules/video_coding/timing/rtt_filter.h"
|
||||||
#include "rtc_base/rolling_accumulator.h"
|
#include "rtc_base/rolling_accumulator.h"
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class JitterEstimator {
|
|||||||
|
|
||||||
// Filters the {frame_delay_delta, frame_size_delta} measurements through
|
// Filters the {frame_delay_delta, frame_size_delta} measurements through
|
||||||
// a linear Kalman filter.
|
// a linear Kalman filter.
|
||||||
FrameDelayDeltaKalmanFilter kalman_filter_;
|
FrameDelayVariationKalmanFilter kalman_filter_;
|
||||||
|
|
||||||
// TODO(bugs.webrtc.org/14381): Update `avg_frame_size_bytes_` to DataSize
|
// TODO(bugs.webrtc.org/14381): Update `avg_frame_size_bytes_` to DataSize
|
||||||
// when api/units have sufficient precision.
|
// when api/units have sufficient precision.
|
||||||
|
|||||||
Reference in New Issue
Block a user