From a3f7c6a908c4724b9d230628b04d28b2c92ee7e8 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 23 Jan 2025 10:04:58 -0800 Subject: [PATCH 1/8] Add PSNR (Y/U/V) for outbound-rtp This is similar to qpSum but codec-independent. Since PSNR requires additional computation it is defined with an accompanying psnrMeasurements counter to allow the computation of an average PSNR. Defined as three components for the Y, U and V planes respeectively. See also https://datatracker.ietf.org/doc/html/rfc8761#section-5 --- webrtc-stats.html | 35 +++++++++++++++++++++++++++++++++++ webrtc-stats.js | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/webrtc-stats.html b/webrtc-stats.html index 889f7e5..12a5f30 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -1966,6 +1966,10 @@

unsigned long framesEncoded; unsigned long keyFramesEncoded; unsigned long long qpSum; + double psnrSumY; + double psnrSumU; + double psnrSumV; + unsigned long long psnrMeasurements; double totalEncodeTime; double totalPacketSendDelay; RTCQualityLimitationReason qualityLimitationReason; @@ -2218,6 +2222,37 @@

formats have ways to vary the quantizer value within the frame.

+
+ psnrSumY, psnrSumU, psnrSumV of type + double +
+
+

+ MUST NOT [= map/exist =] for audio. + The cumulative sum of the PSNR values of frames encoded by this sender, for Y/U/V components. + The count of measurements is in {{psnrMeasurements}}. +

+

+ PSNR is defined in [[!iso-29170-1:2017]]. +

+
+
+ psnrMeasurements of type unsigned long long + +
+
+

+ MUST NOT [= map/exist =] for audio. + The number of times PSNR was measured. {{psnrSumY}}, {{psnrSumU}} and {{psnrSumV}} are + aggregated with this measurement. +

+

+ The PSNR is defined in [[!iso-29170-1:2017]]. +

+

+ The frequency of PSNR measurements is outside the scope of this specification. +

+
totalEncodeTime of type double diff --git a/webrtc-stats.js b/webrtc-stats.js index 1197742..b54b8df 100644 --- a/webrtc-stats.js +++ b/webrtc-stats.js @@ -99,6 +99,11 @@ var respecConfig = { status: "Internet Draft", publisher: "IETF" }, + "iso-29170-1:2017": { + title: "Information technology — Advanced image coding and evaluation", + href: "https://www.iso.org/standard/63637.html", + publisher: "ISO", + }, }, postProcess: [ function generateStatsHierarchy(config, doc) { From cece6f4692402f28cf88c889885bed90469c470c Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Mon, 27 Jan 2025 15:51:42 -0800 Subject: [PATCH 2/8] record of doubles --- webrtc-stats.html | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index 12a5f30..f5fde0c 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -1966,9 +1966,7 @@

unsigned long framesEncoded; unsigned long keyFramesEncoded; unsigned long long qpSum; - double psnrSumY; - double psnrSumU; - double psnrSumV; + record<DOMString, double> psnrSum; unsigned long long psnrMeasurements; double totalEncodeTime; double totalPacketSendDelay; @@ -2223,13 +2221,14 @@

- psnrSumY, psnrSumU, psnrSumV of type - double + psnrSum of type + record<DOMString, double>

MUST NOT [= map/exist =] for audio. - The cumulative sum of the PSNR values of frames encoded by this sender, for Y/U/V components. + The cumulative sum of the PSNR values of frames encoded by this sender. + The record includes values for the "y", "u" and "v" components. The count of measurements is in {{psnrMeasurements}}.

@@ -2243,7 +2242,7 @@

MUST NOT [= map/exist =] for audio. - The number of times PSNR was measured. {{psnrSumY}}, {{psnrSumU}} and {{psnrSumV}} are + The number of times PSNR was measured. The components of {{psnrSum}} are aggregated with this measurement.

From 33b41597368f0183ffde228469eff38c90fbf8a8 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Wed, 29 Jan 2025 12:06:21 -0800 Subject: [PATCH 3/8] make reference informative --- webrtc-stats.html | 4 ++-- webrtc-stats.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index f5fde0c..838d000 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2232,7 +2232,7 @@

The count of measurements is in {{psnrMeasurements}}.

- PSNR is defined in [[!iso-29170-1:2017]]. + PSNR is defined in [[ISO-29170-1:2017]].

@@ -2246,7 +2246,7 @@

aggregated with this measurement.

- The PSNR is defined in [[!iso-29170-1:2017]]. + The PSNR is defined in [[ISO-29170-1:2017]].

The frequency of PSNR measurements is outside the scope of this specification. diff --git a/webrtc-stats.js b/webrtc-stats.js index b54b8df..1c87249 100644 --- a/webrtc-stats.js +++ b/webrtc-stats.js @@ -99,7 +99,7 @@ var respecConfig = { status: "Internet Draft", publisher: "IETF" }, - "iso-29170-1:2017": { + "ISO-29170-1:2017": { title: "Information technology — Advanced image coding and evaluation", href: "https://www.iso.org/standard/63637.html", publisher: "ISO", From 85afc3657fac40b4f3b82129ece83a8a78a0a792 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Mon, 3 Mar 2025 10:31:17 -0800 Subject: [PATCH 4/8] statistical analysis, implementation-defined --- webrtc-stats.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index 838d000..2ade45b 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2249,7 +2249,9 @@

The PSNR is defined in [[ISO-29170-1:2017]].

- The frequency of PSNR measurements is outside the scope of this specification. + PSNR metrics should primarily be used as a basis for statistical analysis rather + than be used as an absolute truth on a per-frame basis. + The frequency of PSNR measurements is [=implementation-defined=].

From 7140c3f2a4c1aebb15992c0d166983377b3b0a30 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Tue, 8 Apr 2025 10:31:17 -0700 Subject: [PATCH 5/8] move frequency out of the note --- webrtc-stats.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index 2ade45b..0fe748a 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2247,11 +2247,11 @@

The PSNR is defined in [[ISO-29170-1:2017]]. + The frequency of PSNR measurements is [=implementation-defined=].

PSNR metrics should primarily be used as a basis for statistical analysis rather than be used as an absolute truth on a per-frame basis. - The frequency of PSNR measurements is [=implementation-defined=].

From 42d593a79fb0f61fcb9434653437169a7f5f834e Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Tue, 8 Apr 2025 10:32:31 -0700 Subject: [PATCH 6/8] move note to metrics from number of measurements --- webrtc-stats.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index 0fe748a..3a1e878 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2234,6 +2234,10 @@

PSNR is defined in [[ISO-29170-1:2017]].

+

+ PSNR metrics should primarily be used as a basis for statistical analysis rather + than be used as an absolute truth on a per-frame basis. +

psnrMeasurements of type unsigned long long @@ -2249,10 +2253,6 @@

The PSNR is defined in [[ISO-29170-1:2017]]. The frequency of PSNR measurements is [=implementation-defined=].

-

- PSNR metrics should primarily be used as a basis for statistical analysis rather - than be used as an absolute truth on a per-frame basis. -

totalEncodeTime of type Date: Thu, 10 Apr 2025 09:10:30 -0700 Subject: [PATCH 7/8] neutral --- webrtc-stats.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc-stats.html b/webrtc-stats.html index 3a1e878..904f00a 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2235,8 +2235,8 @@

PSNR is defined in [[ISO-29170-1:2017]].

- PSNR metrics should primarily be used as a basis for statistical analysis rather - than be used as an absolute truth on a per-frame basis. + PSNR metrics are intended for statistical analysis rather + than representing absolute truth on a per-frame basis.

From 2e3124033bba5b71dd81f6165bfb3db9a99bca3a Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Mon, 21 Apr 2025 14:02:00 -0700 Subject: [PATCH 8/8] gate on hw --- webrtc-stats.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webrtc-stats.html b/webrtc-stats.html index 904f00a..7d66739 100644 --- a/webrtc-stats.html +++ b/webrtc-stats.html @@ -2225,6 +2225,9 @@

record<DOMString, double>

+

+ MUST NOT [= map/exist =] unless [= exposing hardware is allowed =]. +

MUST NOT [= map/exist =] for audio. The cumulative sum of the PSNR values of frames encoded by this sender. @@ -2244,6 +2247,9 @@

+

+ MUST NOT [= map/exist =] unless [= exposing hardware is allowed =]. +

MUST NOT [= map/exist =] for audio. The number of times PSNR was measured. The components of {{psnrSum}} are