From ee57799005268cb30c951d51c101c11b0cda2830 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 14 May 2020 00:00:49 +0200 Subject: [PATCH] remove dead code from aardgl, basic settings for aardGl --- src/ext/conf/ExtensionConf.js | 26 -------------------------- src/ext/lib/ar-detect/AardGl.js | 9 ++++----- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index 38c98e2..3e2285f 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -151,11 +151,6 @@ var ExtensionConf = { }, sampleCols: 32, canvasDimensions: { - blackframeCanvas: { // smaller than sample canvas, blackframe canvas is used to recon for black frames - // it's not used to detect aspect ratio by itself, so it can be tiny af - width: 16, - height: 9, - }, sampleCanvas: { // size of image sample for detecting aspect ratio. Bigger size means more accurate results, // at the expense of performance. Width == sample texture size (size of webGL canvas is pegged // on sample count) @@ -206,11 +201,6 @@ var ExtensionConf = { thresholdStep: 8, // when failing to set aspect ratio, increase threshold by this much increaseAfterConsecutiveResets: 2 // increase if AR resets this many times in a row }, - sampling: { - staticCols: 9, // we take a column at [0-n]/n-th parts along the width and sample it - randomCols: 0, // we add this many randomly selected columns to the static columns - staticRows: 9, // forms grid with staticSampleCols. Determined in the same way. For black frame checks - }, guardLine: { // all pixels on the guardline need to be black, or else we trigger AR recalculation // (if AR fails to be recalculated, we reset AR) enabled: true, @@ -229,22 +219,6 @@ var ExtensionConf = { switches: 2, // we can switch this many times period: 2.0 // per this period }, - edgeDetection: { - sampleWidth: 8, // we take a sample this wide for edge detection - detectionThreshold: 4, // sample needs to have this many non-black pixels to be a valid edge - confirmationThreshold: 1, // - singleSideConfirmationThreshold: 3, // we need this much edges (out of all samples, not just edges) in order - // to confirm an edge in case there's no edges on top or bottom (other - // than logo, of course) - logoThreshold: 0.15, // if edge candidate sits with count greater than this*all_samples, it can't be logo - // or watermark. - edgeTolerancePx: 1, // we check for black edge violation this far from detection point - edgeTolerancePercent: null, // we check for black edge detection this % of height from detection point. unused - middleIgnoredArea: 0.2, // we ignore this % of canvas height towards edges while detecting aspect ratios - minColsForSearch: 0.5, // if we hit the edge of blackbars for all but this many columns (%-wise), we don't - // continue with search. It's pointless, because black edge is higher/lower than we - // are now. (NOTE: keep this less than 1 in case we implement logo detection) - }, pillarTest: { ignoreThinPillarsPx: 5, // ignore pillars that are less than this many pixels thick. allowMisaligned: 0.05 // left and right edge can vary this much (%) diff --git a/src/ext/lib/ar-detect/AardGl.js b/src/ext/lib/ar-detect/AardGl.js index 53b339b..827b3ca 100644 --- a/src/ext/lib/ar-detect/AardGl.js +++ b/src/ext/lib/ar-detect/AardGl.js @@ -330,8 +330,7 @@ class AardGl { // // [2] SETUP WEBGL STUFF ————————————————————————————————————————————————————————————————————————————————— - // - + //#region webgl setup this.gl = this.canvas.getContext("webgl"); // load shaders and stuff. PixelSize for horizontalAdder should be 1/sample canvas width @@ -373,7 +372,7 @@ class AardGl { // tho we could do it for every frame this.canvasScaleFactor = cheight / this.video.videoHeight; - + //#endregion // // [3] detect if we're in the fallback mode and reset guardline @@ -451,7 +450,7 @@ class AardGl { this._exited = false; // set initial timestamps so frame check will trigger the first time we run the loop - let lastFrameCheckStartTime = Date.now() - (this.settings.active.arDetect.timers.playing << 1); + let lastFrameCheckStartTime = Date.now() - (this.settings.active.aardGl.timers.playing << 1); const frameCheckTimes = new Array(10).fill(-1); let frameCheckBufferIndex = 0; @@ -501,7 +500,6 @@ class AardGl { } var startTime = performance.now(); - let sampleCols = this.sampleCols.slice(0); // // [0] blackframe tests (they also determine whether we need fallback mode) @@ -551,6 +549,7 @@ class AardGl { this.logger.log('info', 'arDetect_verbose', `%c[AardGl::frameCheck] canvas.drawImage seems to have worked`, "color:#000; backgroud:#2f5;"); } + // [1] this.clearImageData(imageData); }