fix stuff from merge

This commit is contained in:
Tamius Han 2022-07-26 22:40:45 +02:00
parent b7a61e5bc0
commit bfef49bc33

View File

@ -681,17 +681,14 @@ class ArDetector {
return; return;
} }
if (!this.blackframeContext) { // if (!this.blackframeContext) {
this.init(); // this.init();
} // }
let startTime; let startTime;
let partialDrawImageTime = 0; let partialDrawImageTime = 0;
let sampleCols = this.sampleCols.slice(0); let sampleCols = this.sampleCols.slice(0);
let startTime = performance.now();
await new Promise<void>( await new Promise<void>(
resolve => { resolve => {
this.context.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height); this.context.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
@ -699,21 +696,20 @@ class ArDetector {
} }
) )
const imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height).data; const imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height).data;
timerResults.imageDrawTime = performance.now() - startTime; // timerResults.imageDrawTime = performance.now() - startTime;
const bfAnalysis = await this.blackframeTest(imageData); const bfAnalysis = await this.blackframeTest(imageData);
if (bfAnalysis.isBlack) { if (bfAnalysis.isBlack) {
// we don't do any corrections on frames confirmed black // we don't do any corrections on frames confirmed black
this.logger.log('info', 'arDetect_verbose', `%c[ArDetect::frameCheck] Black frame analysis suggests this frame is black or too dark. Doing nothing.`, "color: #fa3", bfAnalysis); this.logger.log('info', 'arDetect_verbose', `%c[ArDetect::frameCheck] Black frame analysis suggests this frame is black or too dark. Doing nothing.`, "color: #fa3", bfAnalysis);
timerResults.blackFrameDrawTime = bfAnalysis.processingTime.blackFrameDrawTime; // timerResults.blackFrameDrawTime = bfAnalysis.processingTime.blackFrameDrawTime;
timerResults.blackFrameProcessTime = bfAnalysis.processingTime.blackFrameProcessTime; // timerResults.blackFrameProcessTime = bfAnalysis.processingTime.blackFrameProcessTime;
this.addPerformanceMeasurement(timerResults); // this.addPerformanceMeasurement(timerResults);
return; return;
} }
startTime = performance.now(); startTime = performance.now();
const imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height).data; // this.addPerformanceTimeMeasure(this.performance.getImageData, performance.now() - startTime);
this.addPerformanceTimeMeasure(this.performance.getImageData, performance.now() - startTime);
if (! this.fastLetterboxPresenceTest(imageData, sampleCols) ) { if (! this.fastLetterboxPresenceTest(imageData, sampleCols) ) {
// Če ne zaznamo letterboxa, kličemo reset. Lahko, da je bilo razmerje stranic popravljeno na roke. Možno je tudi, // Če ne zaznamo letterboxa, kličemo reset. Lahko, da je bilo razmerje stranic popravljeno na roke. Možno je tudi,
@ -801,7 +797,7 @@ class ArDetector {
// blackSamples -> {res_top, res_bottom} // blackSamples -> {res_top, res_bottom}
let edgePost = this.edgeDetector.findBars(imageData, sampleCols, EdgeDetectPrimaryDirection.Vertical, EdgeDetectQuality.Improved, guardLineOut, bfanalysis); let edgePost = this.edgeDetector.findBars(imageData, sampleCols, EdgeDetectPrimaryDirection.Vertical, EdgeDetectQuality.Improved, guardLineOut, bfAnalysis);
this.logger.log('info', 'arDetect_verbose', `%c[ArDetect::frameCheck] edgeDetector returned this\n`, "color: #aaf", edgePost); this.logger.log('info', 'arDetect_verbose', `%c[ArDetect::frameCheck] edgeDetector returned this\n`, "color: #aaf", edgePost);
@ -900,8 +896,8 @@ class ArDetector {
let pixelMax = 0; let pixelMax = 0;
let cumulativeValue = 0; let cumulativeValue = 0;
let blackPixelCount = 0; let blackPixelCount = 0;
const bfImageData = this.blackframeContext.getImageData(0, 0, cols, rows).data; // const bfImageData = this.blackframeContext.getImageData(0, 0, cols, rows).data;
const blackTreshold = this.blackLevel + this.settings.active.arDetect.blackbar.frameThreshold; const blackThreshold = this.blackLevel + this.settings.active.arDetect.blackbar.frameThreshold;
const actualPixels = imageData.length / 4; const actualPixels = imageData.length / 4;