#42: GlobalVars is gone.
This commit is contained in:
parent
da18f5a5c4
commit
b3079a81ea
@ -31,7 +31,7 @@ var ExtensionConf = {
|
|||||||
vSamples: 360,
|
vSamples: 360,
|
||||||
// samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1]
|
// 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
|
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
|
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
|
// on 0-255. Needs to be fairly high (8 might not cut it) due to compression
|
||||||
// artifacts in the video itself
|
// artifacts in the video itself
|
||||||
|
@ -304,7 +304,7 @@ class EdgeDetect{
|
|||||||
// it could be watermark. It could be a dark frame. Let's check for watermark first.
|
// it could be watermark. It could be a dark frame. Let's check for watermark first.
|
||||||
if( edgesTop[0].distance < edgesBottom[0].distance &&
|
if( edgesTop[0].distance < edgesBottom[0].distance &&
|
||||||
edgesTop[0].count < edgesBottom[0].count &&
|
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
|
// 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
|
// ujema s prvim spodnjim (+/- variance). Če je temu tako, potem bo verjetno watermark. Logo mora imeti
|
||||||
// manj vzorcev kot navaden rob.
|
// manj vzorcev kot navaden rob.
|
||||||
@ -335,7 +335,7 @@ class EdgeDetect{
|
|||||||
}
|
}
|
||||||
if( edgesBottom[0].distance < edgesTop[0].distance &&
|
if( edgesBottom[0].distance < edgesTop[0].distance &&
|
||||||
edgesBottom[0].count < edgesTop[0].count &&
|
edgesBottom[0].count < edgesTop[0].count &&
|
||||||
edgesBottom[0].count < GlobalVars.arDetect.sampleCols * this.settings.active.arDetect.edgeDetection.logoTreshold){
|
edgesBottom[0].count <this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.logoTreshold){
|
||||||
|
|
||||||
if(edgesBottom[0].length > 1){
|
if(edgesBottom[0].length > 1){
|
||||||
var lowMargin = edgesTop[0].distance - alignMargin;
|
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
|
// 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.
|
// 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){
|
if(edges.edgeCandidatesTopCount == 0 && edges.edgeCandidatesBottomCount != 0){
|
||||||
for(var edge of edgesBottom){
|
for(var edge of edgesBottom){
|
||||||
|
@ -160,10 +160,7 @@ class GuardLine {
|
|||||||
imageCheck(image){
|
imageCheck(image){
|
||||||
if(!this.imageBar.top || !this.imageBar.bottom)
|
if(!this.imageBar.top || !this.imageBar.bottom)
|
||||||
return { success: false };
|
return { success: false };
|
||||||
|
|
||||||
|
|
||||||
var edges = GlobalVars.arDetect.guardLine;
|
|
||||||
|
|
||||||
var offset = parseInt(this.conf.canvas.width * this.settings.active.arDetect.guardLine.ignoreEdgeMargin) << 2;
|
var offset = parseInt(this.conf.canvas.width * this.settings.active.arDetect.guardLine.ignoreEdgeMargin) << 2;
|
||||||
|
|
||||||
// TODO: implement logo check.
|
// TODO: implement logo check.
|
||||||
|
@ -695,7 +695,7 @@ class ArDetector {
|
|||||||
if(Debug.debug && Debug.debugArDetect){
|
if(Debug.debug && Debug.debugArDetect){
|
||||||
console.log(`%c[ArDetect::_ard_vdraw] edgeDetector returned this\n`, "color: #aaf", edgePost);
|
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"){
|
if(edgePost.status == "ar_known"){
|
||||||
|
|
||||||
|
@ -317,9 +317,6 @@ class Resizer {
|
|||||||
}
|
}
|
||||||
console.log("css watcher running. video?", ths.video)
|
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:
|
// first, a quick test:
|
||||||
if (ths.currentVideoSettings.validFor == ths.conf.player.dimensions ){
|
if (ths.currentVideoSettings.validFor == ths.conf.player.dimensions ){
|
||||||
|
@ -32,10 +32,10 @@ class Scaler {
|
|||||||
ar = this.conf.player.dimensions.width / this.conf.player.dimensions.height;
|
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.
|
// 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).
|
// 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;
|
var fileAr = this.conf.video.videoWidth / this.conf.video.videoHeight;
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user