diff --git a/src/csui/PlayerUiBase.vue b/src/csui/PlayerUiBase.vue
index 6d554af..a98980e 100644
--- a/src/csui/PlayerUiBase.vue
+++ b/src/csui/PlayerUiBase.vue
@@ -116,6 +116,13 @@
:site="site"
>
+
+
@@ -127,6 +134,7 @@
+
+
+
+
+
+
diff --git a/src/ext/lib/ar-detect/ArDetector.ts b/src/ext/lib/ar-detect/ArDetector.ts
index 13d9544..f147f75 100644
--- a/src/ext/lib/ar-detect/ArDetector.ts
+++ b/src/ext/lib/ar-detect/ArDetector.ts
@@ -31,6 +31,7 @@ export interface AardPerformanceMeasurement {
export interface AardPerformanceData {
total: AardPerformanceMeasurement,
+ theoretical: AardPerformanceMeasurement,
imageDraw: AardPerformanceMeasurement
blackFrameDraw: AardPerformanceMeasurement,
blackFrame: AardPerformanceMeasurement,
@@ -136,6 +137,8 @@ class ArDetector {
this.settings = videoData.settings;
this.eventBus = videoData.eventBus;
+ this.initEventBus();
+
this.sampleCols = [];
this.blackLevel = this.settings.active.arDetect.blackbar.blackLevel;
@@ -146,6 +149,15 @@ class ArDetector {
this.logger.log('info', 'init', `[ArDetector::ctor] creating new ArDetector. arid: ${this.arid}`);
}
+ private initEventBus() {
+ for (const action in this.eventBusCommands) {
+ for (const command of this.eventBusCommands[action]) {
+ this.eventBus.subscribe(action, command);
+ }
+ }
+ }
+
+
init(){
this.logger.log('info', 'init', `[ArDetect::init] <@${this.arid}> Initializing autodetection.`);
this.setup();
@@ -471,6 +483,10 @@ class ArDetector {
let totalWorst = 0;
let totalStDev = 0;
+ let theoreticalAverage = 0;
+ let theoreticalWorst = 0;
+ let theoreticalStDev = 0;
+
for (const sample of this.performance.samples) {
if (sample.imageDrawTime) {
imageDrawCount++;
@@ -511,12 +527,39 @@ class ArDetector {
if (execTime > totalWorst) {
totalWorst = execTime;
}
+
+ const partialExecTime =
+ sample.imageDrawTime ?? 0
+ + sample.blackFrameDrawTime ?? 0
+ + sample.blackFrameProcessTime ?? 0;
+
+ if (partialExecTime > theoreticalWorst) {
+ theoreticalWorst = partialExecTime;
+ }
}
- imageDrawAverage /= imageDrawCount;
- blackFrameDrawAverage /= blackFrameDrawCount;
- blackFrameProcessAverage /= blackFrameProcessCount;
- totalAverage /= this.performance.samples.length;
+ if (imageDrawCount) {
+ imageDrawAverage /= imageDrawCount;
+ } else {
+ imageDrawAverage = 0;
+ }
+ if (blackFrameDrawCount) {
+ blackFrameDrawAverage /= blackFrameDrawCount;
+ } else {
+ blackFrameDrawAverage = 0;
+ }
+ if (blackFrameProcessCount) {
+ blackFrameProcessAverage /= blackFrameProcessCount;
+ } else {
+ blackFrameProcessAverage = 0;
+ }
+ if (this.performance.samples.length) {
+ totalAverage /= this.performance.samples.length;
+ } else {
+ totalAverage = 0;
+ }
+
+ theoreticalAverage = imageDrawAverage + blackFrameDrawAverage + blackFrameProcessAverage;
for (const sample of this.performance.lastMeasurements.fastLetterbox.samples) {
fastLetterboxAverage += sample;
@@ -533,8 +576,19 @@ class ArDetector {
fastLetterboxCount = this.performance.lastMeasurements.fastLetterbox.samples.length;
edgeDetectCount = this.performance.lastMeasurements.edgeDetect.samples.length;
- fastLetterboxAverage /= fastLetterboxCount;
- edgeDetectAverage /= edgeDetectCount;
+ if (fastLetterboxCount) {
+ fastLetterboxAverage /= fastLetterboxCount;
+ } else {
+ fastLetterboxAverage = 0;
+ }
+ if (edgeDetectCount) {
+ edgeDetectAverage /= edgeDetectCount;
+ } else {
+ edgeDetectAverage = 0;
+ }
+
+ theoreticalWorst += fastLetterboxWorst + edgeDetectWorst;
+ theoreticalAverage += fastLetterboxAverage + edgeDetectAverage;
for (const sample of this.performance.samples) {
if (sample.imageDrawTime) {
@@ -599,6 +653,7 @@ class ArDetector {
totalStDev = Math.sqrt(totalStDev / (this.performance.samples.length - 1));
}
+
const res: AardPerformanceData = {
total: {
sampleCount: this.performance.samples.length,
@@ -606,6 +661,12 @@ class ArDetector {
worstTime: totalWorst,
stDev: totalStDev,
},
+ theoretical: {
+ sampleCount: -1,
+ averageTime: theoreticalAverage,
+ worstTime: theoreticalWorst,
+ stDev: theoreticalStDev
+ },
imageDraw: {
sampleCount: imageDrawCount,
averageTime: imageDrawAverage,
@@ -644,7 +705,7 @@ class ArDetector {
edgeDetectCount
}
- this.eventBus.send('uw-config-broadcast', {type: 'aard-performance-data', config: res});
+ this.eventBus.send('uw-config-broadcast', {type: 'aard-performance-data', performanceData: res});
}
//#endregion