From dcbeecc8cf8ccad805fc04dc1e70ddf9299253eb Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 23 Oct 2024 01:23:37 +0200 Subject: [PATCH] fix syntax --- src/common/interfaces/SettingsInterface.ts | 6 ++--- src/ext/conf/ExtensionConf.ts | 27 ++++++++++++++----- .../aard-gradient-sample.interface.ts | 2 +- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/common/interfaces/SettingsInterface.ts b/src/common/interfaces/SettingsInterface.ts index 62920eb..c136b60 100644 --- a/src/common/interfaces/SettingsInterface.ts +++ b/src/common/interfaces/SettingsInterface.ts @@ -166,9 +166,9 @@ export interface AardSettings { gradientTestMinDelta: number, // if last pixels of the test sample is less than this brighter than the first -> not gradient thresholds: { - edgeDetectionLimit: 8, // during scanning of the edge, quit after edge gets detected at this many points - minQualitySingleEdge: 6, // At least one of the detected must reach this quality - minQualitySecondEdge: 3, // The other edge must reach this quality (must be smaller or equal to single edge quality) + edgeDetectionLimit: number, // during scanning of the edge, quit after edge gets detected at this many points + minQualitySingleEdge: number, // At least one of the detected must reach this quality + minQualitySecondEdge: number, // The other edge must reach this quality (must be smaller or equal to single edge quality) } maxLetterboxOffset: 0.1, // Upper and lower letterbox can be different by this many (% of height) diff --git a/src/ext/conf/ExtensionConf.ts b/src/ext/conf/ExtensionConf.ts index bfcd27c..330643e 100644 --- a/src/ext/conf/ExtensionConf.ts +++ b/src/ext/conf/ExtensionConf.ts @@ -89,8 +89,14 @@ const ExtensionConf: SettingsInterface = { 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 }, + blackLevels: { + defaultBlack: 16, + blackTolerance: 4, + imageDelta: 16, + }, sampling: { - staticCols: 9, // we take a column at [0-n]/n-th parts along the width and sample it + edgePosition: 0.25, + staticCols: 16, // 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 }, @@ -103,16 +109,25 @@ const ExtensionConf: SettingsInterface = { edgeTolerancePx: 2, // black edge violation is performed this far from reported 'last black pixel' edgeTolerancePercent: null // unused. same as above, except use % of canvas height instead of pixels }, - fallbackMode: { - enabled: true, - safetyBorderPx: 5, // determines the thickness of safety border in fallback mode - noTriggerZonePx: 8 // if we detect edge less than this many pixels thick, we don't correct. - }, arSwitchLimiter: { // to be implemented switches: 2, // we can switch this many times period: 2.0 // per this period }, edgeDetection: { + slopeTestWidth: 8, + gradientTestSamples: 8, + gradientTestBlackThreshold: 16, + gradientTestDeltaThreshold: 32, + gradientTestMinDelta: 8, + + thresholds: { + edgeDetectionLimit: 8, + minQualitySingleEdge: 6, + minQualitySecondEdge: 3, + }, + + maxLetterboxOffset: 0.1, + 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, // diff --git a/src/ext/lib/aard/interfaces/aard-gradient-sample.interface.ts b/src/ext/lib/aard/interfaces/aard-gradient-sample.interface.ts index c06e278..add60a4 100644 --- a/src/ext/lib/aard/interfaces/aard-gradient-sample.interface.ts +++ b/src/ext/lib/aard/interfaces/aard-gradient-sample.interface.ts @@ -37,7 +37,7 @@ export function resetGradientSamples(samples: AardGradientSamples) { } } if (samples.left) { - for (let i = 0; i < samples.left.length, i++) { + for (let i = 0; i < samples.left.length; i++) { for (let j = 0; j < samples.left[i].length; j++) { samples.left[i][j] = 0; }