brightness/contrast: BasicOcrParam統合・SIMD実装・全OCRプラグイン対応#596
Merged
Conversation
…n BitmapUtility, update all OCR plugins Co-authored-by: Freeesia <9002657+Freeesia@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement brightness and contrast adjustments in OCR settings
brightness/contrast: BasicOcrParam統合・SIMD実装・全OCRプラグイン対応
Mar 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
brightness/contrast 調整を「環境変数+OneOCR限定」から「BasicOcrParam 統合+全OCRプラグイン共通」へ移行し、画像調整ロジックを Abstractions 側へ集約しつつ SIMD 最適化を導入するPRです(設定UIスライダー対応・コピー削減も含む)。
Changes:
BasicOcrParamに Brightness/Contrast を追加し、UIスライダー用の上下限を付与BitmapUtilityに BGRA 向けの明るさ/コントラスト調整(SIMD+フォールバック)を追加し、各OCR実装から利用- Brightness/Contrast の表示名リソースを多言語
.resxに追加
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| WindowTranslator/Modules/Ocr/WindowsMediaOcr.cs | リサイズ後に Brightness/Contrast をインプレース適用(必要時のみコピー) |
| WindowTranslator.Abstractions/WindowTranslator.Abstractions.csproj | SIMD/ポインタアクセスのため unsafe を許可 |
| WindowTranslator.Abstractions/BitmapUtility.cs | リサイズ拡張に加え、Brightness/Contrast 調整(SIMD/スカラー)を追加 |
| WindowTranslator.Abstractions/Modules/IOcrModule.cs | BasicOcrParam に Brightness/Contrast(Slidable付き)を追加 |
| Plugins/WindowTranslator.Plugin.TesseractOCRPlugin/TesseractOcr.cs | OCR前処理に Brightness/Contrast 調整を追加(コピー最小化) |
| Plugins/WindowTranslator.Plugin.OneOcrPlugin/OneOcr.cs | 環境変数依存を削除し、BasicOcrParam 経由で Brightness/Contrast を適用 |
| WindowTranslator.Abstractions/Properties/Resources.resx | Brightness/Contrast リソース追加(ja) |
| WindowTranslator.Abstractions/Properties/Resources.en.resx | Brightness/Contrast リソース追加(en) |
| WindowTranslator.Abstractions/Properties/Resources.de.resx | Brightness/Contrast リソース追加(de) |
| WindowTranslator.Abstractions/Properties/Resources.fr.resx | Brightness/Contrast リソース追加(fr) |
| WindowTranslator.Abstractions/Properties/Resources.es.resx | Brightness/Contrast リソース追加(es) |
| WindowTranslator.Abstractions/Properties/Resources.ar.resx | Brightness/Contrast リソース追加(ar) |
| WindowTranslator.Abstractions/Properties/Resources.cs.resx | Brightness/Contrast リソース追加(cs) |
| WindowTranslator.Abstractions/Properties/Resources.fa.resx | Brightness/Contrast リソース追加(fa) |
| WindowTranslator.Abstractions/Properties/Resources.fil.resx | Brightness/Contrast リソース追加(fil) |
| WindowTranslator.Abstractions/Properties/Resources.hi.resx | Brightness/Contrast リソース追加(hi) |
| WindowTranslator.Abstractions/Properties/Resources.id.resx | Brightness/Contrast リソース追加(id) |
| WindowTranslator.Abstractions/Properties/Resources.ko.resx | Brightness/Contrast リソース追加(ko) |
| WindowTranslator.Abstractions/Properties/Resources.ms.resx | Brightness/Contrast リソース追加(ms) |
| WindowTranslator.Abstractions/Properties/Resources.pl.resx | Brightness/Contrast リソース追加(pl) |
| WindowTranslator.Abstractions/Properties/Resources.pt-BR.resx | Brightness/Contrast リソース追加(pt-BR) |
| WindowTranslator.Abstractions/Properties/Resources.ru.resx | Brightness/Contrast リソース追加(ru) |
| WindowTranslator.Abstractions/Properties/Resources.th.resx | Brightness/Contrast リソース追加(th) |
| WindowTranslator.Abstractions/Properties/Resources.tr.resx | Brightness/Contrast リソース追加(tr) |
| WindowTranslator.Abstractions/Properties/Resources.vi.resx | Brightness/Contrast リソース追加(vi) |
| WindowTranslator.Abstractions/Properties/Resources.zh-CN.resx | Brightness/Contrast リソース追加(zh-CN) |
| WindowTranslator.Abstractions/Properties/Resources.zh-TW.resx | Brightness/Contrast リソース追加(zh-TW) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Freeesia <9002657+Freeesia@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brightness/contrast調整が環境変数依存でOneOCRのみに限定されていた問題を解消し、設定UI対応・SIMD最適化・全OCRプラグイン統一化を実施。
変更内容
BasicOcrParamへのパラメータ移行
IOcrModule.cs:BasicOcrParamにBrightness(-127〜128)・Contrast(-99〜100)を追加[Slidable]属性付きで設定UIのスライダーに上下限を反映OneOcr.cs: 環境変数(OCR_BRIGHTNESS_WindowTranslator等)からの読み込みを削除SIMD実装(BitmapUtility.cs)
AdjustBrightnessContrast(Span<byte> data, int brightness, int contrast)をAbstractionsプロジェクトに追加Vector<short>ベースの固定小数点演算(×64スケール)でSIMD処理Vector.AndNot+OR復元)AllowUnsafeBlocksをAbstractionsプロジェクトに追加全OCRプラグイン対応・コピー削減
TesseractOcr.cs・WindowsMediaOcr.csにも輝度調整を追加SoftwareBitmap.Copy()1回のみで済む(旧実装はCloneBitmapSafe+リサイズで2回)ローカライズ
Brightness・Contrastのリソースエントリを21言語すべてに追加Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.