mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
perf(scanner-effect): Optimize fake-scanner effect with multithreading (#4614)
# Description of Changes TLDR: should be 3-4x faster by my (very) unscientific benchmarks (I ran the new and old with 5 docs and averaged out the results) Notes: - Made Threadpool and pages are rendered separately (large perf improvement over previous code) - Most of actual rendering/processing logic remain unchanged - DPI values are now more "reasonable - Buffering related perf gains also somewhat significant <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
parent
051b5ad41d
commit
5e281fa002
File diff suppressed because it is too large
Load Diff
@ -79,14 +79,6 @@ public class ScannerEffectRequest {
|
||||
@Schema(description = "Whether advanced settings are enabled", example = "false")
|
||||
private boolean advancedEnabled = false;
|
||||
|
||||
public int getQualityValue() {
|
||||
return switch (quality) {
|
||||
case low -> 30;
|
||||
case medium -> 60;
|
||||
case high -> 100;
|
||||
};
|
||||
}
|
||||
|
||||
public int getRotationValue() {
|
||||
return switch (rotation) {
|
||||
case none -> 0;
|
||||
@ -97,26 +89,26 @@ public class ScannerEffectRequest {
|
||||
}
|
||||
|
||||
public void applyHighQualityPreset() {
|
||||
this.blur = 0.1f;
|
||||
this.blur = 0.10f;
|
||||
this.noise = 1.0f;
|
||||
this.brightness = 1.02f;
|
||||
this.contrast = 1.05f;
|
||||
this.resolution = 300;
|
||||
this.brightness = 1.03f;
|
||||
this.contrast = 1.06f;
|
||||
this.resolution = 150;
|
||||
}
|
||||
|
||||
public void applyMediumQualityPreset() {
|
||||
this.blur = 0.5f;
|
||||
this.noise = 3.0f;
|
||||
this.brightness = 1.05f;
|
||||
this.contrast = 1.1f;
|
||||
this.resolution = 300;
|
||||
this.blur = 0.10f;
|
||||
this.noise = 1.0f;
|
||||
this.brightness = 1.06f;
|
||||
this.contrast = 1.12f;
|
||||
this.resolution = 100;
|
||||
}
|
||||
|
||||
public void applyLowQualityPreset() {
|
||||
this.blur = 1.0f;
|
||||
this.noise = 5.0f;
|
||||
this.brightness = 1.1f;
|
||||
this.contrast = 1.2f;
|
||||
this.resolution = 150;
|
||||
this.blur = 0.9f;
|
||||
this.noise = 2.5f;
|
||||
this.brightness = 1.08f;
|
||||
this.contrast = 1.15f;
|
||||
this.resolution = 75;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user