diff --git a/js/conf/ExtensionConf.js b/js/conf/ExtensionConf.js index d3db062..402d6b4 100644 --- a/js/conf/ExtensionConf.js +++ b/js/conf/ExtensionConf.js @@ -31,7 +31,7 @@ var ExtensionConf = { vSamples: 360, // samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1] blackLevel_default: 10, // everything darker than 10/255 across all RGB components is considered black by - // default. GlobalVars.blackLevel can decrease if we detect darker black. + // default. blackLevel can decrease if we detect darker black. blackbarTreshold: 16, // if pixel is darker than blackLevel + blackbarTreshold, we count it as black // on 0-255. Needs to be fairly high (8 might not cut it) due to compression // artifacts in the video itself diff --git a/js/lib/EdgeDetect.js b/js/lib/EdgeDetect.js index c1686d4..1bec891 100644 --- a/js/lib/EdgeDetect.js +++ b/js/lib/EdgeDetect.js @@ -304,7 +304,7 @@ class EdgeDetect{ // it could be watermark. It could be a dark frame. Let's check for watermark first. if( edgesTop[0].distance < edgesBottom[0].distance && edgesTop[0].count < edgesBottom[0].count && - edgesTop[0].count < GlobalVars.arDetect.sampleCols * this.settings.active.arDetect.edgeDetection.logoTreshold){ + edgesTop[0].count < this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.logoTreshold){ // možno, da je watermark zgoraj. Preverimo, če se kateri od drugih potencialnih robov na zgornjem robu // ujema s prvim spodnjim (+/- variance). Če je temu tako, potem bo verjetno watermark. Logo mora imeti // manj vzorcev kot navaden rob. @@ -335,7 +335,7 @@ class EdgeDetect{ } if( edgesBottom[0].distance < edgesTop[0].distance && edgesBottom[0].count < edgesTop[0].count && - edgesBottom[0].count < GlobalVars.arDetect.sampleCols * this.settings.active.arDetect.edgeDetection.logoTreshold){ + edgesBottom[0].count 1){ var lowMargin = edgesTop[0].distance - alignMargin; @@ -368,7 +368,7 @@ class EdgeDetect{ // either the top or the bottom edge remains undetected, but we have one more trick that we // can try. It also tries to work around logos. - var edgeDetectionTreshold = GlobalVars.arDetect.sampleCols * this.settings.active.arDetect.edgeDetection.singleSideConfirmationTreshold; + var edgeDetectionTreshold = this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.singleSideConfirmationTreshold; if(edges.edgeCandidatesTopCount == 0 && edges.edgeCandidatesBottomCount != 0){ for(var edge of edgesBottom){ diff --git a/js/lib/GuardLine.js b/js/lib/GuardLine.js index 6e8b68c..49f87e5 100644 --- a/js/lib/GuardLine.js +++ b/js/lib/GuardLine.js @@ -160,10 +160,7 @@ class GuardLine { imageCheck(image){ if(!this.imageBar.top || !this.imageBar.bottom) return { success: false }; - - - var edges = GlobalVars.arDetect.guardLine; - + var offset = parseInt(this.conf.canvas.width * this.settings.active.arDetect.guardLine.ignoreEdgeMargin) << 2; // TODO: implement logo check. diff --git a/js/modules/ArDetect.js b/js/modules/ArDetect.js index 2ce67aa..ca8cf47 100644 --- a/js/modules/ArDetect.js +++ b/js/modules/ArDetect.js @@ -695,7 +695,7 @@ class ArDetector { if(Debug.debug && Debug.debugArDetect){ console.log(`%c[ArDetect::_ard_vdraw] edgeDetector returned this\n`, "color: #aaf", edgePost); } - // console.log("SAMPLES:", blackbarSamples, "candidates:", edgeCandidates, "post:", edgePost,"\n\nblack level:",GlobalVars.arDetect.blackLevel, "tresh:", this.blackLevel + this.settings.active.arDetect.blackbarTreshold); + // console.log("SAMPLES:", blackbarSamples, "candidates:", edgeCandidates, "post:", edgePost,"\n\nblack level:", this.blackLevel, "tresh:", this.blackLevel + this.settings.active.arDetect.blackbarTreshold); if(edgePost.status == "ar_known"){ diff --git a/js/modules/Resizer.js b/js/modules/Resizer.js index f6020ce..bf2f330 100644 --- a/js/modules/Resizer.js +++ b/js/modules/Resizer.js @@ -317,9 +317,6 @@ class Resizer { } console.log("css watcher running. video?", ths.video) - // // our current css is fucky? Null, undefined and 0 are invalid values. - // if(! GlobalVars.currentCss.width || ! GlobalVars.currentCss.height ) - // return; // first, a quick test: if (ths.currentVideoSettings.validFor == ths.conf.player.dimensions ){ diff --git a/js/modules/Scaler.js b/js/modules/Scaler.js index b1cf7a6..c940e3b 100644 --- a/js/modules/Scaler.js +++ b/js/modules/Scaler.js @@ -32,10 +32,10 @@ class Scaler { ar = this.conf.player.dimensions.width / this.conf.player.dimensions.height; } - // POMEMBNO: GlobalVars.lastAr je potrebno nastaviti šele po tem, ko kličemo _res_setAr(). _res_setAr() predvideva, + // POMEMBNO: lastAr je potrebno nastaviti šele po tem, ko kličemo _res_setAr(). _res_setAr() predvideva, // da želimo nastaviti statično (type: 'static') razmerje stranic — tudi, če funkcijo kličemo tu oz. v ArDetect. // - // IMPORTANT NOTE: GlobalVars.lastAr needs to be set after _res_setAr() is called, as _res_setAr() assumes we're + // IMPORTANT NOTE: lastAr needs to be set after _res_setAr() is called, as _res_setAr() assumes we're // setting a static aspect ratio (even if the function is called from here or ArDetect). var fileAr = this.conf.video.videoWidth / this.conf.video.videoHeight; diff --git a/js/run/GlobalVars.js b/js/run/GlobalVars.js deleted file mode 100644 index 5db8e17..0000000 --- a/js/run/GlobalVars.js +++ /dev/null @@ -1,46 +0,0 @@ -var GlobalVars = { - video: null, - player: null, - playerDimensions: null, - playerElement: null, - lastAr: null, - lastUrl: "", - currentCss: { - top: null, - left: null - }, - canvas: { - context: null, - width: null, - height: null, - imageDataRowLength: null - }, - correctedVideoDimensions: { - width: null, - height: null, - top: null, - left: null - }, - arDetect: { - autoDisable: { - eventCount: 0 - }, - canvas: null, - blackLevel: 10, - sampleCols_current: 0, - noLetterboxCanvasReset: false, - guardLine: { - top: null, - bottom: null, - logo: { - detected: false, - top_left: null, - top_right: null, - bottom_left: null, - bottom_right: null - }, - start: null, - end: null - } - } -}